Skip to content

Commit

Permalink
Merge branch 'main' into control_board
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-gt committed Jun 23, 2024
2 parents 57be4d9 + 2be2deb commit ac8b521
Show file tree
Hide file tree
Showing 93 changed files with 5,733 additions and 1,591 deletions.
49 changes: 41 additions & 8 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
FROM ghcr.io/clubcapra/gazebo:harmonic
FROM ros:humble-ros-base

# Add vscode user with same UID and GID as your host system
# (copied from https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user)
ARG USERNAME=rove
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# ENV variables
ENV ROS_DISTRO=humble
ENV GZ_VERSION=harmonic

WORKDIR /workspace/$USERNAME

RUN groupadd --gid $USER_GID $USERNAME \
RUN groupadd --gid $USER_GID $USERNAME || true \
&& groupadd -g 107 input \
&& useradd -s /bin/bash --uid $USER_UID -g $USER_GID -G 107 -m $USERNAME \
&& apt-get update \
&& apt-get install -y sudo \
&& apt-get install -y sudo tesseract-ocr \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# Give user serial device permission
RUN usermod -a -G dialout $USERNAME

# Update all packages
RUN apt update && apt upgrade -y

Expand All @@ -25,16 +32,42 @@ RUN apt install -y git python3-pip
# Install custom python libraries
RUN pip install capra_micro_comm_py@git+https://github.com/clubcapra/capra_micro_comm_py.git@master python-can@git+https://github.com/IliTheButterfly/python-can.git@main --no-input

# Copy to preload the ros packages
COPY ./ /workspace/$USERNAME/
# Install necessary packages for Gazebo Garden and its dependencies
RUN apt-get update && apt-get install -y \
software-properties-common \
wget \
lsb-release \
gnupg \
curl

# Install Gazebo
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null

RUN apt update -y --fix-missing

# Change user
RUN chown $USER_UID:$USER_GID /workspace/$USERNAME

USER $USERNAME

# Copy to preload the ros packages
COPY ./ /workspace/$USERNAME/

# Source the ROS setup file
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc

COPY --chown=$USERNAME ./ /workspace/$USERNAME

# Add needed packages
RUN vcs import src < rove.repos


# Rosdep update
RUN rosdep update

# Install ROS dependencies
RUN rosdep install --from-paths src --ignore-src --rosdistro humble -y

# Source the ROS setup file
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc
RUN echo "source /gazebo/gazebo_ws/install/setup.bash" >> ~/.bashrc
# Install gzharmonic after rosdep install
RUN sudo apt install -y ros-humble-ros-gzharmonic
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build/
log/
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ jobs:

steps:
- name: Check out the repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Build docker compose
run: |
docker compose run --user root devcontainer bash -c "colcon build"
docker compose build --build-arg USER_UID=$(id -u) --build-arg USER_GID=$(id -g)
- name: Build rove
run: |
docker compose run devcontainer bash -c "colcon build --packages-ignore zed_components zed_wrapper"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ __pycache__/

# Ignore files related to your dev environment
.vscode/

# generated map database by rtabmap
*.db
68 changes: 55 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Rove is a robot developed by the Capra team at ÉTS. Utilizing ROS2 Humble, Rove

## Work in a docker container (Preferred)

Working in a dev container will allow you to have the same environnement as the CI and make sure that your code will work on another computer. It will also allow you to easily switch package version and test thing without breaking your computer.
Working in a dev container will allow you to have the same environment as the CI and make sure that your code will work on another computer. It will also allow you to easily switch package version and test things without breaking your computer.

### Windows installation
### Windows docker installation

1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop)
2. Install [Visual Studio Code](https://code.visualstudio.com/)
Expand All @@ -17,26 +17,31 @@ Working in a dev container will allow you to have the same environnement as the
7. Wait for the container to build
8. Start Xserver with the ```-nowgl``` option (double click on the shortcut to open it if you use VcXsrv)

### Linux installation
### Linux docker installation

Same as the windows installation, step 4 and 8 can be skiped.
Same as the windows installation, step 3 and 8 can be skipped.

Replace the DISPLAY environemnt variable in the .env file
Replace the DISPLAY environment variable in the .env file
```bash
echo DISPLAY=$DISPLAY
```

To be able to use the controller node, the user need read/write permissions on the inputs.
Exemple:
Example:
```bash
cat /dev/input/event0
```

**Suggestion:** Configure docker to be able to run as non-root user https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user

## Native installation (Ubuntu 22.04 LTS, other distros not supported)
Pour installer vcs tool et ROS: https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html#id4
## Native/WSL installation (Ubuntu 22.04 LTS, other distros not supported)

To install ROS2 and vcs natively: https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html

Note: At the step `sudo apt install ros-humble-desktop` do `sudo apt install ros-humble-desktop-full` instead.

```bash
git clone https://github.com/gazebosim/ros_gz.git -b humble # Install gazebo locally
git clone https://github.com/clubcapra/rove.git
vcs import src < rove.repos
pip install capra_micro_comm_py@git+https://github.com/clubcapra/capra_micro_comm_py.git@master python-can@git+https://github.com/IliTheButterfly/python-can.git@main
Expand All @@ -46,10 +51,21 @@ source install/setup.bash

## Running Rove in simulation

IF YOU ARE RUNNING IN WSL: do this command
```bash
export LIBGL_ALWAYS_INDIRECT=0 export LIBGL_ALWAYS_SOFTWARE=1
```
Do these commands to run the gazebo simulation with physics enabled
```bash
colcon build --symlink-install
source install/setup.bash
ros2 launch rove_description sim.launch.py
ros2 launch rove_bringup sim.launch.py
```
OR Do these commands to only run the rviz simulation (with joints control)
```bash
colcon build --symlink-install
source install/setup.bash
ros2 launch rove_description launch.py
```

## Running the controller with a usb cable
Expand All @@ -59,11 +75,37 @@ source install/setup.bash
ros2 launch rove_bringup rove_controller_usb.launch.py
```

## Running the controller with a usb cable
## Running the controller with bluetooth

```bash
source install/setup.bash
ros2 launch rove_bringup rove_controller_bluethoot.launch.py
ros2 launch rove_bringup rove_controller_bluetooth.launch.py
```

## Launch VectorNav node
```bash
ros2 launch rove_bringup vectornav.launch.py
```

## Using the Robotiq gripper
Launch the gripper controller:
```bash
ros2 launch robotiq_description robotiq_control.launch.py
```

Close the gripper (set to 1m to reduce command lenght):
```bash
ros2 action send_goal /robotiq_gripper_controller/gripper_cmd control_msgs/action/GripperCommand "{command:{position: 1, max_effort: 1.0}}"
```

Open the gripper:
```bash
ros2 action send_goal /robotiq_gripper_controller/gripper_cmd control_msgs/action/GripperCommand "{command:{position: 0, max_effort: 1.0}}"
```

View the gripper in RViz:
```bash
ros2 launch robotiq_description view_gripper.launch.py
```

## Adding New Packages
Expand Down Expand Up @@ -99,10 +141,10 @@ This package serves as a comprehensive wrapper for SLAM operations, incorporatin

## Docker architecture

It's possible to run the entire project into multiple docker containers. Each container can be run independantly and are built using the following structure :
It's possible to run the entire project into multiple docker containers. Each container can be run independently and are built using the following structure :

![Docker structure](https://www.plantuml.com/plantuml/svg/VP71Ri8m38RlUOgezwvZq8vnc3XmsLDKJkgLGEj4JbfjU_gr0QgWJHoGVjl_xtouUn-0mz1tyc3r6Ldwm8CE0wCGmOGEPNOTVFJGeZoWGsgGj46V2S6e0r0xszgZvYTZ2zqDIeDZA5huGMLtH-3Uaj6P12zlHPfawulfjpiElUemRz2VWtNHFhNhQ_qWCSbSWSSbCXUfdyOB6uscCL0O3w3ZWgzjLLURUS5BVLbMA_rPhak4jNfhLXLiomq0gjNhymfK2TigFdB2u2tLbWs9Ux1n_WEZjXJ0479qJmtihEkHGhrC_iGOl5F8_9qx4sFip0Fx1I6V4HAa922IPsMUlzyTCz5njdoNcuZT_y55jg3A2NLsBbUNOb6nxSnTy8G-M98HEXhIGoOwdINvFL8pz9tu1G00 "Docker structure")

# Documentation

To update the UML diagram, create a new encoded link on the PlantUML website. Copy the existing UML, make your changes, and then update the markdown file with the new link.
To update the UML diagram, create a new encoded link on the PlantUML website. Copy the existing UML, make your changes, and then update the Markdown file with the new link.
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ services:
build:
context: .
dockerfile: ./.devcontainer/Dockerfile
args:
- USER_UID=${USER_UID:-1000}
- USER_GID=${USER_GID:-1000}
volumes:
- ./:/workspace/rove
- /tmp/.X11-unix:/tmp/.X11-unix
Expand Down
2 changes: 1 addition & 1 deletion docs/docker_architecture_dev.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title "Docker Image Dependencies"
rectangle "ghcr.io/clubcapra/gazebo:harmonic" as harmonic
rectangle "ros/ros:humble-desktop" as ros_desktop
rectangle "ros/ros:humble-ros-base" as ros_base
rectangle "nvcr.io/nvidia/isaac/ros:x86_64-ros2_humble_bcf535ea3b9d16a854aaeb1701ab5a86" as jetson_orin
rectangle "nvcr.io/nvidia/isaac/ros:aarch64-ros2_humble_b7e1ed6c02a6fa3c1c7392479291c035" as jetson_orin

rectangle "rove-devcontainer" as development_container
rectangle "rove-raspberry-pi" as rpi_container
Expand Down
36 changes: 34 additions & 2 deletions rove.repos
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
repositories:
capra_gazebo:
ovis_ros2:
type: git
url: https://github.com/clubcapra/capra_gazebo.git
url: https://github.com/clubcapra/ovis_ros2
version: new-env-with-arm
ros_odrive:
type: git
url: https://github.com/IliTheButterfly/ros_odrive.git
version: 0fa84d3745a8c385076d29b7f54971e9f2d14de7
vectornav:
type: git
url: https://github.com/dawonn/vectornav.git
version: ros2
zed_wrapper:
type: git
url: https://github.com/stereolabs/zed-ros2-wrapper.git
version: master
zed_wrapper/zed-ros2-interfaces:
type: git
url: https://github.com/stereolabs/zed-ros2-interfaces.git
version: main
ros2_robotiq_gripper:
type: git
url: https://github.com/PickNikRobotics/ros2_robotiq_gripper.git
version: main
serial:
type: git
url: https://github.com/tylerjw/serial.git
version: ros2
control_msgs:
type: git
url: https://github.com/ros-controls/control_msgs.git
version: humble
ros2_control:
type: git
url: https://github.com/ros-controls/ros2_control.git
version: humble
5 changes: 4 additions & 1 deletion src/rove_bringup/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ project(rove_bringup)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(control_msgs REQUIRED)

add_executable(rove_controller_node src/rove_controller_node.cpp)

# Link dependencies
ament_target_dependencies(rove_controller_node rclcpp sensor_msgs)
ament_target_dependencies(rove_controller_node rclcpp sensor_msgs geometry_msgs control_msgs rclcpp_action)

# Install executable
install(TARGETS
Expand Down
30 changes: 30 additions & 0 deletions src/rove_bringup/config/VLP16_velodyne_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# from https://github.com/ros-drivers/velodyne/tree/ros2
velodyne_driver_node:
ros__parameters:
device_ip: 192.168.84.201 # be sure that your ip adress is 192.168.84.150/24 or look destination in the velodyne settings
gps_time: false
time_offset: 0.0
enabled: true
read_once: false
read_fast: false
repeat_delay: 0.0
frame_id: velodyne_laser
model: VLP16
rpm: 600.0
port: 2368
timestamp_first_packet: false

velodyne_laserscan_node:
ros__parameters:
ring: -1
resolution: 0.007

velodyne_transform_node:
ros__parameters:
model: VLP16
min_range: 0.9
max_range: 130.0
view_direction: 0.0
fixed_frame: "base_link"
target_frame: "velodyne_laser"
organize_cloud: true
53 changes: 53 additions & 0 deletions src/rove_bringup/config/VLP16db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# callibration of the Velodyne lidar
# from https://github.com/ros-drivers/velodyne/tree/ros2
lasers:
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 0, rot_correction: 0.0,
vert_correction: -0.2617993877991494, vert_offset_correction: 0.0112}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 1, rot_correction: 0.0,
vert_correction: 0.017453292519943295, vert_offset_correction: -0.0007}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 2, rot_correction: 0.0,
vert_correction: -0.22689280275926285, vert_offset_correction: 0.0097}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 3, rot_correction: 0.0,
vert_correction: 0.05235987755982989, vert_offset_correction: -0.0022}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 4, rot_correction: 0.0,
vert_correction: -0.19198621771937624, vert_offset_correction: 0.0081}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 5, rot_correction: 0.0,
vert_correction: 0.08726646259971647, vert_offset_correction: -0.0037}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 6, rot_correction: 0.0,
vert_correction: -0.15707963267948966, vert_offset_correction: 0.0066}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 7, rot_correction: 0.0,
vert_correction: 0.12217304763960307, vert_offset_correction: -0.0051}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 8, rot_correction: 0.0,
vert_correction: -0.12217304763960307, vert_offset_correction: 0.0051}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 9, rot_correction: 0.0,
vert_correction: 0.15707963267948966, vert_offset_correction: -0.0066}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 10, rot_correction: 0.0,
vert_correction: -0.08726646259971647, vert_offset_correction: 0.0037}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 11, rot_correction: 0.0,
vert_correction: 0.19198621771937624, vert_offset_correction: -0.0081}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 12, rot_correction: 0.0,
vert_correction: -0.05235987755982989, vert_offset_correction: 0.0022}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 13, rot_correction: 0.0,
vert_correction: 0.22689280275926285, vert_offset_correction: -0.0097}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 14, rot_correction: 0.0,
vert_correction: -0.017453292519943295, vert_offset_correction: 0.0007}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 15, rot_correction: 0.0,
vert_correction: 0.2617993877991494, vert_offset_correction: -0.0112}
num_lasers: 16
distance_resolution: 0.002
Loading

0 comments on commit ac8b521

Please sign in to comment.