12 #include <std_msgs/String.h> 15 #include "dsr_robot.h" 35 ROS_INFO(
"________ ROBOT STATUS ________");
36 ROS_INFO(
" robot_state : %d", msg->robot_state);
37 ROS_INFO(
" robot_state_str : %s", msg->robot_state_str.c_str());
38 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]
39 ,msg->current_posj[3] ,msg->current_posj[4] ,msg->current_posj[5] );
40 ROS_INFO(
" current_posx : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",msg->current_posx[0] ,msg->current_posx[1] ,msg->current_posx[2]
41 ,msg->current_posx[3] ,msg->current_posx[4] ,msg->current_posx[5] );
43 for(
int i = 0; i < 16; i++){
44 temp_data += (std::to_string(msg->ctrlbox_digital_input[i]) +
" ");
46 ROS_INFO(
" ctrlbox_digital_input : %s",
temp_data.c_str());
49 for(
int i = 0; i < 16; i++){
50 temp_data += (std::to_string(msg->ctrlbox_digital_output[i]) +
" ");
52 ROS_INFO(
" ctrlbox_digital_output : %s", temp_data.c_str());
55 for(
int i = 0; i < 6; i++){
56 temp_data += (std::to_string(msg->flange_digital_input[i]) +
" ");
58 ROS_INFO(
" flange_digital_input : %s", temp_data.c_str());
61 for(
int i = 0; i < 6; i++){
62 temp_data += (std::to_string(msg->flange_digital_output[i]) +
" ");
64 ROS_INFO(
" flange_digital_output : %s", temp_data.c_str());
67 for(
int i = 0; i < msg->modbus_state.size(); i++){
68 temp_data += (
"[" + msg->modbus_state[i].modbus_symbol +
" , " + std::to_string(msg->modbus_state[i].modbus_value) +
"] ");
70 ROS_INFO(
" modbus_state : %s", temp_data.c_str());
71 ROS_INFO(
" access_control : %d", msg->access_control);
72 ROS_INFO(
" homming_completed : %d", msg->homming_completed);
73 ROS_INFO(
" tp_initialized : %d", msg->tp_initialized);
74 ROS_INFO(
" joint_speed : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",msg->current_velj[0] ,msg->current_velj[1] ,msg->current_velj[2]
75 ,msg->current_velj[3] ,msg->current_velj[4] ,msg->current_velj[5] );
76 ROS_INFO(
" task_speed : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",msg->current_velx[0] ,msg->current_velx[1] ,msg->current_velx[2]
77 ,msg->current_velx[3] ,msg->current_velx[4] ,msg->current_velx[5] );
78 ROS_INFO(
" mastering_need : %d", msg->mastering_need);
79 ROS_INFO(
" drl_stopped : %d", msg->drl_stopped);
80 ROS_INFO(
" disconnected : %d", msg->disconnected);
107 dsr_msgs::RobotStop msg;
109 msg.stop_mode = STOP_TYPE_QUICK;
110 pubRobotStop.publish(msg);
115 int main(
int argc,
char** argv)
118 string my_robot_id =
"dsr01";
119 string my_robot_model =
"m1013";
121 ROS_INFO(
"default arguments: dsr01 m1013");
125 ROS_ERROR(
"invalid arguments: <ns> <model> (ex) dsr01 m1013");
128 for (
int i = 1; i < argc; i++){
129 printf(
"argv[%d] = %s\n", i, argv[i]);
131 my_robot_id = argv[1];
132 my_robot_model = argv[2];
147 CDsrRobot robot(nh, my_robot_id, my_robot_model);
153 std::string drlCodeMove =
"set_velj(50)\nset_accj(50)\nmovej([0,0,90,0,90,0])\n";
154 std::string drlCodeReset =
"movej([0,0,0,0,0,0])\n";
158 ROS_INFO(
"current mode is : %s", mode.c_str());
160 robot.drl_start(ROBOT_SYSTEM_REAL, drlCodeMove + drlCodeReset);
163 robot.drl_start(ROBOT_SYSTEM_VIRTUAL, drlCodeMove + drlCodeReset);
171 ROS_INFO(
"dsr_service_test finished !!!!!!!!!!!!!!!!!!!!!");
void msgRobotState_cb(const dsr_msgs::RobotState::ConstPtr &msg)
int main(int argc, char **argv)
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)
bool getParam(const std::string &key, std::string &s) const
void SET_ROBOT(string id, string model)
ROSCPP_DECL void shutdown()