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


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