Hi @zhixin, let's start with ros_control
package:
The ros_control packages are a rewrite
of the pr2_mechanism packages to make
controllers generic to all robots
beyond just the PR2.
The ros_control packages takes as
input the joint state data from your
robot's actuator's encoders and an
input set point. It uses a generic
control loop feedback mechanism,
typically a PID controller, to control
the output, typically effort, sent to
your actuators. ros_control gets more
complicated for physical mechanisms
that do not have one-to-one mappings
of joint positions, efforts, etc but
these scenarios are accounted for
using transmission
Source: http://wiki.ros.org/ros_control
One of the goals of ROS is not to re-invent the wheel so ros_control
package allows for wide range of applications.
However it's not the only way to interact with Hardware, you could do that through ROS1 messages and services.
Refer to this tutorial: http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv
And take a look at example of robot implementation, you can communicate with drivers or other interfaces.
https://docs.niryo.com/dev/ros/v3.2.0/en/source/stack_hardware/niryo_robot_hardware_interface.html#hardware-interface-node
Finally I suggest you look at what is also available with ROS2 control: http://control.ros.org/
Originally posted by osilva with karma: 1650 on 2021-12-28
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by zhixin on 2022-01-02:
Thank you, Very informative anwser. So there are many ways to interact with the hardware. For the message and services as you mentioned, say I want controll a motor by sending the signal through a series port, I think the "actual send signal code" should be written in a node "control_signal_publisher", the messge is given to the topic not the actual SBC port. And I should assure the sended signal and the messge is the same. Is that right?
Comment by osilva on 2022-01-02:
Take a look at this example using Arduino and rosserial: https://www.google.com/amp/s/atadiat.com/en/e-rosserial-arduino-introduction/
I think you can do something similar. Not sure what do you mean by assuring the sent signal and message are the same, can you explain further pls
Comment by osilva on 2022-01-02:
If the answer responded the original question please accept by clicking on the check mark
Comment by zhixin on 2022-01-02:
First thanks for the rosserial example, it solve my confusion. Then forget about "assuring the sent signal and message are the same". I just misundertand the communication between SBC and Arduino board: not realized that there is ros interface not only on SBC but also on Arduino. So rosseriel and ros_lib do the stuff I meant. User needn't to directly handle the seriel port(connect SBC and Arduino) stuff.