00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "RobotPainter.h"
00012
00013 #include "Messages/FastRobotPoseM.h"
00014 #include "Messages/IMUStateM.h"
00015
00016 #include <QtOpenGL>
00017 #include <GL/glut.h>
00018
00019
00020 #define THIS RobotPainter
00021
00022 THIS::THIS() : PainterPlugin( )
00023 {
00024 setName ( "Main Robot" );
00025 m_RollAngle = 0;
00026 m_PitchAngle = 0;
00027 }
00028
00029
00030 THIS::~THIS()
00031 {
00032 }
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 void THIS::paint ( float next2DLayer )
00082 {
00083 glTranslatef ( m_RobotPose.x(), m_RobotPose.y(), next2DLayer );
00084 glRotatef ( m_RobotPose.theta() * 180.0 / M_PI, 0.0, 0.0, 1.0 );
00085
00086 glRotatef ( -m_RollAngle, 1.0, 0.0, 0.0 );
00087 glRotatef ( -m_PitchAngle, 0.0, 1.0, 0.0 );
00088
00089
00090 glColor4f ( 0.0, 0.0, 0.0, 0.35 );
00091 glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE );
00092 glEnable ( GL_BLEND );
00093 glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
00094
00095
00096 glBegin ( GL_POLYGON );
00097 glVertex3f ( 160, 0, 0 );
00098 glVertex3f ( -106, 100, 0 );
00099 glVertex3f ( -50, 0, 0 );
00100 glVertex3f ( -106, -100, 0 );
00101 glEnd();
00102
00103 glRotatef ( 180, 0.0, 0.0, 1.0 );
00104
00105 float extrudeHeight = 0.0;
00106
00107
00108 glBegin ( GL_POLYGON );
00109 glVertex3f ( 232, 115, extrudeHeight );
00110 glVertex3f ( 240, 136, extrudeHeight );
00111 glVertex3f ( 240, 225, extrudeHeight );
00112 glVertex3f ( 40, 225, extrudeHeight );
00113 glVertex3f ( 40, 172, extrudeHeight );
00114 glVertex3f ( -10, 172, extrudeHeight );
00115
00116 glVertex3f ( -10, 225, extrudeHeight );
00117 glVertex3f ( -215, 225, extrudeHeight );
00118 glVertex3f ( -215, 135, extrudeHeight );
00119 glVertex3f ( -285, 135, extrudeHeight );
00120 glVertex3f ( -285, 12, extrudeHeight );
00121 glVertex3f ( -285, -12 , extrudeHeight );
00122 glVertex3f ( -285, -135 , extrudeHeight );
00123 glVertex3f ( -215, -135 , extrudeHeight );
00124 glVertex3f ( -215, -225 , extrudeHeight );
00125 glVertex3f ( -10, -225 , extrudeHeight );
00126
00127 glVertex3f ( -10, -172 , extrudeHeight );
00128 glVertex3f ( 40, -172 , extrudeHeight );
00129 glVertex3f ( 40, -225 , extrudeHeight );
00130 glVertex3f ( 240, -225 , extrudeHeight );
00131 glVertex3f ( 240, -136, extrudeHeight );
00132 glVertex3f ( 232, -115 , extrudeHeight );
00133 glVertex3f ( 282, -115 , extrudeHeight );
00134 glVertex3f ( 282, 115 , extrudeHeight );
00135 glEnd();
00136
00137 extrudeHeight = 150.0;
00138
00139
00140 glColor4f ( 1.0, 1.0, 1.0, 0.35 );
00141 glPolygonMode ( GL_FRONT, GL_FILL );
00142 glPolygonMode ( GL_BACK, GL_NONE );
00143 glBegin ( GL_POLYGON );
00144 glVertex3f ( 100, 0, extrudeHeight );
00145 glVertex3f ( 232, 115, extrudeHeight );
00146 glVertex3f ( 240, 136, extrudeHeight );
00147 glVertex3f ( 240, 225, extrudeHeight );
00148 glVertex3f ( 40, 225, extrudeHeight );
00149 glVertex3f ( 40, 172, extrudeHeight );
00150 glVertex3f ( -10, 172, extrudeHeight );
00151 glVertex3f ( -10, -172 , extrudeHeight );
00152 glVertex3f ( 40, -172 , extrudeHeight );
00153 glVertex3f ( 40, -225 , extrudeHeight );
00154 glVertex3f ( 240, -225 , extrudeHeight );
00155 glVertex3f ( 240, -136, extrudeHeight );
00156 glVertex3f ( 232, -115 , extrudeHeight );
00157 glVertex3f ( 282, -115 , extrudeHeight );
00158 glVertex3f ( 282, 115 , extrudeHeight );
00159 glVertex3f ( 232, 115, extrudeHeight );
00160 glEnd();
00161 glBegin ( GL_POLYGON );
00162 glVertex3f ( -100, 0, extrudeHeight );
00163 glVertex3f ( -10, 225, extrudeHeight );
00164 glVertex3f ( -215, 225, extrudeHeight );
00165 glVertex3f ( -215, 135, extrudeHeight );
00166 glVertex3f ( -285, 135, extrudeHeight );
00167 glVertex3f ( -285, 12, extrudeHeight );
00168 glVertex3f ( -285, -12 , extrudeHeight );
00169 glVertex3f ( -285, -135 , extrudeHeight );
00170 glVertex3f ( -215, -135 , extrudeHeight );
00171 glVertex3f ( -215, -225 , extrudeHeight );
00172 glVertex3f ( -10, -225 , extrudeHeight );
00173 glVertex3f ( -10, 225, extrudeHeight );
00174 glEnd();
00175 glColor4f ( 0.7, 0.7, 0.7, 0.2 );
00176 glPolygonMode ( GL_BACK, GL_FILL );
00177 glPolygonMode ( GL_FRONT, GL_NONE );
00178 glBegin ( GL_TRIANGLE_STRIP );
00179 glVertex3f ( 232, 115, 0.0 );
00180 glVertex3f ( 232, 115, extrudeHeight );
00181 glVertex3f ( 223, 130, 0.0 );
00182 glVertex3f ( 223, 130, extrudeHeight );
00183 glVertex3f ( 223, 138, 0.0 );
00184 glVertex3f ( 223, 138, extrudeHeight );
00185 glVertex3f ( 240, 136, 0.0 );
00186 glVertex3f ( 240, 136, extrudeHeight );
00187 glVertex3f ( 240, 225, 0.0 );
00188 glVertex3f ( 240, 225, extrudeHeight );
00189 glVertex3f ( 40, 225, 0.0 );
00190 glVertex3f ( 40, 225, extrudeHeight );
00191 glVertex3f ( 40, 172, 0.0 );
00192 glVertex3f ( 40, 172, extrudeHeight );
00193 glVertex3f ( -10, 172, 0.0 );
00194 glVertex3f ( -10, 172, extrudeHeight );
00195 glVertex3f ( -10, 225, 0.0 );
00196 glVertex3f ( -10, 225, extrudeHeight );
00197 glVertex3f ( -215, 225, 0.0 );
00198 glVertex3f ( -215, 225, extrudeHeight );
00199 glVertex3f ( -215, 135, 0.0 );
00200 glVertex3f ( -215, 135, extrudeHeight );
00201 glVertex3f ( -285, 135, 0.0 );
00202 glVertex3f ( -285, 135, extrudeHeight );
00203 glVertex3f ( -285, 12, 0.0 );
00204 glVertex3f ( -285, 12, extrudeHeight );
00205 glVertex3f ( -285, -12 , 0.0 );
00206 glVertex3f ( -285, -12 , extrudeHeight );
00207 glVertex3f ( -285, -135 , 0.0 );
00208 glVertex3f ( -285, -135 , extrudeHeight );
00209 glVertex3f ( -215, -135 , 0.0 );
00210 glVertex3f ( -215, -135 , extrudeHeight );
00211 glVertex3f ( -215, -225 , 0.0 );
00212 glVertex3f ( -215, -225 , extrudeHeight );
00213 glVertex3f ( -10, -225 , 0.0 );
00214 glVertex3f ( -10, -225 , extrudeHeight );
00215 glVertex3f ( -10, -172 , 0.0 );
00216 glVertex3f ( -10, -172 , extrudeHeight );
00217 glVertex3f ( 40, -172 , 0.0 );
00218 glVertex3f ( 40, -172 , extrudeHeight );
00219 glVertex3f ( 40, -225 , 0.0 );
00220 glVertex3f ( 40, -225 , extrudeHeight );
00221 glVertex3f ( 240, -225 , 0.0 );
00222 glVertex3f ( 240, -225 , extrudeHeight );
00223 glVertex3f ( 240, -136, 0.0 );
00224 glVertex3f ( 240, -136, extrudeHeight );
00225 glVertex3f ( 223, -138, 0.0 );
00226 glVertex3f ( 223, -138, extrudeHeight );
00227 glVertex3f ( 223, -130 , 0.0 );
00228 glVertex3f ( 223, -130 , extrudeHeight );
00229 glVertex3f ( 232, -115 , 0.0 );
00230 glVertex3f ( 232, -115 , extrudeHeight );
00231 glVertex3f ( 282, -115 , 0.0 );
00232 glVertex3f ( 282, -115 , extrudeHeight );
00233 glVertex3f ( 282, 115 , 0.0 );
00234 glVertex3f ( 282, 115 , extrudeHeight );
00235 glEnd();
00236
00237 glDisable ( GL_BLEND );
00238
00239 }
00240
00241 #undef THIS