trajectory_planner_nodelet_aux.cpp
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
27 #ifndef _trajectory_planner_nodelet_aux_CPP_
28 #define _trajectory_planner_nodelet_aux_CPP_
29 
31 
32 void processFeedback( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback )
33 {
34  std::ostringstream s;
35  s << "Feedback from marker '" << feedback->marker_name << "' "
36  << " / control '" << feedback->control_name << "'";
37 
38  std::ostringstream mouse_point_ss;
39  if( feedback->mouse_point_valid )
40  {
41  mouse_point_ss << " at " << feedback->mouse_point.x
42  << ", " << feedback->mouse_point.y
43  << ", " << feedback->mouse_point.z
44  << " in frame " << feedback->header.frame_id;
45  }
46 
47  switch ( feedback->event_type )
48  {
49  case visualization_msgs::InteractiveMarkerFeedback::POSE_UPDATE:
50  manage_vt->set_attractor_point(feedback->pose.position.x, feedback->pose.position.y, 2.0*asin(feedback->pose.orientation.z));
51 
52  break;
53  }
54 
55  server->applyChanges();
56 }
57 
58 
59 Marker makeBox( InteractiveMarker &msg )
60 {
61  Marker marker;
62 
63  marker.type = Marker::ARROW;
64  marker.scale.x = msg.scale;
65  marker.scale.y = msg.scale;
66  marker.scale.z = msg.scale;
67  marker.color.r = 0;
68  marker.color.g = 0.7;
69  marker.color.b = 0;
70  marker.color.a = 0.6;
71  return marker;
72 }
73 
74 
75 InteractiveMarkerControl& makeBoxControl( InteractiveMarker &msg )
76 {
77  InteractiveMarkerControl control;
78  control.always_visible = true;
79  control.markers.push_back( makeBox(msg) );
80  msg.controls.push_back( control );
81 
82  return msg.controls.back();
83 }
84 
85 
86 void make6DofMarker( bool fixed )
87 {
88  InteractiveMarker int_marker;
89  int_marker.header.frame_id = "/vehicle_odometry";
90  int_marker.pose.position.x = 5;
91  int_marker.pose.position.y = 0;
92  int_marker.pose.position.z = 0;
93  int_marker.scale = 0.4;
94 
95  int_marker.name = "Control target";
96  int_marker.description = "Control the final \nposition of the robot";
97 
98  // insert a box
99  makeBoxControl(int_marker);
100  InteractiveMarkerControl control;
101 
102  control.orientation.w = 1;
103  control.orientation.x = 1;
104  control.orientation.y = 0;
105  control.orientation.z = 0;
106  control.name = "move_x";
107  control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
108  int_marker.controls.push_back(control);
109 
110  control.orientation.w = 1;
111  control.orientation.x = 0;
112  control.orientation.y = 0;
113  control.orientation.z = 1;
114  control.name = "move_y";
115  control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
116  int_marker.controls.push_back(control);
117 
118  control.orientation.w = 1;
119  control.orientation.x = 0;
120  control.orientation.y = 1;
121  control.orientation.z = 0;
122  control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
123  control.name = "rotate_z";
124  int_marker.controls.push_back(control);
125 
126  server->insert(int_marker);
127  server->setCallback(int_marker.name, &processFeedback);
128 }
129 #endif
_EXTERN_ c_manage_trajectoryPtr manage_vt
Marker makeBox(InteractiveMarker &msg)
void make6DofMarker(bool fixed)
InteractiveMarkerControl & makeBoxControl(InteractiveMarker &msg)
void processFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
visualization_msgs::Marker marker
boost::shared_ptr< interactive_markers::InteractiveMarkerServer > server
Definition: APgenerator.cpp:44


trajectory_planner
Author(s): Joel Pereira
autogenerated on Mon Mar 2 2015 01:32:54