rviz官网教程:这里,其中3-5属于交互式Markers的教程。message类型可查看:visualization_msgs。
教程4:Writing a Simple Interactive Marker Server
interactive Markers创建的一般流程为:
- server:
interactive_markers::InteractiveMarkerServer server("simple_marker");
- InteractiveMarker:
visualization_msgs::InteractiveMarker int_marker;
- Marker:
visualization_msgs::Marker box_marker;
- InteractiveMarkerControl:
visualization_msgs::InteractiveMarkerControl box_control;
设置交互模式、属性以及把上一步的Marker加到成员markers中:box_control.markers.push_back( box_marker );
。 - 再把control添加到interactiveMarker的control属性中:
int_marker.controls.push_back( box_control );
一个int_marker可添加多个control,例如这里的box和rotate。
教程5:Basic Controls
interactiveMarkerServer:创建一个实例对象,将所有的InteractiveMarker messages都传给这个对象:
boost::shared_ptr<interactive_markers