ros-controls / ros_control

Generic and simple controls framework for ROS
http://wiki.ros.org/ros_control
BSD 3-Clause "New" or "Revised" License
487 stars 307 forks source link

update() of ControllerManager don't work #505

Closed yeying256 closed 2 years ago

yeying256 commented 2 years ago

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;`
bmagyar commented 2 years ago

Please post your questions on https://answers.ros.org/questions/