13 #include "dsr_robot.h" 32 ROS_INFO(
"________ ROBOT STATUS ________");
33 ROS_INFO(
" robot_state : %d", msg->robot_state);
34 ROS_INFO(
" robot_state_str : %s", msg->robot_state_str.c_str());
35 ROS_INFO(
" current_posj : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",msg->current_posj[0] ,msg->current_posj[1] ,msg->current_posj[2]
36 ,msg->current_posj[3] ,msg->current_posj[4] ,msg->current_posj[5] );
40 ROS_INFO(
" access_control : %d", msg->access_control);
41 ROS_INFO(
" homming_completed : %d", msg->homming_completed);
42 ROS_INFO(
" tp_initialized : %d", msg->tp_initialized);
44 ROS_INFO(
" mastering_need : %d", msg->mastering_need);
45 ROS_INFO(
" drl_stopped : %d", msg->drl_stopped);
46 ROS_INFO(
" disconnected : %d", msg->disconnected);
73 dsr_msgs::RobotStop msg;
75 msg.stop_mode = STOP_TYPE_QUICK;
76 pubRobotStop.publish(msg);
81 int main(
int argc,
char** argv)
84 string my_robot_id =
"dsr01";
85 string my_robot_model =
"m1013";
87 ROS_INFO(
"default arguments: dsr01 m1013");
91 ROS_ERROR(
"invalid arguments: <ns> <model> (ex) dsr01 m1013");
94 for (
int i = 1; i < argc; i++){
95 printf(
"argv[%d] = %s\n", i, argv[i]);
97 my_robot_id = argv[1];
98 my_robot_model = argv[2];
113 CDsrRobot robot(nh, my_robot_id, my_robot_model);
119 float velx[2]={250.0, 80.625};
120 float accx[2]={1000.0, 322.5};
122 float j1[6]={0.0, 0.0, 90.0, 0.0, 90.0, 0.0};
123 float sj1[2][6]={{10.00, 0.00, 0.00, 0.00, 10.00, 20.00},{15.00, 0.00, -10.00, 0.00, 10.00, 20.00}};
124 float x1[6]={0.0, 0.0, -100.0, 0.0, 0.0, 0.0};
125 float x2[6]={545,100,514,0,-180,0};
126 float cx1[2][6]={{544.00, 100.00, 500.00, 0.00, -180.00, 0.00},{543.00, 106.00, 479.00, 7.00, -180.00, 7.00}};
127 float sx1[2][6]={{10.00, -10.00, 20.00, 0.00, 10.00, 0.00},{15.00, 10.00, -10.00, 0.00, 10.00, 0.00}};
128 float bx1[2][6]={{564.00, 200.00, 690.00, 0.00, 180.00, 0.00},{0, 0, 0, 0, 0, 0}};
129 float bx2[2][6]={{564.00, 100.00, 590.00, 0.00, 180.00, 0.00},{564.00, 150.00, 590.00, 0.00, 180.00, 0.00}};
131 float amp[6]={10.00, 0.00, 20.00, 0.00, 0.50, 0.00};
132 float period[6]={1.00, 0.00, 1.50, 0.00, 0.00, 0.00};
144 robot.movej(j1, 60, 30);
146 robot.movel(x1, velx, accx, 0, MOVE_MODE_RELATIVE);
148 robot.movejx(x2, 60, 30, 2, MOVE_MODE_ABSOLUTE,MOVE_REFERENCE_BASE, 0, BLENDING_SPEED_TYPE_DUPLICATE, 2);
150 robot.movec(cx1, velx, accx);
152 robot.movesj(sj1, 2, 60, 30, 0, MOVE_MODE_RELATIVE);
154 robot.movesx(sx1, 2, velx, accx, 0, MOVE_MODE_RELATIVE);
156 for(
int i=0; i<2; i++){
157 for(
int j=0; j<6; j++){
158 posb[0]._fTargetPos[i][j] = bx1[i][j];
159 posb[1]._fTargetPos[i][j] = bx2[i][j];
163 posb[0]._iBlendType = 0;
164 posb[1]._iBlendType = 1;
166 posb[0]._fBlendRad = 40.0;
167 posb[1]._fBlendRad = 20.0;
169 robot.moveb(posb, 2, velx, accx);
171 robot.move_spiral(1.00, 20.00, 20.00, velx, accx, 5, TASK_AXIS_Z, MOVE_REFERENCE_TOOL);
173 robot.move_periodic(amp, period, 0.5, 3, MOVE_REFERENCE_BASE);
175 robot.amovej(j1, 60, 30, 0, MOVE_MODE_ABSOLUTE, 0, BLENDING_SPEED_TYPE_DUPLICATE);
179 robot.amovel(x1, velx, accx, 0, MOVE_MODE_RELATIVE, MOVE_REFERENCE_BASE, 0, BLENDING_SPEED_TYPE_DUPLICATE);
181 robot.amovejx(x2, 60, 30, 2,MOVE_MODE_ABSOLUTE,MOVE_REFERENCE_BASE, 0, BLENDING_SPEED_TYPE_DUPLICATE, 2);
185 robot.amovec(cx1, velx, accx, 0, MOVE_MODE_ABSOLUTE, MOVE_REFERENCE_BASE, 0, BLENDING_SPEED_TYPE_DUPLICATE);
189 robot.amovesj(sj1, 2, 60, 30, 0, MOVE_MODE_RELATIVE);
193 robot.amovesx(sx1, 2, velx, accx, 0, MOVE_MODE_RELATIVE, MOVE_REFERENCE_BASE, SPLINE_VELOCITY_OPTION_DEFAULT);
197 robot.amoveb(posb, 2, velx, accx, 0, MOVE_MODE_ABSOLUTE, MOVE_REFERENCE_BASE);
201 robot.amove_spiral(1.00, 20.00, 20.00, velx, accx, 5, TASK_AXIS_Z, MOVE_REFERENCE_TOOL);
205 robot.amove_periodic(amp, period, 0.5, 3, MOVE_REFERENCE_BASE);
211 ROS_INFO(
"dsr_service_test finished !!!!!!!!!!!!!!!!!!!!!");
int main(int argc, char **argv)
void SET_ROBOT(string id, string model)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
static void thread_subscriber()
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void msgRobotState_cb(const dsr_msgs::RobotState::ConstPtr &msg)
ROSCPP_DECL void shutdown()