ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm not familiar with this code and haven't used it, but I can read through it and explain what it's doing.

The callback type is std_msgs/String: https://github.com/ros-simulation/gazebo_ros_pkgs/blob/kinetic-devel/gazebo_plugins/src/gazebo_ros_elevator.cpp#L80 , but it calls std::strtoi on the argument, which indicates that the string should be a number.

The topic name is defined by the <topic> XML property: https://github.com/ros-simulation/gazebo_ros_pkgs/blob/kinetic-devel/gazebo_plugins/src/gazebo_ros_elevator.cpp#L60-L61

This sets the topic to ~/elevator: https://bitbucket.org/osrf/gazebo/src/default/worlds/elevator.world?fileviewer=file-view-default#elevator.world-196 . That's relative to the gazebo node name, so probably /gazebo/elevator . Running rostopic list when the elevator simulation and looking for a topic with "elevator" in the name will also help you find the topic name.

Overall, it looks like publishing "1" or "2" (or maybe "0", if floors are 0-indexed) on the /gazeo/elevator topic (or whatever topic it's actually using) will send the elevator to a floor.