11 printf(
"[DrawList] Load object files...\n");
12 std::vector<std::string> names = {
13 "c3_body.obj",
"mini_abad.obj",
14 "c3_upper_link.obj",
"c3_lower_link.obj",
15 "mini_body.obj",
"mini_abad.obj",
16 "mini_upper_link.obj",
"mini_lower_link.obj",
17 "sphere.obj",
"cube.obj"};
18 for (
const auto& name : names) {
24 if (name ==
"sphere.obj") {
27 }
else if (name ==
"cube.obj") {
33 defaultRobotColor[2]);
53 QMatrix4x4 bodyOffset, abadOffset, lowerOffset, eye;
55 QMatrix4x4 upperOffsets[2];
58 bodyOffset.setToIdentity();
59 bodyOffset.rotate(90, 1, 0, 0);
60 bodyOffset.rotate(90, 0, 0, 1);
63 abadOffset.setToIdentity();
66 upperOffsets[0].setToIdentity();
67 upperOffsets[0].rotate(-180, 0, 1, 0);
68 upperOffsets[0].translate(0, -.045
f, 0);
69 upperOffsets[0].rotate(-180, 0, 0, 1);
71 upperOffsets[1].setToIdentity();
72 upperOffsets[1].rotate(-180, 0, 1, 0);
73 upperOffsets[1].translate(0, .045
f, 0);
75 lowerOffset.setToIdentity();
76 lowerOffset.rotate(180, 0, 1, 0);
77 lowerOffset.translate(0, 0, 0);
79 SolidColor bodyColor, abadColor, link1Color, link2Color;
83 abadColor.
rgba = useOld ? Vec4<float>(.3, .2, .2, .6) : color;
86 link1Color.
rgba = useOld ? Vec4<float>(.2, .3, .2, .6) : color;
89 link2Color.
rgba = useOld ? Vec4<float>(.2, .2, .3, .6) : color;
99 for (
int i = 0; i < 4; i++) {
117 printf(
"size of kinematicXform: %lu, j0: %lu\n",
_kinematicXform.size(), j0);
134 QMatrix4x4 bodyOffset, upper, lower, eye;
135 QMatrix4x4 abadOffsets[4];
139 bodyOffset.setToIdentity();
142 abadOffsets[0].setToIdentity();
143 abadOffsets[0].rotate(-90, 0, 0, 1);
144 abadOffsets[0].translate(0, -.0565
f, 0);
145 abadOffsets[0].rotate(180, 0, 1, 0);
147 abadOffsets[1].setToIdentity();
148 abadOffsets[1].rotate(-90, 0, 0, 1);
149 abadOffsets[1].translate(0, -.0565
f, 0);
150 abadOffsets[1].rotate(0, 0, 1, 0);
152 abadOffsets[2].setToIdentity();
153 abadOffsets[2].rotate(90, 0, 0, 1);
154 abadOffsets[2].translate(0, -.0565
f, 0);
155 abadOffsets[2].rotate(0, 0, 1, 0);
157 abadOffsets[3].setToIdentity();
158 abadOffsets[3].rotate(90, 0, 0, 1);
159 abadOffsets[3].translate(0, -.0565
f, 0);
160 abadOffsets[3].rotate(180, 0, 1, 0);
163 upper.setToIdentity();
164 upper.rotate(-90, 0, 1, 0);
167 lower.setToIdentity();
168 lower.rotate(180, 0, 1, 0);
170 SolidColor bodyColor, abadColor, link1Color, link2Color;
174 abadColor.
rgba = useOld ? Vec4<float>(.3, .2, .2, .6) : color;
177 link1Color.
rgba = useOld ? Vec4<float>(.2, .3, .2, .6) : color;
180 link2Color.
rgba = useOld ? Vec4<float>(.2, .2, .3, .6) : color;
190 for (
int i = 0; i < 4; i++) {
229 QMatrix4x4 eye, offset;
231 offset.setToIdentity();
232 offset.translate(-checkerBoard.
getSize()[0] / 2,
233 -checkerBoard.
getSize()[1] / 2);
252 offset.setToIdentity();
254 offset.scale(radius);
273 for (
size_t i = 0; i <
_nUnique; i++) {
302 for (
size_t i(0); i < 3; ++i) {
303 for (
size_t j(0); j < 3; ++j) {
304 tmp.
frame[4 * i + j] = ori(j, i);
307 for (
size_t i(0); i < 3; ++i) tmp.
frame[12 + i] = pos[i];
314 offset.setToIdentity();
315 offset.scale(depth, width, height);
319 offset.setToIdentity();
320 offset.translate(pos[0], pos[1], pos[2]);
322 QQuaternion qq(q[0], q[1], q[2], q[3]);
329 disgustingGreen[2], 1.f);
348 for (
int i(0); i < height_map.rows(); ++i) {
349 for (
int j(0); j < height_map.cols(); ++j) {
static constexpr float disgustingGreen[]
void addMesh(double grid_size, const Vec3< double > &left_corner, const DMat< double > &height_map, bool transparent)
size_t addCheetah3(Vec4< float > color, bool useOld)
std::vector< size_t > _glArrayOffsets
std::vector< std::vector< float > > _normalData
std::vector< std::vector< float > > _colorData
typename Eigen::Matrix< T, 3, 3 > Mat3
typename Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > DMat
typename Eigen::Matrix< T, 4, 1 > Quat
std::vector< size_t > _glArraySizes
static void setSolidColor(std::vector< float > &data, size_t size, float r, float g, float b)
size_t addMiniCheetah(Vec4< float > color, bool useOld)
void computeVertices(std::vector< float > &vertices, std::vector< float > &normals, std::vector< float > &colors)
typename Eigen::Matrix< T, 3, 1 > Vec3
size_t _miniCheetahLoadIndex
static constexpr float defaultRobotColor[]
size_t addDebugSphere(float radius)
void load_obj_file(std::string fileName, std::vector< float > &positions, std::vector< float > &normals)
void addBox(double depth, double width, double height, const Vec3< double > &pos, const Mat3< double > &ori, bool transparent)
vectorAligned< SolidColor > _instanceColor
static constexpr float debugRedColor[]
Data structure to store robot model to be drawn.
std::vector< BoxInfo > _box_list
std::vector< QMatrix4x4 > _kinematicXform
Vec3< double > _height_map_left_corner
std::vector< float > _glColorData
Quat< typename T::Scalar > rotationMatrixToQuaternion(const Eigen::MatrixBase< T > &r1)
typename Eigen::Matrix< T, 4, 1 > Vec4
DMat< double > _height_map
std::vector< float > _glNormalData
std::vector< size_t > _objectMap
std::string _baseFileName
size_t _cheetah3LoadIndex
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Vec4< float > rgba
std::vector< float > _glVertexData
size_t addCheckerboard(Checkerboard &checkerBoard)
std::vector< QMatrix4x4 > _modelOffsets
MX f(const MX &x, const MX &u)
std::vector< std::vector< float > > _vertexData