50 :
DensoBase(parent, service, handle, name, mode)
63 , m_send_userio_offset(UserIO::MIN_USERIO_OFFSET)
64 , m_send_userio_size(1)
65 , m_recv_userio_offset(UserIO::MIN_USERIO_OFFSET)
66 , m_recv_userio_size(1)
98 m_actMoveString = boost::make_shared<SimpleActionServer<MoveStringAction> >(
103 m_actMoveString->start();
105 m_actMoveValue = boost::make_shared<SimpleActionServer<MoveValueAction> >(
147 DensoVariable_Vec::iterator itVar;
150 (*itVar)->StartService(node);
168 DensoVariable_Vec::iterator itVar;
171 (*itVar)->StopService();
193 boost::mutex::scoped_lock lockSrv(
m_mtxSrv);
197 DensoVariable_Vec::iterator itVar;
242 vntArgs.push_back(*vntTmp.get());
273 vntArgs.push_back(*vntTmp.get());
367 vntArgs.push_back(*vntTmp.get());
411 vntArgs.push_back(*vntTmp.get());
452 vntTmp->fltVal = value;
456 vntArgs.push_back(*vntTmp.get());
497 vntArgs.push_back(*vntTmp.get());
532 vntArgs.push_back(*vntTmp.get());
565 vntArgs.push_back(*vntTmp.get());
575 num = vntRet->parray->rgsabound->cElements;
577 pose.resize(num - 1);
578 std::copy(&pdblval[1], &pdblval[num], pose.begin());
617 vntArgs.push_back(*vntTmp.get());
647 ROS_WARN(
"DensoRobot::put_SendFormat() has been deprecated.");
659 ROS_WARN(
"Failed to put_SendFormat.");
679 ROS_WARN(
"DensoRobot::put_RecvFormat() has been deprecated.");
683 switch (format & ~RECVFMT_POSE)
711 ROS_WARN(
"Failed to put_RecvFormat.");
717 ROS_WARN(
"Failed to put_RecvFormat.");
739 ROS_WARN(
"Failed to put_TimeFormat.");
765 if (value.offset < UserIO::MIN_USERIO_OFFSET)
767 ROS_WARN(
"User I/O offset has to be greater than %d.", UserIO::MIN_USERIO_OFFSET - 1);
771 if (value.offset % UserIO::USERIO_ALIGNMENT)
773 ROS_WARN(
"User I/O offset has to be multiple of %d.", UserIO::USERIO_ALIGNMENT);
779 ROS_WARN(
"User I/O size has to be greater than 0.");
783 if (value.size < value.value.size())
785 ROS_WARN(
"User I/O size has to be equal or greater than the value length.");
796 if (value.offset < UserIO::MIN_USERIO_OFFSET)
798 ROS_WARN(
"User I/O offset has to be greater than %d.", UserIO::MIN_USERIO_OFFSET - 1);
802 if (value.offset % UserIO::USERIO_ALIGNMENT)
804 ROS_WARN(
"User I/O offset has to be multiple of %d.", UserIO::USERIO_ALIGNMENT);
810 ROS_WARN(
"User I/O size has to be greater than 0.");
838 uint32_t num = 3 + (((pose.exjoints.mode != 0) && (pose.exjoints.joints.size() > 0)) ? 1 : 0);
847 for (i = 0; i < num; i++)
855 std::copy(pose.value.begin(), pose.value.end(), pfltval);
859 pvntval[i].vt =
VT_I4;
860 pvntval[i].lVal = pose.type;
863 pvntval[i].vt =
VT_I4;
864 pvntval[i].lVal = pose.pass;
880 uint32_t num = 1 + exjoints.joints.size();
888 for (i = 0; i < num; i++)
892 pvntval[0].vt =
VT_I4;
893 pvntval[0].lVal = exjoints.mode;
900 pjntval[0].vt =
VT_I4;
901 pjntval[0].lVal = exjoints.joints.at(i - 1).joint;
902 pjntval[1].vt =
VT_R4;
903 pjntval[1].fltVal = exjoints.joints.at(i - 1).value;
997 vntTmp->lVal = format;
1011 vntArgs.push_back(*vntTmp.get());
1018 const int handio,
const int recv_userio_offset,
const int recv_userio_size,
1019 const int send_userio_offset,
const int send_userio_size,
1020 const std::vector<uint8_t>& send_userio)
1046 bool send_hio, send_mio, send_uio, recv_uio;
1053 if (send_userio_size < send_userio.size())
1063 int num = 1 + send_hio + send_mio + 3 * send_uio + 2 * recv_uio;
1077 memset(pdbl, 0, joints *
sizeof(
double));
1078 std::copy(pose.begin(), pose.end(), pdbl);
1095 memset(pdbl, 0, joints *
sizeof(
double));
1096 std::copy(pose.begin(), pose.end(), pdbl);
1105 pvnt[offset].vt =
VT_I4;
1106 pvnt[offset].lVal = miniio;
1114 pvnt[offset + 0].vt =
VT_I4;
1115 pvnt[offset + 0].lVal = send_userio_offset;
1117 pvnt[offset + 1].vt =
VT_I4;
1118 pvnt[offset + 1].lVal = send_userio_size * UserIO::USERIO_ALIGNMENT;
1123 memset(pbool, 0, send_userio_size *
sizeof(
uint8_t));
1124 std::copy(send_userio.begin(), send_userio.end(), pbool);
1133 pvnt[offset + 0].vt =
VT_I4;
1134 pvnt[offset + 0].lVal = recv_userio_offset;
1136 pvnt[offset + 1].vt =
VT_I4;
1137 pvnt[offset + 1].lVal = recv_userio_size * UserIO::USERIO_ALIGNMENT;
1145 pvnt[offset].vt =
VT_I4;
1146 pvnt[offset].lVal = handio;
1158 std::vector<double>& joint, std::vector<double>& trans,
int& miniio,
int& handio,
1159 int& timestamp, std::vector<uint8_t>& recv_userio, std::vector<double>& current)
1164 int j = 0, j1 = 0, j2 = 0, joints = 0;
1165 std::vector<double>*pose1 = NULL, *pose2 = NULL;
1200 bool recv_ts, recv_hio, recv_mio, recv_uio, recv_crt;
1208 int num = 1 + recv_ts + recv_hio + recv_mio + recv_uio + recv_crt;
1217 if (joints != recv->parray->rgsabound->cElements)
1225 std::copy(pdbl, &pdbl[j1], pose1->begin());
1229 std::copy(&pdbl[j1], &pdbl[joints], pose2->begin());
1235 if (num != recv->parray->rgsabound->cElements)
1247 if (pvnt[offset].vt !=
VT_I4)
1253 timestamp = pvnt[offset].lVal;
1260 if ((pvnt[offset].vt != (
VT_ARRAY |
VT_R8)) || (joints != pvnt[offset].parray->rgsabound->cElements))
1268 std::copy(pdbl, &pdbl[j1], pose1->begin());
1272 std::copy(&pdbl[j1], &pdbl[joints], pose2->begin());
1282 if (pvnt[offset].vt !=
VT_I4)
1288 miniio = pvnt[offset].lVal;
1303 recv_userio.resize(pvnt[offset].parray->rgsabound->cElements);
1304 std::copy(pbool, &pbool[pvnt[offset].parray->rgsabound->cElements], recv_userio.begin());
1313 if (pvnt[offset].vt !=
VT_I4)
1319 handio = pvnt[offset].lVal;
1327 if ((pvnt[offset].vt != (
VT_ARRAY |
VT_R8)) || (8 != pvnt[offset].parray->rgsabound->cElements))
1335 std::copy(pdbl, &pdbl[8], current.begin());
1355 MoveStringResult res;
1358 boost::mutex::scoped_lock lockAct(
m_mtxAct);
1376 hr =
ExecMove(goal->comp, vntPose, goal->option);
1400 MoveValueResult res;
1403 boost::mutex::scoped_lock lockAct(
m_mtxAct);
1420 hr =
ExecMove(goal->comp, vntPose, goal->option);
1444 DriveStringResult res;
1450 if (!name.compare(
"DriveEx"))
1455 else if (!name.compare(
"DriveAEx"))
1464 boost::mutex::scoped_lock lockAct(
m_mtxAct);
1470 actSvr->setAborted(res);
1495 actSvr->setSucceeded(res);
1500 actSvr->setAborted(res);
1510 DriveValueResult res;
1516 if (!name.compare(
"DriveEx"))
1521 else if (!name.compare(
"DriveAEx"))
1530 boost::mutex::scoped_lock lockAct(
m_mtxAct);
1536 actSvr->setAborted(res);
1556 for (
int i = 0; i < goal->pose.size(); i++)
1559 pd.value.push_back(goal->pose.at(i).joint);
1560 pd.value.push_back(goal->pose.at(i).value);
1562 pd.pass = (i == 0) ? goal->pass : 0;
1582 actSvr->setSucceeded(res);
1587 actSvr->setAborted(res);
1601 std::stringstream ss;
1602 ss << name << msg->data;
1608 boost::mutex::scoped_lock lockAct(
m_mtxAct);
1642 boost::mutex::scoped_lock lockAct(
m_mtxAct);
1647 std::vector<double> pose;
1649 MoveStringFeedback fbMvStr;
1650 MoveValueFeedback fbMvVal;
1651 DriveStringFeedback fbDrvStr;
1652 DriveValueFeedback fbDrvVal;
1661 fbMvStr.pose = pose;
1665 fbMvVal.pose = pose;
1669 fbDrvStr.pose = pose;
1673 fbDrvVal.pose = pose;
1677 fbDrvStr.pose = pose;
1681 fbDrvVal.pose = pose;
HRESULT ExecSpeed(float value)
void ChangeArmGroup(int number)
HRESULT SafeArrayUnaccessData(SAFEARRAY *psa)
static constexpr const char * NAME_ARMGROUP
void put_HandIO(unsigned int value)
virtual HRESULT InitializeBCAP()
HRESULT ExecDrive(const std::string &name, const VARIANT_Ptr &option)
void put_RecvFormat(int format)
SAFEARRAY * SafeArrayCreateVector(uint16_t vt, int32_t lLbound, uint32_t cElements)
void get_RecvUserIO(UserIO &value) const
std::vector< double > m_current
static constexpr const char * NAME_DRIVEAEXSTRING
HRESULT AddVariable(int32_t get_id, const std::string &name, std::vector< boost::shared_ptr< class DensoVariable > > &vecVar, int16_t vt=VT_EMPTY, bool bRead=false, bool bWrite=false, bool bID=false, int iDuration=BCAP_VAR_DEFAULT_DURATION)
int get_SendFormat() const
HRESULT ExecMove(int comp, const VARIANT_Ptr &pose, const std::string &option)
HRESULT ExecSlaveMove(const std::vector< double > &pose, std::vector< double > &joint)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
HRESULT AddVariable(const std::string &name)
boost::shared_ptr< SimpleActionServer< DriveStringAction > > m_actDriveExString
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)
ros::Subscriber m_subChangeWork
void Callback_ArmGroup(const Int32::ConstPtr &msg)
ros::Subscriber m_subSpeed
ros::Subscriber m_subArmGroup
unsigned int get_MiniIO() const
std::vector< VARIANT, VariantAllocator< VARIANT > > VARIANT_Vec
std::vector< uint32_t > Handle_Vec
int get_TimeFormat() const
void Callback_MoveValue(const MoveValueGoalConstPtr &goal)
void Callback_MoveString(const MoveStringGoalConstPtr &goal)
std::vector< double > m_joint
boost::shared_ptr< SimpleActionServer< MoveStringAction > > m_actMoveString
int get_RecvFormat() const
static constexpr const char * NAME_DRIVEAEXVALUE
static constexpr const char * NAME_CHANGETOOL
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
void put_SendUserIO(const UserIO &value)
static constexpr const char * NAME_MOVESTRING
std::vector< uint8_t > m_send_userio
ros::Subscriber m_subChangeTool
std::vector< BCAPService_Ptr > Service_Vec
void VariantInit(VARIANT *pvarg)
void put_RecvUserIO(const UserIO &value)
static constexpr int BCAP_ROBOT_SPEED_ARGS
const XMLElement * NextSiblingElement(const char *value=0) const
Get the next (right) sibling element of this node, with an optionally supplied name.
std::string RosName() const
static constexpr const char * NAME_DRIVEEXVALUE
BSTR SysAllocString(const wchar_t *sz)
static constexpr const char * NAME_CHANGEWORK
unsigned int get_HandIO() const
_DN_EXP_COMMON HRESULT VariantCopy(VARIANT *pvargDest, const VARIANT *pvargSrc)
void Callback_Speed(const Float32::ConstPtr &msg)
int get_Timestamp() const
static constexpr int BCAP_ROBOT_HALT_ARGS
boost::interprocess::unique_ptr< VARIANT, variant_deleter > VARIANT_Ptr
HRESULT ExecChange(const std::string &value)
HRESULT SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
static BSTR ConvertStringToBSTR(const std::string &str)
static constexpr int BCAP_ROBOT_MOVE_ARGS
void set_SendFormat(int format)
DensoVariable_Vec m_vecVar
static constexpr const char * NAME_SPEED
HRESULT CreateExJoints(const ExJoints &exjoints, VARIANT &vnt)
void put_SendFormat(int format)
void get_Current(std::vector< double > ¤t) const
#define ID_ROBOT_GETVARIABLE
static constexpr int BCAP_ROBOT_EXECUTE_ARGS
HRESULT get_Object(const std::vector< boost::shared_ptr< DensoBase > > &vecBase, int index, boost::shared_ptr< DensoBase > *obj)
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)
const XMLElement * FirstChildElement(const char *value=0) const
void put_TimeFormat(int format)
boost::shared_ptr< SimpleActionServer< DriveStringAction > > m_actDriveAExString
std::vector< double > m_position
boost::shared_ptr< SimpleActionServer< DriveValueAction > > m_actDriveExValue
void put_MiniIO(unsigned int value)
void set_RecvFormat(int format)
static constexpr const char * XML_VARIABLE_NAME
void Callback_DriveValue(const std::string &name, const DriveValueGoalConstPtr &goal)
HRESULT ParseRecvParameter(const VARIANT_Ptr &recv, std::vector< double > &position, std::vector< double > &joint, std::vector< double > &trans, int &miniio, int &handio, int ×tamp, std::vector< uint8_t > &recv_userio, std::vector< double > ¤t)
std::vector< double > m_trans
void Callback_DriveString(const std::string &name, const DriveStringGoalConstPtr &goal)
HRESULT StartService(ros::NodeHandle &node)
std::vector< DensoBase_Ptr > DensoBase_Vec
boost::shared_ptr< SimpleActionServer< DriveValueAction > > m_actDriveAExValue
static constexpr int BCAP_ROBOT_CHANGE_ARGS
static constexpr const char * NAME_MOVEVALUE
HRESULT CreatePoseData(const PoseData &pose, VARIANT &vnt)
boost::shared_ptr< SimpleActionServer< MoveValueAction > > m_actMoveValue
std::vector< uint8_t > m_recv_userio
HRESULT ExecCurJnt(std::vector< double > &pose)