ami-iit / amo_urdf

Friendly mantainance fork of odio-urdf .
3 stars 1 forks source link

Empty transmission attributes throws issue when parsing xml_text #2

Open akhilsathuluri opened 4 months ago

akhilsathuluri commented 4 months ago

Problem

When adding the elements of SimpleTransmission there are no problems. But when loading the modified urdf back to amo_urdf DSL, we get the issue:

  File <string>:167
    Type(xmltext= "SimpleTransmission",xmltext = "
                                                 ^
SyntaxError: unterminated string literal (detected at line 167)

Problem origin

The issue is because of the way SimpleTransmissions are currently added. When adding the tag adds the following element in the urdf

<transmission  name="transmissionankle" >
  <type  xmltext="SimpleTransmission" >
   SimpleTransmission
  </type>
  <actuator  name="actuator_ankle" >
   <mechanicalreduction  xmltext="1" >
    1
   </mechanicalreduction>
  </actuator>
  <joint  name="ankle" >
   <hardwareInterface  name="EffortJointInterface" />
  </joint>
 </transmission>

When parsing it back some elements are not recognised,

Transmission(\n  Type(xmltext= "SimpleTransmission",xmltext = "\n   SimpleTransmission\n  "),\n  Actuator(\n   Mechanicalreduction(xmltext= "1",xmltext = "\n    1\n   "),\n   name= "actuator_ankle")