Skip to content
huskyroboticsteamPublic

About

Overhaul of Rover codebase.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

Pre-Setup Notes

Our codebase is developed for an NVIDIA Jetson TX2, which runs Ubuntu Linux; as such, much of our code will be Unix-specific.

⚠️ The only supported platform is Ubuntu 22.04 LTS. Other versions/distros/platforms may work, but if you want as easy as possible, go with this version.

We will be using vmware workstation for Windows, or UTM for Mac (For additional support, this installation process is based on CSE 478 virtual machine setup guide however please refer to instructions in this readme for specific files such as os images).

  1. First install the VM
    • Windows: vmware workstation, setup an account and install the desktop application.
    • Mac: UTM, click download from their page.
  2. Install the OS image to your laptop.
  3. Finish all of the install instructions for the ubuntu install (This will take a long time so go do some homework or look through the repo).
  4. Install basic requirements
    - sudo apt install git
  5. Setup SSH keys in the VM
  6. Clone the repo inside of the VM
    - git clone git@github.com:huskyroboticsteam/Overhaul.git
  7. Generate SSH keys
    - 'ssh-keygen -t ed25519 -C "your_email@example.com"'
  8. Add the keys to your githubs SSH Keys
  9. Clone the repository:
    - git clone git@github.com:huskyroboticsteam/Overhaul.git --recursive
  10. Follow ROS install instructions on the ROS website - Follow all instructions up until Try some examples
  11. Install Gazebo ign Fortress binaries
  12. Then install the ROS Gazebo dependencies install guide

Never update your VM! Ubuntu will try to do it for some reason, just don't do it. Same goes for os on laptops

Next open a terminal and enter the Overhaul folder within this repo

cd \Overhaul

Then build the docker container

ctrl + shift + p and search Rebuild and Reopen in containers

Normally just do Reopen in containers so you don't have to build every time

Running into the failed to connect to the docker API at npipe:////./pipe/dockerDesktopLinuxEngine;?? Enter the docker desktop app and go to the top right setting icon. Then enter the Resources tab on the left. Disable integration with WSL distro, save and restart in the bottom corner. Then recheck the enable integration with my defaul WSL distro. Rebuild and reopen and it should work!

Then wait for a really long time until it lets you type to exit. In the top bar of vs code click terminal and hit new terminal. At this point you are in the VM and can start developing!

Windows VNC

If you need a graphical interface (you most likely will) you will need to do some more setup

First instal the VNC viewer application. Any works however I personally use this one

Everytime you boot up the docker container you must follow the steps above to create a new terminal. Once in that terminal run the

./start_vnc.sh

Then Open up real VNC

  1. If you have not made a connection to the session yet right click the background and click new connection
  2. Type in the address 127.0.0.1:5901, you can name the vnc session anything (mine is HRT_Container)
  3. connect to it and enter the password dockervnc
  4. It should connect to the session and you can now see the desktop!

From here on out, the installation instructions will assume you are using Ubuntu 22.04 LTS. Windows users should run commands in either their Linux VM or their WSL terminal. For Linux users, we'll assume you're running Ubuntu; users of another distribution may need to change some instructions (e.g. package managers) depending on your distro. Mac users can you run set of instructions in their local terminal or VM.

Read instructions in .devcontainer/README.md first! This will allow all of our builds to be in the same environments (hopefully)!

From here instructions assume that you are in a linux environment

Docker

  1. Install Dev Containers extension to vscode
    • Left side bar find extensions and search for Dev Containers. Correct one is by microsoft.
  2. Install
    • Window
    • Linux
    • Mac
    • Windows: clone the repo inside WSL2 (e.g. ~/ in Ubuntu), not under C:\, or builds will be very slow.
  3. Run Dev Containers: Reopen in Container in vscode command palette

Building

In one terminal, source /opt/ros/humble/setup.bash (Should be sourced by default but just in case) For VM users use . ~/ros2_humble/install/local_setup.bash

Then run the build command in the project root directory, colcon build

Running

In a separate terminal from where you built, source /opt/ros/humble/setup.bash

Then, source install/local_setup.bash

Finally, ros2 run rover Rover --ros-args -p peripheral:=<peripheral>

Running mc node ros2 run mc --ros-args

Alternatively you can launch all nodes with:
ros2 launch rover rover_launch.xml

Or with the image CI publishes (--net=host so it can reach the host's can0):

docker run --rm --net=host ghcr.io/huskyroboticsteam/overhaul:latest

Tests

colcon test --ctest-args -LE linter && colcon test-result --verbose

-LE linter skips the ament linters, which the code doesn't pass yet.

CI (.github/workflows/ci.yml) builds the root Dockerfile, runs the tests in it, and pushes an amd64/arm64 image to GHCR on every push to main and every PR commit (latest and main tags from main, pr-<n> from PRs, plus sha-<commit>). Dependabot (.github/dependabot.yml) opens weekly PRs for action and base-image updates.

Testing tools

  1. Install dep pip install pynput
  2. Run ros2 run rover controller_node.py

Adding new ROS2 Packages

Suppose we want to add a custom ROS2 package (i.e rosbag2). Remember to update the following:

  1. package.xml - Add <depend>custom_node</depend>

  2. CMakeLists.txt - Add find_package(custom_node REQUIRED)

  3. CMakeLists.txt - Add custom_node under ament_target_dependencies f After adding, run the following:

  4. Install external dependencies rosdep install --from-paths src --ignore-src -y (as ChatGPT says, "get ingredients 🛒✨")

  5. Run CMake colcon build --packages-select rover (as ChatGPT says "cook the meal 🍳✨")

Adding new (external) ROS2 Packages

Add install steps into Dockerfile. For example, add the following to Dockerfile:

RUN apt-get install -y ros-humble-mavros ros-humble-mavros-extras

Miscellaneous Notes

  • If the Jetson isn't connecting to the internet, try the following on the host computer:
    • Change "Wired Connected" to 10.40.0.x
    • Go to "Wired Settings" and make sure "Shared to other computers" is checked (under IPv4)
    • Try disabling the firewall with the following command: sudo ufw disable. If it works after disabling the firewall, set DEFAULT_FORWARD_POLICY to ACCEPT in /etc/default/ufw. You can re-enable ufw after it is set.
    • There might also be some DNS issues on the Jetson. Good luck if that's the case.

About

Overhaul of Rover codebase.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages