Up:Tutorial? The aim of this tutorial is to explain how to integrate SIGVerse with ROS operating system. First, we will show how to install ROS on your operating system, then we will explain step by step how to run SIGVerse controller in ROS node and how to communicate with another node. The ROS part tutorial is based on the official ROS wiki, you can check it for more details. Overview †In order to integrate SIGVerse and ROS, we first need to create ROS package containing two nodes, SIGVerse controller node and ROS command node. The first node, SIGVerse controller node, will receive data from the SIGViewer as messages, then publish them on the message topic, in the other part, ROS command node reads these data and subscribe the corresponding velocity on the velocity topic, the velocity command will be retrieved by the SIGVerse controller node to be used for controlling the robot. Installing ROS †To install ROS on your server please refer to the official web site. Creating ROS workspace †In our project we are using catkin, here are the steps to follow to create a ROS workspace: Run the following command: $ source /opt/ros/groovy/setup.sh To create a catkin workspace: $ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/src $ catkin_init_workspace You can build even though no project is created yet, you just need MakeLists.txt: $ cd ~/catkin_ws/ $ catkin_make Run the setup.bash $ source devel/setup.bash Creating the package †We need to create a new package in the catkin_ws directory.
Download the project †Please download the project file from here. Compiling the project †
You need to have Cmake installed on your server. Let's edit the CMakeLists.txt file to compile the project: Cmake parameters:
add_executable(ros_controller src/ros_controller.cpp) target_link_libraries(ros_controller ${catkin_LIBRARIES}) add_dependencies(ros_controller sig_ros_gencpp)
ADD_LIBRARY(sig_ros/sig_controller src/sig_controller.cpp) target_link_libraries(sig_ros/sig_controller ${catkin_LIBRARIES}) add_dependencies(sig_ros/sig_controller sig_ros_gencpp)
A new library will be generated in ~/catkin_ws/devel/lib/libsig_ros. Run the following command to add this package to ROS packages: $source ~/catkin_ws/devel/setup.sh
We must have the following output: $ CMakeLists.txt include msg package.xml src This shows that the sig_ros package exists. Testing the project †Running the server †To run the server please follow the these steps: Go to catkin_ws and and follow these steps :
$ roscore
$ cd ~/catkin_ws/devel/lib/libsig_ros $ sigserver.sh -w ./RobotInMove.xml Client side †
Source Code understanding †SIGVerse controller node †sig_controller.cpp
The following is the callback function which preforms the command on the velocity of the robot’s wheels: Message Sender †
Node Initialization †
Robot Controller †This function allows to control the robot using the appropriate velocity. ROS command node †This is the node that controls the robot’s velocity: ros_controller.cpp:
Main to execute the Node †
Message Sender †
World file †RobotInMove.xml:
Counter: 7292,
today: 1,
yesterday: 0
Tutorial? |