/home/joel/ros_workspace/lar3/planning/trajectory_planner/src/trajectory_planner_nodelet_aux.cpp

Go to the documentation of this file.
00001 #ifndef _trajectory_planner_nodelet_aux_CPP_
00002 #define _trajectory_planner_nodelet_aux_CPP_
00003 
00004 #include "trajectory_planner_nodelet.h"
00005 
00006 void processFeedback( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback )
00007 {
00008         std::ostringstream s;
00009         s << "Feedback from marker '" << feedback->marker_name << "' "
00010                 << " / control '" << feedback->control_name << "'";
00011 
00012         std::ostringstream mouse_point_ss;
00013         if( feedback->mouse_point_valid )
00014         {
00015                 mouse_point_ss << " at " << feedback->mouse_point.x
00016                         << ", " << feedback->mouse_point.y
00017                         << ", " << feedback->mouse_point.z
00018                         << " in frame " << feedback->header.frame_id;
00019         }
00020 
00021         switch ( feedback->event_type )
00022         {
00023                 case visualization_msgs::InteractiveMarkerFeedback::POSE_UPDATE:
00024                         manage_vt->set_attractor_point(feedback->pose.position.x, feedback->pose.position.y, 2.0*asin(feedback->pose.orientation.z));
00025                         
00026                         break;
00027         }
00028 
00029         server->applyChanges();
00030 }
00031 
00032 
00033 Marker makeBox( InteractiveMarker &msg )
00034 {
00035         Marker marker;
00036 
00037         marker.type = Marker::ARROW;
00038         marker.scale.x = msg.scale;
00039         marker.scale.y = msg.scale;
00040         marker.scale.z = msg.scale;
00041         marker.color.r = 0;
00042         marker.color.g = 0.7;
00043         marker.color.b = 0;
00044         marker.color.a = 0.6;
00045         return marker;
00046 }
00047 
00048 
00049 InteractiveMarkerControl& makeBoxControl( InteractiveMarker &msg )
00050 {
00051         InteractiveMarkerControl control;
00052         control.always_visible = true;
00053         control.markers.push_back( makeBox(msg) );
00054         msg.controls.push_back( control );
00055 
00056         return msg.controls.back();
00057 }
00058 
00059 
00060 void make6DofMarker( bool fixed )
00061 {
00062         InteractiveMarker int_marker;
00063         int_marker.header.frame_id = "/vehicle_odometry";
00064         int_marker.pose.position.x = 5;
00065         int_marker.pose.position.y = 0;
00066         int_marker.pose.position.z = 0;
00067         int_marker.scale = 0.4;
00068 
00069         int_marker.name = "Control target";
00070         int_marker.description = "Control the final \nposition of the robot";
00071 
00072         // insert a box
00073         makeBoxControl(int_marker);
00074         InteractiveMarkerControl control;
00075 
00076         control.orientation.w = 1;
00077         control.orientation.x = 1;
00078         control.orientation.y = 0;
00079         control.orientation.z = 0;
00080         control.name = "move_x";
00081         control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
00082         int_marker.controls.push_back(control);
00083 
00084         control.orientation.w = 1;
00085         control.orientation.x = 0;
00086         control.orientation.y = 0;
00087         control.orientation.z = 1;
00088         control.name = "move_y";
00089         control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
00090         int_marker.controls.push_back(control);
00091 
00092         control.orientation.w = 1;
00093         control.orientation.x = 0;
00094         control.orientation.y = 1;
00095         control.orientation.z = 0;
00096         control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
00097         control.name = "rotate_z";
00098         int_marker.controls.push_back(control);
00099 
00100         server->insert(int_marker);
00101         server->setCallback(int_marker.name, &processFeedback);
00102 }
00103 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


trajectory_planner
Author(s): joel
autogenerated on Thu Jul 26 2012 21:36:27