nasa-jpl / osr-rover-code

Code that runs on the Open Source Rover
Apache License 2.0
435 stars 149 forks source link

Added error decoding to roboclaw_wrapper #174

Closed abust005 closed 1 year ago

abust005 commented 1 year ago

Added error decoding to roboclaw_wrapper, using the error code table in the Roboclaw manual.

Also statically typed the parameters, as I encountered some issues running the code with the dynamic typing.

abust005 commented 1 year ago

Can you clarify what kind of issues?

For some reason, when I tried to use the dynamic typing functionality for the parameters, the scripts would actually crash on startup. I would get an InvalidParameterTypeException. See below:


[roboclaw_wrapper-1]   File "/home/bobert/osr_ws/install/osr_control/lib/osr_control/roboclaw_wrapper", line 33, in <module>
[roboclaw_wrapper-1]     sys.exit(load_entry_point('osr-control', 'console_scripts', 'roboclaw_wrapper')())
[roboclaw_wrapper-1]   File "/home/bobert/osr_ws/build/osr_control/osr_control/roboclaw_wrapper.py", line 437, in main
[roboclaw_wrapper-1]     wrapper = RoboclawWrapper()
[roboclaw_wrapper-1]   File "/home/bobert/osr_ws/build/osr_control/osr_control/roboclaw_wrapper.py", line 28, in __init__
[roboclaw_wrapper-1]     self.declare_parameters(
[roboclaw_wrapper-1]   File "/opt/ros/iron/lib/python3.10/site-packages/rclpy/node.py", line 526, in declare_parameters
[roboclaw_wrapper-1]     self._declare_parameter_common(
[roboclaw_wrapper-1]   File "/opt/ros/iron/lib/python3.10/site-packages/rclpy/node.py", line 582, in _declare_parameter_common
[roboclaw_wrapper-1]     raise InvalidParameterTypeException(
[roboclaw_wrapper-1] rclpy.exceptions.InvalidParameterTypeException: Trying to set parameter 'baud_rate' to '115200' of type 'INTEGER', expecting type 'NOT_SET'
[ERROR] [roboclaw_wrapper-1]: process has died [pid 1612, exit code 1, cmd '/home/bobert/osr_ws/install/osr_control/lib/osr_control/roboclaw_wrapper --ros-args -r __node:=roboclaw_wrapper --params-file /home/bobert/osr_ws/install/osr_bringup/share/osr_bringup/config/roboclaw_params.yaml'].
[rover-3] [INFO] [1697965140.669282010] [rover]: Initializing Rover
[rover-3] Traceback (most recent call last):
[rover-3]   File "/home/bobert/osr_ws/install/osr_control/lib/osr_control/rover", line 33, in <module>
[rover-3]     sys.exit(load_entry_point('osr-control', 'console_scripts', 'rover')())
[rover-3]   File "/home/bobert/osr_ws/build/osr_control/osr_control/rover.py", line 400, in main
[rover-3]     rover = Rover()
[rover-3]   File "/home/bobert/osr_ws/build/osr_control/osr_control/rover.py", line 24, in __init__
[rover-3]     self.declare_parameters(
[rover-3]   File "/opt/ros/iron/lib/python3.10/site-packages/rclpy/node.py", line 526, in declare_parameters
[rover-3]     self._declare_parameter_common(
[rover-3]   File "/opt/ros/iron/lib/python3.10/site-packages/rclpy/node.py", line 582, in _declare_parameter_common
[rover-3]     raise InvalidParameterTypeException(
[rover-3] rclpy.exceptions.InvalidParameterTypeException: Trying to set parameter 'rover_dimensions.d1' to '0.177' of type 'DOUBLE', expecting type 'NOT_SET'
[ERROR] [rover-3]: process has died [pid 1616, exit code 1, cmd '/home/bobert/osr_ws/install/osr_control/lib/osr_control/rover --ros-args -r __node:=rover --params-file /home/bobert/osr_ws/install/osr_bringup/share/osr_bringup/config/osr_params.yaml --params-file /tmp/launch_params_v59momyz'].```
Achllle commented 1 year ago

For some reason, when I tried to use the dynamic typing functionality for the parameters, the scripts would actually crash on startup. I would get an InvalidParameterTypeException.

Perhaps this is because I'm on ROS2 Foxy still, haven't yet updated and behavior changed with Humble/Iron.

Let me know if you think this is ready and we'll get it merged in!

abust005 commented 1 year ago

Please perform one last review to make sure I've pulled all the parameter static typing; if it's clean, then we're good to merge!