denso_robot.h
Go to the documentation of this file.
1 
25 #ifndef DENSO_ROBOT_H
26 #define DENSO_ROBOT_H
27 
30 
31 namespace denso_robot_core
32 {
33 class DensoRobot : public DensoBase
34 {
35  friend class DensoRobotCore;
36 
37 public:
38  static constexpr HRESULT S_BUF_FULL = 0x0F200501;
39  static constexpr HRESULT E_BUF_FULL = 0x83201483;
40 
41  static constexpr int BCAP_ROBOT_EXECUTE_ARGS = 3;
42  static constexpr int BCAP_ROBOT_HALT_ARGS = 2;
43  static constexpr int BCAP_ROBOT_MOVE_ARGS = 4;
44  static constexpr int BCAP_ROBOT_SPEED_ARGS = 3;
45  static constexpr int BCAP_ROBOT_CHANGE_ARGS = 2;
46 
47  static constexpr const char* XML_ROBOT_NAME = "Robot";
48 
49  static constexpr const char* NAME_ARMGROUP = "_armgroup";
50  static constexpr const char* NAME_MOVESTRING = "_MoveString";
51  static constexpr const char* NAME_MOVEVALUE = "_MoveValue";
52  static constexpr const char* NAME_DRIVEEXSTRING = "_DriveExString";
53  static constexpr const char* NAME_DRIVEEXVALUE = "_DriveExValue";
54  static constexpr const char* NAME_DRIVEAEXSTRING = "_DriveAExString";
55  static constexpr const char* NAME_DRIVEAEXVALUE = "_DriveAExValue";
56  static constexpr const char* NAME_SPEED = "_Speed";
57  static constexpr const char* NAME_CHANGETOOL = "_ChangeTool";
58  static constexpr const char* NAME_CHANGEWORK = "_ChangeWork";
59  enum
60  {
62  SLVMODE_POSE_P = 0x0001,
63  SLVMODE_POSE_J = 0x0002,
64  SLVMODE_POSE_T = 0x0003,
65  SLVMODE_POSE = 0x000F,
66  SLVMODE_ASYNC = 0x0100,
68  };
69 
70  enum
71  {
73  SENDFMT_HANDIO = 0x0020,
74  SENDFMT_MINIIO = 0x0100,
75  SENDFMT_USERIO = 0x0200,
76  };
77 
78  enum
79  {
81  RECVFMT_POSE_P = 0x0001,
82  RECVFMT_POSE_J = 0x0002,
83  RECVFMT_POSE_T = 0x0003,
84  RECVFMT_POSE_PJ = 0x0004,
85  RECVFMT_POSE_TJ = 0x0005,
86  RECVFMT_POSE = 0x000F,
87  RECVFMT_TIME = 0x0010,
88  RECVFMT_HANDIO = 0x0020,
89  RECVFMT_CURRENT = 0x0040,
90  RECVFMT_MINIIO = 0x0100,
91  RECVFMT_USERIO = 0x0200,
92  };
93 
94  enum
95  {
98  };
99 
100  enum
101  {
104  };
105 
106 public:
107  virtual ~DensoRobot();
108 
109  virtual HRESULT InitializeBCAP(XMLElement* xmlElem);
110 
113 
114  bool Update();
115 
116  HRESULT get_Variable(const std::string& name, DensoVariable_Ptr* var);
117 
118  HRESULT AddVariable(const std::string& name);
119 
122 
123  void ChangeArmGroup(int number);
124 
125  HRESULT ExecMove(int comp, const VARIANT_Ptr& pose, const std::string& option);
126  HRESULT ExecDrive(const std::string& name, const VARIANT_Ptr& option);
127  HRESULT ExecSpeed(float value);
128  HRESULT ExecChange(const std::string& value);
129  HRESULT ExecHalt();
130  HRESULT ExecCurJnt(std::vector<double>& pose);
131 
132  HRESULT ExecSlaveMove(const std::vector<double>& pose, std::vector<double>& joint);
133 
134  int get_SendFormat() const;
135  void put_SendFormat(int format); /* deprecated */
136  int get_RecvFormat() const;
137  void put_RecvFormat(int format); /* deprecated */
138  int get_TimeFormat() const;
139  void put_TimeFormat(int format);
140  void set_SendFormat(int format);
141  void set_RecvFormat(int format);
142 
143  unsigned int get_MiniIO() const;
144  void put_MiniIO(unsigned int value);
145  unsigned int get_HandIO() const;
146  void put_HandIO(unsigned int value);
147  void put_SendUserIO(const UserIO& value);
148  void put_RecvUserIO(const UserIO& value);
149  void get_RecvUserIO(UserIO& value) const;
150  void get_Current(std::vector<double>& current) const;
151  int get_Timestamp() const;
152 
153 protected:
154  DensoRobot(DensoBase* parent, Service_Vec& service, Handle_Vec& handle, const std::string& name, const int* mode);
155 
156  void Callback_ArmGroup(const Int32::ConstPtr& msg);
157 
158  virtual HRESULT AddVariable(XMLElement* xmlElem);
159 
160  HRESULT CreatePoseData(const PoseData& pose, VARIANT& vnt);
161 
162  HRESULT CreateExJoints(const ExJoints& exjoints, VARIANT& vnt);
163 
164 private:
165  virtual HRESULT ChangeMode(int mode);
166 
167  HRESULT ExecSlaveMode(const std::string& name, int32_t format, int32_t option = 0);
168 
169  HRESULT CreateSendParameter(const std::vector<double>& pose, VARIANT_Ptr& send, const int miniio = 0,
170  const int handio = 0, const int recv_userio_offset = 0, const int recv_userio_size = 0,
171  const int send_userio_offset = 0, const int send_userio_size = 0,
172  const std::vector<uint8_t>& send_userio = std::vector<uint8_t>());
173 
174  HRESULT ParseRecvParameter(const VARIANT_Ptr& recv, std::vector<double>& position, std::vector<double>& joint,
175  std::vector<double>& trans, int& miniio, int& handio, int& timestamp,
176  std::vector<uint8_t>& recv_userio, std::vector<double>& current);
177 
178 private:
179  void Callback_MoveString(const MoveStringGoalConstPtr& goal);
180  void Callback_MoveValue(const MoveValueGoalConstPtr& goal);
181  void Callback_DriveString(const std::string& name, const DriveStringGoalConstPtr& goal);
182  void Callback_DriveValue(const std::string& name, const DriveValueGoalConstPtr& goal);
183  void Callback_Speed(const Float32::ConstPtr& msg);
184  void Callback_Change(const std::string& name, const Int32::ConstPtr& msg);
185  void Callback_Cancel();
186  void Action_Feedback();
187 
188 protected:
190 
193 
194 private:
198 
205 
206  int m_curAct;
207  boost::mutex m_mtxAct;
208 
210  unsigned int m_memRetry;
211 
217  std::vector<uint8_t> m_send_userio, m_recv_userio;
218  std::vector<double> m_position, m_joint, m_trans, m_current;
219 };
220 
222 typedef std::vector<DensoRobot_Ptr> DensoRobot_Vec;
223 
224 } // namespace denso_robot_core
225 
226 #endif // DENSO_ROBOT_H
HRESULT ExecSpeed(float value)
void ChangeArmGroup(int number)
static constexpr HRESULT S_BUF_FULL
Definition: denso_robot.h:38
static constexpr const char * NAME_ARMGROUP
Definition: denso_robot.h:49
void put_HandIO(unsigned int value)
unsigned uint32_t
virtual HRESULT InitializeBCAP()
Definition: denso_base.h:104
HRESULT ExecDrive(const std::string &name, const VARIANT_Ptr &option)
void put_RecvFormat(int format)
std::vector< DensoRobot_Ptr > DensoRobot_Vec
Definition: denso_robot.h:222
void get_RecvUserIO(UserIO &value) const
std::vector< double > m_current
Definition: denso_robot.h:218
static constexpr const char * NAME_DRIVEAEXSTRING
Definition: denso_robot.h:54
HRESULT ExecMove(int comp, const VARIANT_Ptr &pose, const std::string &option)
HRESULT ExecSlaveMove(const std::vector< double > &pose, std::vector< double > &joint)
HRESULT AddVariable(const std::string &name)
boost::shared_ptr< SimpleActionServer< DriveStringAction > > m_actDriveExString
Definition: denso_robot.h:201
HRESULT ExecSlaveMode(const std::string &name, int32_t format, int32_t option=0)
DensoRobot(DensoBase *parent, Service_Vec &service, Handle_Vec &handle, const std::string &name, const int *mode)
Definition: denso_robot.cpp:48
ros::Subscriber m_subChangeWork
Definition: denso_robot.h:197
void Callback_ArmGroup(const Int32::ConstPtr &msg)
ros::Subscriber m_subSpeed
Definition: denso_robot.h:195
ros::Subscriber m_subArmGroup
Definition: denso_robot.h:192
unsigned int get_MiniIO() const
std::vector< uint32_t > Handle_Vec
Definition: denso_base.h:67
void Callback_MoveValue(const MoveValueGoalConstPtr &goal)
void Callback_MoveString(const MoveStringGoalConstPtr &goal)
std::vector< double > m_joint
Definition: denso_robot.h:218
boost::shared_ptr< SimpleActionServer< MoveStringAction > > m_actMoveString
Definition: denso_robot.h:199
static constexpr const char * NAME_DRIVEAEXVALUE
Definition: denso_robot.h:55
static constexpr const char * NAME_CHANGETOOL
Definition: denso_robot.h:57
HRESULT CreateSendParameter(const std::vector< double > &pose, VARIANT_Ptr &send, const int miniio=0, const int handio=0, const int recv_userio_offset=0, const int recv_userio_size=0, const int send_userio_offset=0, const int send_userio_size=0, const std::vector< uint8_t > &send_userio=std::vector< uint8_t >())
static constexpr const char * NAME_DRIVEEXSTRING
Definition: denso_robot.h:52
void put_SendUserIO(const UserIO &value)
static constexpr const char * NAME_MOVESTRING
Definition: denso_robot.h:50
std::vector< uint8_t > m_send_userio
Definition: denso_robot.h:217
ros::Subscriber m_subChangeTool
Definition: denso_robot.h:196
std::vector< BCAPService_Ptr > Service_Vec
Definition: denso_base.h:68
void put_RecvUserIO(const UserIO &value)
static constexpr int BCAP_ROBOT_SPEED_ARGS
Definition: denso_robot.h:44
int32_t HRESULT
static constexpr HRESULT E_BUF_FULL
Definition: denso_robot.h:39
boost::shared_ptr< DensoRobot > DensoRobot_Ptr
Definition: denso_robot.h:221
static constexpr const char * NAME_DRIVEEXVALUE
Definition: denso_robot.h:53
static constexpr const char * NAME_CHANGEWORK
Definition: denso_robot.h:58
unsigned int get_HandIO() const
std::vector< DensoVariable_Ptr > DensoVariable_Vec
void Callback_Speed(const Float32::ConstPtr &msg)
static constexpr int BCAP_ROBOT_HALT_ARGS
Definition: denso_robot.h:42
boost::interprocess::unique_ptr< VARIANT, variant_deleter > VARIANT_Ptr
HRESULT ExecChange(const std::string &value)
static constexpr int BCAP_ROBOT_MOVE_ARGS
Definition: denso_robot.h:43
void set_SendFormat(int format)
DensoVariable_Vec m_vecVar
Definition: denso_robot.h:189
static constexpr const char * NAME_SPEED
Definition: denso_robot.h:56
HRESULT CreateExJoints(const ExJoints &exjoints, VARIANT &vnt)
void put_SendFormat(int format)
void get_Current(std::vector< double > &current) const
static constexpr int BCAP_ROBOT_EXECUTE_ARGS
Definition: denso_robot.h:41
void Callback_Change(const std::string &name, const Int32::ConstPtr &msg)
virtual HRESULT ChangeMode(int mode)
HRESULT get_Variable(const std::string &name, DensoVariable_Ptr *var)
void put_TimeFormat(int format)
boost::shared_ptr< SimpleActionServer< DriveStringAction > > m_actDriveAExString
Definition: denso_robot.h:203
std::vector< double > m_position
Definition: denso_robot.h:218
boost::shared_ptr< SimpleActionServer< DriveValueAction > > m_actDriveExValue
Definition: denso_robot.h:202
void put_MiniIO(unsigned int value)
void set_RecvFormat(int format)
void Callback_DriveValue(const std::string &name, const DriveValueGoalConstPtr &goal)
int int32_t
HRESULT ParseRecvParameter(const VARIANT_Ptr &recv, std::vector< double > &position, std::vector< double > &joint, std::vector< double > &trans, int &miniio, int &handio, int &timestamp, std::vector< uint8_t > &recv_userio, std::vector< double > &current)
static constexpr const char * XML_ROBOT_NAME
Definition: denso_robot.h:47
std::vector< double > m_trans
Definition: denso_robot.h:218
void Callback_DriveString(const std::string &name, const DriveStringGoalConstPtr &goal)
HRESULT StartService(ros::NodeHandle &node)
Definition: denso_robot.cpp:84
boost::shared_ptr< SimpleActionServer< DriveValueAction > > m_actDriveAExValue
Definition: denso_robot.h:204
static constexpr int BCAP_ROBOT_CHANGE_ARGS
Definition: denso_robot.h:45
static constexpr const char * NAME_MOVEVALUE
Definition: denso_robot.h:51
HRESULT CreatePoseData(const PoseData &pose, VARIANT &vnt)
boost::shared_ptr< SimpleActionServer< MoveValueAction > > m_actMoveValue
Definition: denso_robot.h:200
std::vector< uint8_t > m_recv_userio
Definition: denso_robot.h:217
HRESULT ExecCurJnt(std::vector< double > &pose)


denso_robot_core
Author(s): DENSO WAVE INCORPORATED
autogenerated on Sat Feb 18 2023 04:06:02