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/gaz... , 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/gaz...
This sets the topic to ~/elevator
: https://bitbucket.org/osrf/gazebo/src... . 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.