interactive_markers.cpp
Go to the documentation of this file.
00001 
00059 /*
00060  * interactive_markers.cpp
00061  *
00062  *  Created on: 07.06.2012
00063  *      Author: josh
00064  */
00065 
00066 
00067 #include "interactive_markers.h"
00068 
00069 using namespace Slam;
00070 
00071 InteractiveMarkers::InteractiveMarkers():
00072     server_("slam_markers")
00073 {
00074 
00075 }
00076 
00077 template<typename OBJECT_CONTEXT>
00078 void InteractiveMarkers<OBJECT_CONTEXT>::createNode(Node<OBJECT_CONTEXT>::Ptr node)
00079 {
00080 
00081   // create an interactive marker for our server
00082   visualization_msgs::InteractiveMarker int_marker;
00083   int_marker.header.frame_id = "/base_link";
00084   int_marker.name = "my_marker";
00085   int_marker.description = "Simple 1-DOF Control";
00086 
00087   // create a grey box marker
00088   visualization_msgs::Marker box_marker;
00089   box_marker.type = visualization_msgs::Marker::CUBE;
00090   box_marker.scale.x = 0.45;
00091   box_marker.scale.y = 0.45;
00092   box_marker.scale.z = 0.45;
00093   box_marker.color.r = 0.5;
00094   box_marker.color.g = 0.5;
00095   box_marker.color.b = 0.5;
00096   box_marker.color.a = 1.0;
00097 
00098   // create a non-interactive control which contains the box
00099   visualization_msgs::InteractiveMarkerControl box_control;
00100   box_control.always_visible = true;
00101   box_control.markers.push_back( box_marker );
00102 
00103   // add the control to the interactive marker
00104   int_marker.controls.push_back( box_control );
00105 
00106   // create a control which will move the box
00107   // this control does not contain any markers,
00108   // which will cause RViz to insert two arrows
00109   visualization_msgs::InteractiveMarkerControl rotate_control;
00110   rotate_control.name = "move_x";
00111   rotate_control.interaction_mode =
00112       visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
00113 
00114   // add the control to the interactive marker
00115   int_marker.controls.push_back(rotate_control);
00116 
00117   // add the interactive marker to our collection &
00118   // tell the server to call processFeedback() when feedback arrives for it
00119   server.insert(int_marker, &processFeedback);
00120 
00121   // 'commit' changes and send to all clients
00122   server.applyChanges();
00123 }
00124 
00125 int main(int argc, char** argv)
00126 {
00127 
00128   // start the ROS main loop
00129   ros::spin();
00130 }


cob_3d_mapping_slam
Author(s): Joshua Hampp
autogenerated on Wed Aug 26 2015 11:04:51