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> 78 dsr_msgs::DrlPause srv;
80 if(srvDrlPause.call(srv))
83 return (srv.response.success);
87 ROS_ERROR(
"Failed to call service dr_control_service : drl_pause\n");
98 dsr_msgs::DrlResume srv;
100 if(srvDrlResume.call(srv))
103 return (srv.response.success);
107 ROS_ERROR(
"Failed to call service dr_control_service : drl_resume\n");
119 dsr_msgs::DrlStart srv;
121 srv.request.robotSystem = nRobotSystem;
122 srv.request.code = strCode;
124 if(srvDrlStart.call(srv))
127 return (srv.response.success);
131 ROS_ERROR(
"Failed to call service dr_control_service : drl_start\n");
142 dsr_msgs::DrlStop srv;
144 srv.request.stop_mode = nStopMode;
146 if(srvDrlStop.call(srv))
149 return (srv.response.success);
153 ROS_ERROR(
"Failed to call service dr_control_service : drl_stop\n");
175 ROS_INFO(
"shutdown time! sig=%d",sig);
176 ROS_INFO(
"shutdown time! sig=%d",sig);
177 ROS_INFO(
"shutdown time! sig=%d",sig);
183 dsr_msgs::RobotStop msg;
185 msg.stop_mode = STOP_TYPE_QUICK;
186 pubRobotStop.publish(msg);
191 int main(
int argc,
char** argv)
194 string my_robot_id =
"dsr01";
195 string my_robot_model =
"m1013";
197 ROS_INFO(
"default arguments: dsr01 m1013");
201 ROS_ERROR(
"invalid arguments: <ns> <model> (ex) dsr01 m1013");
204 for (
int i = 1; i < argc; i++){
205 printf(
"argv[%d] = %s\n", i, argv[i]);
207 my_robot_id = argv[1];
208 my_robot_model = argv[2];
229 std::string drlCodeMove =
"set_velj(50)\nset_accj(50)\nmovej([0,0,90,0,90,0])\n";
230 std::string drlCodeReset =
"movej([0,0,0,0,0,0])\n";
235 ROS_INFO(
"current mode is : %s", mode.c_str());
237 drl_start(ROBOT_SYSTEM_REAL, drlCodeMove + drlCodeReset);
240 drl_start(ROBOT_SYSTEM_VIRTUAL, drlCodeMove + drlCodeReset);
249 ROS_INFO(
"dsr_service_drl_basic_cpp finished !!!!!!!!!!!!!!!!!!!!!");
void SET_ROBOT(string id, string model)
int drl_start(int nRobotSystem, string strCode)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
int main(int argc, char **argv)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
bool getParam(const std::string &key, std::string &s) const
ROSCPP_DECL void shutdown()
int drl_stop(int nStopMode=STOP_TYPE_QUICK)