SamplePD_HG.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_HG_H
20 #define SamplePD_HG_H
21 
22 #define DOF (29)
23 
24 #include <rtm/idl/BasicDataType.hh>
25 #include <rtm/Manager.h>
26 #include <rtm/DataFlowComponentBase.h>
27 #include <rtm/CorbaPort.h>
28 #include <rtm/DataInPort.h>
29 #include <rtm/DataOutPort.h>
30 #include <rtm/idl/BasicDataTypeSkel.h>
31 
32 #include <vector>
33 
34 // Service implementation headers
35 // <rtc-template block="service_impl_h">
36 
37 // </rtc-template>
38 
39 // Service Consumer stub headers
40 // <rtc-template block="consumer_stub_h">
41 
42 // </rtc-template>
43 
44 using namespace RTC;
45 
48 {
49  public:
51  ~SamplePD_HG();
52 
53  // The initialize action (on CREATED->ALIVE transition)
54  // formaer rtc_init_entry()
55  virtual RTC::ReturnCode_t onInitialize();
56 
57  // The finalize action (on ALIVE->END transition)
58  // formaer rtc_exiting_entry()
59  // virtual RTC::ReturnCode_t onFinalize();
60 
61  // The startup action when ExecutionContext startup
62  // former rtc_starting_entry()
63  // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
64 
65  // The shutdown action when ExecutionContext stop
66  // former rtc_stopping_entry()
67  // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
68 
69  // The activated action (Active state entry action)
70  // former rtc_active_entry()
71  virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
72 
73  // The deactivated action (Active state exit action)
74  // former rtc_active_exit()
75  virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
76 
77  // The execution action that is invoked periodically
78  // former rtc_active_do()
79  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
80 
81  // The aborting action when main logic error occurred.
82  // former rtc_aborting_entry()
83  // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
84 
85  // The error action in ERROR state
86  // former rtc_error_do()
87  // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
88 
89  // The reset action that is invoked resetting
90  // This is same but different the former rtc_init_entry()
91  // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
92 
93  // The state update action that is invoked after onExecute() action
94  // no corresponding operation exists in OpenRTm-aist-0.2.0
95  // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
96 
97  // The action that is invoked when execution context's rate is changed
98  // no corresponding operation exists in OpenRTm-aist-0.2.0
99  // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
100 
101 
102  protected:
103  // Configuration variable declaration
104  // <rtc-template block="config_declare">
105 
106  // </rtc-template>
107 
108  // DataInPort declaration
109  // <rtc-template block="inport_declare">
110  TimedDoubleSeq m_angle_in;
112 
113  // </rtc-template>
114 
115  // DataOutPort declaration
116  // <rtc-template block="outport_declare">
117  TimedDoubleSeq m_angle_out;
119  TimedDoubleSeq m_vel;
121  TimedDoubleSeq m_acc;
123  TimedDoubleSeq m_torque;
125 
126  // </rtc-template>
127 
128  // CORBA Port declaration
129  // <rtc-template block="corbaport_declare">
130 
131  // </rtc-template>
132 
133  // Service declaration
134  // <rtc-template block="service_declare">
135 
136  // </rtc-template>
137 
138  // Consumer declaration
139  // <rtc-template block="consumer_declare">
140 
141  // </rtc-template>
142 
143  private:
144  int dummy;
145  std::ifstream angle, vel, acc, gain;
146  double *Pgain;
147  double *Dgain;
148  std::vector<double> qold;
149  double q_ref[DOF], dq_ref[DOF], ddq_ref[DOF];
150 
151  void openFiles();
152  void closeFiles();
153 };
154 
155 
156 extern "C"
157 {
159 };
160 
161 #endif // SamplePD_HG_H
ec_id
TimedDoubleSeq m_vel
Definition: SamplePD_HG.h:119
double * Pgain
Definition: SamplePD_HG.h:146
manager
TimedDoubleSeq m_acc
Definition: SamplePD_HG.h:121
OutPort< TimedDoubleSeq > m_angle_outOut
Definition: SamplePD_HG.h:118
std::vector< double > qold
Definition: SamplePD_HG.h:148
TimedDoubleSeq m_angle_out
Definition: SamplePD_HG.h:117
ExecutionContextHandle_t UniqueId
InPort< TimedDoubleSeq > m_angle_inIn
Definition: SamplePD_HG.h:111
OutPort< TimedDoubleSeq > m_torqueOut
Definition: SamplePD_HG.h:124
TimedDoubleSeq m_torque
Definition: SamplePD_HG.h:123
DLL_EXPORT void SamplePD_HGInit(RTC::Manager *manager)
OutPort< TimedDoubleSeq > m_accOut
Definition: SamplePD_HG.h:122
double * Dgain
Definition: SamplePD_HG.h:147
#define DOF
Definition: SamplePD_HG.h:22
OutPort< TimedDoubleSeq > m_velOut
Definition: SamplePD_HG.h:120
TimedDoubleSeq m_angle_in
Definition: SamplePD_HG.h:110
std::ifstream vel
Definition: SamplePD_HG.h:145
#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