LCAS / topological_navigation

The topological navigation framework
Apache License 2.0
31 stars 36 forks source link

[FEAT]: Yaml load with extended safe loader for topological map files #185

Open arsh09 opened 1 week ago

arsh09 commented 1 week ago

Description

Problem:

The current map managers loads the topological map file using the PyYaml safe load option directly here on manager2.py file:

Considering a map file that is exported using JSON stringily for large farms, the 'stringification' strips all the leading zeros so a pose orientation like the following :

const orientation = { x : 0.0, y : 0.0, z : 0.0, w : 1.0 } 

would become:

orientation: 
      x : 0
      y : 0
      z : 0
      w : 1

When the yaml file is loaded in Python, the x, y, z, w keys are treated as integer type instead of float types. This integer type fails an assertion in geometry_msgs/Point and geometry_msgs/Vector3:

The behaviour is reproducible if any of the nodes' pose or map global transformation is set without leading zeroes.

Solution:

PyYaml allows to extend the behaviour of SafeLoad by extending the class and passing it as a Loader argument. Within that extension, one can change the 'x', 'y', 'z', and 'w' keys to float type. Something like the first response here.

Additional Information

No response