52 visualization_msgs::msg::InteractiveMarker int_marker;
53 int_marker.header = stamped.header;
54 int_marker.name = name;
55 int_marker.scale = scale;
56 int_marker.pose = stamped.pose;
63 visualization_msgs::msg::Marker m;
64 m.type = visualization_msgs::msg::Marker::ARROW;
65 m.scale.x = 0.6 * im.scale;
66 m.scale.y = 0.12 * im.scale;
67 m.scale.z = 0.12 * im.scale;
68 m.ns =
"goal_pose_arrow_marker";
70 m.action = visualization_msgs::msg::Marker::ADD;
74 tf2::Quaternion imq, tmq;
75 tf2::fromMsg(m.pose.orientation, imq);
76 tmq.setRPY(0, -M_PI / 2.0, 0);
78 m.pose.orientation = tf2::toMsg(imq);
84 visualization_msgs::msg::Marker mc;
85 mc.type = visualization_msgs::msg::Marker::CYLINDER;
86 mc.scale.x = 0.05 * im.scale;
87 mc.scale.y = 0.05 * im.scale;
88 mc.scale.z = 0.15 * im.scale;
89 mc.ns =
"goal_pose_arrow_marker";
91 mc.action = visualization_msgs::msg::Marker::ADD;
92 mc.header = im.header;
95 tf2::fromMsg(mc.pose.orientation, imq);
96 tmq.setRPY(M_PI / 2.0, 0, 0);
98 mc.pose.orientation = tf2::toMsg(imq);
99 mc.pose.position.x -= 0.04;
100 mc.pose.position.z += 0.01;
106 visualization_msgs::msg::InteractiveMarkerControl m_control;
107 m_control.always_visible =
true;
108 m_control.interaction_mode = m_control.BUTTON;
109 m_control.markers.push_back(m);
110 m_control.markers.push_back(mc);
113 im.controls.push_back(m_control);
119 visualization_msgs::msg::Marker err;
120 err.type = visualization_msgs::msg::Marker::MESH_RESOURCE;
121 err.scale.x = 0.002 * im.scale;
122 err.scale.y = 0.002 * im.scale;
123 err.scale.z = 0.002 * im.scale;
124 err.mesh_resource =
"package://moveit_ros_planning_interface/resources/access-denied.dae";
125 err.ns =
"robot_interaction_error";
127 err.action = visualization_msgs::msg::Marker::ADD;
128 err.header = im.header;
130 err.pose.orientation.x = err.pose.orientation.y = 0.7071067811865476;
131 err.pose.orientation.z = err.pose.orientation.w = 0.0;
137 visualization_msgs::msg::InteractiveMarkerControl err_control;
138 err_control.always_visible =
false;
139 err_control.markers.push_back(err);
142 im.controls.push_back(err_control);
148void addPlanarXYControl(visualization_msgs::msg::InteractiveMarker& int_marker,
bool orientation_fixed)
150 visualization_msgs::msg::InteractiveMarkerControl
control;
152 if (orientation_fixed)
153 control.orientation_mode = visualization_msgs::msg::InteractiveMarkerControl::FIXED;
154 control.orientation.w = SQRT2INV;
155 control.orientation.x = SQRT2INV;
158 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
159 int_marker.controls.push_back(
control);
161 control.orientation.w = SQRT2INV;
163 control.orientation.y = SQRT2INV;
165 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_AXIS;
166 int_marker.controls.push_back(
control);
168 control.orientation.w = SQRT2INV;
171 control.orientation.z = SQRT2INV;
172 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
173 int_marker.controls.push_back(
control);
184 visualization_msgs::msg::InteractiveMarkerControl
control;
186 if (orientation_fixed)
187 control.orientation_mode = visualization_msgs::msg::InteractiveMarkerControl::FIXED;
188 control.orientation.w = SQRT2INV;
189 control.orientation.x = SQRT2INV;
192 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_AXIS;
193 int_marker.controls.push_back(
control);
195 control.orientation.w = SQRT2INV;
197 control.orientation.y = SQRT2INV;
199 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_AXIS;
200 int_marker.controls.push_back(
control);
202 control.orientation.w = SQRT2INV;
205 control.orientation.z = SQRT2INV;
206 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_AXIS;
207 int_marker.controls.push_back(
control);
210void addPositionControl(visualization_msgs::msg::InteractiveMarker& int_marker,
bool orientation_fixed)
212 visualization_msgs::msg::InteractiveMarkerControl
control;
214 if (orientation_fixed)
215 control.orientation_mode = visualization_msgs::msg::InteractiveMarkerControl::FIXED;
216 control.orientation.w = SQRT2INV;
217 control.orientation.x = SQRT2INV;
220 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
221 int_marker.controls.push_back(
control);
223 control.orientation.w = SQRT2INV;
225 control.orientation.y = SQRT2INV;
227 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
228 int_marker.controls.push_back(
control);
230 control.orientation.w = SQRT2INV;
233 control.orientation.z = SQRT2INV;
234 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_AXIS;
235 int_marker.controls.push_back(
control);
239 const std_msgs::msg::ColorRGBA& color,
bool position,
bool orientation)
241 visualization_msgs::msg::InteractiveMarkerControl
control;
242 control.orientation_mode = visualization_msgs::msg::InteractiveMarkerControl::VIEW_FACING;
243 if (position && orientation)
245 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_ROTATE_3D;
247 else if (orientation)
249 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::ROTATE_3D;
253 control.interaction_mode = visualization_msgs::msg::InteractiveMarkerControl::MOVE_3D;
255 control.independent_marker_orientation =
true;
258 visualization_msgs::msg::Marker marker;
260 marker.type = visualization_msgs::msg::Marker::SPHERE;
261 marker.scale.x = radius * 2.0;
262 marker.scale.y = radius * 2.0;
263 marker.scale.z = radius * 2.0;
264 marker.color = color;
266 control.markers.push_back(marker);
267 control.always_visible =
false;
269 int_marker.controls.push_back(
control);