13 #include "dsr_robot.h" 49 dsr_msgs::RobotStop msg;
51 msg.stop_mode = STOP_TYPE_QUICK;
52 pubRobotStop.publish(msg);
57 int main(
int argc,
char** argv)
60 string my_robot_id =
"dsr01";
61 string my_robot_model =
"m1013";
63 ROS_INFO(
"default arguments: dsr01 m1013");
67 ROS_ERROR(
"invalid arguments: <ns> <model> (ex) dsr01 m1013");
70 for (
int i = 1; i < argc; i++){
71 printf(
"argv[%d] = %s\n", i, argv[i]);
73 my_robot_id = argv[1];
74 my_robot_model = argv[2];
89 CDsrRobot robot(nh, my_robot_id, my_robot_model);
95 robot.config_create_modbus(
"di1",
"192.168.137.50", 502, MODBUS_REGISTER_TYPE_DISCRETE_INPUTS, 3);
96 robot.config_create_modbus(
"do1",
"192.168.137.50", 502, MODBUS_REGISTER_TYPE_COILS, 3);
97 robot.config_create_modbus(
"ro1",
"192.168.137.50", 502, MODBUS_REGISTER_TYPE_HOLDING_REGISTER, 7);
98 robot.config_create_modbus(
"ro2",
"192.168.137.50", 502, MODBUS_REGISTER_TYPE_HOLDING_REGISTER, 6);
102 robot.set_modbus_output(
"ro2", 80);
103 robot.set_modbus_output(
"do1", 1);
104 if(robot.get_modbus_input(
"di1") == 1){
105 robot.set_modbus_output(
"ro1", 30);
110 ROS_INFO(
"dsr_service_test finished !!!!!!!!!!!!!!!!!!!!!");
static void thread_subscriber()
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void SET_ROBOT(string id, string model)
ROSCPP_DECL void shutdown()
int main(int argc, char **argv)