One of the challenges in developing robot hardware is handling communication with the motors and sending commands to them based on a trajectory generated in real time. Seamless communication between the motor driver and the controller becomes critical because the motor that accepts the trajectory is subject to time constraints. In addition, the controller receives the latest joint status (position, velocity, force) information from the motor to verify trajectory execution. Then the last remaining challenge is to actually generate the trace and send it to the motor driver.
To meet these requirements, the ROS(Robot Operating System) framework provides us with tools such as ROS-Control and RoS-MoveIt. ROS (Robot Operating System) is a software framework that implements state-of-the-art algorithms and tools to simplify robot hardware and software development with minimal effort.
Joint actuators can be controlled in a variety of ways, such as specifying joint positions, joint velocities, or joint forces, depending entirely on the level of control required for the application. Since all low-level processing, such as speed and torque control loops, is performed within the drive hardware, things are simpler if joint positions are used directly with the command executor. However, if a joint or joint force command executor is used, the positional interface must be generated by running a control loop on the command device, in our case the Linux machine running the ROS Control instance.
ROS-CONTROL
Ros-control is a ROS package capable of docking with a variety of hardware instances described above. To achieve this, ROS-Control provides an abstract representation of the implementation of the control loop, allowing control of any motor or actuator regardless of its hardware interface.
According to the official documentation, ROS-Control natively supports four types of hardware interfaces:
1. Joint command interface
Force joint interface
Velocity joint interface
Position joint interface
2. Joint status interface
This interface can be best understood by looking at the following figure.

ROS hardware interface memory concept diagram. Source: Ros_control
As you can see from the figure, ROS Control uses memory locations to communicate with actuators and motors. For example, if the motor must be ordered using the location interface, ROS Control simply writes the location requirement value at the memory location "POS_cmd_", which will be transmitted to the motor through the communication interface of the motor. In the case of the TMC4671 evaluation kit with Landungsbrucke, these interfaces can be RS232, USB serial port, or THE RN171XV/RN42XV wireless module. Similarly, for the speed and force interfaces, the required values are written to the corresponding predefined memory locations. Now, all that remains is how to read the joint state from the motor. Similar to the joint command interface, joint values are read into memory locations "pos_", "vel_", and "eff_".
Now, you can simply update these memory locations at regular intervals to command and read the joint interface. This process is easily explained with the following code snippet:
class trinamic: public hardware_interface::RobotHW
{
public:
trinamic();
void read();
void write();
};
Here, constructors can be used to initialize, for example, a communication interface (serial port in our implementation using Landungsbrucke). Further, the Trinamic ::read() and Trinamic ::write() functions are called periodically in the loop to update storage locations at fixed intervals.
ROS controller
After the hardware interface is up and running, we can generate one of the many controllers, such as POSItion_controllers, velocity_controllers, JOINT_STATE_controller, joint_trajectory_controller. These controllers are simply abstract representations of the hardware interface as ROS Topics. As mentioned above, position_controller can be started here using the speed joint interface to make the control loop run on the host. In addition, the Joint_trajectory_controller is compatible with all types of joint command interfaces. It is important to note that we should always check for conflicts to ensure that no two controllers have access to the same hardware interface at the same time.
Establish communication between ROS CONTROL and TMC4671
Thanks to the TMCL API, communication between ROS and TMC4671 can be established effortlessly with Landungsbrucke. As mentioned above, establishing communication through the USB serial port supports command positions (since we are establishing the hardware interface) and transport joint positions. After Landungsbrucke receives the command location, it writes the value to register 0x68, PID_POSITION_TARGET via SPI. In addition, the current position is obtained from registers 0x6B, PID_POSITION_ACTUAL and transmitted via the USB serial port. Since all of these values are 32-bit signed integers, the data is marshalled into four single-byte unsigned integers for sending and receiving.
How to set up
【 Video hardware servo control chip TMC4671 configuration process guidance 】
Initially, TMC4671 was set up according to the motor using Tmcl-IDE. For details, please watch the video on the configuration process of the hardware servo control chip TMC4671. Update register Settings received from the IDE in the init_motor() function in ros_control.c. Now, download ROSpackage in any workspace and start the hardware interface with the startup file. Any compatible ROS controller can be generated with the ROS Control node in the startup file. The controller can be configured in controller.yaml.
When using TMC4671 for position control, the most important part is adjusting the speed and PI gain of the position control loop. These loops can be manually adjusted using registers 0x58 and 0x5A. But it is highly recommended not to do so.
reference
S. Hitta, E. Marder-Eppstein, W. Meeussen, V. Pradeep, A. RodriguezTsouroukdissian, J. Bohren, D. Coleman, B. Magyar, G. Raiola, M. Ludtke and E. Fernandez Perdomo
"Ros_control: A Generic and Simple Control Framework for ROS"
Manly Battery
A leading Lithium battery manufacturer over 12 years ,widly used for Robostic industry,if there is any project need to evluate ,pls feel free tosend email to info@manlybatteries.com







