GripperMarkerVis.cpp
Go to the documentation of this file.
00001 #include <remote_manipulation_markers/GripperMarkerVis.h>
00002 
00003 using namespace std;
00004 
00005 GripperMarkerVis::GripperMarkerVis() : pnh("~")
00006 {
00007   string markerNodeName;
00008   //read in parameters
00009   pnh.param<string>("marker_node_name", markerNodeName, "free_positioning");
00010 
00011   //messages
00012   markerPoseSubscriber = n.subscribe(markerNodeName + "/gripper_marker_pose", 1, &GripperMarkerVis::markerPoseCallback, this);
00013 
00014   imServer.reset(
00015       new interactive_markers::InteractiveMarkerServer("nimbus_6dof_vis", "nimbus_6dof_vis", false));
00016   ros::Duration(0.1).sleep();
00017 
00018   imServer->applyChanges();
00019 }
00020 
00021 void GripperMarkerVis::markerPoseCallback(const geometry_msgs::PoseStamped& pose)
00022 {
00023   visualization_msgs::InteractiveMarker gripperMarker;
00024   if (imServer->get("gripper", gripperMarker))
00025   {
00026     //update pose
00027     imServer->setPose("gripper", pose.pose);
00028   }
00029   else
00030   {
00031     //create new gripper vis marker with given pose
00032     gripperMarker = Common::makeGripperMarker(pose);
00033     imServer->insert(gripperMarker);
00034   }
00035   imServer->applyChanges();
00036 }
00037 
00038 int main(int argc, char **argv)
00039 {
00040   ros::init(argc, argv, "gripper_marker_vis");
00041 
00042   GripperMarkerVis gmv;
00043 
00044   ros::spin();
00045 }


remote_manipulation_markers
Author(s): David Kent
autogenerated on Thu Jun 6 2019 22:05:39