Skip to content

Commit 7d4ded0

Browse files
committed
Clean-up
1 parent 167769f commit 7d4ded0

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ doc/_build
1010
*build
1111
*.egg-info
1212
*.egg
13-
*_wip**
13+
*_wip**
14+
tests/api/test_data/.temp**
15+
*.zip

phobos/core/robot.py

+10-20
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ def get_blender_model_dictionary(self):
137137
if joint.mimic is not None:
138138
for k, v in joint.mimic.to_yaml().items():
139139
model["joints"][joint.name]["mimic_"+k] = v
140-
# [TODO pre_v2.0.0] dynamics, etc.
141140
model["links"][joint.child]["pose"] = {'translation': joint.origin.xyz,
142141
'rotation_euler': joint.origin.rpy,
143142
}
@@ -2190,7 +2189,6 @@ def attach(self, other, joint, do_not_rename=False, name_prefix="", name_suffix=
21902189
raise Exception("Provide valid joint type.")
21912190

21922191
# Check for naming and rename if necessary
2193-
# [TODO pre_v2.0.0] attach the rest
21942192
plink = set([str(link) for link in self.links])
21952193
pjoints = set([str(j) for j in self.joints])
21962194
pcollisions = set([str(c) for c in self.get_all_collisions()])
@@ -2233,7 +2231,7 @@ def attach(self, other, joint, do_not_rename=False, name_prefix="", name_suffix=
22332231

22342232
if pjoints & cjoints:
22352233
if not do_not_rename:
2236-
log.warning(f"Joint names are duplicates a _2 will be appended! {pjoints & cjoints}")
2234+
log.warning(f"Joint names are duplicates a {name_suffix} will be appended! {pjoints & cjoints}")
22372235
renamed_entities.update(other.rename(targettype="joint", target=list(pjoints & cjoints), prefix=name_prefix, suffix=name_suffix))
22382236
if joint.name in list(pjoints & cjoints):
22392237
joint.name = joint.name + "_2"
@@ -2242,15 +2240,15 @@ def attach(self, other, joint, do_not_rename=False, name_prefix="", name_suffix=
22422240

22432241
if pcollisions & ccollisions:
22442242
if not do_not_rename:
2245-
log.warning(f"Collision names are duplicates a _2 will be appended! {pcollisions & ccollisions}")
2243+
log.warning(f"Collision names are duplicates a {name_suffix} will be appended! {pcollisions & ccollisions}")
22462244
renamed_entities.update(
22472245
other.rename(targettype="collision", target=list(pcollisions & ccollisions), prefix=name_prefix, suffix=name_suffix))
22482246
else:
22492247
raise NameError("There are duplicates in collision names", repr(pcollisions & ccollisions))
22502248

22512249
if pvisuals & cvisuals:
22522250
if not do_not_rename:
2253-
log.warning(f"Visual names are duplicates a _2 will be appended! {pvisuals & cvisuals}")
2251+
log.warning(f"Visual names are duplicates a {name_suffix} will be appended! {pvisuals & cvisuals}")
22542252
renamed_entities.update(
22552253
other.rename(targettype="visual", target=list(pvisuals & cvisuals), prefix=name_prefix, suffix=name_suffix))
22562254
else:
@@ -2261,7 +2259,7 @@ def attach(self, other, joint, do_not_rename=False, name_prefix="", name_suffix=
22612259
cmaterials.remove(mat_name)
22622260
if pmaterials & cmaterials:
22632261
if not do_not_rename:
2264-
log.warning(f"Material names are duplicates a _2 will be appended! {pmaterials & cmaterials}")
2262+
log.warning(f"Material names are duplicates a {name_suffix} will be appended! {pmaterials & cmaterials}")
22652263
renamed_entities.update(
22662264
other.rename(targettype="material", target=list(pmaterials & cmaterials), prefix=name_prefix, suffix=name_suffix))
22672265
else:
@@ -2275,47 +2273,47 @@ def attach(self, other, joint, do_not_rename=False, name_prefix="", name_suffix=
22752273
conflicting_sensors.remove(sname)
22762274
if conflicting_sensors:
22772275
if not do_not_rename:
2278-
log.warning(f"Sensor names are duplicates a _2 will be appended! {conflicting_sensors}")
2276+
log.warning(f"Sensor names are duplicates a {name_suffix} will be appended! {conflicting_sensors}")
22792277
renamed_entities.update(
22802278
other.rename(targettype="sensor", target=list(conflicting_sensors), prefix=name_prefix, suffix=name_suffix))
22812279
else:
22822280
raise NameError("There are duplicates in sensor names", repr(conflicting_sensors))
22832281

22842282
if ptransmissions & ctransmissions:
22852283
if not do_not_rename:
2286-
log.warning(f"Transmission names are duplicates a _2 will be appended! {ptransmissions & ctransmissions}")
2284+
log.warning(f"Transmission names are duplicates a {name_suffix} will be appended! {ptransmissions & ctransmissions}")
22872285
renamed_entities.update(
22882286
other.rename(targettype="transmission", target=list(ptransmissions & ctransmissions), prefix=name_prefix, suffix=name_suffix))
22892287
else:
22902288
raise NameError("There are duplicates in transmission names", repr(ptransmissions & ctransmissions))
22912289

22922290
if pmotors & cmotors:
22932291
if not do_not_rename:
2294-
log.warning(f"Motor names are duplicates a _2 will be appended! {pmotors & cmotors}")
2292+
log.warning(f"Motor names are duplicates a {name_suffix} will be appended! {pmotors & cmotors}")
22952293
renamed_entities.update(
22962294
other.rename(targettype="motor", target=list(pmotors & cmotors), prefix=name_prefix, suffix=name_suffix))
22972295
else:
22982296
raise NameError("There are duplicates in motor names", repr(pmotors & cmotors))
22992297

23002298
if pexoskeletons & cexoskeletons:
23012299
if not do_not_rename:
2302-
log.warning(f"Exoskeleton names are duplicates a _2 will be appended! {pexoskeletons & cexoskeletons}")
2300+
log.warning(f"Exoskeleton names are duplicates a {name_suffix} will be appended! {pexoskeletons & cexoskeletons}")
23032301
renamed_entities.update(
23042302
other.rename(targettype="exoskeleton", target=list(pexoskeletons & cexoskeletons), prefix=name_prefix, suffix=name_suffix))
23052303
else:
23062304
raise NameError("There are duplicates in exoskeleton names", repr(pexoskeletons & cexoskeletons))
23072305

23082306
if psubmechanisms & csubmechanisms:
23092307
if not do_not_rename:
2310-
log.warning(f"Submechanism names are duplicates a _2 will be appended! {psubmechanisms & csubmechanisms}")
2308+
log.warning(f"Submechanism names are duplicates a {name_suffix} will be appended! {psubmechanisms & csubmechanisms}")
23112309
renamed_entities.update(
23122310
other.rename(targettype="submechanism", target=list(psubmechanisms & csubmechanisms), prefix=name_prefix, suffix=name_suffix))
23132311
else:
23142312
raise NameError("There are duplicates in submechanism names", repr(psubmechanisms & csubmechanisms))
23152313

23162314
if pinterfaces & cinterfaces:
23172315
if not do_not_rename:
2318-
log.warning(f"Interface names are duplicates a _2 will be appended! {pinterfaces & cinterfaces}")
2316+
log.warning(f"Interface names are duplicates a {name_suffix} will be appended! {pinterfaces & cinterfaces}")
23192317
renamed_entities.update(
23202318
other.rename(targettype="interface", target=list(pinterfaces & cinterfaces), prefix=name_prefix, suffix=name_suffix))
23212319
else:
@@ -2357,14 +2355,6 @@ def attach(self, other, joint, do_not_rename=False, name_prefix="", name_suffix=
23572355
assert len(self.joints) == len(self.get_joints_ordered_df()), f"{sorted([str(x) for x in self.joints])}\n{sorted([str(x) for x in self.get_joints_ordered_df()])}"
23582356
assert self.get_root()
23592357

2360-
# this will be done by fill_submechanisms we are delaying this to the export to give the user the opportunity to define something thereselves
2361-
# # Add the connection joint to the submechanism tree
2362-
# self.submechanisms += [Submechanism(self, name=joint.name, type="serial", contextual_name="ConnectionJoint",
2363-
# jointnames_independent=[] if joint.type == "fixed" else [joint.name],
2364-
# jointnames_spanningtree=[] if joint.type == "fixed" else [joint.name],
2365-
# jointnames_active=[] if joint.type == "fixed" else [joint.name],
2366-
# jointnames=[joint.name])]
2367-
23682358
self.relink_entities()
23692359
return renamed_entities
23702360

phobos/io/smurfrobot.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def load_submechanisms(self, submechanism_definition, replace_only_conflicting=F
426426
self.exoskeletons.remove(existing)
427427
self.add_aggregate("exoskeletons", _ex)
428428

429-
def sort_submechanisms(self): # [TODO pre_v2.0.0] The submechanisms are not ordered correctly
429+
def sort_submechanisms(self):
430430
"""
431431
Sorts the submechanisms as well as there jointname lists
432432
:return: None
@@ -462,7 +462,7 @@ def _get_joints_included_twice_in_submechanisms(self):
462462
sm_joints += sm.get_joints()
463463
return twice
464464

465-
def generate_submechanisms(self): # [TODO pre_v2.0.0] The fixed joints are not sorted correctly
465+
def generate_submechanisms(self):
466466
"""
467467
Scans the defined submechanisms and creates the entries for missing joints
468468
:return: None

0 commit comments

Comments
 (0)