Skip to content
James Edmondson edited this page Apr 3, 2020 · 4 revisions

TOOL AND FEATURE TEMPORARILY UNAVAILABLE

As of 1.3.0 of the GAMS middleware, ROS support is temporarily removed. With the removal of the Any type and capnproto, especially, in order to support Windows and UE4 builds, we have removed direct ROS support. You can still technically bridge GAMS and MADARA by creating new platforms that manipulate ROS directly, but there is no longer a functional rosbridge or ros2gams tool that translates between the standards implicitly. We do plan to readd this feature as soon as we have the time and manpower. It will just no longer use the Any type.

You can access these features in the final version of 1.2.2.


Rosbridge

The rosbridge transport allows the connection of a madara/gams system to a running ROS master. It provides communication in both directions - so ROS messages are subscribed and the results are added to the knowledgebase as well as changes to the knowledgebase result in the publication of ROS messages.


Table of Contents


How to configure a rosbridge

Since the rosbridge is based on the madara::transport protocol you simply have to add the bridge to you knowledgebase. To do so you also have to define the mapping. This declares which ros topic is mapped to which madara variable name as well as which ros message type shall be used for publication.

See the following example:


  std::vector<std::string> selected_topics {"odom", "/tf", "imu"};
  std::map<std::string,std::string> topic_map = {{"odom", "sensors.odom"},
                                                 {"imu", "sensors.imu"},
                                                 {"/tf", "frames"}};
  std::map<std::string,std::string> pub_types = {{"odom", "nav_msgs/Odometry"},
                                                 {"imu", "sensor_msgs/Imu"}};

  gams::transports::RosBridge * ros_bridge = new gams::transports::RosBridge (
    knowledge.get_id (), settings, knowledge, selected_topics,
    topic_map, pub_types);
  knowledge.attach_transport (ros_bridge);

This example subscribes to odom, imu and /tf and maps it to the names which are defined in topic_map. The map pub_types defines the topic type for each topic in it's string representation.

Important: Please keep in mind that it is necessary to use global variable names for the values you want to publish to ROS when the knowledgebase changes. E.g. if you map imu to .sensors.imu instead of sensors.imu this madara variable would be updated by ROS messages to imu. But since it is defined as local variable it would not be published if the knowledgbase is changed.

Clone this wiki locally