Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update README.md of chassis controller #9

Merged
merged 1 commit into from Aug 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
259 changes: 133 additions & 126 deletions rm_chassis_controllers/README.md
@@ -1,32 +1,62 @@
# rm_chassis_controllers

## 1. Overview
## Overview

The Controller is RoboMaster robot chassis controller, balance, swerve and mecanum included.
There are four states: raw, follow, gyro and twist. The output torque and speed of each motor of the chassis can be calculated according to the current state of the control, the received speed and pose of the pan/tilt, and the speed and acceleration commands, and the data is returned by the motor to calculate The speed and posture of the chassis are released. The control algorithm involved in the chassis controller is PID algorithm.

***Keywords***: mecanum, swerve, balance, chassis.
**Keywords:** mecanum, swerve, balance, chassis, ROS, RoboMaster

### License
The source code is released under a [BSD 3-Clause license](http://192.168.0.100:7070/dynamicx/rm_gimbal_controllers/-/blob/master/LICENSE)
#### Author: DynamicX
#### Affiliation: DynamicX
#### License

The source code is released under a [BSD 3-Clause license](https://github.com/rm-controls/rm_controllers/blob/master/rm_chassis_controllers/LICENSE).

**Author: DynamicX**

**Affiliation: DynamicX**

**Maintainer: DynamicX**

The package has been tested under [ROS](https://www.ros.org/) Indigo, Melodic and Noetic on respectively Ubuntu 18.04 and 20.04. This is research code, expect that it changes often and any fitness for a particular purpose is disclaimed.

[![Build Status](http://rsl-ci.ethz.ch/buildStatus/icon?job=ros_best_practices)](http://rsl-ci.ethz.ch/job/ros_best_practices/)
### Hardware interface type

`JointStateInterface`

Used to get the position and speed of the chassis joint.

`EffortJointInterface`

Used to send the torque command of the chassis joint.

## 2. Installation
`RoboSateInterface`

Used for high-frequency maintenance of the transformation relationship of changing odom to base_link.

## Installation

### Installation from Packages

To install all packages from the this repository as Debian packages use

```
sudo apt-get install ros-noetic-rm-chassis-controllers
```

#### 2.1. Installation from Packages
sudo apt-get install ros-noetic-...
Or better, use `rosdep`:

sudo rosdep install --from-paths src
```
sudo rosdep install --from-paths src
```

### Building from Source

#### Dependencies

#### 2.2. Building from Source
##### 2.2.1. Dependencies
* [Robot Operating System (ROS) ](http://wiki.ros.org/) ( middleware for robotics )
* [Eigen](https://eigen.tuxfamily.org/index.php?title=Main_Page) ( linear algebra library )
* [Robot Operating System (ROS)](http://wiki.ros.org/) (middleware for robotics),
* roscpp
* roslint
* rm_msgs
* rm_common
* pluginlib
* hardware_interface
* controller_interface
Expand All @@ -37,186 +67,162 @@ Or better, use `rosdep`:
* tf2
* tf2_geometry_msgs
* angles
* roscpp
* roslint
* rm_msgs
* rm_common
* imu_sensor_controller
* robot_localization
* robot_state_controller
* rm_description
* rm_gazebo


#### 2.2.2. Building
#### Building

To build from source, clone the latest version from this repository into your catkin workspace and compile the package using
* Build this package with catkin build. Clone the latest version from this repository into your catkin workspace.

cd catkin_workspace/src
git clone https://github.com/ethz-asl/ros_best_practices.git
cd ../
rosdep install --from-paths . --ignore-src
catkin_make
```
catkin_workspace/src
git clone https://github.com/rm-controls/rm_controllers.git
rosdep install --from-paths . --ignore-src
catkin build
```

## Usage

## 3. Usage
Run the controller with mon launch:

* Run the controller with mon launch:
```
mon launch rm_chassis_controllers load_controllers.launch
```

mon launch rm_chassis_controller load_controllers.launch
## 4. Config
## Launch files

* ***auto.yaml***: It loads some controllers and the parameters used for auto into the parameter server.
* ***balance.yaml***: It loads some controllers and the parameters used for balance into the parameter server.
* ***localization.yaml***: It loads some controllers and the parameters used for localization into the parameter server.
* ***engineer.yaml***: It loads some controllers and the parameters used for engineer robot into the parameter server.
* ***hero.yaml***: It loads some controllers and the parameters used for hero robot into the parameter server.
* ***sentry.yaml***: It loads some controllers and the parameters used for sentry robot into the parameter server.
* ***standard3.yaml***: It loads some controllers and the parameters used for standard3 robot into the parameter server.
* ***standard4.yaml***: It loads some controllers and the parameters used for standard4 robot into the parameter server.
* ***standard5.yaml***: It loads some controllers and the parameters used for standard5 robot into the parameter server.
## 5. Launch files
* **load_controllers.launch:** It loads tf, robot_localization and some controllers, robot_state_controller, joint_state_controller and chassis controller are included.

* ***load_controllers.launch***: It loads tf, robot_localization and some controllers, robot_state_controller, joint_state_controller and chassis controller
## 6. ROS API
## ROS API

### 6.1. Description
The controller main input is a [geometry_msgs::Twist](http://docs.ros.org/api/geometry_msgs/html/msg/Twist.html) topic in the namespace of the controller.
### 6.2 Subscribed Topics
#### Subscribed Topics

* `base_imu`( [sensor_msgs/Imu](http://docs.ros.org/en/api/sensor_msgs/html/msg/Imu.html) )
* **`base_imu`** ([sensor_msgs/Imu](http://docs.ros.org/en/api/sensor_msgs/html/msg/Imu.html))

Inertial Measurement Unit data.
The inertial measurement unit data of base command.

* `command`( )
* **`command`** (rm_msgs::ChassisCmd)

Velocity command.
Set the mode, acceleration, and maximum power of the chassis.

* `cmd_vel`( [geometry_msgs/Twist](http://docs.ros.org/en/api/geometry_msgs/html/msg/Twist.html) )
* **`cmd_vel`** ([geometry_msgs/Twist](http://docs.ros.org/en/api/geometry_msgs/html/msg/Twist.html))

Velocity command.
Set the speed of the chassis.

### 6.3 Published Topics
#### Published Topics

* `state_real`( )
* **`state_real`** (rm_msgs::BalanceState)

Publish the real state.
* **`odom`**([nav_msgs/Odometry](http://docs.ros.org/en/api/nav_msgs/html/msg/Odometry.html))

* `odom`( [nav_msgs/Odometry](http://docs.ros.org/en/api/nav_msgs/html/msg/Odometry.html) )

Odometry computed from the hardware feedback.
Chassis odometer information (speed, position, covariance).

### 6.4 Parameters
#### Parameters

#### 6.4.1 common
##### common

* `joint_left_name` (`string` | string [ ... ])
* **`wheel_radius`** (double)

Left wheel joint name or list of joint names.

* `joint_right_name` (`string` | string [ ... ])

Right wheel joint name or list of joint names.
Radius of the wheels.

* `wheel_radius` ( `double`, default: 0.02 )
* **`wheel_track`** (double)

Radius of the wheels. It is expected they all have the same size. The rm_chassis_controller will attempt to read the value from the URDF if this parameter is not specified.
The distance between the center of the left and right wheels on the same side.

* `wheel_track` ( `double`, default: 0.410 )
* **`wheel_base`** (double)

Distance between wheels. It is expected they all have the same size. The rm_chassis_controller will attempt to read the value from the URDF if this parameter is not specified.
The distance between the center of the front and rear wheels on the same side.

* `wheel_base` ( `double`, default: 0.320 )
* **`twist_angle`** (double)

Distance between the axes. It is expected they all have the same size. The rm_chassis_controller will attempt to read the value from the URDF if this parameter is not specified.
Amplitude of twist at the status of twist.

* `twist_angular` ( `double`, default: M_PI / 6 )

The velocity of angular in the twist mode.

* `enable_odom_tf` ( `bool`, default: true )
* **`enable_odom_tf`** (bool, default: true)

Publish to TF directly or not.

* `twist_covariance_diagonal` ( double [ 6 ] )
* **`twist_covariance_diagonal`** (double[6])

Diagonal of the covariance matrix for odometry twist publishing.
The diagonal covariance matrix of twist.

* `publish_rate` ( `double`, default: 50 )
* **`publish_rate`** (double, default: 50)

Frequency ( in Hz ) at which the odometry is published. Used for both tf and odom.
Frequency (in Hz) at which the topic is published.

* `coeff` ( `double` )
* **`coeff`** (double)

The power limit coeff.
The influence of power loss can be conservatively reduced by adjusting safety factor.

* `min_vel` ( `double` )
* **`min_vel`** (double)

Minimum angular velocity of single chassis wheel.
When the motor speed is lower than the minimum speed, the minimum speed is used to calculate the maximum torque.

* `timeout` ( `double` )
* **`timeout`** (double)

Allowed period ( in s ) allowed between two commands.
Allowed period (in s) between two commands. If the time is exceed this period, the speed of chassis will be set 0.

#### 6.4.2 Balance
##### Balance

* `joint_right_name` ( `string` | string [ ... ] )
* **`joint_left_name`** (string, default: "joint_left")

Left wheel joint name or list of joint names.

* `joint_right_name` (`string` | string [ ... ])
* **`joint_right_name`** (string, default: "joint_right")

Right wheel joint name or list of joint names.

* `com_pitch_offset` (`double`, default: 0 )
* **`com_pitch_offset`** (double, default: 0)

The reduction ratio of pitch.

* `a` ( `double [ 16 ]` )
* **`a`** (double[16])

State space expression.

* `b` ( `double [ 8 ]` )
* **`b`** (double[8])

State space expression.

* `q` ( `double [ 16 ]` )
* **`q`** (double[16])

Weight matrix.

* `r` ( `double [ 4 ]` )
* **`r`** (double[4])

Weight matrix.

#### 6.4.3 Swerve
* `modules`
##### Swerve

Data about each component.
* **`/modules/left_front/position`** (double[2])

## 7. Controller configuration examples
The position of left front wheel.

* **`/modules/left_front/pivot/offset`** (double)

The reduction ratio of left front pivot.

* **`/modules/left_front/wheel/radius`** (double)

The radius of left front wheel.

* **`/modules/right_front/position`** (double[2])

The position of right front wheel.

* **`/modules/left_back/position`** (double[2])

The position of left back wheel.

* **`/modules/right_back/position`** (double[2])

The position of right back wheel.


## Controller configuration examples

### Complete description

### 7.1. Minimal description
```
chassis_controller:
type: rm_chassis_controllers/MecanumController
publish_rate: 100
enable_odom_tf: true
wheel_radius: 0.07625
left_front:
joint: "left_front_wheel_joint"
pid: { p: 0.8, i: 0, d: 0.0, i_max: 0.0, i_min: 0.0, antiwindup: true, publish_state: true }
right_front:
joint: "right_front_wheel_joint"
pid: { p: 0.8, i: 0, d: 0.0, i_max: 0.0, i_min: 0.0, antiwindup: true, publish_state: true }
left_back:
joint: "left_back_wheel_joint"
pid: { p: 0.8, i: 0, d: 0.0, i_max: 0.0, i_min: 0.0, antiwindup: true, publish_state: true }
right_back:
joint: "right_back_wheel_joint"
pid: { p: 0.8, i: 0, d: 0.0, i_max: 0.0, i_min: 0.0, antiwindup: true, publish_state: true }
twist_covariance_diagonal: [ 0.001, 0.001, 0.001, 0.001, 0.001, 0.001 ]
```
### 7.2. Complete description
```
chassis_controller:
type: rm_chassis_controllers/MecanumController
Expand All @@ -236,7 +242,6 @@ chassis_controller:
joint: "right_back_wheel_joint"
pid: { p: 0.8, i: 0, d: 0.0, i_max: 0.0, i_min: 0.0, antiwindup: true, publish_state: true }
twist_covariance_diagonal: [ 0.001, 0.001, 0.001, 0.001, 0.001, 0.001 ]

wheel_base: 0.395
wheel_track: 0.374
power:
Expand All @@ -246,6 +251,8 @@ chassis_controller:
timeout: 0.1
pid_follow: { p: 5, i: 0, d: 0.8, i_max: 0.0, i_min: 0.0, antiwindup: true, publish_state: true }
```

## Bugs & Feature Requests

Please report bugs and request features using the [Issue Tracker](https://github.com/gdut-dynamic-x/rm_template/issues) .
Please report bugs and request features using the [Issue Tracker](https://github.com/rm-controls/rm_controllers/issues).