3 #include <visualization_msgs/Marker.h>
4 #include <visualization_msgs/MarkerArray.h>
8 void publishText(
int&
id,
float x,
float y,
const std::string& text)
10 visualization_msgs::Marker marker;
11 marker.header.frame_id =
"base_link";
14 marker.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
15 marker.action = visualization_msgs::Marker::ADD;
16 marker.pose.orientation.x = 0.0;
17 marker.pose.orientation.y = 0.0;
18 marker.pose.orientation.z = 0.0;
19 marker.pose.orientation.w = 1.0;
27 marker.pose.position.x = x;
28 marker.pose.position.y = y;
40 bool use_embedded_materials,
43 using visualization_msgs::Marker;
46 marker.header.frame_id =
"base_link";
52 marker.type = Marker::MESH_RESOURCE;
53 marker.mesh_resource =
"package://rviz/src/test/meshes/pr2-base.dae";
54 marker.mesh_use_embedded_materials = use_embedded_materials;
57 marker.type = Marker::MESH_RESOURCE;
58 marker.mesh_resource =
"package://rviz/src/test/meshes/frame.dae";
59 marker.mesh_use_embedded_materials = use_embedded_materials;
62 marker.type = Marker::SPHERE;
65 marker.action = Marker::ADD;
66 marker.pose.orientation.x = 0.0;
67 marker.pose.orientation.y = 0.0;
68 marker.pose.orientation.z = 0.0995;
69 marker.pose.orientation.w = 0.995;
77 marker.frame_locked =
true;
79 marker.pose.position.x = x;
80 marker.pose.position.y = y;
85 void publishMeshes(
int&
id,
float x,
float r,
float g,
float b,
float a)
89 snprintf(buffer,
sizeof(buffer),
"rbg: %.1f %.1f %.1f, a: %.1f", r, g, b, a);
111 publishText(
id, x, y++,
"mesh1, use_embedded_materials = true");
112 publishText(
id, x, y++,
"mesh1, use_embedded_materials = false");
113 publishText(
id, x, y++,
"mesh2, use_embedded_materials = true");
114 publishText(
id, x, y++,
"mesh2, use_embedded_materials = false");
115 publishText(
id, x, y++,
"sphere, use_embedded_materials = true");
116 publishText(
id, x, y++,
"sphere, use_embedded_materials = false");
132 static float rgba[4] = {0, 0, 0, 0};
139 if (rgba[index] > 1.01)
140 rgba[index--] = 0.0f;
151 int main(
int argc,
char** argv)
153 ros::init(argc, argv,
"mesh_marker_test");
156 bool latch_only =
false;
159 if (std::string(argv[1]) ==
"--latch-only")