SequencePlayer.h
Go to the documentation of this file.
1 // -*- C++ -*-
10 #ifndef SEQUENCEPLAYER_H
11 #define SEQUENCEPLAYER_H
12 
13 #include <rtm/idl/BasicDataType.hh>
14 #include <rtm/idl/ExtendedDataTypes.hh>
15 #include <semaphore.h>
16 #include <rtm/Manager.h>
17 #include <rtm/DataFlowComponentBase.h>
18 #include <rtm/CorbaPort.h>
19 #include <rtm/DataInPort.h>
20 #include <rtm/DataOutPort.h>
21 #include <rtm/idl/BasicDataTypeSkel.h>
22 #include <rtm/idl/ExtendedDataTypesSkel.h>
23 #include <hrpModel/Body.h>
24 #include <hrpModel/Sensor.h>
25 #include "seqplay.h"
26 
27 // Service implementation headers
28 // <rtc-template block="service_impl_h">
30 
31 // </rtc-template>
32 
33 // Service Consumer stub headers
34 // <rtc-template block="consumer_stub_h">
35 
36 // </rtc-template>
37 
38 using namespace RTC;
39 
42 {
43  public:
45  virtual ~SequencePlayer();
46 
47  // The initialize action (on CREATED->ALIVE transition)
48  // formaer rtc_init_entry()
49  virtual RTC::ReturnCode_t onInitialize();
50 
51  // The finalize action (on ALIVE->END transition)
52  // formaer rtc_exiting_entry()
53  virtual RTC::ReturnCode_t onFinalize();
54 
55  // The startup action when ExecutionContext startup
56  // former rtc_starting_entry()
57  // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
58 
59  // The shutdown action when ExecutionContext stop
60  // former rtc_stopping_entry()
61  // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
62 
63  // The activated action (Active state entry action)
64  // former rtc_active_entry()
65  virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
66 
67  // The deactivated action (Active state exit action)
68  // former rtc_active_exit()
69  // virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
70 
71  // The execution action that is invoked periodically
72  // former rtc_active_do()
73  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
74 
75  // The aborting action when main logic error occurred.
76  // former rtc_aborting_entry()
77  // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
78 
79  // The error action in ERROR state
80  // former rtc_error_do()
81  // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
82 
83  // The reset action that is invoked resetting
84  // This is same but different the former rtc_init_entry()
85  // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
86 
87  // The state update action that is invoked after onExecute() action
88  // no corresponding operation exists in OpenRTm-aist-0.2.0
89  // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
90 
91  // The action that is invoked when execution context's rate is changed
92  // no corresponding operation exists in OpenRTm-aist-0.2.0
93  // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
94 
95  double dt;
96  seqplay *player() { return m_seq; }
97  hrp::BodyPtr robot() { return m_robot;}
98  void setClearFlag();
99  void waitInterpolation();
100  bool waitInterpolationOfGroup(const char *gname);
101  bool setJointAngle(short id, double angle, double tm);
102  bool setJointAngles(const double *angles, double tm);
103  bool setJointAngles(const double *angles, const bool *mask, double tm);
104  bool setJointAnglesSequence(const OpenHRP::dSequenceSequence angless, const OpenHRP::bSequence& mask, const OpenHRP::dSequence& times);
105  bool setJointAnglesSequenceFull(const OpenHRP::dSequenceSequence i_jvss, const OpenHRP::dSequenceSequence i_vels, const OpenHRP::dSequenceSequence i_torques, const OpenHRP::dSequenceSequence i_poss, const OpenHRP::dSequenceSequence i_rpys, const OpenHRP::dSequenceSequence i_accs, const OpenHRP::dSequenceSequence i_zmps, const OpenHRP::dSequenceSequence i_wrenches, const OpenHRP::dSequenceSequence i_optionals, const dSequence i_tms);
106  bool clearJointAngles();
107  bool setBasePos(const double *pos, double tm);
108  bool setBaseRpy(const double *rpy, double tm);
109  bool setZmp(const double *zmp, double tm);
110  bool setTargetPose(const char* gname, const double *xyz, const double *rpy, double tm, const char* frame_name);
111  bool setWrenches(const double *wrenches, double tm);
112  void loadPattern(const char *basename, double time);
113  void playPattern(const OpenHRP::dSequenceSequence& pos, const OpenHRP::dSequenceSequence& rpy, const OpenHRP::dSequenceSequence& zmp, const OpenHRP::dSequence& tm);
114  bool setInterpolationMode(OpenHRP::SequencePlayerService::interpolationMode i_mode_);
115  bool setInitialState(double tm=0.0);
116  bool addJointGroup(const char *gname, const OpenHRP::SequencePlayerService::StrSequence& jnames);
117  bool removeJointGroup(const char *gname);
118  bool setJointAnglesOfGroup(const char *gname, const OpenHRP::dSequence& jvs, double tm);
119  bool setJointAnglesSequenceOfGroup(const char *gname, const OpenHRP::dSequenceSequence angless, const OpenHRP::dSequence& times);
120  bool clearJointAnglesOfGroup(const char *gname);
121  bool playPatternOfGroup(const char *gname, const OpenHRP::dSequenceSequence& pos, const OpenHRP::dSequence& tm);
122 
123  void setMaxIKError(double pos, double rot);
124  void setMaxIKIteration(short iter);
125  protected:
126  // Configuration variable declaration
127  // <rtc-template block="config_declare">
128 
129  // </rtc-template>
130 
131  // DataInPort declaration
132  // <rtc-template block="inport_declare">
133  TimedDoubleSeq m_qInit;
135  TimedPoint3D m_basePosInit;
137  TimedOrientation3D m_baseRpyInit;
139  TimedPoint3D m_zmpRefInit;
141 
142  // </rtc-template>
143 
144  // DataOutPort declaration
145  // <rtc-template block="outport_declare">
146  TimedDoubleSeq m_qRef;
148  TimedDoubleSeq m_tqRef;
150  TimedPoint3D m_zmpRef;
152  TimedAcceleration3D m_accRef;
154  TimedPoint3D m_basePos;
156  TimedOrientation3D m_baseRpy;
158  std::vector<TimedDoubleSeq> m_wrenches;
159  std::vector<OutPort<TimedDoubleSeq> *> m_wrenchesOut;
160  TimedDoubleSeq m_optionalData;
162 
163 
164  // </rtc-template>
165 
166  // CORBA Port declaration
167  // <rtc-template block="corbaport_declare">
169 
170  // </rtc-template>
171 
172  // Service declaration
173  // <rtc-template block="service_declare">
175 
176  // </rtc-template>
177 
178  // Consumer declaration
179  // <rtc-template block="consumer_declare">
180 
181  // </rtc-template>
182 
183  private:
185  bool m_clearFlag, m_waitFlag;
186  sem_t m_waitSem;
188  std::string m_gname;
189  unsigned int m_debugLevel;
192  double m_error_pos, m_error_rot;
193  short m_iteration;
194  std::string m_fixedLink;
198  int dummy;
199 };
200 
201 
202 extern "C"
203 {
205 };
206 
207 #endif // SEQUENCEPLAYER_H
ec_id
hrp::Matrix33 m_offsetR
unsigned int m_debugLevel
hrp::BodyPtr robot()
std::vector< TimedDoubleSeq > m_wrenches
TimedDoubleSeq m_tqRef
def loadPattern(basename, tm=1.0)
Definition: HRP4C.py:42
OutPort< TimedOrientation3D > m_baseRpyOut
manager
std::string basename(const std::string name)
std::string m_fixedLink
InPort< TimedPoint3D > m_basePosInitIn
InPort< TimedDoubleSeq > m_qInitIn
TimedDoubleSeq m_qInit
hrp::BodyPtr m_robot
SequencePlayerService_impl m_service0
Eigen::Vector3d Vector3
Eigen::Matrix3d Matrix33
coil::Mutex m_mutex
OutPort< TimedPoint3D > m_zmpRefOut
ExecutionContextHandle_t UniqueId
OutPort< TimedDoubleSeq > m_tqRefOut
png_infop int png_uint_32 mask
TimedPoint3D m_zmpRefInit
TimedAcceleration3D m_accRef
std::string m_gname
OutPort< TimedAcceleration3D > m_accRefOut
seqplay * player()
TimedDoubleSeq m_optionalData
TimedDoubleSeq m_qRef
TimedOrientation3D m_baseRpy
InPort< TimedPoint3D > m_zmpRefInitIn
TimedPoint3D m_basePos
TimedPoint3D m_zmpRef
OutPort< TimedDoubleSeq > m_qRefOut
OutPort< TimedDoubleSeq > m_optionalDataOut
hrp::BodyPtr m_robot
RTC::CorbaPort m_SequencePlayerServicePort
OutPort< TimedPoint3D > m_basePosOut
InPort< TimedOrientation3D > m_baseRpyInitIn
TimedPoint3D m_basePosInit
double m_timeToStartPlaying
hrp::Vector3 m_offsetP
size_t optional_data_dim
std::vector< OutPort< TimedDoubleSeq > * > m_wrenchesOut
void SequencePlayerInit(RTC::Manager *manager)
TimedOrientation3D m_baseRpyInit


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:51