Skip to content

ucmercedrobotics/amiga-ros2-bridge

Repository files navigation

FarmNG Amiga ROS2 Bridge

github website python pre-commits Code style: black

Overview

The Amiga-ROS2 bridge, currently supported for ROS2 Humble, interfaces with the Amiga gRPC services to:

  • Stream data from the Amiga brain services
  • Control the Amiga using the available vehicle control APIs.

Using this bridge with the amiga requires an Amiga OS v2.3.x.

Note

To setup the environment, you'll be working in Docker on your local machine. It will communicate to the Amiga via Tailscale using gRPC, just like any of our ADK Brain examples.

In theory, this would also work on the Amiga with minimal changes, but we haven't tested it yet.

Even though this repo is a collaboration between farm-ng and Robotics@UC Merced, this is NOT an official release from farm-ng and, therefore, we can't guarantee support or long term compatibility. That said, we will do everything possible to help you use it. For suggestions, questions, or concerns, raise an issue here.

Collaboration and PRs are welcome and will be evaluated by UC Merced and Farm-ng teams on regular basis.

How to set up the node (needed only one time):

  1. Clone this repo and open the directory:
git clone https://github.com/ucmercedrobotics/amiga-ros2-bridge.git
cd amiga-ros2-bridge

[Optional, but highly recommended] Create a new virtual environment

python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip

From now on, we will be using Makefile in this repo to make chain commands, feel free to modify and/or use your own commands.

  1. [Optional, for application requiring GUIs] Make your local Docker network to connect your VNC client, local machine, and Amiga together. You'll use this later when remote controlling the Amiga.
make network
  1. After, build your ROS2 container:
make build-image
  1. [Optional, for application requiring GUIs] Next, standup the VNC container to forward X11 to your web browser. You can see this at localhost:8080. We use localhost here assuming the container is running locally.
make vnc

Execution (every time you start the node):

  1. Configure and spin up your docker container:

This step assumes you have installed Tailscale and properly configured your access to the Brain with farm-ng's support team.

Check which services/streams you want to see and/or control at amiga-ros2-bridge/include/service_config.json. Make sure you update your Brains addresses on each host:

{
    "configs": [
        {
            "name": "canbus",
            "port": 6001,
            "host": "000.000.000.000"
        },
        ...

Finally, standup the container and connect to it:

make bash

You should now be inside the container, and the terminal will show something like:

root@docker-desktop:/amiga_ros2_bridge#

Note

Feel free to modify Makefile to change your container's startup command based on what you need adding port forwarding, displays, different volumes, etc.

  1. Expose your Amiga gRPC servers as ROS2 topics:
make amiga-streams

You should see confirmation of the topics exposed:

...
[amiga_streams-1] [INFO] [1743180979.278455758] [amiga_streams]: Subscribing to farm-ng topic: /oak0/left and publishing on ROS topic: /oak0/left
...
  1. Do Stuff:

You should now be able to interact with the services from your ROS2 container. An example is to allow twist commands to drive the Amiga:

Open a new terminal, connect to the container with a shell:

make shell

Now run our example twist converter

make twist

You should see two more topics (published by twist_control node):

ros2 topic list
/amiga/cmd_vel
/amiga/vel

Now you should see your commands getting to the robot. You can confirm this on the AUTO page from the dashboard:

dashboard in auto page

Warning

If your Amiga has AUTO CONTROL enabled, the robot will move. Make sure it is safe.

  1. Control remotely or autonomously:
make joy

This defaults to a PS4 controller, which should be configured via bluetoothctl.

Feel free to explore around the code and add functionality. You will see there are a lot of commented sections that are useful to get a better understanding of this repo, ROS2 and the Amiga.

Have fun!

Nav2

If you want to build autonomy with ROS2 into your ecosystem, follow these steps.

  1. Initialize the Nav2 submodule in this repo with git submodule update. This will clone the Nav2 packages for the Amiga.

  2. Follow the instructions in the README in amiga-ros2-nav.

  3. Build and Start the docker container with make build-prod and make bash.

  4. From within the container, install dependencies

rosdep update; rosdep install --from-paths . --ignore-src -r -y
  1. Run colcon build

Foxglove [Optional]

  1. Inside the docker container, install the ros2 foxglove node with
apt install ros-humble-foxglove-bridge
  1. Run the foxglove node (Farm-ng uses port 8765 for their foxglove bridge, so use 8766)
ros2 launch foxglove_bridge foxglove_bridge_launch.xml port:="8766"
  1. Follow instructions here to open foxglove

Autonomy

  1. Bringup the relevant nodes for robot localization (you can make shell in new windows as each command will block the shell)
make foxglove # optional
make amiga-streams
make twist
make description
make oakd
make localization

This will spawn the robot localization in preparation for Nav2 control.

About

Farm-NG ROS2 bridge

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •