.. _start-with-ros-on-the-robot: 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 :ref:`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. :: export ROS_DOMAIN_ID=1 .. note:: The above setting will only work for devices connected to the same network, i.e. technically having the same subnet mask. .. note:: More `about ROS Middleware found here `_ and `about ROS Domain ID can be found here `_. 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 :ref:`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: MP / MM robots ************** :: ros2 launch neo_mpo_700-2 bringup.launch.py ROX robots ********** :: ros2 launch rox_bringup bringup.launch.py rox_type:=argo 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: .. note:: If you are changing the relayboard configs, it is always essential to turn the key towards the "on" direction, once after the ROS bringup as been initiated. The indications can be seen with the LED's if they are present. The robot will not move without the key being turned. :: ros2 topic list It should show the topics as follows: MP / MM robots ************** :: /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 ROX robots ********** .. warning:: Some of the scanner topics are omitted here. Please look into the `documentation from sick for more details `_. :: /cmd_vel /diagnostics /drives/joint_states /drives/joint_states_raw /drives/joint_trajectory /joint_states /joy /joy/set_feedback /kinematics_state /lidar_1/scan /lidar_1/scan_filtered /lidar_2/scan /lidar_2/scan_filtered /odom /battery_state /emergency_stop_state /relayboard_v3/state /safety_state /scan /rosout /rosout_agg /tf /tf_static .. note:: If you have IMU and the robot arm 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 that are part of the platform with the help of the corresponding drivers. The launch of the bringup comes with additional arguments. The launch arguments are described below: MP / MM robots ************** .. Note:: As of July 2023, the complete namespacing support is currently only avaiable for MP-400 and partially for MPO-700. The rest will be updated soon. ================= ========================= ===================================================== Arguments Defaults Description ================= ========================= ===================================================== `robot_namespace` NaN (Format: `string`) sets the robot namespace `use_imu` `False` (Format: `Bool`) Enables / Disables IMU (only avaiable for MPO-700) `use_d435` `False` (Format: `Bool`) Enables / Disables D435 (only avaiable for MPO-700) `arm_type` `None` (Format: `string`) sets the arm type (only avaiable for MPO-700) ================= ========================= ===================================================== .. note:: * Currently, only Universal robots are supported, soon Elite robots will be added. * Setting up an IMU or any other customization can be seen in :ref:`customize_with_ros2`. * Make sure to set the robot arm to remote mode in the teach pendant before bringing up the drivers. The launch prompt for the commandline with all the option set, will be something like this: :: ros2 launch neo_mpo_700-2 bringup.launch.py robot_namespace:="robot1" use_imu:=True arm_type:="ur5" More about the namespacing can be learnt in the documentation for :ref:`namespacing-guide`. Frames of the UR arms are broadcasted with a prefix. The prefix is the name of the `arm_type` itself. For example, if the `arm_type` is set to `ur5`, then the frames will be broadcasted as `ur5base_link`, `ur5shoulder_link`, `ur5elbow_link`, `ur5wrist_1_link`, `ur5wrist_2_link`, `ur5wrist_3_link` and `ur5tool0`. ROX robots ********** .. Note:: The packages for ROX will be updated frequently. The support for various software components and the hardware components will be slowly made available in the forthcoming updates. Please contact us directly incase if there is an update that is required immediately. ============= ======================== ============================== Arguments Defaults Description ============= ======================== ============================== `rox_type` NaN (Format: `string`) sets the kinematics type ============= ======================== ============================== Visualize the data with RViz ---------------------------- A pre-configured visualization can be started via a launch file from your Client-PC as follows: MP / MM robots ************** :: 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 ROX robots ********** :: ros2 launch rox_rviz rox_rviz_launch.py |rviz| Teleoperation ------------- Joystick node is already initialized in the bringup. The Logitech joystick should be operable at this point. 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. .. warning:: 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 `_. .. note:: MP-400 and MP-500 cannot move in Y direction. |joy| .. |joy| image:: joystick.jpg :width: 50% .. |rviz| image:: mpo_700_rviz_basic.png :width: 100% Manipulation ------------ The platforms that are equipped with an arm can be quickly tested using the ``rqt_joint_trajectory_controller`` plugin. The plugin can be started as follows: :: ros2 run rqt_joint_trajectory_controller rqt_joint_trajectory_controller More information regarding the `joint_trajectory_controller can be found here `_. .. attention:: The robot arm can be also controlled with the MoveIt. Please read the :ref:`neo-ur-moveit-config` for more information.