Welcome to ROSMASTER M3 repository
6.Modify Control Board Firmware Parameters
Modify the Firmware Parameters of the Car's Control Board
Modify the Firmware Parameters of the Car's Control Board1. Hardware Connection2. Modify Parameters3. Write Configuration
This course requires that the car has already been flashed with the factory firmware before you can configure the firmware parameters. The purpose of modifying the control board's firmware parameters is to make the car's functions better suit individual needs. The factory firmware comes with default parameters, which do not need to be modified unless necessary.
The car's control board has been flashed with the factory firmware at the factory. If you have flashed other firmware, please re-flash the factory firmware according to the course [13.Control Board Course-1.Development environment setup-4.Burning STM32 firmware using serial port]. The factory firmware is located in the [Firmware_DriverFile\Control Board Factory Firmware] folder.
This course uses the Jetson Orin series mainboard as an example; the operation is the same for other mainboards.
Note: Before running the configuration modification script, you need to close the microros agent first.
1. Hardware Connection
Ensure that the Type-C USB Connect interface of the control board is connected to the USB port of the mainboard.
2. Modify Parameters
Open the system terminal, find and open the [config_robot.py] file in the user directory.
vim ~/config_robot.py
Scroll to the bottom of the file. The configuration parameters mainly include set_ros_domain_id, set_ros_namespace, set_motor_pid_parm, set_imu_yaw_pid_parm, set_ros_scale_line, set_ros_scale_angular, and set_arm_mid_value.
If you need to modify a parameter, please remove the comment symbol in front of the corresponding function.
x# robot.set_ros_domain_id(30)# robot.set_ros_namespace("")# robot.set_motor_pid_parm(0.8, 0.06, 0.5)# robot.set_imu_yaw_pid_parm(0.6, 0, 0.3)# robot.set_ros_scale_line(1.0)# robot.set_ros_scale_angular(1.0)# arm_mid_value = [2000, 2000, 2000, 2000, 1486, 3100]# robot.set_arm_mid_value(arm_mid_value)
set_ros_domain_id sets the car's ROS DOMAIN ID, with a range of 0~100. If there are multiple devices on the local network, set a different ROS DOMAIN ID for each to avoid interference. Note that it must be consistent with the ROS_DOMAIN_ID value in the system terminal's .bashrc file for communication.
set_ros_namespace sets the car's ROS namespace, mainly used for multi-car control functions on a local network.
set_motor_pid_parm sets the PID parameters for the car's motor speed.
set_imu_yaw_pid_parm sets the PID parameters for the car's direction calibration using the IMU.
set_ros_scale_line sets the scaling ratio for the car's ROS linear velocity.
set_ros_scale_angular sets the scaling ratio for the car's ROS angular velocity.
set_arm_mid_value sets the median deviation of the robotic arm, mainly used to quickly restore the robotic arm's calibration values. It generally does not need to be modified. Note: If you modify this value, it will affect the calibrated values of the robotic arm. If you need to calibrate the robotic arm, please refer to the robotic arm calibration tutorial.
Here is an example of modifying the domain id to 31:

3. Write Configuration
Note: Before running the configuration modification script, you need to close the microros agent first.
Open the system terminal and run the following command to start writing the configuration:
xxxxxxxxxxpython3 ~/config_robot.py

You can see all the parameter values that are finally read.