publish_target.cpp
Go to the documentation of this file.
00001 /**************************************************************************************************
00002  Software License Agreement (BSD License)
00003 
00004  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
00005  All rights reserved.
00006 
00007  Redistribution and use in source and binary forms, with or without modification, are permitted
00008  provided that the following conditions are met:
00009 
00010   *Redistributions of source code must retain the above copyright notice, this list of
00011    conditions and the following disclaimer.
00012   *Redistributions in binary form must reproduce the above copyright notice, this list of
00013    conditions and the following disclaimer in the documentation and/or other materials provided
00014    with the distribution.
00015   *Neither the name of the University of Aveiro nor the names of its contributors may be used to
00016    endorse or promote products derived from this software without specific prior written permission.
00017  
00018  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
00019  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
00020  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
00021  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
00024  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00025  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 ***************************************************************************************************/
00036 //#include <tf/tf.h>
00037 
00038 //#include <math.h>
00039 //#include <interactive_markers/interactive_marker_server.h>
00040 //#include <stdio.h>
00041 //#include <ros/ros.h>
00042 //#include <laser_geometry/laser_geometry.h>
00043 //#include <sensor_msgs/LaserScan.h>
00044 #include <sensor_msgs/PointCloud2.h>
00045 //#include <tf/transform_listener.h>
00046 //#include <pcl_ros/transforms.h>
00047 #include <pcl/conversions.h>
00048 #include <pcl/point_cloud.h>
00049 #include <pcl/point_types.h>
00050 #include <pcl_conversions/pcl_conversions.h>
00051 //#include <pcl/segmentation/extract_polygonal_prism_data.h>
00052 //#include <pcl/filters/extract_indices.h>
00053 //#include <pcl/filters/project_inliers.h>
00054 
00055 #include <ros/ros.h>
00056 
00057 #include <interactive_markers/interactive_marker_server.h>
00058 #include <interactive_markers/menu_handler.h>
00059 
00060 #include <tf/transform_broadcaster.h>
00061 #include <tf/tf.h>
00062 
00063 #include <math.h>
00064 
00065 using namespace visualization_msgs;
00066 
00067 
00068 // %Tag(vars)%
00069 boost::shared_ptr<interactive_markers::InteractiveMarkerServer> server;
00070 float marker_pos = 0;
00071 interactive_markers::MenuHandler menu_handler;
00072 ros::Publisher pub;
00073 // %EndTag(vars)%
00074 
00075 // %Tag(frameCallback)%
00076 void frameCallback(const ros::TimerEvent&)
00077 {
00078         //static uint32_t counter = 0;
00079 
00080         //static tf::TransformBroadcaster br;
00081 
00082         //tf::Transform t;
00083 
00084         //ros::Time time = ros::Time::now();
00085 
00086         //t.setOrigin(tf::Vector3(0.0, 0.0, sin(float(counter)/140.0) * 2.0));
00087         //t.setRotation(tf::Quaternion(0.0, 0.0, 0.0, 1.0));
00088         //br.sendTransform(tf::StampedTransform(t, time, "base_link", "moving_frame"));
00089 
00090         //t.setOrigin(tf::Vector3(0.0, 0.0, 0.0));
00091         //t.setRotation(tf::createQuaternionFromRPY(0.0, float(counter)/140.0, 0.0));
00092         //br.sendTransform(tf::StampedTransform(t, time, "base_link", "rotating_frame"));
00093 
00094         //++counter;
00095 }
00096 // %EndTag(frameCallback)%
00097 
00098 // %Tag(processFeedback)%
00099 void processFeedback( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback )
00100 {
00101         std::ostringstream s;
00102         s << "Feedback from marker '" << feedback->marker_name << "' "
00103                 << " / control '" << feedback->control_name << "'";
00104 
00105         std::ostringstream mouse_point_ss;
00106         if( feedback->mouse_point_valid )
00107         {
00108                 mouse_point_ss << " at " << feedback->mouse_point.x
00109                         << ", " << feedback->mouse_point.y
00110                         << ", " << feedback->mouse_point.z
00111                         << " in frame " << feedback->header.frame_id;
00112         }
00113 
00114         switch ( feedback->event_type )
00115         {
00116                 //case visualization_msgs::InteractiveMarkerFeedback::BUTTON_CLICK:
00117                 //ROS_INFO_STREAM( s.str() << ": button click" << mouse_point_ss.str() << "." );
00118                 //break;
00119 
00120                 //case visualization_msgs::InteractiveMarkerFeedback::MENU_SELECT:
00121                 //ROS_INFO_STREAM( s.str() << ": menu item " << feedback->menu_entry_id << " clicked" << mouse_point_ss.str() << "." );
00122                 //break;
00123 
00124                 case visualization_msgs::InteractiveMarkerFeedback::POSE_UPDATE:
00125                         pcl::PointCloud<pcl::PointXYZ> pc;
00126                         pcl::PointXYZ pt;       
00127                         pt.x = feedback->pose.position.x; pt.y = feedback->pose.position.y;     pt.z = feedback->pose.position.z;
00128                         pc.points.push_back(pt);
00129 
00130                         sensor_msgs::PointCloud2 pcmsg_out;
00131                         pcl::toROSMsg(pc, pcmsg_out);
00132                         pcmsg_out.header.stamp = ros::Time::now();
00133                         pcmsg_out.header.frame_id = "/atc/vehicle/center_bumper";
00134                         //ROS_INFO("Publishing Target position x=%f y=%f z=%f", feedback->pose.position.x, feedback->pose.position.y, feedback->pose.position.z);
00135                         pub.publish(pcmsg_out);
00136 
00137                         //ROS_INFO_STREAM( s.str() << ": pose changed"
00138                         //<< "\nposition = "
00139                         //<< feedback->pose.position.x
00140                         //<< ", " << feedback->pose.position.y
00141                         //<< ", " << feedback->pose.position.z
00142                         //<< "\norientation = "
00143                         //<< feedback->pose.orientation.w
00144                         //<< ", " << feedback->pose.orientation.x
00145                         //<< ", " << feedback->pose.orientation.y
00146                         //<< ", " << feedback->pose.orientation.z
00147                         //<< "\nframe: " << feedback->header.frame_id
00148                         //<< " time: " << feedback->header.stamp.sec << "sec, "
00149                         //<< feedback->header.stamp.nsec << " nsec" );
00150                         break;
00151 
00152                         //case visualization_msgs::InteractiveMarkerFeedback::MOUSE_DOWN:
00153                         //ROS_INFO_STREAM( s.str() << ": mouse down" << mouse_point_ss.str() << "." );
00154                         //break;
00155 
00156                         //case visualization_msgs::InteractiveMarkerFeedback::MOUSE_UP:
00157                         //ROS_INFO_STREAM( s.str() << ": mouse up" << mouse_point_ss.str() << "." );
00158                         //break;
00159         }
00160 
00161         server->applyChanges();
00162 }
00163 // %EndTag(processFeedback)%
00164 
00165 // %Tag(alignMarker)%
00166 void alignMarker( const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback )
00167 {
00168         geometry_msgs::Pose pose = feedback->pose;
00169 
00170         pose.position.x = round(pose.position.x-0.5)+0.5;
00171         pose.position.y = round(pose.position.y-0.5)+0.5;
00172 
00173         ROS_INFO_STREAM( feedback->marker_name << ":"
00174                         << " aligning position = "
00175                         << feedback->pose.position.x
00176                         << ", " << feedback->pose.position.y
00177                         << ", " << feedback->pose.position.z
00178                         << " to "
00179                         << pose.position.x
00180                         << ", " << pose.position.y
00181                         << ", " << pose.position.z );
00182 
00183         server->setPose( feedback->marker_name, pose );
00184         server->applyChanges();
00185 }
00186 // %EndTag(alignMarker)%
00187 
00188 double rand( double min, double max )
00189 {
00190         double t = (double)rand() / (double)RAND_MAX;
00191         return min + t*(max-min);
00192 }
00193 
00194 // %Tag(Box)%
00195 Marker makeBox( InteractiveMarker &msg )
00196 {
00197         Marker marker;
00198 
00199         marker.type = Marker::SPHERE;
00200         marker.scale.x = msg.scale * 0.45;
00201         marker.scale.y = msg.scale * 0.45;
00202         marker.scale.z = msg.scale * 0.45;
00203         marker.color.r = 0;
00204         marker.color.g = 0.7;
00205         marker.color.b = 0;
00206         marker.color.a = 0.6;
00207 
00208         return marker;
00209 }
00210 
00211 InteractiveMarkerControl& makeBoxControl( InteractiveMarker &msg )
00212 {
00213         InteractiveMarkerControl control;
00214         control.always_visible = true;
00215         control.markers.push_back( makeBox(msg) );
00216         msg.controls.push_back( control );
00217 
00218         return msg.controls.back();
00219 }
00220 // %EndTag(Box)%
00221 
00222 void saveMarker( InteractiveMarker int_marker )
00223 {
00224         server->insert(int_marker);
00225         server->setCallback(int_marker.name, &processFeedback);
00226 }
00227 
00229 
00230 // %Tag(6DOF)%
00231 void make6DofMarker( bool fixed )
00232 {
00233         InteractiveMarker int_marker;
00234         int_marker.header.frame_id = "/atc/vehicle/center_bumper";
00235         int_marker.pose.position.x = 2;
00236         int_marker.pose.position.y = 0;
00237         int_marker.pose.position.z = 0.5;
00238         int_marker.scale = 0.5;
00239 
00240         int_marker.name = "Fovetation Control Target";
00241         int_marker.description = "Foveation_control will try \nto aim the PTU towards\n the marker";
00242 
00243         // insert a box
00244         makeBoxControl(int_marker);
00245         InteractiveMarkerControl control;
00246 
00247         if ( fixed )
00248         {
00249                 //int_marker.name += "_fixed";
00250                 //int_marker.description += "\n(fixed orientation)";
00251                 //control.orientation_mode = InteractiveMarkerControl::FIXED;
00252         }
00253 
00254         control.orientation.w = 1;
00255         control.orientation.x = 1;
00256         control.orientation.y = 0;
00257         control.orientation.z = 0;
00258         //control.name = "rotate_x";
00259         //control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
00260         //int_marker.controls.push_back(control);
00261         control.name = "move_x";
00262         control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
00263         int_marker.controls.push_back(control);
00264 
00265         control.orientation.w = 1;
00266         control.orientation.x = 0;
00267         control.orientation.y = 1;
00268         control.orientation.z = 0;
00269         //control.name = "rotate_z";
00270         //control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
00271         //int_marker.controls.push_back(control);
00272         control.name = "move_z";
00273         control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
00274         int_marker.controls.push_back(control);
00275 
00276         control.orientation.w = 1;
00277         control.orientation.x = 0;
00278         control.orientation.y = 0;
00279         control.orientation.z = 1;
00280         //control.name = "rotate_y";
00281         //control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
00282         //int_marker.controls.push_back(control);
00283         control.name = "move_y";
00284         control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
00285         int_marker.controls.push_back(control);
00286 
00287         server->insert(int_marker);
00288         server->setCallback(int_marker.name, &processFeedback);
00289 }
00290 // %EndTag(6DOF)%
00291 
00292 // %Tag(RandomDof)%
00293 void makeRandomDofMarker( )
00294 {
00295         InteractiveMarker int_marker;
00296         int_marker.header.frame_id = "/base_link";
00297         int_marker.pose.position.y = -3.0 * marker_pos++;;
00298         int_marker.scale = 1;
00299 
00300         int_marker.name = "6dof_random_axes";
00301         int_marker.description = "6-DOF\n(Arbitrary Axes)";
00302 
00303         makeBoxControl(int_marker);
00304 
00305         InteractiveMarkerControl control;
00306 
00307         for ( int i=0; i<3; i++ )
00308         {
00309                 control.orientation.w = rand(-1,1);
00310                 control.orientation.x = rand(-1,1);
00311                 control.orientation.y = rand(-1,1);
00312                 control.orientation.z = rand(-1,1);
00313                 control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
00314                 int_marker.controls.push_back(control);
00315                 control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
00316                 int_marker.controls.push_back(control);
00317         }
00318 
00319         server->insert(int_marker);
00320         server->setCallback(int_marker.name, &processFeedback);
00321 }
00322 // %EndTag(RandomDof)%
00323 
00324 
00325 // %Tag(ViewFacing)%
00326 void makeViewFacingMarker( )
00327 {
00328         InteractiveMarker int_marker;
00329         int_marker.header.frame_id = "/base_link";
00330         int_marker.pose.position.y = -3.0 * marker_pos++;;
00331         int_marker.scale = 1;
00332 
00333         int_marker.name = "view_facing";
00334         int_marker.description = "View Facing 6-DOF";
00335 
00336         InteractiveMarkerControl control;
00337 
00338         // make a control that rotates around the view axis
00339         control.orientation_mode = InteractiveMarkerControl::VIEW_FACING;
00340         control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
00341         control.orientation.w = 1;
00342         control.name = "rotate";
00343 
00344         int_marker.controls.push_back(control);
00345 
00346         // create a box in the center which should not be view facing,
00347         // but move in the camera plane.
00348         control.orientation_mode = InteractiveMarkerControl::VIEW_FACING;
00349         control.interaction_mode = InteractiveMarkerControl::MOVE_PLANE;
00350         control.independent_marker_orientation = true;
00351         control.name = "move";
00352 
00353         control.markers.push_back( makeBox(int_marker) );
00354         control.always_visible = true;
00355 
00356         int_marker.controls.push_back(control);
00357 
00358         server->insert(int_marker);
00359         server->setCallback(int_marker.name, &processFeedback);
00360 }
00361 // %EndTag(ViewFacing)%
00362 
00363 
00364 // %Tag(Quadrocopter)%
00365 void makeQuadrocopterMarker( )
00366 {
00367         InteractiveMarker int_marker;
00368         int_marker.header.frame_id = "/base_link";
00369         int_marker.pose.position.y = -3.0 * marker_pos++;;
00370         int_marker.scale = 1;
00371 
00372         int_marker.name = "quadrocopter";
00373         int_marker.description = "Quadrocopter";
00374 
00375         makeBoxControl(int_marker);
00376 
00377         InteractiveMarkerControl control;
00378 
00379         control.orientation.w = 1;
00380         control.orientation.x = 0;
00381         control.orientation.y = 1;
00382         control.orientation.z = 0;
00383         control.interaction_mode = InteractiveMarkerControl::MOVE_ROTATE;
00384         int_marker.controls.push_back(control);
00385         control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
00386         int_marker.controls.push_back(control);
00387 
00388         server->insert(int_marker);
00389         server->setCallback(int_marker.name, &processFeedback);
00390 }
00391 // %EndTag(Quadrocopter)%
00392 
00393 // %Tag(ChessPiece)%
00394 void makeChessPieceMarker( )
00395 {
00396         InteractiveMarker int_marker;
00397         int_marker.header.frame_id = "/base_link";
00398         int_marker.pose.position.y = -3.0 * marker_pos++;;
00399         int_marker.scale = 1;
00400 
00401         int_marker.name = "chess_piece";
00402         int_marker.description = "Chess Piece\n(2D Move + Alignment)";
00403 
00404         InteractiveMarkerControl control;
00405 
00406         control.orientation.w = 1;
00407         control.orientation.x = 0;
00408         control.orientation.y = 1;
00409         control.orientation.z = 0;
00410         control.interaction_mode = InteractiveMarkerControl::MOVE_PLANE;
00411         int_marker.controls.push_back(control);
00412 
00413         // make a box which also moves in the plane
00414         control.markers.push_back( makeBox(int_marker) );
00415         control.always_visible = true;
00416         int_marker.controls.push_back(control);
00417 
00418         // we want to use our special callback function
00419         server->insert(int_marker);
00420         server->setCallback(int_marker.name, &processFeedback);
00421 
00422         // set different callback for POSE_UPDATE feedback
00423         server->setCallback(int_marker.name, &alignMarker, visualization_msgs::InteractiveMarkerFeedback::POSE_UPDATE );
00424 }
00425 // %EndTag(ChessPiece)%
00426 
00427 // %Tag(PanTilt)%
00428 void makePanTiltMarker( )
00429 {
00430         InteractiveMarker int_marker;
00431         int_marker.header.frame_id = "/base_link";
00432         int_marker.pose.position.y = -3.0 * marker_pos++;;
00433         int_marker.scale = 1;
00434 
00435         int_marker.name = "pan_tilt";
00436         int_marker.description = "Pan / Tilt";
00437 
00438         makeBoxControl(int_marker);
00439 
00440         InteractiveMarkerControl control;
00441 
00442         control.orientation.w = 1;
00443         control.orientation.x = 0;
00444         control.orientation.y = 1;
00445         control.orientation.z = 0;
00446         control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
00447         control.orientation_mode = InteractiveMarkerControl::FIXED;
00448         int_marker.controls.push_back(control);
00449 
00450         control.orientation.w = 1;
00451         control.orientation.x = 0;
00452         control.orientation.y = 0;
00453         control.orientation.z = 1;
00454         control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
00455         control.orientation_mode = InteractiveMarkerControl::INHERIT;
00456         int_marker.controls.push_back(control);
00457 
00458         server->insert(int_marker);
00459         server->setCallback(int_marker.name, &processFeedback);
00460 }
00461 // %EndTag(PanTilt)%
00462 
00463 // %Tag(Menu)%
00464 void makeMenuMarker()
00465 {
00466         InteractiveMarker int_marker;
00467         int_marker.header.frame_id = "/base_link";
00468         int_marker.pose.position.y = -3.0 * marker_pos++;;
00469         int_marker.scale = 1;
00470 
00471         int_marker.name = "context_menu";
00472         int_marker.description = "Context Menu\n(Right Click)";
00473 
00474         InteractiveMarkerControl control;
00475 
00476         // make one control using default visuals
00477         control.interaction_mode = InteractiveMarkerControl::MENU;
00478         control.description="Options";
00479         control.name = "menu_only_control";
00480         int_marker.controls.push_back(control);
00481 
00482         // make one control showing a box
00483         Marker marker = makeBox( int_marker );
00484         control.markers.push_back( marker );
00485         control.always_visible = true;
00486         int_marker.controls.push_back(control);
00487 
00488         server->insert(int_marker);
00489         server->setCallback(int_marker.name, &processFeedback);
00490         menu_handler.apply( *server, int_marker.name );
00491 }
00492 // %EndTag(Menu)%
00493 
00494 // %Tag(Moving)%
00495 void makeMovingMarker()
00496 {
00497         InteractiveMarker int_marker;
00498         int_marker.header.frame_id = "/moving_frame";
00499         int_marker.pose.position.y = -3.0 * marker_pos++;;
00500         int_marker.scale = 1;
00501 
00502         int_marker.name = "moving";
00503         int_marker.description = "Marker Attached to a\nMoving Frame";
00504 
00505         InteractiveMarkerControl control;
00506 
00507         control.orientation.w = 1;
00508         control.orientation.x = 1;
00509         control.orientation.y = 0;
00510         control.orientation.z = 0;
00511         control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
00512         int_marker.controls.push_back(control);
00513 
00514         control.interaction_mode = InteractiveMarkerControl::MOVE_PLANE;
00515         control.always_visible = true;
00516         control.markers.push_back( makeBox(int_marker) );
00517         int_marker.controls.push_back(control);
00518 
00519         server->insert(int_marker);
00520         server->setCallback(int_marker.name, &processFeedback);
00521 }
00522 // %EndTag(Moving)%
00523 
00524 // %Tag(main)%
00525 int main(int argc, char** argv)
00526 {
00527         ros::init(argc, argv, "foveation_control_target_generator");
00528         ros::NodeHandle n;
00529 
00530 
00531         pub = n.advertise<sensor_msgs::PointCloud2>("/target", 1);
00532 
00533         // create a timer to update the published transforms
00534         //ros::Timer frame_timer = n.createTimer(ros::Duration(0.01), frameCallback);
00535 
00536         server.reset( new interactive_markers::InteractiveMarkerServer("bytarget/im","",false) );
00537 
00538         ros::Duration(0.1).sleep();
00539 
00540 
00541         menu_handler.insert( "First Entry", &processFeedback );
00542         menu_handler.insert( "Second Entry", &processFeedback );
00543         interactive_markers::MenuHandler::EntryHandle sub_menu_handle = menu_handler.insert( "Submenu" );
00544         menu_handler.insert( sub_menu_handle, "First Entry", &processFeedback );
00545         menu_handler.insert( sub_menu_handle, "Second Entry", &processFeedback );
00546 
00547         //make6DofMarker( false );
00548         make6DofMarker( true );
00549         //makeRandomDofMarker( );
00550         //makeViewFacingMarker( );
00551         //makeQuadrocopterMarker( );
00552         //makeChessPieceMarker( );
00553         //makePanTiltMarker( );
00554         //makeMenuMarker( );
00555         //makeMovingMarker( );
00556 
00557         server->applyChanges();
00558 
00559         ros::spin();
00560 
00561         server.reset();
00562 }
00563 // %EndTag(main)%
00564 
00565 
00566 //#include <interactive_markers/interactive_marker_server.h>
00567 //#include <interactive_markers/menu_handler.h>
00568 
00569 //#include <tf/transform_broadcaster.h>
00570 //#include <tf/tf.h>
00571 
00572 //#include <math.h>
00573 //#include <interactive_markers/interactive_marker_server.h>
00574 //#include <stdio.h>
00575 //#include <ros/ros.h>
00576 //#include <laser_geometry/laser_geometry.h>
00577 //#include <sensor_msgs/LaserScan.h>
00578 //#include <sensor_msgs/PointCloud2.h>
00579 //#include <tf/transform_listener.h>
00580 //#include <pcl_ros/transforms.h>
00581 //#include <pcl/ros/conversions.h>
00582 //#include <pcl/point_cloud.h>
00583 //#include <pcl/point_types.h>
00584 //#include <pcl/segmentation/extract_polygonal_prism_data.h>
00585 //#include <pcl/filters/extract_indices.h>
00586 //#include <pcl/filters/project_inliers.h>
00587 
00588 
00589 //#define PFLN printf("file %s line %d\n",__FILE__,__LINE__);
00590 
00591 //void processFeedback(
00592 //const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback )
00593 //{
00594 //ROS_INFO_STREAM( feedback->marker_name << " is now at "
00595 //<< feedback->pose.position.x << ", " << feedback->pose.position.y
00596 //<< ", " << feedback->pose.position.z );
00597 //}
00598 
00599 //int main(int argc, char **argv)
00600 //{
00601 
00602 
00603 
00604 
00605 //ros::init(argc, argv, "foveation_control_target_generator");
00606 //ros::NodeHandle n("~");
00607 //tf::TransformListener listener(n,ros::Duration(10));
00608 //ros::Publisher pub = n.advertise<sensor_msgs::PointCloud2>("/target", 1);
00609 
00610 
00612 //interactive_markers::InteractiveMarkerServer server("foveation_control_target_generator");
00613 
00615 //visualization_msgs::InteractiveMarker int_marker;
00616 //int_marker.header.frame_id = "/atc/vehicle/center_bumper";
00617 //int_marker.name = "my_marker";
00618 //int_marker.description = "Simple 1-DOF Control";
00619 
00621 //visualization_msgs::Marker box_marker;
00622 //box_marker.type = visualization_msgs::Marker::CUBE;
00623 //box_marker.scale.x = 0.45;
00624 //box_marker.scale.y = 0.45;
00625 //box_marker.scale.z = 0.45;
00626 //box_marker.color.r = 0.5;
00627 //box_marker.color.g = 0.5;
00628 //box_marker.color.b = 0.5;
00629 //box_marker.color.a = 1.0;
00630 
00632 //visualization_msgs::InteractiveMarkerControl box_control;
00633 //box_control.always_visible = true;
00634 //box_control.markers.push_back( box_marker );
00635 
00638 
00645 
00648 //visualization_msgs::InteractiveMarkerControl control;
00649 
00650 //control.orientation.w = 1;
00651 //control.orientation.x = 1;
00652 //control.orientation.y = 0;
00653 //control.orientation.z = 0;
00654 //control.name = "rotate_x";
00655 //control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
00656 //int_marker.controls.push_back(control);
00657 //control.name = "move_x";
00658 //control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
00659 //int_marker.controls.push_back(control);
00660 
00661 //control.orientation.w = 1;
00662 //control.orientation.x = 0;
00663 //control.orientation.y = 1;
00664 //control.orientation.z = 0;
00665 //control.name = "rotate_z";
00666 //control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
00667 //int_marker.controls.push_back(control);
00668 //control.name = "move_z";
00669 //control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
00670 //int_marker.controls.push_back(control);
00671 
00672 //control.orientation.w = 1;
00673 //control.orientation.x = 0;
00674 //control.orientation.y = 0;
00675 //control.orientation.z = 1;
00676 //control.name = "rotate_y";
00677 //control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
00678 //int_marker.controls.push_back(control);
00679 //control.name = "move_y";
00680 //control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
00681 //int_marker.controls.push_back(control);
00682 
00683 //server.insert(int_marker);
00684 //server.setCallback(int_marker.name, &processFeedback);
00685 
00686 
00687 
00691 
00693 //server.applyChanges();
00694 
00695 
00696 //ros::Rate loop_rate(10);
00697 //ros::spin();
00700 
00702 
00709 
00710 
00711 
00716 
00723 
00725 
00728 //}


foveation_control
Author(s): Miguel Oliveira
autogenerated on Thu Nov 20 2014 11:35:24