GCC Code Coverage Report


Directory: ./
File: tests/test.cpp
Date: 2024-08-14 11:04:57
Exec Total Coverage
Lines: 0 14 0.0%
Branches: 0 28 0.0%

Line Branch Exec Source
1 //
2 // test.cpp
3 // Test for SceneViwer
4 //
5 // Created by Mathieu Geisert in November 2014.
6 // Copyright (c) 2014 LAAS-CNRS. All rights reserved.
7 //
8
9 #include <gepetto/viewer/group-node.h>
10 #include <gepetto/viewer/leaf-node-box.h>
11 #include <gepetto/viewer/leaf-node-capsule.h>
12 #include <gepetto/viewer/leaf-node-collada.h>
13 #include <gepetto/viewer/leaf-node-cone.h>
14 #include <gepetto/viewer/leaf-node-cylinder.h>
15 #include <gepetto/viewer/leaf-node-face.h>
16 #include <gepetto/viewer/leaf-node-ground.h>
17 #include <gepetto/viewer/leaf-node-line.h>
18 #include <gepetto/viewer/leaf-node-sphere.h>
19 #include <gepetto/viewer/node.h>
20 #include <gepetto/viewer/urdf-parser.h>
21 #include <gepetto/viewer/window-manager.h>
22
23 #include <iostream>
24
25 int main(int, const char**)
26
27 {
28 using namespace gepetto::viewer;
29
30 LeafNodeBoxPtr_t box =
31 LeafNodeBox::create("box1", osgVector3(0.1f, 0.2f, 0.3f));
32 /*LeafNodeCapsulePtr_t capsule = LeafNodeCapsule::create("capsule1", 1,1);
33 LeafNodeConePtr_t cone = LeafNodeCone::create("cone", 1,1);
34 LeafNodeCylinderPtr_t cylindre = LeafNodeCylinder::create("cylindre", 1,1);
35 LeafNodeSpherePtr_t sphere = LeafNodeSphere::create("sphere", 1);
36 LeafNodeGroundPtr_t ground = LeafNodeGround::create("ground");*/
37 // LeafNodeColladaPtr_t collada =
38 // LeafNodeCollada::create("collada","/home/simeval/AluminumChair.dae");
39 box->addLandmark(1.);
40 // LeafNodeLinePtr_t line = LeafNodeLine::create(std::string("line"),
41 // osgVector3(1.0,1.0,1.0), osgVector3(0.0,0.0,0.0)); LeafNodeFacePtr_t face =
42 // LeafNodeFace::create(std::string("face"), osgVector3(0.0,0.0,0.0),
43 // osgVector3(-2.0,0.0,0.0), osgVector3(-2.0,-2.0,0.0),
44 // osgVector3(0.0,-2.0,0.0)); face->addVertex(osgVector3(0.,0.,2.));
45
46 GroupNodePtr_t world = GroupNode::create(std::string("world"));
47 // GroupNodePtr_t robot = GroupNode::create(std::string("robot"));
48 // GroupNodePtr_t robot = urdfParser::parse(std::string("hrp2"),
49 // std::string("/home/ostasse/devel/ros-indigo-1/install/share/hrp2_14_description/urdf/hrp2_14.urdf"),
50 // std::string("/home/ostasse/devel/ros-indigo-1/install/share/"));
51
52 world->addChild(box);
53 /*world->addChild(obstacle);
54
55 DefVector3 position1(2.,0.,0.);
56 DefQuat attitude1(1.,0.,0.,0.);
57 Tools::ConfigurationPtr_t config1 = Tools::Configuration::create(position1,
58 attitude1); DefVector3 position2(0.,2.,0.); DefQuat attitude2(1.,0.,0.,0.);
59 Tools::ConfigurationPtr_t config2 = Tools::Configuration::create(position2,
60 attitude2);
61
62 robot->addChild(box);
63 robot->applyConfiguration(config1);
64 box->applyConfiguration(config1);
65 robot->addChild(capsule);
66 capsule->setVisibilityMode(VISIBILITY_OFF);
67 robot->addChild(cone);
68 cone->applyConfiguration(config2);
69 cone->setColor(osgVector4(1.,1.,0.5,1.));
70 cone->setVisibilityMode(VISIBILITY_ON);
71 DefVector3 position3(0.,0.,8.);
72 DefQuat attitude3(1.,0.,0.,0.);
73 Tools::ConfigurationPtr_t config3 = Tools::Configuration::create(position3,
74 attitude3); obstacle->applyConfiguration(config3);
75 obstacle->addChild(cylindre);
76 sphere->applyConfiguration(config2);
77 obstacle->addChild(sphere);
78 sphere->setAlpha(0.1f);
79 world->addChild(ground);
80 world->addChild(collada);
81 collada->applyConfiguration(config2);
82 std::string name("world/robot/genou");
83 std::cout << (parseName(name)) << std::endl;*/
84
85 // world->addChild(ground);
86 // world->addChild(line);
87 world->addChild(box);
88 // world->addChild(robot);
89 WindowManagerPtr_t gm = WindowManager::create();
90 gm->addNode(world);
91 // osgViewer::Viewer viewer;
92 // viewer.setSceneData( world->asGroup() );
93 box->deleteLandmark();
94 box->addLandmark(2.);
95 box->applyConfiguration(osgVector3(0., 0., 0.),
96 osgQuat(0.884, 0.306, -0.177, 0.306));
97 world->addLandmark(1.);
98
99 return gm->run();
100 }
101