Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <cob_interactive_teleop/interactive_markers_tools.h>
00019
00020 namespace interactive_markers
00021 {
00022
00023 void makeCircle(visualization_msgs::InteractiveMarkerControl &control,
00024 float radius,
00025 float width,
00026 std_msgs::ColorRGBA color
00027 )
00028 {
00029 visualization_msgs::Marker marker;
00030
00031 marker.pose.orientation = control.orientation;
00032 marker.type = visualization_msgs::Marker::TRIANGLE_LIST;
00033 marker.scale.x = radius;
00034 marker.scale.y = radius;
00035 marker.scale.z = radius;
00036 marker.color = color;
00037
00038 int steps = 36;
00039 std::vector<geometry_msgs::Point> circle1, circle2;
00040
00041 geometry_msgs::Point v1, v2;
00042
00043 for (int i = 0; i < steps; i++)
00044 {
00045 float a = float(i) / float(steps) * M_PI * 2.0;
00046
00047 v1.y = 0.5 * cos(a);
00048 v1.z = 0.5 * sin(a);
00049
00050 v2.y = (1 + width) * v1.y;
00051 v2.z = (1 + width) * v1.z;
00052
00053 circle1.push_back(v1);
00054 circle2.push_back(v2);
00055 }
00056
00057 for (int i = 0; i < steps; i++)
00058 {
00059 int i1 = i;
00060 int i2 = (i + 1) % steps;
00061
00062 marker.points.clear();
00063 marker.points.push_back(circle1[i1]);
00064 marker.points.push_back(circle2[i1]);
00065 marker.points.push_back(circle1[i2]);
00066 marker.points.push_back(circle2[i1]);
00067 marker.points.push_back(circle2[i2]);
00068 marker.points.push_back(circle1[i2]);
00069
00070 control.markers.push_back(marker);
00071 }
00072 }
00073
00074 }