OnlineViewer_impl.cpp
Go to the documentation of this file.
1 #include <cstdio>
2 #include <iostream>
3 #include <hrpModel/ModelLoaderUtil.h>
4 #include "hrpsys/util/GLbody.h"
5 #include "hrpsys/util/GLlink.h"
6 #include "hrpsys/util/GLutil.h"
7 #include "OnlineViewer_impl.h"
8 #include "GLscene.h"
9 
10 using namespace OpenHRP;
11 
12 OnlineViewer_impl::OnlineViewer_impl(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, GLscene *i_scene, LogManager<OpenHRP::WorldState> *i_log)
13  :
14  orb(CORBA::ORB::_duplicate(orb)),
15  poa(PortableServer::POA::_duplicate(poa)),
16  scene(i_scene), log(i_log)
17 {
18 }
19 
21 {
22 }
23 
24 PortableServer::POA_ptr OnlineViewer_impl::_default_POA()
25 {
26  return PortableServer::POA::_duplicate(poa);
27 }
28 
29 void OnlineViewer_impl::update(const WorldState& state)
30 {
31  log->add(state);
32 }
33 
34 void OnlineViewer_impl::load(const char* name_, const char* url)
35 {
36  if (!scene->body(name_)){
37  std::cout << "load(" << url << ")" << std::endl;
38  OpenHRP::ModelLoader_var ml = hrp::getModelLoader(orb);
39  OpenHRP::ModelLoader::ModelLoadOption opt;
40  opt.readImage = true;
41  opt.AABBdata.length(0);
42  opt.AABBtype = OpenHRP::ModelLoader::AABB_NUM;
43  BodyInfo_var binfo = ml->getBodyInfoEx(url, opt);
44  GLbody *glbody = new GLbody();
45  hrp::BodyPtr body(glbody);
46  hrp::loadBodyFromBodyInfo(body, binfo, false, GLlinkFactory);
47  body->setName(name_);
48  loadShapeFromBodyInfo(glbody, binfo);
49  scene->addBody(body);
50  }
51 }
52 
54 {
55  log->clear();
56 }
57 
59 {
60 }
61 
62 void OnlineViewer_impl::drawScene(const WorldState& state)
63 {
64 }
65 
66 void OnlineViewer_impl::setLineWidth(::CORBA::Float width)
67 {
68 }
69 
70 void OnlineViewer_impl::setLineScale(::CORBA::Float scale)
71 {
72 }
73 
74 ::CORBA::Boolean OnlineViewer_impl::getPosture(const char* robotId, DblSequence_out posture)
75 {
76  return true;
77 }
78 
79 void OnlineViewer_impl::setLogName(const char* name)
80 {
81 }
82 
void setLineWidth(::CORBA::Float width)
HRPMODEL_API OpenHRP::ModelLoader_var getModelLoader(CosNaming::NamingContext_var cxt)
LogManager< OpenHRP::WorldState > * log
void setLineScale(::CORBA::Float scale)
HRPMODEL_API bool loadBodyFromBodyInfo(BodyPtr body, OpenHRP::BodyInfo_ptr bodyInfo, bool loadGeometryForCollisionDetection=false, Link *(*f)()=NULL)
void loadShapeFromBodyInfo(GLbody *body, BodyInfo_var i_binfo, GLshape *(*shapeFactory)())
Definition: GLutil.cpp:181
virtual PortableServer::POA_ptr _default_POA()
void load(const char *name, const char *url)
Definition: GLbody.h:11
OnlineViewer_impl(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, GLscene *i_scene, LogManager< OpenHRP::WorldState > *i_log)
void update(const WorldState &state)
PortableServer::POA_var poa
::CORBA::Boolean getPosture(const char *robotId, DblSequence_out posture)
void add(const T &state)
Definition: LogManager.h:17
void setLogName(const char *name)
void drawScene(const WorldState &state)
void clear()
Definition: LogManager.h:27


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:50