KalmanFilterComp.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00010 #include <rtm/Manager.h>
00011 #include <iostream>
00012 #include <string>
00013 #include "KalmanFilter.h"
00014 
00015 
00016 void MyModuleInit(RTC::Manager* manager)
00017 {
00018   KalmanFilterInit(manager);
00019   RTC::RtcBase* comp;
00020 
00021   // Create a component
00022   comp = manager->createComponent("KalmanFilter");
00023 
00024 
00025   // Example
00026   // The following procedure is examples how handle RT-Components.
00027   // These should not be in this function.
00028 
00029   // Get the component's object reference
00030  RTC::RTObject_var rtobj;
00031  rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));
00032 
00033   // Get the port list of the component
00034  PortServiceList* portlist;
00035  portlist = rtobj->get_ports();
00036 
00037   // getting port profiles
00038  std::cerr << "Number of Ports: ";
00039  std::cerr << portlist->length() << std::endl << std::endl; 
00040  for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
00041  {
00042    PortService_ptr port;
00043    port = (*portlist)[i];
00044    std::cerr << "Port" << i << " (name): ";
00045    std::cerr << port->get_port_profile()->name << std::endl;
00046    
00047    RTC::PortInterfaceProfileList iflist;
00048    iflist = port->get_port_profile()->interfaces;
00049    std::cerr << "---interfaces---" << std::endl;
00050    for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
00051    {
00052      std::cerr << "I/F name: ";
00053      std::cerr << iflist[i].instance_name << std::endl;
00054      std::cerr << "I/F type: ";
00055      std::cerr << iflist[i].type_name << std::endl;
00056      const char* pol;
00057      pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
00058      std::cerr << "Polarity: " << pol << std::endl;
00059    }
00060    std::cerr << "---properties---" << std::endl;
00061    //NVUtil::dump(port->get_port_profile()->properties);
00062    std::cerr << "----------------" << std::endl << std::endl;
00063  }
00064 
00065   return;
00066 }
00067 
00068 int main (int argc, char** argv)
00069 {
00070   RTC::Manager* manager;
00071   manager = RTC::Manager::init(argc, argv);
00072 
00073   // Initialize manager
00074   manager->init(argc, argv);
00075 
00076   // Set module initialization proceduer
00077   // This procedure will be invoked in activateManager() function.
00078   manager->setModuleInitProc(MyModuleInit);
00079 
00080   // Activate manager and register to naming service
00081   manager->activateManager();
00082 
00083   // run the manager in blocking mode
00084   // runManager(false) is the default.
00085   manager->runManager();
00086 
00087   // If you want to run the manager in non-blocking mode, do like this
00088   // manager->runManager(true);
00089 
00090   return 0;
00091 }


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed Sep 6 2017 02:35:55