Skip to content

Commit 131b911

Browse files
Remove reference to HyQ submodule which has been deleted off github, update test cases that used it
1 parent 45df95b commit 131b911

File tree

5 files changed

+67
-965
lines changed

5 files changed

+67
-965
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
[submodule "urdf_files/A1/unitree_ros"]
33
path = urdf_files/A1/unitree_ros
44
url = https://github.com/unitreerobotics/unitree_ros.git
5-
[submodule "urdf_files/HyQ/hyq-description"]
6-
path = urdf_files/HyQ/hyq-description
7-
url = https://github.com/iit-DLSLab/hyq-description.git
85
[submodule "urdf_files/Go1/unitree_ros"]
96
path = urdf_files/Go1/unitree_ros
107
url = https://github.com/unitreerobotics/unitree_ros.git

tests/testGraphParser.py

+67-68
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,27 @@
1313
class TestNormalRobotGraph(unittest.TestCase):
1414

1515
def setUp(self):
16-
self.hyq_path = Path(
17-
Path(__file__).cwd(), 'urdf_files', 'HyQ', 'hyq.urdf').absolute()
16+
self.mini_cheetah_path = Path(
17+
Path(__file__).cwd(), 'urdf_files', 'MiniCheetah', 'miniCheetah.urdf').absolute()
1818

19-
self.HyQ_URDF = NormalRobotGraph(self.hyq_path,
20-
'package://hyq_description/',
21-
'hyq-description')
19+
self.mini_cheetah_URDF = NormalRobotGraph(self.mini_cheetah_path,
20+
'package://yobotics_description/', 'mini-cheetah-gazebo-urdf/yobo_model/yobotics_description')
2221

2322
def test_constructor(self):
2423
"""
2524
Check that the constructor properly assigns all of the links and joints to a node/edge.
2625
"""
2726

2827
joint_names = [
29-
'floating_base', 'lf_haa_joint', 'lf_hfe_joint', 'lf_kfe_joint',
30-
'lf_foot_joint', 'rf_haa_joint', 'rf_hfe_joint', 'rf_kfe_joint',
31-
'rf_foot_joint', 'lh_haa_joint', 'lh_hfe_joint', 'lh_kfe_joint',
32-
'lh_foot_joint', 'rh_haa_joint', 'rh_hfe_joint', 'rh_kfe_joint',
33-
'rh_foot_joint'
28+
'floating_base',
29+
'FL_hip_joint', 'FL_thigh_joint', 'FL_calf_joint', 'FL_foot_fixed',
30+
'FR_hip_joint', 'FR_thigh_joint', 'FR_calf_joint', 'FR_foot_fixed',
31+
'RL_hip_joint', 'RL_thigh_joint', 'RL_calf_joint', 'RL_foot_fixed',
32+
'RR_hip_joint', 'RR_thigh_joint', 'RR_calf_joint', 'RR_foot_fixed',
3433
]
3534

3635
edge_names_copy = copy.deepcopy(joint_names)
37-
for i, node in enumerate(self.HyQ_URDF.nodes):
36+
for i, node in enumerate(self.mini_cheetah_URDF.nodes):
3837
self.assertTrue(node.name in edge_names_copy)
3938
edge_names_copy.remove(node.name)
4039
self.assertEqual(0, len(edge_names_copy))
@@ -44,28 +43,28 @@ def test_constructor(self):
4443
# Additionally, links with multiple children joints get one
4544
# edge for each child.
4645
desired_edges = [
47-
RobotGraph.Edge('trunk_to_lf_haa_joint', "floating_base",
48-
"lf_haa_joint", None),
49-
RobotGraph.Edge('trunk_to_lh_haa_joint', "floating_base",
50-
"lh_haa_joint", None),
51-
RobotGraph.Edge('trunk_to_rf_haa_joint', "floating_base",
52-
"rf_haa_joint", None),
53-
RobotGraph.Edge('trunk_to_rh_haa_joint', "floating_base",
54-
"rh_haa_joint", None),
55-
RobotGraph.Edge('lf_hipassembly', "lf_haa_joint", "lf_hfe_joint", None),
56-
RobotGraph.Edge('lf_upperleg', "lf_hfe_joint", "lf_kfe_joint", None),
57-
RobotGraph.Edge('lf_lowerleg', "lf_kfe_joint", "lf_foot_joint", None),
58-
RobotGraph.Edge('rf_hipassembly', "rf_haa_joint", "rf_hfe_joint", None),
59-
RobotGraph.Edge('rf_upperleg', "rf_hfe_joint", "rf_kfe_joint", None),
60-
RobotGraph.Edge('rf_lowerleg', "rf_kfe_joint", "rf_foot_joint", None),
61-
RobotGraph.Edge('lh_hipassembly', "lh_haa_joint", "lh_hfe_joint", None),
62-
RobotGraph.Edge('lh_upperleg', "lh_hfe_joint", "lh_kfe_joint", None),
63-
RobotGraph.Edge('lh_lowerleg', "lh_kfe_joint", "lh_foot_joint", None),
64-
RobotGraph.Edge('rh_hipassembly', "rh_haa_joint", "rh_hfe_joint", None),
65-
RobotGraph.Edge('rh_upperleg', "rh_hfe_joint", "rh_kfe_joint", None),
66-
RobotGraph.Edge('rh_lowerleg', "rh_kfe_joint", "rh_foot_joint", None)
46+
RobotGraph.Edge('trunk_to_FL_hip_joint', "floating_base",
47+
"FL_hip_joint", None),
48+
RobotGraph.Edge('trunk_to_FR_hip_joint', "floating_base",
49+
"FR_hip_joint", None),
50+
RobotGraph.Edge('trunk_to_RL_hip_joint', "floating_base",
51+
"RL_hip_joint", None),
52+
RobotGraph.Edge('trunk_to_RR_hip_joint', "floating_base",
53+
"RR_hip_joint", None),
54+
RobotGraph.Edge('FL_hip', "FL_hip_joint", "FL_thigh_joint", None),
55+
RobotGraph.Edge('FL_thigh', "FL_thigh_joint", "FL_calf_joint", None),
56+
RobotGraph.Edge('FL_calf', "FL_calf_joint", "FL_foot_fixed", None),
57+
RobotGraph.Edge('FR_hip', "FR_hip_joint", "FR_thigh_joint", None),
58+
RobotGraph.Edge('FR_thigh', "FR_thigh_joint", "FR_calf_joint", None),
59+
RobotGraph.Edge('FR_calf', "FR_calf_joint", "FR_foot_fixed", None),
60+
RobotGraph.Edge('RL_hip', "RL_hip_joint", "RL_thigh_joint", None),
61+
RobotGraph.Edge('RL_thigh', "RL_thigh_joint", "RL_calf_joint", None),
62+
RobotGraph.Edge('RL_calf', "RL_calf_joint", "RL_foot_fixed", None),
63+
RobotGraph.Edge('RR_hip', "RR_hip_joint", "RR_thigh_joint", None),
64+
RobotGraph.Edge('RR_thigh', "RR_thigh_joint", "RR_calf_joint", None),
65+
RobotGraph.Edge('RR_calf', "RR_calf_joint", "RR_foot_fixed", None)
6766
]
68-
for i, edge in enumerate(self.HyQ_URDF.edges):
67+
for i, edge in enumerate(self.mini_cheetah_URDF.edges):
6968
match_found = False
7069
for j, desired_edge in enumerate(desired_edges):
7170
if edge.name == desired_edge.name:
@@ -89,7 +88,7 @@ def test_constructor(self):
8988
]
9089
edge_names_copy = copy.deepcopy(joint_names)
9190
num_matches = 0
92-
for i, node in enumerate(self.HyQ_URDF.nodes):
91+
for i, node in enumerate(self.mini_cheetah_URDF.nodes):
9392
for j, node_des in enumerate(edge_names_copy):
9493
if (node.name == node_des):
9594
self.assertEqual(node.get_node_type(), des_node_type[j])
@@ -103,15 +102,15 @@ def test_constructor(self):
103102
# is stored for one of the Nodes.
104103
# ==================
105104
node_found = False
106-
for i, node in enumerate(self.HyQ_URDF.nodes):
107-
if node.name == "rh_kfe_joint":
105+
for i, node in enumerate(self.mini_cheetah_URDF.nodes):
106+
if node.name == "RL_hip_joint":
108107
# Test name information
109108
joint: urchin.Joint= node.joint
110-
self.assertEqual("rh_kfe_joint", joint.name)
109+
self.assertEqual("RL_hip_joint", joint.name)
111110

112111
# Test joint information
113-
np.testing.assert_array_equal(np.array([[1.0, 0.0, 0.0, 0.35], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]), joint.origin)
114-
self.assertEqual(0.1, joint.dynamics.damping)
112+
np.testing.assert_array_equal(np.array([[1.0, 0.0, 0.0, -0.196], [0.0, 1.0, 0.0, 0.049664], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]), joint.origin)
113+
self.assertEqual(0.0, joint.dynamics.damping)
115114
self.assertEqual(0.0, joint.dynamics.friction)
116115

117116
node_found = True
@@ -120,16 +119,16 @@ def test_constructor(self):
120119
self.assertTrue(node_found)
121120

122121
edge_found = False
123-
for i, edge in enumerate(self.HyQ_URDF.edges):
124-
if edge.name == "lh_hipassembly":
122+
for i, edge in enumerate(self.mini_cheetah_URDF.edges):
123+
if edge.name == "FL_calf":
125124
# Test name information
126125
link: urchin.Link = edge.link
127-
self.assertEqual("lh_hipassembly", link.name)
126+
self.assertEqual("FL_calf", link.name)
128127

129128
# Test inertial information
130-
np.testing.assert_array_equal(np.array([[1.0, 0.0, 0.0, 0.04263], [0.0, 1.0, 0.0, -0.0], [0.0, 0.0, 1.0, -0.16931], [0.0, 0.0, 0.0, 1.0]]), link.inertial.origin)
131-
self.assertEqual(2.93, link.inertial.mass)
132-
np.testing.assert_array_equal(np.array([[0.05071, 4e-05, 0.00159], [4e-05, 0.05486, -5e-05], [0.00159, -5e-05, 0.00571]]), link.inertial.inertia)
129+
np.testing.assert_array_equal(np.array([[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]), link.inertial.origin)
130+
self.assertEqual(0.064, link.inertial.mass)
131+
np.testing.assert_array_equal(np.array([[0.000214698666667, 0.0, 0.0], [0.0, 0.000214698666667, 0.0], [0.0, 0.0, 2.73066666667e-06]]), link.inertial.inertia)
133132

134133
edge_found = True
135134
break
@@ -141,21 +140,21 @@ def test_get_connections_to_link(self):
141140
Check that we can properly find the connections to the links in the library.
142141
"""
143142

144-
edge_parent, edge_children = self.HyQ_URDF.get_connections_to_link(
143+
edge_parent, edge_children = self.mini_cheetah_URDF.get_connections_to_link(
145144
urchin.Link("base_link", None, None, None))
146145
self.assertEqual(edge_parent, None)
147146
self.assertSequenceEqual(edge_children, ["floating_base"])
148147

149-
edge_parent, edge_children = self.HyQ_URDF.get_connections_to_link(
148+
edge_parent, edge_children = self.mini_cheetah_URDF.get_connections_to_link(
150149
urchin.Link("trunk", None, None, None))
151150
self.assertEqual(edge_parent, "floating_base")
152151
self.assertSequenceEqual(
153152
edge_children,
154-
["lf_haa_joint", "rf_haa_joint", "lh_haa_joint", "rh_haa_joint"])
153+
["RL_hip_joint", "FL_hip_joint", "RR_hip_joint", "FR_hip_joint"])
155154

156-
edge_parent, edge_children = self.HyQ_URDF.get_connections_to_link(
157-
urchin.Link("lf_foot", None, None, None))
158-
self.assertEqual(edge_parent, "lf_foot_joint")
155+
edge_parent, edge_children = self.mini_cheetah_URDF.get_connections_to_link(
156+
urchin.Link("FL_foot", None, None, None))
157+
self.assertEqual(edge_parent, "FL_foot_fixed")
159158
self.assertSequenceEqual(edge_children, [])
160159

161160
def test_create_updated_urdf_file(self):
@@ -165,26 +164,26 @@ def test_create_updated_urdf_file(self):
165164
"""
166165

167166
# Delete the urdf file
168-
hyq_path_updated = self.hyq_path.parent / "hyq_updated.urdf"
169-
os.remove(str(hyq_path_updated))
170-
self.assertFalse(os.path.exists(hyq_path_updated))
167+
mini_cheetah_path_updated = self.mini_cheetah_path.parent / "miniCheetah_updated.urdf"
168+
os.remove(str(mini_cheetah_path_updated))
169+
self.assertFalse(os.path.exists(mini_cheetah_path_updated))
171170

172171
# Rebuild it
173-
RobotGraph(self.hyq_path, 'package://hyq_description/',
174-
'hyq-description')
175-
self.assertTrue(os.path.exists(hyq_path_updated))
172+
RobotGraph(self.mini_cheetah_path, 'package://yobotics_description/',
173+
'mini-cheetah-gazebo-urdf/yobo_model/yobotics_description')
174+
self.assertTrue(os.path.exists(mini_cheetah_path_updated))
176175

177176
def test_get_node_name_to_index_dict(self):
178177
"""
179178
Check if all the indexes of the nodes in the dictionary
180179
are unique.
181180
"""
182181

183-
key = list(self.HyQ_URDF.get_node_name_to_index_dict())
182+
key = list(self.mini_cheetah_URDF.get_node_name_to_index_dict())
184183
get_nodes_index = []
185184

186185
for key in key:
187-
index = self.HyQ_URDF.get_node_name_to_index_dict()[key]
186+
index = self.mini_cheetah_URDF.get_node_name_to_index_dict()[key]
188187
get_nodes_index.append(index)
189188

190189
self.assertTrue(pd.Index(get_nodes_index).is_unique)
@@ -195,12 +194,12 @@ def test_get_node_index_to_name_dict(self):
195194
index_to_name dict and the name_to_index dict are consistent.
196195
"""
197196

198-
index_to_name = list(self.HyQ_URDF.get_node_index_to_name_dict())
199-
name_to_index = list(self.HyQ_URDF.get_node_name_to_index_dict())
197+
index_to_name = list(self.mini_cheetah_URDF.get_node_index_to_name_dict())
198+
name_to_index = list(self.mini_cheetah_URDF.get_node_name_to_index_dict())
200199
get_nodes_index = []
201200

202201
for key in name_to_index:
203-
index = self.HyQ_URDF.get_node_name_to_index_dict()[key]
202+
index = self.mini_cheetah_URDF.get_node_name_to_index_dict()[key]
204203
get_nodes_index.append(index)
205204

206205
self.assertEqual(index_to_name, get_nodes_index)
@@ -210,7 +209,7 @@ def test_get_edge_index_matrix(self):
210209
Check the dimensionality of the edge matrix.
211210
"""
212211

213-
edge_matrix = self.HyQ_URDF.get_edge_index_matrix()
212+
edge_matrix = self.mini_cheetah_URDF.get_edge_index_matrix()
214213

215214
self.assertEqual(edge_matrix.shape[0], 2)
216215
self.assertEqual(edge_matrix.shape[1], 32)
@@ -220,7 +219,7 @@ def test_get_num_nodes(self):
220219
Check that the number of nodes are correct.
221220
"""
222221

223-
self.assertEqual(self.HyQ_URDF.get_num_nodes(), 17)
222+
self.assertEqual(self.mini_cheetah_URDF.get_num_nodes(), 17)
224223

225224
def test_get_edge_connections_to_name_dict(self):
226225
"""
@@ -230,13 +229,13 @@ def test_get_edge_connections_to_name_dict(self):
230229
"""
231230

232231
connections_to_name = list(
233-
self.HyQ_URDF.get_edge_connections_to_name_dict())
232+
self.mini_cheetah_URDF.get_edge_connections_to_name_dict())
234233
name_to_connections = list(
235-
self.HyQ_URDF.get_edge_name_to_connections_dict())
234+
self.mini_cheetah_URDF.get_edge_name_to_connections_dict())
236235

237236
result = []
238237
for key in name_to_connections:
239-
connections = self.HyQ_URDF.get_edge_name_to_connections_dict(
238+
connections = self.mini_cheetah_URDF.get_edge_name_to_connections_dict(
240239
)[key]
241240
for i in range(connections.shape[1]):
242241
real_reshaped = np.squeeze(connections[:, i].reshape(1, -1))
@@ -252,12 +251,12 @@ def test_get_edge_name_to_connections_dict(self):
252251
"""
253252

254253
name_to_connections = list(
255-
self.HyQ_URDF.get_edge_name_to_connections_dict())
254+
self.mini_cheetah_URDF.get_edge_name_to_connections_dict())
256255
all_connections = []
257256

258257
# Get all connections from dictionary
259258
for key in name_to_connections:
260-
connections = self.HyQ_URDF.get_edge_name_to_connections_dict(
259+
connections = self.mini_cheetah_URDF.get_edge_name_to_connections_dict(
261260
)[key]
262261
for i in range(connections.shape[1]):
263262
real_reshaped = np.squeeze(connections[:, i].reshape(1, -1))

urdf_files/HyQ/hyq-description

-1
This file was deleted.

urdf_files/HyQ/hyq.pdf

-13.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)