Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for errorcodes #14

Merged
merged 9 commits into from
Jun 30, 2021
Merged

Add support for errorcodes #14

merged 9 commits into from
Jun 30, 2021

Conversation

leandropineda
Copy link
Member

@leandropineda leandropineda commented Jun 29, 2021

Changes

  • Added support for error codes (comma-separated values that are translated into an array of messages)

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
Copy link
Member Author

@miguelgarcia ready for review!

@miguelgarcia
Copy link
Member

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
Copy link
Member Author

I added a few examples @miguelgarcia

@leandropineda leandropineda merged commit 79991fd into inorbit-ai:foxy-devel Jun 30, 2021
@leandropineda leandropineda deleted the add-support-for-errorcodes branch June 30, 2021 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants