Militaru92-colab

From jderobot
Jump to: navigation, search


People[edit]

  • Andrei Iulian Militaru (militaru.andrei92@gmail.com)
  • José María Cañas Plaza (jmplaza [at] gsyc [dot] es)

Project Description[edit]

The goal is to implement a generalized adapter between JdeRobot and ROS

Development[edit]

  • Project Repository RosIceBridge
  • JdeRobot Version: JdeRobot
  • Technology: C++, OpenCV, ROS Jade, JdeRobot, IceStorm, CMake, gazebo 5


Documentation[edit]

Robot Drivers[edit]

In order to control and read data from a robot, a developer must make use of the following drivers:

Encoders[edit]

returns the robot's position and orientation as an angle.

Pose3D[edit]

returns the robot's 3D homogenious coordinates and its orientation as quaternion.

Laser[edit]

returns the position of the objects detected by the laser sensor of the robot

Camera[edit]

returns the image recorded by the camera sensors of he robot

Kinect[edit]

returns the pointcloud returned by the 3D camera of the robot

Motor[edit]

sets the speed and orientation of the wheel-motors

Each one of this drivers has its own data structure implemented in both frameworks, using ice files and msg files respectively. The translation of two data structures is done as explained in ROS-Ice Class

ROS-Ice Class[edit]

The main idea behind this class is that it contains the objects for each framework, ROS and Ice, which handle the transmission of messages. For ROS, the handler is ros::NodeHandle and for Ice it is Ice::CommunicatorPtr. Note that this class makes use of templates in order to define the type of messages that need to be transmitted.

Other important members of the class are the ROS Publisher and Subscriber. A ROS Node is normally associated with a Publisher to send messages to another node and with a Subscriber to receive messages and interpret them. In order for the frameworks to work in parallel, the class provides an ros::AsyncSpinner object, that makes the ROS functions work in background threads, thus letting the Ice functions run in the main thread. The Ice messages are sent through a corresponding Ice Proxy. Since this object is created by the programmer through the slice program, the Ice Proxy is a template member which needs to be defined by the developer.

As mentioned above, the way the messages are sent and interpreted in Ice, is defined in .ice files and transformed into C++ code with the slice compiler. For ROS however, several methods have been implemented to configure the Publisher and the Subscriber:


/**
   *rosTopic is the name of Topic on which the node needs to publish
   *queueSize is the size of the outgoing message queue
   *ROS_DATA is the type of message defined for ROS

*/
template <class ROS_DATA>
void addRosPublisher(std::string rosTopic, int queueSize)

/**
   *rosTopic is the name of Topic from which the node needs to take messages
   *queueSize is the size of the incoming message queue
   *callback is a pointer to the function that it is automatically invoked once a message is received by the node and it receives the respective message as parameter
   *ROS_DATA is the type of message defined for ROS

*/

template <class ROS_DATA>
void addRosSubscriber(std::string rosTopic, int queueSize,void(*callback)(ROS_DATA))


/**
   *rosTopic is the name of Topic from which the node needs to take messages
   *queueSize is the size of the incoming message queue
   *callback is a pointer to a method that it is automatically invoked once a message is received by the node and it receives the respective message as parameter
   *rosObject is a pointer to an object which contains the callback method
   *ROS_DATA is the type of message defined for ROS
   *ROS_CLASS is an user-defined class which contains the callback method

*/

template <class ROS_DATA, class ROS_CLASS>
void addRosSubscriber(std::string rosTopic, int queueSize,void(ROS_CLASS::*callback)(ROS_DATA), ROS_CLASS *rosObject)

There is also a method to configure the Ice Proxy:

/**
   *ProxyString contains the Ice Server address  
*/
void addIceProxy(std::string ProxyString)

There are two ways this class can be used. A message could be published in ROS and received by an Ice Server or an Ice Client cand send a request and it will eventually be received by a ROS Subscriber. There are however some guidelines that need to be followed by the developer for each case:

ROS Publisher -> Ice Server[edit]

The developer needs to create a derived class from Ros_Ice in which he will define the rosCallback method for the Subscriber. In this method, the programmer will define how to create an Ice message from a ROS message and then he will send the Ice message to the Ice Server.

Ice Client -> ROS Subscriber[edit]

Normally, for the Ice Server a derived class from the slice interface needs to be defined, but in this case the developer has to create a derived class from both the interface and the Ros_Ice class. He also needs to implement the rosCallback method and the method for the Ice interface

RosIceMessage[edit]

In this package the ROS messages for the pioneer-gazebo-simulator are defined. Before the RosIceGazebo and the IceRosGazebo are compiled, this package needs to be compiled and then the devel/setup.bash file needs to be sourced. After the setup file is loaded, navigate to the RosIceGazebo or the IceRosGazebo and compile it as well.

RosIceGazebo[edit]

This package contains the interface between the gazebo simulator from the JdeRobot Framework and the ROS-based GUI from the rviz package. All the classes in this package are derived from the Ros_Ice class.

Besides the methods inherited from Ros_Ice, each Sensor-Class provides its own publishROS() method. The publishROS() function is called in an endless loop in the main function. Through the inherited Ice Proxy, the data from the gazebo simulator is received and then converted in a ROS message and finally published on the corresponding ROS topic.

The Actuators classes on the other hand, provide a rosCallback() method, which is used to subscribe to the nodes from the rviz Window. In these functions the data is received from the Rviz-GUI in a ROS format, it is converted into JdeRobot format and it is sent to the gazebo simulator through the inherited Proxy.

IceRosGazebo[edit]

This package contains two types of classes: Plugin, used to create the ROS libraries for the ROS Gazebo Simulator, and Interface, which is used to convert the ROS Data from the gazebo simulator to the JdeRobot format which is used by the introrobot component.

Besides compiling this package, the user must also add the output path of the libraries IceRosGazebo/devel/lib to the environment variables $GAZEBO_PLUGIN_PATH and $LD_LIBRARY_PATH. The Structure of a Plugin class is like a typical Gazebo Plugin class, only that in the Load() method there also the ROS components created and in the OnUpdate() function the data from the simulator is published on the corresponding topic.

An Interface class, subscribes to a topic from the simulator, transforms the ROS message in a JdeRobot format and the result is stored in a private member, so that it can be returned when the Ice function is called.

Rosbag file[edit]

A rosbag file is a file where the ros-server, which is started when using the command roscore, stores every data which is published on the registered topics. The data is stored in an unsynchronized manner and it also contains the time at which the message was published and the name of the topic. The ROS framework provides a feature that plays back the data the same way it was published. For further information, please check the videos.

RosBagParser[edit]

For this package it is recommended to create a rosbag file using the JdeRobot Gazebo Simulator and the RosIceGazebo package. It is important that the rosbag file contains the same number of data instances for each plugin of the pioneer, since there is no clean way to synchronize the messages with ICE. If the IceRosGazebo package is used instead, there is a high chance that for every Camera or Laser instance, there will be 500 instances of Encoders or Pose3D. In this case it will be impossible to determine which position of the pioneer corresponds to an image of the camera. However, if the user wants to register rosbag file with ROS Gazebo Simulator, the rosbag file can be used with the IceRosGazebo package and the built-in command of the ROS framework: rosbag play <file_name>

Once the rosbag is done, the program needs to be ran with the name of the configuration file for the Ice framework and the rosbag file.

Each Interface class from this package is a derived class from the RosBagParser class. This base class parses the rosbag file, given the name of the topic it needs to query and it also keeps an iterator to the current instance-data. Furthermore, each Interface also inherits from the specific JdeRobot interface. In the inherited method from the JdeRobot class, each Interface must convert the current instance data to a JdeRobot format, increment the iterator and finally return the result.

Progress[edit]

  • 29.07.2015 - 05.08.2015: Synchronizing RosBagParser messages
  • 24.07.2015 - 25.07.2015: Implemented RosBagParser messages
  • 21.07.2015 - 22.07.2015: Implemented RosBag Interface
  • 15.07.2015 - 19.07.2015: Implemented Ice Interface for ROS Gazebo Plugins
  • 10.07.2015 - 15.07.2015: Implemented ROS Gazebo Plugins Pioneer
  • 25.06.2015 - 28.06.2015: Integrated Pose3D interface in introrob
  • 21.06.2015: Studied JdeRobot GazeboServer
  • 20.06.2015: Implemented TeleOperate control in rviz
  • 18.06.2015 - 19.06.2015: Implemented 3D Laser in rviz
  • 12.06.2015 - 13.06.2015: Implemented viewing Camera and Laser Data in rviz
  • 08.06.2015 - 10.06.2015: Debugging JdeRobot installation
  • 06.06.2015 - 07.06.2015: Studied Gazebo and IntroRobot
  • 31.05.2015 - 01.06.2015: Implemented ROS server - Ice Viewer
  • 30.05.2015: Implemented Ice server - ROS Viewer
  • 29.05.2015: Added ROS Image Transport feature
  • 25.05.2015 - 26.05.2015: Implemented the template(generalized) bridge between ROS and Ice
  • 23.05.2015: Configured the CMake file of the project to compile and link the Ice components
  • 22.05.2015: Implemented the template class for the ROS component of the library ( Generalized ROS Component implemented )

Videos[edit]

ROS Kinect - Ice Viewer[edit]

Ice Kinect - ROS Viewer - Rosbag[edit]

Ros PCL Openni[edit]

RosBag Play[edit]

RosBagParser[edit]

RosBag - Create file[edit]

ROS Ice Gazebo Pose3D RosIceMessage[edit]

IceInterface - ROS Gazebo[edit]

ROS Ice Gazebo Pose3D[edit]

ROS Ice Gazebo TeleOperate[edit]

ROS Ice Gazebo Sensors[edit]

ROS Ice Camera[edit]

ROS Ice Bridge[edit]

Current Status[edit]

Synchronize the rosbag messages