-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update docs for global planning * Remove no longer needed package tf_relay * Move odometry_conversion package to robot_interface * Update robot interface docs * Organize Robot docs
- Loading branch information
1 parent
2fef687
commit fddb6cd
Showing
39 changed files
with
509 additions
and
499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Interface | ||
|
||
The interface defines the communication between the autonomy stack running on the onboard computer and the robot's control unit. | ||
For example, for drones it converts the control commands from the autonomy stack into MAVLink messages for the flight controller. | ||
|
||
==TODO: This is not our diagram, must replace.== | ||
 | ||
|
||
The code is located under `AirStack/ros_ws/src/robot/autonomy/0_interface/`. | ||
|
||
## Launch | ||
|
||
Launch files are under `src/robot/autonomy/0_interface/interface_bringup/launch`. | ||
|
||
The main launch command is `ros2 launch interface_bringup interface.launch.xml`. | ||
|
||
|
||
## RobotInterface | ||
|
||
Package `robot_interface` is a ROS2 node that interfaces with the robot's hardware. | ||
The `RobotInterface` _gets robot state_ and forwards it to the autonomy stack, | ||
and also _translates control commands_ from the autonomy stack into the command for the underlying hardware. | ||
Note the base class is unimplemented. | ||
Specific implementations should extend `class RobotInterface` in `robot_interface.hpp`, for example `class MAVROSInterface`. | ||
|
||
### State | ||
The `RobotInterface` class broadcasts the robot's pose as a TF2 transform. | ||
It also publishes the robot's odometry as a `nav_msgs/Odometry` message to `$(arg robot_name)/0_interface/robot_0_interface/odometry`. | ||
|
||
### Commands | ||
The commands are variations of the two main command modes: Attitude control and Position control. | ||
These are reflected in [MAVLink](https://mavlink.io/en/messages/common.html#SET_POSITION_TARGET_LOCAL_NED) and supported by both PX4 and [Ardupilot](https://ardupilot.org/dev/docs/copter-commands-in-guided-mode.html#movement-commands). | ||
|
||
The Robot0_interface node subscribes to: | ||
|
||
- `/$(arg robot_name)/interface/cmd_attitude_thrust` of type `mav_msgs/AttitudeThrust.msg` | ||
- `/$(arg robot_name)/interface/cmd_rate_thrust` of type `mav_msgs/RateThrust.msg` | ||
- `/$(arg robot_name)/interface/cmd_roll_pitch_yawrate_thrust` of type `mav_msgs/RollPitchYawrateThrust.msg` | ||
- `/$(arg robot_name)/interface/cmd_torque_thrust` of type `mav_msgs/TorqueThrust.msg` | ||
- `/$(arg robot_name)/interface/cmd_velocity` of type `geometry_msgs/TwistStamped.msg` | ||
- `/$(arg robot_name)/interface/cmd_position` of type `geometry_msgs/PoseStamped.msg` | ||
|
||
All messages are in the robot's body frame, except `velocity` and `position` which use the frame specified by the message header. | ||
|
||
## MAVROSInterface | ||
The available implementation in AirStack is called `MAVROSInterface` implemented in `mavros_interface.cpp`. It simply forwards the control commands to the Ascent flight controller (based on Ardupilot) using MAVROS. | ||
|
||
## Custom Robot Interface | ||
If you're using a different robot control unit with its own custom API, then you need to create an associated RobotInterface. Implementations should do the following: | ||
|
||
### Broadcast State | ||
Implementations of `RobotInterface` should obtain the robot's pose and broadcast it as a TF2 transform. | ||
|
||
Should look something like: | ||
```c++ | ||
// callback function triggered by some loop | ||
void your_callback_function(){ | ||
// ... | ||
geometry_msgs::msg::TransformStamped t; | ||
// populate the transform, e.g.: | ||
t.header = // some header | ||
t.transform.translation.x = // some value | ||
t.transform.translation.y = // some value | ||
t.transform.translation.z = // some value | ||
t.transform.rotation = // some quaternion | ||
// Send the transformation | ||
this->tf_broadcaster_->sendTransform(t); | ||
// ... | ||
} | ||
``` | ||
==TODO: our code doesn't currently do it like this, it instead uses an external odometry_conversion node.== | ||
|
||
### Override Command Handling | ||
Should override all `virtual` functions in `robot_interface.hpp`: | ||
|
||
- `cmd_attitude_thrust_callback` | ||
- `cmd_rate_thrust_callback` | ||
- `cmd_roll_pitch_yawrate_thrust_callback` | ||
- `cmd_torque_thrust_callback` | ||
- `cmd_velocity_callback` | ||
- `cmd_position_callback` | ||
- `request_control` | ||
- `arm` | ||
- `disarm` | ||
- `is_armed` | ||
- `has_control` |
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Perception | ||
These modules process raw sensor data into useful information for the robot. For example: for detecting obstacles, localizing the robot, and recognizing objects. | ||
|
||
Perception modules typically output topics in image space or point cloud space. This information then gets aggregated into global and local world models later in the pipeline. | ||
|
||
Common perception modules include: | ||
|
||
- semantic segmentation | ||
- VIO (Visual Inertial Odometry) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Local Controls | ||
|
||
## Trajectory Controller | ||
The controller should publish control commands directly to topics defined by the [Robot Interface](../0_interface/robot_interface.md). | ||
|
||
## Trajectory Controller | ||
|
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
# Robot Autonomy | ||
# Autonomy Modules | ||
|
||
## Modules | ||
|
||
- [0_interface](0_interface/index.md) | ||
- [1_sensors](1_sensors/index.md) | ||
- [2_perception](2_perception/README.md) | ||
- [3_local](3_local/README.md) | ||
- [4_global](4_global/README.md) | ||
- [5_behavior](5_behavior/README.md) | ||
|
||
## System Diagram | ||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Robot | ||
|
||
## Launch Structure | ||
Each high-level module has a `*_bringup` package that contains the launch files for that module. The launch files are located in the `launch` directory of the `*_bringup` package. The launch files are named `*.launch.(xml/yaml/py)` and can be launched with `ros2 launch <module_name>_bringup <module_name>.launch.(xml/yaml/py)`. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.