Do I need to write my own PID controller when using ros2_control?
Hi all, while using forward_controller in ros2_control I found:
There is no PID control code involved in ros2_control_demo. I think this is because ros2_control_demo is built on virtual hardware, for example, it handles the relationship between hw_state and hw_command like this:
hardware_interface::return_type RRBotSystemPositionOnlyHardware::read()
{
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Reading...");
for (uint i = 0; i < hw_states_.size(); i++)
{
// Simulate RRBot's movement
hw_states_[i] = hw_states_[i] + (hw_commands_[i] - hw_states_[i]) / hw_slowdown_;
RCLCPP_INFO(
rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Got state %.5f for joint %d!",
hw_states_[i], i);
}
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Joints successfully read!");
return hardware_interface::return_type::OK;
}
Does that mean I need to write my own PID control code if using real hardware?