inorbit-ai / ros_amr_interop

BSD 3-Clause "New" or "Revised" License
80 stars 27 forks source link

Add support for errorcodes #14

Closed leandropineda closed 3 years ago

leandropineda commented 3 years ago

Changes

Demo

The node successfully register the callback for errorCodes as seen below (Registered callback for parameter 'errorCodes' (String))

$ ros2 run massrobotics_amr_sender massrobotics_amr_node \
    --ros-args -p config_file:=./ros_amr_interop/massrobotics_amr_sender_py/sample_config.yaml
[INFO] [1624999313.075546947] [MassRoboticsAMRInteropNode]: Using configuration file './src/ros_amr_interop/massrobotics_amr_sender_py/sample_config.yaml'
[INFO] [1624999313.084074082] [MassRoboticsAMRInteropNode]: Registered callback for parameter 'operationalState' (String)
[INFO] [1624999313.085672445] [MassRoboticsAMRInteropNode]: Registered callback for parameter 'location' (PoseStamped)
[INFO] [1624999313.087150037] [MassRoboticsAMRInteropNode]: Registered callback for parameter 'velocity' (TwistStamped)
[INFO] [1624999313.088083952] [MassRoboticsAMRInteropNode]: Registered callback for parameter 'batteryPercentage' (BatteryState)
[INFO] [1624999313.090140858] [MassRoboticsAMRInteropNode]: Registered callback for parameter 'remainingRunTime' (Number)
[INFO] [1624999313.091181618] [MassRoboticsAMRInteropNode]: Registered callback for parameter 'loadPercentageStillAvailable' (Number)
[INFO] [1624999313.092154174] [MassRoboticsAMRInteropNode]: Registered callback for parameter 'errorCodes' (String)
[INFO] [1624999313.093073301] [MassRoboticsAMRInteropNode]: Registered callback for parameter 'destinations' (Path)
[INFO] [1624999313.094932555] [MassRoboticsAMRInteropNode]: Registered callback for parameter 'path' (Path)
[INFO] [1624999313.098289230] [MassRoboticsAMRInteropNode]: Reconnecting to server: ws://localhost:3000

Find below test messages published to the expected topic and the result that is shown on the receiver

Test messages

Single error message

$ ros2 topic pub --once /troubleshooting/errorcodes std_msgs/String "data: error1"
publisher: beginning loop
publishing #1: std_msgs.msg.String(data='error1')

Output

{
  "uuid": "foobar",
  "timestamp": "2021-06-29T17:52:18-03:00",
  "operationalState": "idle",
  "location": {
    "x": 0,
    "y": 0,
    "angle": {
      "w": 0,
      "x": 0,
      "y": 0,
      "z": 0
    },
    "planarDatum": "00000000-0000-0000-0000-000000000000"
  },
  "errorCodes": [
    "error1"
  ]
}

Multiple error message

$ ros2 topic pub --once /troubleshooting/errorcodes std_msgs/String "data: error1,error2,error3"
publisher: beginning loop
publishing #1: std_msgs.msg.String(data='error1,error2,error3')

Output

{
  "uuid": "foobar",
  "timestamp": "2021-06-29T17:52:18-03:00",
  "operationalState": "idle",
  "location": {
    "x": 0,
    "y": 0,
    "angle": {
      "w": 0,
      "x": 0,
      "y": 0,
      "z": 0
    },
    "planarDatum": "00000000-0000-0000-0000-000000000000"
  },
  "errorCodes": [
    "error1",
    "error2",
    "error3"
  ]
}

Empty error message

$ ros2 topic pub --once /troubleshooting/errorcodes std_msgs/String
publisher: beginning loop
publishing #1: std_msgs.msg.String(data='')

Output

{
  "uuid": "foobar",
  "timestamp": "2021-06-29T17:52:18-03:00",
  "operationalState": "idle",
  "location": {
    "x": 0,
    "y": 0,
    "angle": {
      "w": 0,
      "x": 0,
      "y": 0,
      "z": 0
    },
    "planarDatum": "00000000-0000-0000-0000-000000000000"
  },
  "errorCodes": []
}
leandropineda commented 3 years ago

@miguelgarcia ready for review!

miguelgarcia commented 3 years ago

Code LGTM @leandropineda . Can you add to the PR description an example of you publishing a message using ros2 topic pub and how this looks in the other end ?

Thanks!

leandropineda commented 3 years ago

I added a few examples @miguelgarcia