PathPlannerComp.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
9 #include <rtm/Manager.h>
10 #include <iostream>
11 #include <string>
12 #include "PathPlanner.h"
13 
14 
15 void MyModuleInit(RTC::Manager* manager)
16 {
17  PathInit(manager);
18  RTC::RtcBase* comp;
19 
20  // Create a component
21  comp = manager->createComponent("Path");
22 
23 
24  // Example
25  // The following procedure is examples how handle RT-Components.
26  // These should not be in this function.
27 
28  // Get the component's object reference
29  RTC::RTObject_var rtobj;
30  rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));
31 
32  // Get the port list of the component
33  PortServiceList* portlist;
34  portlist = rtobj->get_ports();
35 
36  // getting port profiles
37  std::cout << "Number of Ports: ";
38  std::cout << portlist->length() << std::endl << std::endl;
39  for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
40  {
41  PortService_ptr port;
42  port = (*portlist)[i];
43  std::cout << "Port" << i << " (name): ";
44  std::cout << port->get_port_profile()->name << std::endl;
45 
46  RTC::PortInterfaceProfileList iflist;
47  iflist = port->get_port_profile()->interfaces;
48  std::cout << "---interfaces---" << std::endl;
49  for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
50  {
51  std::cout << "I/F name: ";
52  std::cout << iflist[i].instance_name << std::endl;
53  std::cout << "I/F type: ";
54  std::cout << iflist[i].type_name << std::endl;
55  const char* pol;
56  pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
57  std::cout << "Polarity: " << pol << std::endl;
58  }
59  std::cout << "---properties---" << std::endl;
60  NVUtil::dump(port->get_port_profile()->properties);
61  std::cout << "----------------" << std::endl << std::endl;
62  }
63 
64  return;
65 }
66 
67 int main (int argc, char** argv)
68 {
70  manager = RTC::Manager::init(argc, argv);
71 
72  // Initialize manager
73  manager->init(argc, argv);
74 
75  // Set module initialization proceduer
76  // This procedure will be invoked in activateManager() function.
78 
79  // Activate manager and register to naming service
80  manager->activateManager();
81 
82  // run the manager in blocking mode
83  // runManager(false) is the default.
84  manager->runManager();
85 
86  // If you want to run the manager in non-blocking mode, do like this
87  // manager->runManager(true);
88 
89  return 0;
90 }
91 
int main(int argc, char **argv)
RTObject_impl * createComponent(const char *comp_args)
PortableServer::POA_ptr getPOA()
void runManager(bool no_block=false)
void PathInit(RTC::Manager *manager)
manager
virtual PortServiceList * get_ports()
png_uint_32 i
Definition: png.h:2735
void MyModuleInit(RTC::Manager *manager)
static Manager * init(int argc, char **argv)
void dump(const SDOPackage::NVList &nv)
bool activateManager()
std::vector< IPortService * > PortServiceList
void setModuleInitProc(ModuleInitProc proc)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:24