denso_base.h
Go to the documentation of this file.
1 
25 #ifndef DENSO_BASE_H
26 #define DENSO_BASE_H
27 
28 #include <ros/ros.h>
29 #include "bcap_core/bcap_funcid.h"
31 
32 // Message (std_msgs)
33 #include <std_msgs/Int32.h>
34 #include <std_msgs/Float32.h>
35 #include <std_msgs/Float64.h>
36 #include <std_msgs/String.h>
37 #include <std_msgs/Bool.h>
38 #include <std_msgs/Float32MultiArray.h>
39 #include <std_msgs/Float64MultiArray.h>
40 using namespace std_msgs;
41 
42 // Message (original)
43 #include "denso_robot_core/Joints.h"
44 #include "denso_robot_core/ExJoints.h"
45 #include "denso_robot_core/PoseData.h"
46 #include "denso_robot_core/UserIO.h"
47 
48 // Action
50 using namespace actionlib;
51 
52 // Action (original)
53 #include "denso_robot_core/MoveStringAction.h"
54 #include "denso_robot_core/MoveValueAction.h"
55 #include "denso_robot_core/DriveStringAction.h"
56 #include "denso_robot_core/DriveValueAction.h"
57 
59 using namespace tinyxml2;
60 
61 #define MESSAGE_QUEUE (1)
62 #define BCAP_VAR_DEFAULT_DURATION (1000) /* [ms] */
63 
65 {
66 typedef std::vector<std::string> Name_Vec;
67 typedef std::vector<uint32_t> Handle_Vec;
68 typedef std::vector<BCAPService_Ptr> Service_Vec;
69 
70 class DensoBase
71 {
72 public:
73  static constexpr int BCAP_GET_OBJECT_ARGS = 3;
74  static constexpr int BCAP_GET_OBJECTNAMES_ARGS = 2;
75  enum
76  {
77  SRV_MIN = 0,
78  SRV_ACT = SRV_MIN,
80  SRV_MAX = SRV_WATCH
81  };
82 
83 public:
84  static std::string ConvertBSTRToString(const BSTR bstr);
85  static BSTR ConvertStringToBSTR(const std::string& str);
86 
87 public:
88  DensoBase(const std::string& name, const int* mode) : m_parent(NULL), m_name(name), m_mode(mode), m_serving(false)
89  {
90  }
91 
92  DensoBase(DensoBase* parent, Service_Vec& service, Handle_Vec& handle, const std::string& name, const int* mode)
93  : m_parent(parent), m_name(name), m_mode(mode), m_serving(false)
94  {
95  m_vecService = service;
96  m_vecHandle = handle;
97  }
98 
99  virtual ~DensoBase()
100  {
101  StopService();
102  }
103 
105  {
106  return S_OK;
107  }
108 
110  {
111  return S_OK;
112  }
113 
114  virtual HRESULT StartService(ros::NodeHandle& node) = 0;
115 
117  {
118  return S_OK;
119  }
120 
121  virtual bool Update()
122  {
123  return true;
124  }
125 
126  const std::string& Name() const
127  {
128  return m_name;
129  }
130 
131  std::string RosName() const;
132 
133 protected:
134  HRESULT AddVariable(int32_t get_id, const std::string& name,
135  std::vector<boost::shared_ptr<class DensoVariable> >& vecVar, int16_t vt = VT_EMPTY,
136  bool bRead = false, bool bWrite = false, bool bID = false,
137  int iDuration = BCAP_VAR_DEFAULT_DURATION);
138 
139  HRESULT AddVariable(int32_t get_id, const XMLElement* xmlVar,
140  std::vector<boost::shared_ptr<class DensoVariable> >& vecVar);
141 
142  HRESULT AddObject(int32_t get_id, const std::string& name, Handle_Vec& vecHandle);
143 
144  HRESULT GetObjectNames(int32_t func_id, Name_Vec& vecName);
145 
146  HRESULT get_Object(const std::vector<boost::shared_ptr<DensoBase> >& vecBase, int index,
148 
149  HRESULT get_Object(const std::vector<boost::shared_ptr<DensoBase> >& vecBase, const std::string& name,
151 
152 protected:
154 
155  Service_Vec m_vecService;
156  Handle_Vec m_vecHandle;
157 
158  std::string m_name;
159  const int* m_mode;
160 
161  bool m_serving;
162  boost::mutex m_mtxSrv;
163 };
164 
166 typedef std::vector<DensoBase_Ptr> DensoBase_Vec;
167 
168 } // namespace denso_robot_core
169 
170 #endif // DENSO_BASE_H
short int16_t
virtual HRESULT InitializeBCAP()
Definition: denso_base.h:104
#define S_OK
wchar_t * BSTR
std::vector< uint32_t > Handle_Vec
Definition: denso_base.h:67
VT_EMPTY
virtual HRESULT TerminateBCAP()
Definition: denso_base.h:109
std::vector< BCAPService_Ptr > Service_Vec
Definition: denso_base.h:68
int32_t HRESULT
std::vector< std::string > Name_Vec
Definition: denso_base.h:66
int int32_t
boost::shared_ptr< DensoBase > DensoBase_Ptr
Definition: denso_base.h:165
std::vector< DensoBase_Ptr > DensoBase_Vec
Definition: denso_base.h:166
const std::string & Name() const
Definition: denso_base.h:126
DensoBase(const std::string &name, const int *mode)
Definition: denso_base.h:88
virtual HRESULT StopService()
Definition: denso_base.h:116
#define BCAP_VAR_DEFAULT_DURATION
Definition: denso_base.h:62
DensoBase(DensoBase *parent, Service_Vec &service, Handle_Vec &handle, const std::string &name, const int *mode)
Definition: denso_base.h:92


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