denso_robot_rc8.h
Go to the documentation of this file.
00001 
00025 #ifndef _DENSO_ROBOT_RC8_H_
00026 #define _DENSO_ROBOT_RC8_H_
00027 
00028 #include <boost/thread.hpp>
00029 #include "denso_robot_core/denso_robot.h"
00030 
00031 #define S_BUF_FULL (0x0F200501)
00032 #define E_BUF_FULL (0x83201483)
00033 
00034 namespace denso_robot_core {
00035 
00036 class DensoRobotRC8 : public DensoRobot
00037 {
00038   friend class DensoRobotCore;
00039 
00040 public:
00041   enum {
00042     SLVMODE_NONE      = 0,
00043     SLVMODE_POSE_P    = 0x0001,
00044     SLVMODE_POSE_J    = 0x0002,
00045     SLVMODE_POSE_T    = 0x0003,
00046     SLVMODE_POSE      = 0x000F,
00047     SLVMODE_ASYNC     = 0x0100,
00048     SLVMODE_SYNC_WAIT = 0x0200,
00049   };
00050 
00051   enum {
00052     SENDFMT_NONE   = 0,
00053     SENDFMT_HANDIO = 0x0020,
00054     SENDFMT_MINIIO = 0x0100,
00055     SENDFMT_USERIO = 0x0200,
00056   };
00057 
00058   enum {
00059     RECVFMT_NONE    = 0,
00060     RECVFMT_POSE_P  = 0x0001,
00061     RECVFMT_POSE_J  = 0x0002,
00062     RECVFMT_POSE_T  = 0x0003,
00063     RECVFMT_POSE_PJ = 0x0004,
00064     RECVFMT_POSE_TJ = 0x0005,
00065     RECVFMT_POSE    = 0x000F,
00066     RECVFMT_TIME    = 0x0010,
00067     RECVFMT_HANDIO  = 0x0020,
00068     RECVFMT_CURRENT = 0x0040,
00069     RECVFMT_MINIIO  = 0x0100,
00070     RECVFMT_USERIO  = 0x0200,
00071   };
00072 
00073   enum {
00074     TSFMT_MILLISEC = 0,
00075     TSFMT_MICROSEC = 1,
00076   };
00077 
00078 public:
00079   DensoRobotRC8(DensoBase* parent,
00080       Service_Vec& service, Handle_Vec& handle,
00081       const std::string& name, const int* mode);
00082 
00083   ~DensoRobotRC8();
00084 
00085   HRESULT StartService(ros::NodeHandle& node);
00086   HRESULT StopService();
00087 
00088   bool Update();
00089 
00090   HRESULT ExecTakeArm();
00091   HRESULT ExecGiveArm();
00092   HRESULT ExecMove(int comp, const VARIANT_Ptr& pose, const std::string& option);
00093   HRESULT ExecDrive(const std::string& name, const VARIANT_Ptr& option);
00094   HRESULT ExecSpeed(float value);
00095   HRESULT ExecChange(const std::string& value);
00096   HRESULT ExecHalt();
00097   HRESULT ExecCurJnt(std::vector<double>& pose);
00098 
00099   HRESULT ExecSlaveMove(const std::vector<double>& pose, std::vector<double>& joint);
00100 
00101   int get_SendFormat() const;
00102   void put_SendFormat(int format);
00103   int get_RecvFormat() const;
00104   void put_RecvFormat(int format);
00105   int get_TimeFormat() const;
00106   void put_TimeFormat(int format);
00107 
00108   int get_MiniIO() const;
00109   void put_MiniIO(int value);
00110   int get_HandIO() const;
00111   void put_HandIO(int value);
00112   void put_SendUserIO(const UserIO& value);
00113   void put_RecvUserIO(const UserIO& value);
00114   void get_RecvUserIO(UserIO& value) const;
00115   void get_Current(std::vector<double> &current) const;
00116   int get_Timestamp() const;
00117   
00118 private:
00119   HRESULT ChangeMode(int mode);
00120   HRESULT ExecSlaveMode(const std::string& name, int32_t format, int32_t option = 0);
00121 
00122   HRESULT CreateSendParameter(const std::vector<double>& pose, VARIANT_Ptr& send,
00123       const int miniio = 0, const int handio = 0,
00124       const int recv_userio_offset = 0, const int recv_userio_size = 0,
00125       const int send_userio_offset = 0, const int send_userio_size = 0,
00126       const std::vector<uint8_t>& send_userio = std::vector<uint8_t>());
00127 
00128   HRESULT ParseRecvParameter(const VARIANT_Ptr& recv,
00129       std::vector<double>& position, std::vector<double>& joint, std::vector<double>& trans,
00130       int& miniio, int& handio, int& timestamp,
00131       std::vector<uint8_t>& recv_userio,
00132       std::vector<double>& current);
00133 
00134 private:
00135   void Callback_MoveString(const MoveStringGoalConstPtr& goal);
00136   void Callback_MoveValue(const MoveValueGoalConstPtr& goal);
00137   void Callback_DriveString(const std::string& name, const DriveStringGoalConstPtr& goal);
00138   void Callback_DriveValue(const std::string& name, const DriveValueGoalConstPtr& goal);
00139   void Callback_Speed(const Float32::ConstPtr& msg);
00140   void Callback_Change(const std::string& name, const Int32::ConstPtr& msg);
00141   void Callback_Cancel();
00142   void Action_Feedback();
00143 
00144 private:
00145   ros::Subscriber m_subSpeed;
00146   ros::Subscriber m_subChangeTool;
00147   ros::Subscriber m_subChangeWork;
00148 
00149   boost::shared_ptr<SimpleActionServer<MoveStringAction> >  m_actMoveString;
00150   boost::shared_ptr<SimpleActionServer<MoveValueAction> >   m_actMoveValue;
00151   boost::shared_ptr<SimpleActionServer<DriveStringAction> > m_actDriveExString;
00152   boost::shared_ptr<SimpleActionServer<DriveValueAction> >  m_actDriveExValue;
00153   boost::shared_ptr<SimpleActionServer<DriveStringAction> > m_actDriveAExString;
00154   boost::shared_ptr<SimpleActionServer<DriveValueAction> >  m_actDriveAExValue;
00155 
00156   int m_curAct;
00157   boost::mutex m_mtxAct;
00158 
00159   uint32_t m_memTimeout;
00160   unsigned int m_memRetry;
00161 
00162   int m_tsfmt, m_timestamp;
00163   int m_sendfmt, m_send_miniio, m_send_handio;
00164   int m_recvfmt, m_recv_miniio, m_recv_handio;
00165   int m_send_userio_offset, m_send_userio_size;
00166   int m_recv_userio_offset, m_recv_userio_size;
00167   std::vector<uint8_t> m_send_userio, m_recv_userio;
00168   std::vector<double> m_position, m_joint, m_trans, m_current;
00169 };
00170 
00171 typedef boost::shared_ptr<DensoRobotRC8> DensoRobotRC8_Ptr;
00172 
00173 }
00174 
00175 #endif


denso_robot_core
Author(s): DENSO WAVE INCORPORATED
autogenerated on Thu Jun 6 2019 21:00:11