Skip to content

Visualising Your Robot

Matthew Chiam edited this page Aug 25, 2014 · 2 revisions

Now that you have created your Robot, you have to notify Stage before you can start visualising it.

###CMakeLists.txt

rosbuild_add_executable(FriendRobot src/FriendRobot.cpp) #R3
target_link_libraries(FriendRobot Robot Poi StaticPoi)

You must add your robot to this file so that rosbuild knows to compile the cpp code associated with this robot. Note, the order is important! In this case, FriendRobot is the third robot declared in the file, and as such it must also listen to topics that are associated with its id number, for example:

theFriend.locationInstructionsSub = nodeHandle.subscribe<geometry_msgs::Point>("robot_3/location", 1000, callUpdateDesiredLocationCallback);
theFriend.pathToRobotSub = nodeHandle.subscribe<std_msgs::Empty>("robot_3/toResident", 1000, callGoToResident);
theFriend.pathToHomeSub = nodeHandle.subscribe<std_msgs::Empty>("robot_3/toHome", 1000, callGoToHome);

###World.world

robot(
  name "Friend"
  pose [ 3.7 -8.65 0 0 ]
  color "blue"
)

This same robot must be declared in the .world file in the same order that it was declared in CMakeLists.txt.

###default.launch

<node name="friend" pkg="elderly_care_simulation" type="FriendRobot" />

After building the project, we must notify ROS that this robot must start on run-time.

Clone this wiki locally