Skip to content

Kromium's code which controls the robot and communicates with the VR headset.

Notifications You must be signed in to change notification settings

ar-robotics/robot

Repository files navigation

robot

Kromium's code which controls the robot and communicates with the VR headset.

Important information

  • If you want to run any ROS2 node after making changes to any Python file inside the robot/src folder, you need to rebuild (./colcon).
  • If a new Python package is added to requirements.txt you would need to run ./build_image again.

Test physically (production)

Physically implies using the expansion board.

Make sure that production is set to true in the config.

# robot/
./run_docker_production

Enters the container as root to access the /dev/ttyUSB0 (expansion board). This device is also passed into the container.

Not testing physically (not production)

Not using expansion board.

Make sure that production is set to false in the config.

# robot/
./run_docker

If you get an error when trying to ./run_all, it might be because of non-root permissions. You can try to delete the build, install and log folders and run ./colcon again.

Error: Access already in use when trying to start

Make sure the Meta Quest 3 headset has closed the app, and run ./kill_address.

Prerequisites

Install Docker

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Give permission to use Docker

sudo groupadd docker
sudo usermod -aG docker $USER

Installation

Build the image

# robot/ (same directory as the Dockerfile)
./build_image

Install MongoDB

docker pull mongodb/mongodb-community-server:latest

Add data to the database.

Start the MongoDB container

docker run --name mongodb --network host -d mongodb/mongodb-community-server:latest

Running

# robot/
./run_docker # or ./run_docker_production starts the container
./colcon # builds the ROS2 packages
./run_all # starts all ROS2 nodes

First time building will lead to this error.

--- stderr: astra_camera
In file included from /usr/include/c++/11/string:40,
                from /usr/include/c++/11/stdexcept:39,
                from /usr/include/c++/11/system_error:41,
                from /usr/include/c++/11/bits/fs_fwd.h:35,
                from /usr/include/c++/11/filesystem:44,
                from /robot/src/astra_camera/src/ob_camera_node_factory.cpp:13:
In static member function ‘static constexpr std::size_t std::char_traits<char>::length(const char_type*)’,
    inlined from ‘std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with _Traits = std::char_traits<char>]’ at /usr/include/c++/11/ostream:617:44,
    inlined from ‘void astra_camera::OBCameraNodeFactory::onDeviceConnected(const openni::DeviceInfo*)’ at /robot/src/astra_camera/src/ob_camera_node_factory.cpp:118:5:
/usr/include/c++/11/bits/char_traits.h:399:32: warning: ‘long unsigned int __builtin_strlen(const char*)’ reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
  399 |         return __builtin_strlen(__s);
      |                ~~~~~~~~~~~~~~~~^~~~~
---

Running ./colcon again will fix it.

Development

Start the container

# robot/
./run_docker

To exit the container use CTRL + D.

When the container is running the robot/src folder will be shared between the container and your local one. Changes made inside here will be apply to both. After changes has been made, make sure to run ./colcon or colcon build inside the robot/src folder. Now you can run using ./run_all (if the package is included inside that file) or by running:

# robot/src
source install/local_setup.bash
ros2 run package_name executable_variable

Testing

# robot/src
./run_tests

Every unittest should output OK.

Create a new ROS2 package

# robot/src
ros2 pkg create --build-type ament_python package_name

Documentation

HTML

# install sphinx
sudo apt-get install python3-sphinx -y
pip3 install furo --break-system-packages
cd docs/
make clean
make html

PDF

sudo apt install latexmk texlive-latex-extra
cd docs/
make latexpdf

About

Kromium's code which controls the robot and communicates with the VR headset.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published