SamplePD.h
Go to the documentation of this file.
1 // -*- mode: c++; indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
2 /*
3  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
4  * All rights reserved. This program is made available under the terms of the
5  * Eclipse Public License v1.0 which accompanies this distribution, and is
6  * available at http://www.eclipse.org/legal/epl-v10.html
7  * Contributors:
8  * National Institute of Advanced Industrial Science and Technology (AIST)
9  * General Robotix Inc.
10  */
19 #ifndef SAMPLEPD_H
20 #define SAMPLEPD_H
21 #define DOF (29)
22 
23 #include <rtm/idl/BasicDataType.hh>
24 #include <rtm/Manager.h>
25 #include <rtm/DataFlowComponentBase.h>
26 #include <rtm/CorbaPort.h>
27 #include <rtm/DataInPort.h>
28 #include <rtm/DataOutPort.h>
29 #include <rtm/idl/BasicDataTypeSkel.h>
30 
31 #include <vector>
32 
33 // Service implementation headers
34 // <rtc-template block="service_impl_h">
35 
36 // </rtc-template>
37 
38 // Service Consumer stub headers
39 // <rtc-template block="consumer_stub_h">
40 
41 // </rtc-template>
42 
43 using namespace RTC;
44 
45 class SamplePD
47 {
48  public:
50  ~SamplePD();
51 
52  // The initialize action (on CREATED->ALIVE transition)
53  // formaer rtc_init_entry()
54  virtual RTC::ReturnCode_t onInitialize();
55 
56  // The finalize action (on ALIVE->END transition)
57  // formaer rtc_exiting_entry()
58  //virtual RTC::ReturnCode_t onFinalize();
59 
60  // The startup action when ExecutionContext startup
61  // former rtc_starting_entry()
62  //virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
63 
64  // The shutdown action when ExecutionContext stop
65  // former rtc_stopping_entry()
66  //virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
67 
68  // The activated action (Active state entry action)
69  // former rtc_active_entry()
70  virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
71 
72  // The deactivated action (Active state exit action)
73  // former rtc_active_exit()
74  virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
75 
76  // The execution action that is invoked periodically
77  // former rtc_active_do()
78  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
79 
80  // The aborting action when main logic error occurred.
81  // former rtc_aborting_entry()
82  //virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
83 
84  // The error action in ERROR state
85  // former rtc_error_do()
86  //virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
87 
88  // The reset action that is invoked resetting
89  // This is same but different the former rtc_init_entry()
90  //virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
91 
92  // The state update action that is invoked after onExecute() action
93  // no corresponding operation exists in OpenRTm-aist-0.2.0
94  //virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
95 
96  // The action that is invoked when execution context's rate is changed
97  // no corresponding operation exists in OpenRTm-aist-0.2.0
98  //virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
99 
100 
101  protected:
102  // Configuration variable declaration
103  // <rtc-template block="config_declare">
104 
105  // </rtc-template>
106 
107  // DataInPort declaration
108  // <rtc-template block="inport_declare">
109  TimedDoubleSeq m_angle;
111 
112  // </rtc-template>
113 
114  // DataOutPort declaration
115  // <rtc-template block="outport_declare">
116  TimedDoubleSeq m_torque;
118 
119  // </rtc-template>
120 
121  // CORBA Port declaration
122  // <rtc-template block="corbaport_declare">
123 
124  // </rtc-template>
125 
126  // Service declaration
127  // <rtc-template block="service_declare">
128 
129  // </rtc-template>
130 
131  // Consumer declaration
132  // <rtc-template block="consumer_declare">
133 
134  // </rtc-template>
135 
136  private:
137  int dummy;
138  std::ifstream angle, vel, gain;
139  double *Pgain;
140  double *Dgain;
141  std::vector<double> qold;
142  double q_ref[DOF], dq_ref[DOF];
143  void openFiles();
144  void closeFiles();
145 };
146 
147 
148 extern "C"
149 {
150 DLL_EXPORT void SamplePDInit(RTC::Manager* manager);
151 };
152 
153 #endif // SAMPLEPD_H
ec_id
DLL_EXPORT void SamplePDInit(RTC::Manager *manager)
Definition: SamplePD.cpp:272
TimedDoubleSeq m_angle
Definition: SamplePD.h:109
#define DOF
Definition: SamplePD.h:21
InPort< TimedDoubleSeq > m_angleIn
Definition: SamplePD.h:110
manager
TimedDoubleSeq m_torque
Definition: SamplePD.h:116
int dummy
Definition: SamplePD.h:137
OutPort< TimedDoubleSeq > m_torqueOut
Definition: SamplePD.h:117
ExecutionContextHandle_t UniqueId
std::ifstream vel
Definition: SamplePD.h:138
double * Pgain
Definition: SamplePD.h:139
std::vector< double > qold
Definition: SamplePD.h:141
double * Dgain
Definition: SamplePD.h:140
#define DLL_EXPORT


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