Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3672d6e
added basic interface for isaacsim
LeaStef Apr 22, 2025
0a7b3d6
create world with dt
LeaStef Apr 24, 2025
73d07bb
implemented method connect in interface for isaacsim
LeaStef Apr 25, 2025
f34bf78
implemented method get_feedback to provide joint angles and joint ang…
LeaStef Apr 25, 2025
e2fe8ac
implemented sned_target_angles
LeaStef Apr 28, 2025
6578760
add method to provide pose
LeaStef May 1, 2025
b953b7f
example script to make arm follow cube
LeaStef May 1, 2025
a2ca838
added methods getOreintation() and set_xyz to isaac interface
LeaStef May 6, 2025
0362a48
switched urdf import to xml import
LeaStef May 13, 2025
6e1e766
interface adapted to h1, locked robote pelvis orientation so it does …
LeaStef May 16, 2025
8149846
fixed getfeedback to work only for arm DOFs
LeaStef May 20, 2025
4e70b1a
added config file for H1
LeaStef May 21, 2025
25ab5ca
added matrix for segment lengths of arm
LeaStef May 23, 2025
59d3925
added articulation view
LeaStef May 23, 2025
fb9445b
working example with floating robot
LeaStef Jun 17, 2025
0d70a58
implementation method quaternion, Tx, R
LeaStef Jun 20, 2025
adfa03d
floating control now works for ur5 and jaco2
LeaStef Jun 24, 2025
9e412b8
adapted tu num of controlled DOF
LeaStef Jun 24, 2025
bc7a01e
generalized send u
LeaStef Jun 24, 2025
361b35c
new implementation of the method connect, following the structure of …
LeaStef Jun 25, 2025
00471ef
Create a visual-only cube (no collision)
LeaStef Jun 27, 2025
96b2151
fixed gains of arm joints, which were to stiff for force control
LeaStef Jul 7, 2025
04d54a8
fixed def M
LeaStef Jul 7, 2025
823aa6f
Example with force_osc working
LeaStef Jul 8, 2025
c2593a2
added example linear path gaussian velocity
LeaStef Jul 8, 2025
1da42b9
adaptations for no EE
LeaStef Jul 10, 2025
fc6bd28
force control working for UR5 and jaco2
LeaStef Jul 10, 2025
f7bbb1e
adapted mass matrix to extract the correct, controlled joints
LeaStef Jul 14, 2025
4ec172c
added torso joint and used standing method in setup for h1
LeaStef Jul 15, 2025
53067fb
integrated robot H1 with hands
LeaStef Jul 16, 2025
62cdbec
fixed method set_gains_force_control so it adresses the right joints
LeaStef Jul 16, 2025
ff9299a
adapted method send_forces to work with abritary list of joint indices
LeaStef Jul 16, 2025
b1cb9ea
fixed helper methods for arbitrary indices
LeaStef Jul 17, 2025
15dca0a
removed coriolis forces from function for gravity compensation
LeaStef Jul 30, 2025
4d51236
fixed indexing of jacobian due to non-fixed base
LeaStef Aug 6, 2025
0e1a270
fixed method M
LeaStef Aug 7, 2025
24db8ef
force control OSC working for H1 without gravity
LeaStef Aug 11, 2025
090944b
fixed offset for virtual EE
LeaStef Aug 14, 2025
e6df5fe
fixed calc of body_link in J() and removed obsolete h1 setup
LeaStef Aug 15, 2025
429213d
works with gravity now on all 4 robots (weird fix for h1)
LeaStef Aug 19, 2025
be900e3
example force_osc_xyz_linear_path_gaussian_velocity works with ur5 an…
LeaStef Aug 20, 2025
c503fbe
added documentation
LeaStef Aug 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Example with force_osc working
  • Loading branch information
LeaStef committed Aug 21, 2025
commit 823aa6fb451592392c1130c44703277cd9463c40
94 changes: 40 additions & 54 deletions abr_control/arms/isaacsim_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,59 +244,41 @@ def dJ(self, name, q=None, dq=None, x=None):




def J(self, name, q=None, x=None, object_type="body"):
"""Returns the Jacobian for the specified link,
computed at the origin of the link's rigid body frame,
which in Isaac Sim coincides with the link's center of mass.

Parameters
----------
name: string
The name of the link/body to retrieve the Jacobian for
q: float numpy.array, optional (Default: None)
The joint angles of the robot. If None the current state is
retrieved from the Isaac Sim simulator
x: float numpy.array, optional (Default: None)
Offset from link origin (currently not supported)
object_type: string, optional (Default: "body")
The object type - options: body, geom, site
controlled_dofs: list, optional (Default: None)
List of DOF indices to include in Jacobian. If None, uses first 6 DOFs

Returns
-------
numpy.array
6xN Jacobian matrix where N is number of controlled DOFs
First 3 rows: linear velocity Jacobian (Jv)
Last 3 rows: angular velocity Jacobian (Jω)
"""
if name == "EE": name = self.ee_link_name
if name == "EE":
name = self.ee_link_name

# Check for unsupported features
if x is not None and not np.allclose(x, 0):
raise Exception("x offset currently not supported, set to None")


if object_type == "body":
# Get Jacobians from articulation view
# Get Jacobians from articulation view - ensure proper tensor handling
jacobians = self.articulation_view.get_jacobians(clone=True)


# Convert to numpy if it's a tensor
if hasattr(jacobians, 'cpu'):
jacobians = jacobians.cpu().numpy()
elif hasattr(jacobians, 'numpy'):
jacobians = jacobians.numpy()

# Check if ArticulationView has any environments
if jacobians.shape[0] == 0:
raise RuntimeError("ArticulationView contains no environments. Make sure it's properly initialized and contains articulations.")


#TODO remove of fix method used for UR5
#link_index = self._get_link_index(name)
# Get link index
link_index = self.articulation_view.get_link_index(name)

# Extract Jacobian for specific link
env_idx = 0 # Assuming single environment

# Handle different Jacobian tensor shapes
# Based on your diagnostic: shape is (1, 13, 6, 12)
# This means: (num_envs, num_bodies, 6_dof_per_body, total_dofs)
if len(jacobians.shape) == 4:
# Shape: (num_envs, num_bodies, 6, num_dofs)
# Get Jacobian for the end-effector link (link_index 7)
J_full = jacobians[env_idx, link_index, :, :]
elif len(jacobians.shape) == 3:
# Shape: (num_envs, num_bodies * 6, num_dofs)
Expand All @@ -305,22 +287,38 @@ def J(self, name, q=None, x=None, object_type="body"):
J_full = jacobians[env_idx, start_row:end_row, :]
else:
raise RuntimeError(f"Unexpected jacobians shape: {jacobians.shape}")

# Extract only the columns for controllable DOFs

# For Jaco 2, we want only the first 6 DOFs (arm joints, not fingers)
# J_full is 6x12 (6 DOF end-effector w.r.t. 12 total DOFs)
# We only want columns 0-5 (the arm joints)
if len(self.joint_pos_addrs) != 6:
raise RuntimeError(f"Expected 6 joint addresses for robot arm, got {len(self.joint_pos_addrs)}")

# Extract only the columns for controllable DOFs
# This gives us the end-effector Jacobian w.r.t. only the arm joints
J = J_full[:, self.joint_pos_addrs]

# Verify dimensions
if J.shape[0] != 6:
raise RuntimeError(f"Expected Jacobian to have 6 rows, got {J.shape[0]}")
if J.shape[1] != len(self.joint_pos_addrs):
raise RuntimeError(f"Expected Jacobian to have {len(self.joint_pos_addrs)} columns, got {J.shape[1]}")

if J.shape[1] != 6:
raise RuntimeError(f"Expected Jacobian to have 6 columns for arm DOFs, got {J.shape[1]}")

# Check for NaN or inf values
if np.any(np.isnan(J)) or np.any(np.isinf(J)):
raise RuntimeError("Jacobian contains NaN or infinite values")

# Assign to internal storage
# Linear velocity Jacobian (first 3 rows)
self._J6N[:3, :] = J[:3, :]
# Angular velocity Jacobian (last 3 rows)
# Angular velocity Jacobian (last 3 rows)
self._J6N[3:, :] = J[3:, :]


# Additional validation - check if Jacobian makes sense
# For a 6-DOF arm, we should have non-zero values
if np.allclose(J, 0):
raise RuntimeError("Jacobian is all zeros - check robot configuration and joint addresses")

elif object_type == "geom":
raise NotImplementedError("Calculating the Jacobian for 'geom' is not yet implemented.")
elif object_type == "site":
Expand All @@ -332,7 +330,6 @@ def J(self, name, q=None, x=None, object_type="body"):




def M(self, q=None):
"""
Returns the inertia matrix for the controlled arm_joints.
Expand All @@ -352,8 +349,6 @@ def M(self, q=None):
return np.copy(M_arm)




def R(self, name, q=None, object_type="body"):
"""
Returns the rotation matrix of the specified object in Isaac Sim.
Expand All @@ -367,14 +362,6 @@ def R(self, name, q=None, object_type="body"):
object_type : str
One of "body", "geom", or "site".
"""
'''

print(f"R: {name}, q: {q}, object_type: {object_type}")
if not self.use_sim_state and q is not None:
old_q = self.articulation_view.get_joint_positions()
self.articulation_view.set_joint_positions(q)
#self._world.step(render=False)
'''

if object_type == "body":
prim_path = self._get_prim_path(name)
Expand Down Expand Up @@ -460,7 +447,6 @@ def T(self, name, q=None, x=None):
def Tx(self, name, q=None, x=None, object_type="body"):
"""Simplified version that only gets current position without state changes."""
if name == "EE": name = self.ee_link_name
#print(f"Tx: name={name}, q={q}, x={x}, object_type={object_type}")
# Get prim path
if object_type in ["body", "link"]:
prim_path = self._get_prim_path(name)
Expand Down
Loading