47 visualization_msgs::msg::InteractiveMarker int_marker;
48 int_marker.header = stamped.header;
49 int_marker.name = name;
50 int_marker.scale = scale;
51 int_marker.pose = stamped.pose;
58 visualization_msgs::msg::Marker m;
59 m.type = visualization_msgs::msg::Marker::ARROW;
60 m.scale.x = 0.6 * im.scale;
61 m.scale.y = 0.12 * im.scale;
62 m.scale.z = 0.12 * im.scale;
63 m.ns =
"goal_pose_arrow_marker";
65 m.action = visualization_msgs::msg::Marker::ADD;
69 tf2::Quaternion imq, tmq;
70 tf2::fromMsg(m.pose.orientation, imq);
71 tmq.setRPY(0, -M_PI / 2.0, 0);
73 m.pose.orientation = tf2::toMsg(imq);
79 visualization_msgs::msg::Marker mc;
80 mc.type = visualization_msgs::msg::Marker::CYLINDER;
81 mc.scale.x = 0.05 * im.scale;
82 mc.scale.y = 0.05 * im.scale;
83 mc.scale.z = 0.15 * im.scale;
84 mc.ns =
"goal_pose_arrow_marker";
86 mc.action = visualization_msgs::msg::Marker::ADD;
87 mc.header = im.header;
90 tf2::fromMsg(mc.pose.orientation, imq);
91 tmq.setRPY(M_PI / 2.0, 0, 0);
93 mc.pose.orientation = tf2::toMsg(imq);
94 mc.pose.position.x -= 0.04;
95 mc.pose.position.z += 0.01;
101 visualization_msgs::msg::InteractiveMarkerControl m_control;
102 m_control.always_visible =
true;
103 m_control.interaction_mode = m_control.BUTTON;
104 m_control.markers.push_back(m);
105 m_control.markers.push_back(mc);
108 im.controls.push_back(m_control);
114 visualization_msgs::msg::Marker err;
115 err.type = visualization_msgs::msg::Marker::MESH_RESOURCE;
116 err.scale.x = 0.002 * im.scale;
117 err.scale.y = 0.002 * im.scale;
118 err.scale.z = 0.002 * im.scale;
119 err.mesh_resource =
"package://moveit_ros_planning_interface/resources/access-denied.dae";
120 err.ns =
"robot_interaction_error";
122 err.action = visualization_msgs::msg::Marker::ADD;
123 err.header = im.header;
125 err.pose.orientation.x = err.pose.orientation.y = 0.7071067811865476;
126 err.pose.orientation.z = err.pose.orientation.w = 0.0;
132 visualization_msgs::msg::InteractiveMarkerControl err_control;
133 err_control.always_visible =
false;
134 err_control.markers.push_back(err);
137 im.controls.push_back(err_control);
143void addPlanarXYControl(visualization_msgs::msg::InteractiveMarker& int_marker,
bool orientation_fixed)
145 visualization_msgs::msg::InteractiveMarkerControl
control;
147 if (orientation_fixed)
148 control.orientation_mode = visualization_msgs::msg::InteractiveMarkerControl::FIXED;
149 control.orientation.w = SQRT2INV;
150 control.orientation.x = SQRT2INV;
153 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
154 int_marker.controls.push_back(
control);
156 control.orientation.w = SQRT2INV;
158 control.orientation.y = SQRT2INV;
160 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_AXIS;
161 int_marker.controls.push_back(
control);
163 control.orientation.w = SQRT2INV;
166 control.orientation.z = SQRT2INV;
167 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
168 int_marker.controls.push_back(
control);
179 visualization_msgs::msg::InteractiveMarkerControl
control;
181 if (orientation_fixed)
182 control.orientation_mode = visualization_msgs::msg::InteractiveMarkerControl::FIXED;
183 control.orientation.w = SQRT2INV;
184 control.orientation.x = SQRT2INV;
187 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_AXIS;
188 int_marker.controls.push_back(
control);
190 control.orientation.w = SQRT2INV;
192 control.orientation.y = SQRT2INV;
194 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_AXIS;
195 int_marker.controls.push_back(
control);
197 control.orientation.w = SQRT2INV;
200 control.orientation.z = SQRT2INV;
201 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_AXIS;
202 int_marker.controls.push_back(
control);
205void addPositionControl(visualization_msgs::msg::InteractiveMarker& int_marker,
bool orientation_fixed)
207 visualization_msgs::msg::InteractiveMarkerControl
control;
209 if (orientation_fixed)
210 control.orientation_mode = visualization_msgs::msg::InteractiveMarkerControl::FIXED;
211 control.orientation.w = SQRT2INV;
212 control.orientation.x = SQRT2INV;
215 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
216 int_marker.controls.push_back(
control);
218 control.orientation.w = SQRT2INV;
220 control.orientation.y = SQRT2INV;
222 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
223 int_marker.controls.push_back(
control);
225 control.orientation.w = SQRT2INV;
228 control.orientation.z = SQRT2INV;
229 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
230 int_marker.controls.push_back(
control);
234 const std_msgs::msg::ColorRGBA& color,
bool position,
bool orientation)
236 visualization_msgs::msg::InteractiveMarkerControl
control;
237 control.orientation_mode = visualization_msgs::msg::InteractiveMarkerControl::VIEW_FACING;
238 if (position && orientation)
240 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_ROTATE_3D;
242 else if (orientation)
244 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_3D;
248 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_3D;
250 control.independent_marker_orientation =
true;
253 visualization_msgs::msg::Marker marker;
255 marker.type = visualization_msgs::msg::Marker::SPHERE;
256 marker.scale.x = radius * 2.0;
257 marker.scale.y = radius * 2.0;
258 marker.scale.z = radius * 2.0;
259 marker.color = color;
261 control.markers.push_back(marker);
262 control.always_visible =
false;
264 int_marker.controls.push_back(
control);