11 #include <boost/thread/thread.hpp> 19 #include <dsr_msgs/RobotState.h> 20 #include <dsr_msgs/RobotStop.h> 22 #include <dsr_msgs/MoveJoint.h> 23 #include <dsr_msgs/MoveLine.h> 24 #include <dsr_msgs/MoveJointx.h> 25 #include <dsr_msgs/MoveCircle.h> 26 #include <dsr_msgs/MoveSplineJoint.h> 27 #include <dsr_msgs/MoveSplineTask.h> 28 #include <dsr_msgs/MoveBlending.h> 29 #include <dsr_msgs/MoveSpiral.h> 30 #include <dsr_msgs/MovePeriodic.h> 31 #include <dsr_msgs/MoveWait.h> 33 #include <dsr_msgs/ConfigCreateTcp.h> 34 #include <dsr_msgs/ConfigDeleteTcp.h> 35 #include <dsr_msgs/GetCurrentTcp.h> 36 #include <dsr_msgs/SetCurrentTcp.h> 38 #include <dsr_msgs/SetCurrentTool.h> 39 #include <dsr_msgs/GetCurrentTool.h> 40 #include <dsr_msgs/ConfigCreateTool.h> 41 #include <dsr_msgs/ConfigDeleteTool.h> 43 #include <dsr_msgs/SetCtrlBoxDigitalOutput.h> 44 #include <dsr_msgs/GetCtrlBoxDigitalInput.h> 45 #include <dsr_msgs/SetToolDigitalOutput.h> 46 #include <dsr_msgs/GetToolDigitalInput.h> 47 #include <dsr_msgs/SetCtrlBoxAnalogOutput.h> 48 #include <dsr_msgs/GetCtrlBoxAnalogInput.h> 49 #include <dsr_msgs/SetCtrlBoxAnalogOutputType.h> 50 #include <dsr_msgs/SetCtrlBoxAnalogInputType.h> 52 #include <dsr_msgs/SetModbusOutput.h> 53 #include <dsr_msgs/GetModbusInput.h> 54 #include <dsr_msgs/ConfigCreateModbus.h> 55 #include <dsr_msgs/ConfigDeleteModbus.h> 57 #include <dsr_msgs/DrlPause.h> 58 #include <dsr_msgs/DrlStart.h> 59 #include <dsr_msgs/DrlStop.h> 60 #include <dsr_msgs/DrlResume.h> 74 int movej(
float fTargetPos[NUM_JOINT],
77 float fTargetTime = 0.f,
78 int nMoveMode = MOVE_MODE_ABSOLUTE,
79 float fBlendingRadius = 0.f,
80 int nBlendingType = BLENDING_SPEED_TYPE_DUPLICATE,
88 dsr_msgs::MoveJoint srv;
90 for(
int i=0; i<NUM_JOINT; i++)
91 srv.request.pos[i] = fTargetPos[i];
92 srv.request.vel = fTargetVel;
93 srv.request.acc = fTargetAcc;
94 srv.request.time = fTargetTime;
95 srv.request.mode = nMoveMode;
96 srv.request.radius = fBlendingRadius;
97 srv.request.blendType = nBlendingType;
98 srv.request.syncType = nSyncType;
99 if(srvMoveJoint.call(srv))
102 return (srv.response.success);
106 ROS_ERROR(
"Failed to call service dr_control_service : move_joint\n");
119 dsr_msgs::SetModbusOutput srv;
121 srv.request.name = strName;
122 srv.request.value = nValue;
124 if(srvSetModbusOutput.call(srv))
127 return (srv.response.success);
131 ROS_ERROR(
"Failed to call service dr_control_service : set_modbus_output\n");
142 dsr_msgs::GetModbusInput srv;
144 srv.request.name = strName;
145 if(srvGetModbusInput.call(srv))
148 return (srv.response.value);
152 ROS_ERROR(
"Failed to call service dr_control_service : get_modbus_input\n");
167 dsr_msgs::ConfigCreateModbus srv;
169 srv.request.name = strName;
170 srv.request.ip = strIP;
171 srv.request.port = nPort;
172 srv.request.reg_type = nRegType;
173 srv.request.index = nRegIndex;
174 srv.request.value = nRegValue;
176 if(srvConfigCreateModbus.call(srv))
179 return (srv.response.success);
183 ROS_ERROR(
"Failed to call service dr_control_service : config_create_modbus\n");
194 dsr_msgs::ConfigDeleteModbus srv;
196 srv.request.name = strName;
198 if(srvConfigDeleteModbus.call(srv))
201 return (srv.response.success);
205 ROS_ERROR(
"Failed to call service dr_control_service : config_delete_modbus\n");
227 ROS_INFO(
"shutdown time! sig=%d",sig);
228 ROS_INFO(
"shutdown time! sig=%d",sig);
229 ROS_INFO(
"shutdown time! sig=%d",sig);
235 dsr_msgs::RobotStop msg;
237 msg.stop_mode = STOP_TYPE_QUICK;
238 pubRobotStop.publish(msg);
243 int main(
int argc,
char** argv)
246 string my_robot_id =
"dsr01";
247 string my_robot_model =
"m1013";
249 ROS_INFO(
"default arguments: dsr01 m1013");
253 ROS_ERROR(
"invalid arguments: <ns> <model> (ex) dsr01 m1013");
256 for (
int i = 1; i < argc; i++){
257 printf(
"argv[%d] = %s\n", i, argv[i]);
259 my_robot_id = argv[1];
260 my_robot_model = argv[2];
308 ROS_INFO(
"dsr_service_test finished !!!!!!!!!!!!!!!!!!!!!");
int config_delete_modbus(string strName)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
int movej(float fTargetPos[NUM_JOINT], float fTargetVel, float fTargetAcc, float fTargetTime=0.f, int nMoveMode=MOVE_MODE_ABSOLUTE, float fBlendingRadius=0.f, int nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, int nSyncType=0)
int set_modbus_output(string strName, int nValue)
void SET_ROBOT(string id, string model)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)
ROSCPP_DECL void shutdown()
int config_create_modbus(string strName, string strIP, int nPort, int nRegType, int nRegIndex, int nRegValue=0)
int get_modbus_input(string strName)