Skip to content

Commit

Permalink
Two ROS2 workspaces documented for setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hbuurmei committed Sep 24, 2024
1 parent b880691 commit 2586d2d
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 9 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Cache files
.DS_Store
.cache

# ROS2 compilation files
**/build/
**/install/
**/log/
**/log/

# External packages
**/mocap_msgs/
**/mocap4r2/
**/mocap4ros2_optitrack/
6 changes: 5 additions & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ This should be installed using the following command:
```bash
pip install mkdocs-material
```
Additionally, we make use of a number of plugins, that can be installed as:
```bash
pip install pymdown-extensions mkdocs-git-committers-plugin-2 mkdocs-git-revision-date-localized-plugin
```
**Note:** The documentation is built automatically using GitHub Actions, so there is no need to build it locally. Always push to the `main` branch.
In case you want to preview the updates locally, simply use:
```bash
mkdocs serve
```
in the main directory, and open the browser as instructed.
in the main directory, and open the preview in the browser as instructed.
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This documentation provides a detailed guide to the setup, configuration, and us
![Trunk robot](assets/trunk-closeup.jpg){ align=right width=40% }

## Contents
- **Design**: Documentation for full-system software, electrical, and mechanical design. Inlcudes BOM, CAD assets, circuit diagram, and design considerations.
- **Setup**: Instructions for setting up the hardware and software. This shall be referenced for repairs, upgrades, and new installations.
- **Usage**: Description on how to use the Trunk Robot.
- **Contributing**: Guidelines for contributing to the development of the Trunk Robot project.
- **Design:** Documentation for full-system software, electrical, and mechanical design. Inlcudes BOM, CAD assets, circuit diagram, and design considerations.
- **Setup:** Instructions for setting up the hardware and software. This shall be referenced for repairs, upgrades, and new installations.
- **Usage:** Description on how to use the Trunk Robot.
- **Contributing:** Guidelines for contributing to the development of the Trunk Robot project.
68 changes: 67 additions & 1 deletion docs/ros2_workspaces.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,73 @@
# ROS2 Workspaces

Before setting up the ROS2 workspaces needed to control the robot, please make sure you have cloned this repository:
```bash
gh repo clone StanfordASL/trunk-stack
```
The ROS2 code lives in the `stack/` directory.

## Main Workspace
**Note:** This workspace runs on the main machine.

Enter the `main/` folder.
We primarily use ROS2 Humble, which should be sourced before doing the first build:
```bash
source /opt/ros/humble/setup.bash
```
For actually building the workspace, we use Colcon, i.e. run:
```bash
colcon build
```
in the `main/` directory and subsequently source the new install:
```bash
source install/setup.bash
```
Check that the build process runs without any errors.

## Motion Capture Workspace
**Note:** This workspace runs on the main machine.

Make sure you have set up the motion capture system as described in the [OptiTrack System Setup](./optitrack.md) page.

Enter the `mocap/` folder. Most code is already present, except for the `mocap4ros2_optitrack` plugin, which can be installed by following the instructions on the [respective website](https://github.com/MOCAP4ROS2-Project/mocap4ros2_optitrack).
For completeness, we also list the steps here.

Enter the `src/` directory.
Download the plugin's repository:
```
git clone https://github.com/MOCAP4ROS2-Project/mocap4ros2_optitrack.git
```
Install dependencies:
```
rosdep install --from-paths src --ignore-src -r -y
vcs import < mocap4ros2_optitrack/dependency_repos.repos
```
Now, make sure that configuration file, located in `mocap4ros2_optitrack/mocap4ros2_optitrack_driver/config/`, has the correct information.
Specifically, the `server_address` should be equal to the address that Motive is streaming to (see the Local Interface entry in the Streaming pane in Motive), and `local_address` should be the address of the main machine, that will be running this workspace.

Once that information is entered correctly, compile the workspace:
```bash
cd .. # enter 'mocap' dir.
colcon build --symlink-install
```
Do make sure that ROS2 Humble is sourced again before building. Certain warnings can come up but may be ignored.

Then, check that the Optitrack configuration works fine and is connected by running it once:
```bash
ros2 launch mocap4r2_optitrack_driver optitrack2.launch.py
```
This should say "Configured!" as a last message.
As the driver node is a lifecycle node, you should transition to activate:
```
ros2 lifecycle set /mocap4r2_optitrack_driver_node activate
```
which should return "Transitioning successful".

## Motor Control Workspace
**Note:** This workspace runs on the Raspberry Pi.

For the control of the motors, we use the [ros_phoenix](https://github.com/vanderbiltrobotics/ros_phoenix) package.
Due to compatibility constraints of this package, we use ROS2 Foxy for this workspace.

Clone the `trunk-stack` repository on the Pi and enter the `motors/` folder.

## Main Workspace
1 change: 1 addition & 0 deletions docs/software_design.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Description
The software stack of the ASL Trunk Robot is primarily developed in ROS2, and can be divided into three components: main, motion capture and motor control.
We assume that several computing resources are available: a Rapsberry Pi for executing the motor control, a main linux machine for running the experiments, and a Windows machine for running the motion capture Motive software.

## ROS2 Graph
The diagrams are generated using [ros2_graph](https://github.com/kiwicampus/ros2_graph/).
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ nav:
- Software: software_design.md
- Setup:
- 3D Printing: 3d_printing.md
- OpiTrack System: optitrack.md
- OptiTrack System: optitrack.md
- ROS2 Workspaces: ros2_workspaces.md
- Usage:
- Motion Capture: mocap.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mocap4r2_optitrack_driver_node:
ros__parameters:
connection_type: "Unicast" # Unicast / Multicast
server_address: "10.93.181.100"
local_address: "10.93.181.147"
local_address: "10.93.181.104"
multicast_address: "239.255.42.99"
server_command_port: 1510
server_data_port: 1511
Expand Down

0 comments on commit 2586d2d

Please sign in to comment.