I write a robot_hw node, use ControllerManager init my ros_control, my init() of ros_control can work, but when the code go to the updata(), my ros_control can't work. And then I don't know if the ros_control and my robot_hw is connected.Who can help me!!!
`ros::init(argc, argv, "hw_interface_node");
ros::AsyncSpinner spinner(2);
spinner.start();
ros::NodeHandle nh;
robot_hw_test_ns::MyRobotInterface hw;
int ret = hw.init(nh,nh);
ROS_INFO("hw init ret=%d",ret);
controller_manager::ControllerManager cm(&hw,nh);
sleep(1);
ret = cm.loadController("mylink/joint_controller_test");//It can work ,the init() of my ros_control can work!!!
ROS_INFO("load controller ret=%d",ret);
ros::Duration period(1.0/125);
ROS_INFO("2joint hw run");
while (ros::ok())
{
hw.read(ros::Time::now(),period);//it can work
cm.update(ros::Time::now(),period);//**### **It don't work ,it make me crazy!!!****
hw.write(ros::Time::now(),period);//it can work
period.sleep();
}
spinner.stop();
return 0;`
I write a robot_hw node, use ControllerManager init my ros_control, my
init()
of ros_control can work, but when the code go to theupdata()
, my ros_control can't work. And then I don't know if the ros_control and my robot_hw is connected.Who can help me!!! `ros::init(argc, argv, "hw_interface_node");