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