Usage
This guide shows how to configure and start the EMROS-ROS nodes.
EMROS-ROS works together with EMROS-EM5 to connect ROS to Nanotec's mobile drive and technology platform RP-NTH (only variants with “control center”: RP-NTH-2D01-C1-xx-xx).
Requirements
- Nantoec's RP-NTH-2D01-C1-xx-xx with CANopen Master EM5
- 24V Power supply for RP-NTH
- On-board computer with Linux. This How-To has been tested with Linux versions:
-Mint 18.3 Sylvia Cinnamon
-Ubuntu 18.04 Bionic Beaver
Preparation
- Please follow the instructions of the following tutorials before starting with this one:
-How to: Start running EMROS-EM5 - Install ROS as described in the official ROS installation tutorials
Clone repro and prepare catkin workspace
-
Create a folder for your catkin workspace (for this tutorial we call it "catkin_ws").
-
Within catkin_ws create a folder called "src"
-
Change directory into src, then clone the EMROS-ROS repository with parameter --recursive:
git clone --recursive https://gitlab.nanotec.de/nathan/ros-packages.git
- Change directory into catkin_ws. Then use catkin_make as follows:
catkin_make -j4 --force-cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug --cmake-args -DCMAKE_CXX_COMPILER_ARG1=-std=c++11
Catkin should create two folders in catkin_ws now: "build" and "devel"
-
There are several setup-files in folder devel. Source the suitable one for your shell.
For bash:
source devel/setup.bash
For zsh:
source devel/setup.zsh
The setup file need to be sourced everytime you restart the shell (e.g. after a restart of Your PC).
Hint: To permanently source the setup file, add the command to your .bashrc file or .zshrc.local.
- Check the Ros-path variable for Your catkin_ws:
echo $ROS_PACKAGE_PATH
The answer should look like this:
/home/yourpath/catkin_ws/src:/opt/ros/lunar/share
Setup and start the EMROS nodes
-
Open the file catkin_ws/src/ros-packages/emros_bringup/launch/emros_bringup.launch in a text-editor.
-
In emros_bringup.launch edit the Parameter IP_EM5 and Port_EM5 corresponding to the settings of Your EM5. This EM5 parameter are defined in the "ethernet.ini" file in the folder "config" on the EM5 filesystem.
-
Check the setting in main.cpp of EMROS-EM5.
In main.cpp needs to be set the correct IP-address of Your onboard-pc (where ROS is running).
If neccessary please recompile and flash EMROS-EM5 again into the EM5, as discribed in the tutorial How-To: Start running EMROS-EM5 -
Start EMROS-EM5
-
In emros_bringup.launch, leave the xml-block "2WD DIFFERENTIAL DRIVE" uncommented but comment out the "4WD MECANUM DRIVE" block (or vice versa) depending on your robot.
-
Save the file emros_bringup.launch
-
Start EMROS-EM5 on the RP-NTH
-
Start the nodes:
roslaunch emros_bringup emros_bringup.launch
Hint: If You see the Error "RLException: [emros_bringup.launch] is neither a launch file in ..." You maybe forgot to source the setup.bash or setup.zsh.
- Two Nodes have been started:
-Dispatcher: Sends Messages via Ethernet/UDP to EMROS-EM5 on the EM5 -Basecontroller: Accepts the robot's target velocity (topic cmd_vel), calculates the robot kinematic and tells the Dispatcher-Node what to send This can be displayed with:
rosrun rqt_graph rqt_graph
Choose Display Nodes/Topics (all) and uncheck every checkbox in the "Hide" bar except "Debug".
The EMROS-ROS is ready to work. The Basecontroller waits now to recieve commands under the ROS-topic "/cmd_vel"
Controll the Robot with rqt_robot_steering
- Start the rqt_robot_steering node:
rosrun rqt_robot_steering rqt_robot_steering
-
Set the Topic to "/cmd_vel"
-
Enable the Button "Motor ON" at the Touchdisplay of RP-NTH's EM5.
-
When You use sliders of rqt_robot_steering-GUI the RP-NTH should move!