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
added config file for H1
  • Loading branch information
LeaStef committed Aug 21, 2025
commit 4e70b1a5d147983ccf2630822d2c547f7f9aaafd
1 change: 1 addition & 0 deletions abr_control/arms/unitree_H1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .config import Config
273 changes: 273 additions & 0 deletions abr_control/arms/unitree_H1/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
import numpy as np
import sympy as sp

from ..base_config import BaseConfig


class Config(BaseConfig):
"""Robot config file for the right H1 arm for IsaacSim

Attributes
----------
START_ANGLES : numpy.array
The joint angles for a safe home or rest position
_M_LINKS : sympy.diag
inertia matrix of the links
_M_JOINTS : sympy.diag
inertia matrix of the joints
L : numpy.array
segment lengths of arm [meters]
KZ : sympy.Matrix
z isolation vector in orientational part of Jacobian

Transform Naming Convention: Tpoint1point2
ex: Tj1l1 transforms from joint 1 to link 1

Transforms are broken up into two matrices for simplification
ex: Tj0l1a and Tj0l1b where the former transform accounts for
joint rotations and the latter accounts for static rotations
and translations
"""

def __init__(self, **kwargs):

super().__init__(N_JOINTS=4, N_LINKS=5, ROBOT_NAME="unitree_H1", **kwargs)

self._T = {} # dictionary for storing calculated transforms

self.JOINT_NAMES = [f"H1_right_arm_joint{ii}" for ii in range(self.N_JOINTS)]

# for the null space controller, keep arm near these angles
self.START_ANGLES = np.array(
[np.pi / 4.0, np.pi / 4.0, np.pi / 4.0, np.pi / 4.0], dtype="float32"
)

# TODO adapt this
# create the inertia matrices for each link of the three joint




# TODO: identify the actual values for these links
self._M_LINKS.append(sp.zeros(6, 6)) # link0
self._M_LINKS.append(sp.diag(1.98, 1.98, 1.98, 0.0, 0.0, 10.0)) # link1
self._M_LINKS.append(sp.diag(1.32, 1.32, 1.32, 0.0, 0.0, 10.0)) # link2
self._M_LINKS.append(sp.diag(0.8, 0.8, 0.8, 0.0, 0.0, 10.0)) # link3
#TODO LS vals in next line
self._M_LINKS.append(sp.diag(0.8, 0.8, 0.8, 0.0, 0.0, 10.0)) # link4

# the joints don't weigh anything
self._M_JOINTS = [sp.zeros(6, 6) for ii in range(self.N_JOINTS)]

# segment lengths associated with each joint
# [x, y, z], Ignoring lengths < 1e-04

self.L = np.array(
[
[0, 0, 0], # from origin to l0 (non-existent)
[0, 0, 0], # from l0 to j0
[1.0, 0, 0], # from j0 to l1 COM
[1.0, 0, 0], # from l1 COM to j1
[0.6, 0, 0], # from j1 to l2 COM
[0.6, 0, 0], # from l2 COM to j2
[0.35, 0, 0], # from j2 to l3 COM
[0.35, 0, 0], # from l3 COM to j3
#TODO LS vals in next lines
[0.35, 0, 0], # from j3 to l4 COM
[0.35, 0, 0],
], # from l4 COM to EE
dtype="float32",
)

# Transform matrix : origin -> link 0
# no change of axes, account for offsets
self.Torgl0 = sp.Matrix(
[
[1, 0, 0, self.L[0, 0]],
[0, 1, 0, self.L[0, 1]],
[0, 0, 1, self.L[0, 2]],
[0, 0, 0, 1],
]
)

# Transform matrix : link 0 -> joint 0
# no change of axes, account for offsets
self.Tl0j0 = sp.Matrix(
[
[1, 0, 0, self.L[1, 0]],
[0, 1, 0, self.L[1, 1]],
[0, 0, 1, self.L[1, 2]],
[0, 0, 0, 1],
]
)

# Transform matrix : joint 0 -> link 1
# account for rotation of q
self.Tj0l1a = sp.Matrix(
[
[sp.cos(self.q[0]), -sp.sin(self.q[0]), 0, 0],
[sp.sin(self.q[0]), sp.cos(self.q[0]), 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1],
]
)
# no change of axes, account for offsets
self.Tj0l1b = sp.Matrix(
[
[1, 0, 0, self.L[2, 0]],
[0, 1, 0, self.L[2, 1]],
[0, 0, 1, self.L[2, 2]],
[0, 0, 0, 1],
]
)
self.Tj0l1 = self.Tj0l1a * self.Tj0l1b

# Transform matrix : link 1 -> joint 1
# no change of axes, account for offsets
self.Tl1j1 = sp.Matrix(
[
[1, 0, 0, self.L[3, 0]],
[0, 1, 0, self.L[3, 1]],
[0, 0, 1, self.L[3, 2]],
[0, 0, 0, 1],
]
)

# Transform matrix : joint 1 -> link 2
# account for rotation of q
self.Tj1l2a = sp.Matrix(
[
[sp.cos(self.q[1]), -sp.sin(self.q[1]), 0, 0],
[sp.sin(self.q[1]), sp.cos(self.q[1]), 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1],
]
)
# no change of axes, account for offsets
self.Tj1l2b = sp.Matrix(
[
[1, 0, 0, self.L[4, 0]],
[0, 1, 0, self.L[4, 1]],
[0, 0, 1, self.L[4, 2]],
[0, 0, 0, 1],
]
)
self.Tj1l2 = self.Tj1l2a * self.Tj1l2b

# Transform matrix : link 2 -> joint 2
# no change of axes, account for offsets
self.Tl2j2 = sp.Matrix(
[
[1, 0, 0, self.L[5, 0]],
[0, 1, 0, self.L[5, 1]],
[0, 0, 1, self.L[5, 2]],
[0, 0, 0, 1],
]
)

# Transform matrix : joint 2 -> link 3
# account for rotation of q
self.Tj2l3a = sp.Matrix(
[
[sp.cos(self.q[2]), -sp.sin(self.q[2]), 0, 0],
[sp.sin(self.q[2]), sp.cos(self.q[2]), 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1],
]
)
# no change of axes, account for offsets
self.Tj2l3b = sp.Matrix(
[
[1, 0, 0, self.L[6, 0]],
[0, 1, 0, self.L[6, 1]],
[0, 0, 1, self.L[6, 2]],
[0, 0, 0, 1],
]
)
self.Tj2l3 = self.Tj2l3a * self.Tj2l3b

# Transform matrix : link 3 -> end-effector
# no change of axes, account for offsets
self.Tl3j3 = sp.Matrix(
[
[1, 0, 0, self.L[7, 0]],
[0, 1, 0, self.L[7, 1]],
[0, 0, 1, self.L[7, 2]],
[0, 0, 0, 1],
]
)

# Transform matrix : joint 3 -> link 4
# account for rotation of q
self.Tj3l4a = sp.Matrix(
[
[sp.cos(self.q[3]), -sp.sin(self.q[3]), 0, 0],
[sp.sin(self.q[3]), sp.cos(self.q[3]), 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1],
]
)
# no change of axes, account for offsets
self.Tj3l4b = sp.Matrix(
[
[1, 0, 0, self.L[8, 0]],
[0, 1, 0, self.L[8, 1]],
[0, 0, 1, self.L[8, 2]],
[0, 0, 0, 1],
]
)
self.Tj3l4 = self.Tj3l4a * self.Tj3l4b

# Transform matrix : link 4 -> end-effector
# no change of axes, account for offsets
self.Tl4ee = sp.Matrix(
[
[1, 0, 0, self.L[9, 0]],
[0, 1, 0, self.L[9, 1]],
[0, 0, 1, self.L[9, 2]],
[0, 0, 0, 1],
]
)


# orientation part of the Jacobian (compensating for angular velocity)
self.J_orientation = [
self._calc_T("joint0")[:3, :3] * self._KZ, # joint 0 orientation
self._calc_T("joint1")[:3, :3] * self._KZ, # joint 1 orientation
self._calc_T("joint2")[:3, :3] * self._KZ, # joint 2 orientation
self._calc_T("joint3")[:3, :3] * self._KZ,
] # joint 3 orientation

def _calc_T(self, name):
"""Uses Sympy to generate the transform for a joint or link

name : string
name of the joint, link, or end-effector
"""

if self._T.get(name, None) is None:
if name == "link0":
self._T[name] = self.Torgl0
elif name == "joint0":
self._T[name] = self._calc_T("link0") * self.Tl0j0
elif name == "link1":
self._T[name] = self._calc_T("joint0") * self.Tj0l1
elif name == "joint1":
self._T[name] = self._calc_T("link1") * self.Tl1j1
elif name == "link2":
self._T[name] = self._calc_T("joint1") * self.Tj1l2
elif name == "joint2":
self._T[name] = self._calc_T("link2") * self.Tl2j2
elif name == "link3":
self._T[name] = self._calc_T("joint2") * self.Tj2l3
elif name == "joint3":
self._T[name] = self._calc_T("link3") * self.Tl3j3
elif name == "link4":
self._T[name] = self._calc_T("joint3") * self.Tj3l4
elif name == "EE":
self._T[name] = self._calc_T("link4") * self.Tl4ee

else:
raise Exception(f"Invalid transformation name: {name}")

return self._T[name]