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

First version of the package in ROS Noetic #25

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Code quality
on:
pull_request:
push:
branches: [foxy-devel]
branches: [foxy-devel, noetic-devel]

jobs:
pre-commit:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ CATKIN_IGNORE

# VSCode
workspace.code-workspace
*.vscode/

# rosbag
*.db3-shm
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ standards, with a focus on AMRs (Autonomous Mobile Robots).

The following packages are included in this repository:

### Mass Robotics AMR Interop Sender for ROS1

### Mass Robotics AMR Interop Sender for ROS2

The [massrobotics_amr_sender_py](https://github.com/inorbit-ai/ros_amr_interop/tree/foxy-devel/massrobotics_amr_sender_py#readme)
package provides a ROS2 node written in Python that takes input from a
ROS2 system and publishes it to a [Mass Robotics Interop compliant
The [massrobotics_amr_sender](https://github.com/inorbit-ai/ros_amr_interop/tree/noetic-devel/massrobotics_amr_sender#readme)
package provides a ROS1 node written in Python that takes input from a
ROS1 system and publishes it to a [Mass Robotics Interop compliant
Receiver](https://github.com/MassRobotics-AMR/AMR_Interop_Standard/tree/main/MassRobotics-AMR-Receiver).

Mapping of different data elements from the ROS2 system into Mass
Mapping of different data elements from the ROS1 system into Mass
Robotics Interop messages can be customized through a YAML configuration
file.

Expand Down
53 changes: 53 additions & 0 deletions massrobotics_amr_sender/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 3.0.2)
project(massrobotics_amr_sender)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
rospy
)


###################################
## catkin specific configuration ##
###################################

catkin_python_setup()

catkin_package(
INCLUDE_DIRS
LIBRARIES
CATKIN_DEPENDS
rospy
DEPENDS
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
${catkin_INCLUDE_DIRS}
)

#############
## Install ##
#############

install(
DIRECTORY
scripts/
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(
DIRECTORY
launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)

catkin_install_python(
PROGRAMS
scripts/massrobotics_amr_sender_node.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
44 changes: 44 additions & 0 deletions massrobotics_amr_sender/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# massrobotics_amr_sender

Configuration-based ROS package for sending MassRobotics [AMR Interop Standard messages](https://github.com/MassRobotics-AMR/AMR_Interop_Standard) to compliant receivers.

# Package installation

## From binary packages

Coming soon.

## Building from source

Make sure `ros` is installed properly. Then clone this repository inside your `src` folder on your local workspace and build the package executing the following commands:

```bash
# Create a ROS workspace and go into it - if you don't have one already
mkdir -p ~/ros_ws/src && cd ros_ws/
# Clone the repo inside the workspace
git clone --branch noetic-devel https://github.com/inorbit-ai/ros_amr_interop.git ./src
# Install dependencies
rosdep update && rosdep install --ignore-src --from-paths src/
# Run the build
catkin config --install
catkin build
```
# Node configuration

A configuration file must be provided to define how ROS1 messages are mapped to different AMR Interop Standard messages. A [sample_config.yaml](https://github.com/inorbit-ai/ros_amr_interop/blob/foxy-devel/massrobotics_amr_sender_py/sample_config.yaml) is provided for reference.
FlorGrosso marked this conversation as resolved.
Show resolved Hide resolved

# Running the sender node

The node takes the MassRobotics AMR config file path as parameter. If not provided, it is assumed the file is on the current directory.

```bash
# Remember to source the ROS environment from the binary installation or your workspace overlay
source devel/setup.bash
# Launch the node pointing to your configuration file
roslaunch massrobotics_amr_sender massrobotics_amr_sender.launch config_file:=/path/to/config.yaml
```


# Tests

TODO.
37 changes: 37 additions & 0 deletions massrobotics_amr_sender/launch/massrobotics_amr_sender.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!--
Copyright 2022 InOrbit, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of the InOrbit, Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-->

<launch>
FlorGrosso marked this conversation as resolved.
Show resolved Hide resolved
<arg name="config_file" default="$(find massrobotics_amr_sender)/params/sample_config.yaml"/>

<!-- Launch Node -->
<node name="massrobotics_amr_sender" pkg="massrobotics_amr_sender" type="massrobotics_amr_sender_node.py" output="screen">
<param name="config_file" value="$(arg config_file)" type="string" />
</node>
</launch>
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<package format="2">
<name>massrobotics_amr_sender</name>
<version>1.0.0</version>
<description>MassRobotics AMR Interop Sender</description>
<maintainer email="[email protected]">InOrbit</maintainer>
<license>3-Clause BSD License</license>

<buildtool_depend>catkin</buildtool_depend>

<depend>std_msgs</depend>
<depend>geometry_msgs</depend>
<depend>sensor_msgs</depend>
<depend>nav_msgs</depend>

<build_depend>rospy</build_depend>

<build_export_depend>rospy</build_export_depend>

<exec_depend>python3-websockets</exec_depend>
<!-- kdl is used for processing Twist messages -->
<exec_depend>tf2_kdl</exec_depend>
<exec_depend>python3-pykdl</exec_depend>
<exec_depend>rclpy</exec_depend>
<exec_depend>rospy</exec_depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<!-- common_interfaces for nav_msgs -->
<test_depend>common_interfaces</test_depend>
<test_depend>python3-jsonschema</test_depend>
<test_depend>python3-mock</test_depend>
<test_depend>python3-pep8</test_depend>
<test_depend>python3-pytest</test_depend>
<test_depend>python3-pytest-mock</test_depend>
<test_depend>python3-yaml</test_depend>

<export>
<build_type>ament_python</build_type>
</export>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# MassRobotics AMR Interoperability Standard sender configuration file
# ====================================================================
#
# Parameters that are used to configure ROS2 node for connecting to MassRobotics compatible servers.
# Parameters that are used to configure a ROS1 node for connecting to MassRobotics compatible servers.
# The `server` section expects a string with a WebSocket server URI, while the `mappings` section
# contains a list of paramaters for configuring the ROS2 node. As per AMR Interop Standard,
# contains a list of parameters for configuring the ROS1 node. As per AMR Interop Standard,
# mandatory parameters are `uuid`, `manufacturerName`, `robotModel`, `robotSerialNumber` and
# `baseRobotEnvelope` (full spec https://github.com/MassRobotics-AMR/AMR_Interop_Standard/).
#
# Translation to AMR Interop Standard messages might be direct (i.e. a string to a report message
# field) or complex in case of ROS2 message having data that maps to many AMR report message fields.
# For this reason, some configuration parameters below expect a particular ROS2 message type e.g.
# fields on a ROS2 message of type `sensor_msgs/msg/BatteryState` are translated into AMR Interop
# field) or complex in case of ROS1 message having data that maps to many AMR report message fields.
# For this reason, some configuration parameters below expect a particular ROS1 message type e.g.
# fields on a ROS1 message of type `sensor_msgs/BatteryState` are translated into AMR Interop
# Status Report fields `batteryPercentage`, `remainingRunTime` and `loadPercentageStillAvailable`.
#
# In addition to local values i.e. strings or objects, the `mappings` section supports a variety of
Expand Down Expand Up @@ -93,21 +93,21 @@ config:
location:
valueFrom:
rosTopic: /move_base_simple/goal
msgType: geometry_msgs/msg/PoseStamped
msgType: geometry_msgs/PoseStamped

# Current velocity of AMR
velocity:
valueFrom:
rosTopic: /good_sensors/vel
msgType: geometry_msgs/msg/TwistStamped
msgType: geometry_msgs/TwistStamped

# Percentage of battery remaining
# The ``msgField`` indicates a message field where the battery
# percentage value will be extracted
batteryPercentage:
valueFrom:
rosTopic: /good_sensors/bat
msgType: sensor_msgs/msg/BatteryState
msgType: sensor_msgs/BatteryState
msgField: percentage

# Estimated remaining runtime in hours
Expand All @@ -129,7 +129,7 @@ config:
errorCodes:
valueFrom:
rosTopic: /troubleshooting/errorcodes
msgType: std_msgs/msg/String
msgType: std_msgs/String

# Target destination(s) of Automated Guided Vehicle (AGV)
destinations:
Expand Down
42 changes: 42 additions & 0 deletions massrobotics_amr_sender/sample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Sample data for massrobotics_amr_sender

Scripts, launch files, recordings and other tools for demoing and testing the `massrobotics_amr_sender` node.

The `rosbag` folder contains a stripped rosbag based on `turtlebot3`. It was built using on the [Gazebo](https://emanual.robotis.com/docs/en/platform/turtlebot3/simulation/#gazebo-simulation), [SLAM](https://emanual.robotis.com/docs/en/platform/turtlebot3/slam_simulation/) and [Navigation](https://emanual.robotis.com/docs/en/platform/turtlebot3/nav_simulation/) simulations.

```bash
$ rosbag info rosbag_demo.bag
path: rosbag_demo.bag
version: 2.0
duration: 1:51s (111s)
start: Jul 05 2021 19:45:30.36 (1625525130.36)
end: Jul 05 2021 19:47:21.75 (1625525241.75)
size: 3.8 MB
messages: 12282
compression: none [4/4 chunks]
types: geometry_msgs/PoseStamped [d3812c3cbc69362b77dc0b19b345f8f5]
geometry_msgs/TwistStamped [98d34b0043a2093cf9d9345ab6eef12e]
nav_msgs/Path [6227e2b7e9cce15051f669a5e197bbf7]
sensor_msgs/BatteryState [4ddae7f048e32fda22cac764685e3974]
std_msgs/Float32 [73fcbf46b49191e672908e50842a83d4]
std_msgs/String [992ce8a1687cec8c8bd883ec73ca41d1]
topics: /battery 111 msgs : sensor_msgs/BatteryState
/battery_runtime 37 msgs : std_msgs/Float32
/load_perc_available 22 msgs : std_msgs/Float32
/local_plan 1453 msgs : nav_msgs/Path
/location 5273 msgs : geometry_msgs/PoseStamped
/mode 5 msgs : std_msgs/String
/plan 74 msgs : nav_msgs/Path
/troubleshooting/errorcodes 37 msgs : std_msgs/String
/velocity 5270 msgs : geometry_msgs/TwistStamped
```

Messages on topics such as `/plan` and `/local_plan` were kept unchanged while messages on `/location` and `/velocity` were crafted by creating `PoseStamped` and `TwistStamped` messages using data from `Odometry` messages on topic `/odom`. The messages on the remaining topics `/battery`, `/battery_runtime`, `/load_perc_available`, `/mode` and `/troubleshooting/errorcodes` as well as all the transformation described above were generated with a small ROS1 node that is available at `synthetic/node.py`.

## How to run

The `massrobotics_amr_sender_rosbag_launch.launch` launch file describes a `massrobotics_amr_sender` node that uses a configuration file customized for the sample rosbag, and also plays the rosbag in loop mode so the different node callbacks are executed.

```bash
roslaunch massrobotics_amr_sender massrobotics_amr_sender_rosbag_launch.launch
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# MassRobotics AMR Interoperability Standard sender configuration file
# ====================================================================
#
# Parameters that are used to configure ROS2 node for connecting to MassRobotics compatible servers.
# Parameters that are used to configure ROS1 node for connecting to MassRobotics compatible servers.
# The `server` section expects a string with a WebSocket server URI, while the `mappings` section
# contains a list of paramaters for configuring the ROS2 node. As per AMR Interop Standard,
# contains a list of parameters for configuring the ROS1 node. As per AMR Interop Standard,
# mandatory parameters are `uuid`, `manufacturerName`, `robotModel`, `robotSerialNumber` and
# `baseRobotEnvelope` (full spec https://github.com/MassRobotics-AMR/AMR_Interop_Standard/).
#
# Translation to AMR Interop Standard messages might be direct (i.e. a string to a report message
# field) or complex in case of ROS2 message having data that maps to many AMR report message fields.
# For this reason, some configuration parameters below expect a particular ROS2 message type e.g.
# fields on a ROS2 message of type `sensor_msgs/msg/BatteryState` are translated into AMR Interop
# field) or complex in case of ROS1 message having data that maps to many AMR report message fields.
# For this reason, some configuration parameters below expect a particular ROS1 message type e.g.
# fields on a ROS1 message of type `sensor_msgs/BatteryState` are translated into AMR Interop
# Status Report fields `batteryPercentage`, `remainingRunTime` and `loadPercentageStillAvailable`.
#
# In addition to local values i.e. strings or objects, the `mappings` section supports a variety of
Expand Down Expand Up @@ -93,21 +93,21 @@ config:
location:
valueFrom:
rosTopic: /location
msgType: geometry_msgs/msg/PoseStamped
msgType: geometry_msgs/PoseStamped

# Current velocity of AMR
velocity:
valueFrom:
rosTopic: /velocity
msgType: geometry_msgs/msg/TwistStamped
msgType: geometry_msgs/TwistStamped

# Percentage of battery remaining
# The ``msgField`` indicates a message field where the battery
# percentage value will be extracted
batteryPercentage:
valueFrom:
rosTopic: /battery
msgType: sensor_msgs/msg/BatteryState
msgType: sensor_msgs/BatteryState
msgField: percentage

# Estimated remaining runtime in hours
Expand All @@ -129,7 +129,7 @@ config:
errorCodes:
valueFrom:
rosTopic: /troubleshooting/errorcodes
msgType: std_msgs/msg/String
msgType: std_msgs/String

# Target destination(s) of Automated Guided Vehicle (AGV)
destinations:
Expand Down
Loading