Starting with ROS on the Robot¶
Connecting your PC to the platform via the middleware¶
By default, all distributions of ROS 2 use Fast-RTPS as the middleware. We will continue to support the default middleware and will make the changes according to the developments of Open Robotics.
Connecting to the PC and the robot has already been discussed in Getting Started.
ROS 2 in general uses the Domain ID to distinguish between groups of computers running on the same network. By default, we set all the domain IDs of our robots to
0, which is also the factory default configuration of ROS 2.
If changes are required, then the user has to add the following line to the
~/.bashrc of his client PC as well as the robot PC.
The above setting will only work for devices connected to the same network, i.e. technically having the same subnet mask.
Testing your connection¶
In general, when you turn on your new robot, there is an autostart script for ROS that would bring up all the necessary drivers and packages for the hardware components as part of the robot. If you followed the automated workspace setup instructions in Installation, then the autostart script would already be part of the robot’s desktop.
If, on the other hand, you have installed ROS 2 and other necessary packages manually, then you need to do a manual startup as follows:
ros2 launch neo_mpo_700-2 bringup.launch.py
After completing the ROS network configuration your PC should be able to connect to the ROS on the platform. To check the connection you can try to list the available topics:
ros2 topic list
It should show the topics as follows:
/cmd_vel /diagnostics /drives/joint_states /drives/joint_states_raw /drives/joint_trajectory /joint_states /joy /joy/set_feedback /lidar_1/scan /lidar_1/scan_filtered /lidar_2/scan /lidar_2/scan_filtered /odom /relayboard_v2/battery_state /relayboard_v2/emergency_stop_state /relayboard_v2/state /rosout /rosout_agg /tf /tf_static
If you have IMU enabled, then you’ll be able to see few more topics published as described in the documentation of the phidget_drivers
More about bringup¶
The bringup component that we saw earlier is the heart of our software stack, as this starts and configures all the necessary hardware components which are part of our robot. The launch of the bringup comes with additional arguments. The launch arguments are described below:
Starting from July 2023, the complete namespacing support is currently only avaiable for MP-400 and partially for MPO-700. The rest will be updated soon.
|namespace||NaN (Format: string)||sets the robot namespace|
|imu_enable||False (Format: Bool)||Enables / Disables IMU|
Setting up an IMU or any other customization can be seen in Customization for ROS 2.
The launch prompt for the commandline with both the option set, will be something like this:
ros2 launch neo_mpo_700-2 bringup.launch.py namespace:="robot1" imu_enable:=True
More about the namespacing can be learnt in the documentation for Namespacing Guide.
Visualize the data with RViz¶
A pre-configured visualization can be started via a launch file from your Client-PC as follows:
ros2 launch neo_mp_400-2 rviz.launch.py robot_namespace:=robot1 use_namespace:=True ros2 launch neo_mp_500-2 rviz.launch.py ros2 launch neo_mpo_500-2 rviz.launch.py ros2 launch neo_mpo_700-2 rviz.launch.py
You can use the left stick for movement in X and Y direction and the right stick for rotating. Please make sure to set the joystick to D-mode (found on the top) before teleop.
It is always essential to manually move the axes of the joystick in all possible directions, before pressing the deadman button and starting the teleoperation of the robot. Please read this issue about the teleop for more information.
MP-400 and MP-500 cannot move in Y direction.