ROS学习笔记(七)::RVIZ::Interactive Markers: Basic Controls

这篇教程详细解释了ROS RVIZ中交互式标记物的base_controls,包括灰色盒子的移动方式、6个自由度的独立控制,以及Simple 6-DOF、View-Facing 6-DOF、Quadrocopter、Chess Piece和平移/倾斜等不同类型的控制。教程源代码链接提供。
摘要由CSDN通过智能技术生成

1.Interactive Markers: Basic Controls基本控件

说明:这篇教程说明base_controls教程代码如何工作


2.basic_controls教程说明:


本教程介绍你在设计交互标志物时最常用的选项。节点将从RViz得到的所有反馈打印到命令行上。

 所有交互标志物包含一个灰色盒子。在大多数情况下,这个灰色盒子会与对照的其余控件一起移动。它会告诉你互动标志物的坐标系如何移动。


3.Simple 6-DOF control简单六自由度控件

这显示了如何控件使用6个独立控件,控件6个自由度。使用环去旋转和箭头移动的结构。


4.Simple 6-DOF control (fixed orientation)简单的六自由度控件(固定方向)


与简单六自由度控件相同,除了控件方向将保持固定,被控件的坐标系的方向独立。

https://raw.github.com/ros-visualization/visualization_tutorials/groovy-devel/interactive_marker_tutorials/src/basic_controls.cpp

  48 Marker makeBox( InteractiveMarker &msg )
  49 {
  
  50   Marker marker;
  51 
  52   marker.type = Marker::CUBE;
  53   marker.scale.x = msg.scale * 0.45;
  54   marker.scale.y = msg.scale * 0.45;
  55   marker.scale.z = msg.scale * 0.45;
  56   marker.color.r = 0.5;
  57   marker.color.g = 0.5;
  58   marker.color.b = 0.5;
  59   marker.color.a = 1.0;
  60 
  61   return marker;
  62 }
  63 
  64 InteractiveMarkerControl& makeBoxControl( InteractiveMarker &msg )
  65 {
  
  66   InteractiveMarkerControl control;
  67   control.always_visible = true;
  68   control.markers.push_back( makeBox(msg) );
  69   msg.controls.push_back( control );
  70 
  71   return msg.controls.back();
  72 }

 

https://raw.github.com/ros-visualization/visualization_tutorials/groovy-devel/interactive_marker_tutorials/src/basic_controls.cpp
 
 183 void make6DofMarker( bool fixed, unsigned int interaction_mode, const tf::Vector3& position, bool show_6dof )
 184 {
  
 185   InteractiveMarker int_marker;
 186   int_marker.header.frame_id = "base_link";
 187   tf::pointTFToMsg(position, int_marker.pose.position);
 188   int_marker.scale = 1;
 189 
 190   int_marker.name = "simple_6dof";
 191   int_marker.description = "Simple 6-DOF Control";
 192 
 193   // insert a box
 194   makeBoxControl(int_marker);
 195   int_marker.controls[0].interaction_mode = interaction_mode;
 196 
 197   InteractiveMarkerControl control;
 198 
 199   if ( fixed )
 200   {
  
 201     int_marker.name += "_fixed";
 202     int_marker.description += "\n(fixed orientation)";
 203     control.orientation_mode = InteractiveMarkerControl::FIXED;
 204   }
 205 
 206   if (interaction_mode != visualization_msgs::InteractiveMarkerControl::NONE)
 207   {
  
 208       std::string mode_text;
 209       if( interaction_mode == visualization_msgs::InteractiveMarkerControl::MOVE_3D )         mode_text = "MOVE_3D";
 210       if( interaction_mode == visualization_msgs::InteractiveMarkerControl::ROTATE_3D )       mode_text = "ROTATE_3D";
 211       if( interaction_mode == visualization_msgs::InteractiveMarkerControl::MOVE_ROTATE_3D )  mode_text = "MOVE_ROTATE_3D";
 212       int_marker.name += "_" + mode_text;
 213       int_marker.description = std::string("3D Control") + (show_6dof ? " + 6-DOF controls" : "") + "\n" + mode_text;
 214   }
 215 
 216   if(show_6dof)
 217   {
  
 218     control.orientation.w = 1;
 219     control.orientation.x = 1;
 220     control.orientation.y = 0;
 221     control.orientation.z = 0;
 222     control.name = "rotate_x";
 223     control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
 224     int_marker.controls.push_back(control);
 225     control.name = "move_x";
 226     control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
 227     int_marker.controls.push_back(control);
 228 
 229     control.orientation.w = 1;
 230     control.orientation.x = 0;
 231     control.orientation.y = 1;
 232     control.orientation.z = 0;
 233     control.name = "rotate_z";
 234     control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
 235     int_marker.controls.push_back(control);
 236     control.name = "move_z";
 237     control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
 238     int_marker.controls.push_back(control);
 239 
 240     control.orientation.w = 1;
 241     control.orientation.x = 0;
 242     control.orientation.y = 0;
 243     control.orientation.z = 1;
 244     control.name = "rotate_y";
 245     control.interaction_mode = InteractiveMarkerControl::ROTATE_AXIS;
 246     int_marker.controls.push_back(control);
 247     control.name = "move_y";
 248     control.interaction_mode = InteractiveMarkerControl::MOVE_AXIS;
 249     int_marker.controls.push_back(control);
 250   }
 251 
 252   server->insert(int_marker);
 253   server->setCallback(int_marker.name, &processFeedback);
 254   if (interaction_mode != visualization_msgs::InteractiveMarkerControl::NONE)
 255     
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值