VirtualRobotPortHandler.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  * General Robotix Inc.
9  */
15 #ifndef OPENHRP_CONTROLLER_BRIDGE_VIRTUAL_ROBOT_PORT_HANDLER_H_INCLUDED
16 #define OPENHRP_CONTROLLER_BRIDGE_VIRTUAL_ROBOT_PORT_HANDLER_H_INCLUDED
17 
18 #include <boost/shared_ptr.hpp>
19 
20 #include <rtm/idl/BasicDataType.hh>
21 #include <rtm/idl/ExtendedDataTypes.hh>
22 #include <rtm/RTC.h>
23 #include <rtm/PortBase.h>
24 #include <rtm/OutPort.h>
25 #include <rtm/InPort.h>
26 #include <rtm/idl/BasicDataTypeStub.h>
27 
28 #include <hrpCorba/DynamicsSimulator.hh>
29 
30 #include "BridgeConf.h"
31 
32 #include "config.h"
33 
34 using namespace OpenHRP;
35 
36 
37 class Controller_impl;
38 
40 {
41 public:
42  PortHandler(PortInfo& info) : portName(info.portName){}
43  virtual ~PortHandler();
45  std::string portName;
46 };
47 
48 typedef boost::shared_ptr<PortHandler> PortHandlerPtr;
49 
50 
52 {
53 public:
55  virtual void inputDataFromSimulator(Controller_impl* controller) = 0;
56  virtual void writeDataToPort() = 0;
57  template<class T> void setTime(T& value, double _time)
58  {
59  value.tm.sec = (unsigned long)_time;
60  value.tm.nsec = (unsigned long)((_time-value.tm.sec)*1000000000.0 + 0.5);
61  if( value.tm.nsec >= 1000000000 ){
62  value.tm.sec++;
63  value.tm.nsec -= 1000000000;
64  }
65  }
66  double stepTime;
67 };
68 
69 typedef boost::shared_ptr<OutPortHandler> OutPortHandlerPtr;
70 
71 
72 class InPortHandler : public PortHandler
73 {
74 public:
76  virtual void outputDataToSimulator(Controller_impl* controller) = 0;
77  virtual void readDataFromPort(Controller_impl* controller) = 0;
78 };
79 
80 typedef boost::shared_ptr<InPortHandler> InPortHandlerPtr;
81 
82 
84 {
85 public:
87  virtual void inputDataFromSimulator(Controller_impl* controller);
88  virtual void writeDataToPort();
90 private:
91  RTC::TimedDoubleSeq values;
93 };
94 
95 
97 {
98 public:
100  virtual void inputDataFromSimulator(Controller_impl* controller);
101  virtual void writeDataToPort();
103 private:
104  std::vector<std::string> linkName;
105  DynamicsSimulator::LinkDataType linkDataType;
106  RTC::TimedDoubleSeq value;
107 };
108 
110 {
111 public:
113  virtual void inputDataFromSimulator(Controller_impl* controller);
114  virtual void writeDataToPort();
116 private:
117  std::vector<std::string> linkName;
118  DynamicsSimulator::LinkDataType linkDataType;
119  RTC::TimedPose3D value;
120 };
121 
122 
124 {
125 public:
127  virtual void inputDataFromSimulator(Controller_impl* controller);
128  virtual void writeDataToPort();
130 private:
131  RTC::TimedDoubleSeq value;
132  std::vector<std::string> sensorName;
133 };
134 
136 {
137 public:
139  virtual void inputDataFromSimulator(Controller_impl* controller);
140  virtual void writeDataToPort();
142 private:
143  RTC::TimedAngularVelocity3D value;
144  std::vector<std::string> sensorName;
145 };
146 
148 {
149 public:
151  virtual void inputDataFromSimulator(Controller_impl* controller);
152  virtual void writeDataToPort();
154 private:
155  RTC::TimedAcceleration3D value;
156  std::vector<std::string> sensorName;
157 };
158 
159 
161 {
162 public:
164  virtual void inputDataFromSimulator(Controller_impl* controller);
165  virtual void writeDataToPort();
167 private:
168  RTC::TimedLongSeq image;
169  int cameraId;
170 };
171 
172 
174 {
175 public:
177  virtual void inputDataFromSimulator(Controller_impl* controller);
178  virtual void writeDataToPort();
180 private:
181  RTC::TimedOctetSeq image;
182  int cameraId;
183 };
184 
185 
187 {
188 public:
190  virtual void inputDataFromSimulator(Controller_impl* controller);
191  virtual void writeDataToPort();
193 private:
194  RTC::TimedFloatSeq image;
195  int cameraId;
196 };
197 
198 
200 {
201 public:
203  virtual void outputDataToSimulator(Controller_impl* controller);
204  virtual void readDataFromPort(Controller_impl* controller);
206 private:
207  RTC::TimedDoubleSeq values;
208  DynamicsSimulator::LinkDataType linkDataType;
209 };
210 
212  {
213 public:
215  virtual void outputDataToSimulator(Controller_impl* controller);
216  virtual void readDataFromPort(Controller_impl* controller);
218 private:
219  RTC::TimedDoubleSeq values;
220  std::vector<std::string> linkName;
221  DynamicsSimulator::LinkDataType linkDataType;
222  DblSequence data;
223 };
224 
226 {
227 public:
229  virtual void outputDataToSimulator(Controller_impl* controller);
230  virtual void readDataFromPort(Controller_impl* controller);
232 private:
233  RTC::TimedPose3D values;
234  std::vector<std::string> linkName;
235  DynamicsSimulator::LinkDataType linkDataType;
236  DblSequence data;
237 };
238 
239 
240 #endif
InPortHandler(PortInfo &info)
RTC::InPort< RTC::TimedDoubleSeq > inPort
RTC::InPort< RTC::TimedDoubleSeq > inPort
DynamicsSimulator::LinkDataType linkDataType
DynamicsSimulator::LinkDataType linkDataType
std::vector< std::string > sensorName
std::vector< std::string > sensorName
boost::shared_ptr< InPortHandler > InPortHandlerPtr
DynamicsSimulator::LinkDataType linkDataType
RTC::OutPort< RTC::TimedDoubleSeq > outPort
png_voidp int value
Definition: png.h:2113
std::vector< std::string > linkName
boost::shared_ptr< OutPortHandler > OutPortHandlerPtr
RTC::OutPort< RTC::TimedAngularVelocity3D > outPort
DataTypeId
Definition: BridgeConf.h:34
boost::shared_ptr< PortHandler > PortHandlerPtr
std::vector< std::string > sensorName
void setTime(T &value, double _time)
Port_Service_Var_Type portRef
RTC::OutPort< RTC::TimedFloatSeq > outPort
RTC::TimedAngularVelocity3D value
RTC::OutPort< RTC::TimedPose3D > outPort
PortHandler(PortInfo &info)
OutPortHandler(PortInfo &info)
DynamicsSimulator::LinkDataType linkDataType
backing_store_ptr info
Definition: jmemsys.h:181
std::vector< std::string > linkName
RTC::OutPort< RTC::TimedDoubleSeq > outPort
DynamicsSimulator::LinkDataType linkDataType
RTC::PortService_var Port_Service_Var_Type
RTC::InPort< RTC::TimedPose3D > inPort
std::vector< std::string > linkName
RTC::OutPort< RTC::TimedLongSeq > outPort
std::vector< std::string > linkName
RTC::OutPort< RTC::TimedDoubleSeq > outPort
RTC::OutPort< RTC::TimedOctetSeq > outPort
RTC::OutPort< RTC::TimedAcceleration3D > outPort


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:05