Getting Started
This project based on ROS and Docker. Due to the used interfaces on the RPi, we have to use Linux Kernel functions for GPIO and I2C. Before you can start this project you need to install Docker and you have to check whether the GPIO and I2C modules are installed. If these modules are installed already, you can proceed with activating I2C and GPIO.
The PiCar-X by Sunfounder | The digital twin prototype in GAZEBO |
---|---|
Clone Repository
git clone https://github.com/cau-se/ARCHES-PiCar-X.git
cd ./ARCHES-PiCar-X/PiCar-X
Check if required modules are installed
modinfo i2c-stub
modinfo i2c-dev
modinfo gpio-mockup
If one of the modules is missing follow the installation guides
Check if there is already an existing I2C
On Ubuntu Systems (not WSL) there can already be an I2C device active. To check if a device already exists, type:
ls /dev/i2c*
If there is already an active I2C device, the result can be something like /dev/i2c-0
. The listed devices cannot be used for the DTP.
Activate GPIO and I2C on Your System
If you already have built the modules, you need to activate them via:
- X64
- RaspberryPi 3/4
Type again:
ls /dev/i2c*
If there was already and existing I2C device (see above), then a new would should be listed now. The result can be something like /dev/i2c-0 /dev/i2c-1
and /dev/i2c-1
is the created device that can be used for the DTP.
If there a several devices, use i2cdetect
provided in i2c-tools
:
i2cdetect -l
The result can look like:
i2c-1 i2c bcm2835 (i2c@7e804000) I2C adapter i2c-11 smbus SMBus stub driver SMBus adapter
In this example, i2c-11
is the stub that was created above and can be used for the DTP.
Enable Gazebo GUI
Before starting the Docker containers, enable the X11 forwarding to the hosts display:
# Alternative 1: Allow all connetions
xhost +
# Alternative 2: Allow non-network local connections
xhost + local:root
DEACTIVATE AFTER SHUTDOWN
# Alternative 1: Disable all connetions
xhost -
# Alternative 2: Disable non-network local connections
xhost - local:root
Build and Start Docker Containers from Scratch
You need to configure the correct I2C device in the env
folder (ARCHES-PiCar-X/Picar-X/env
). Which env is used, can be seen in the docker compose file you want to execute.
- X64
- arm32v7 (RPi3)
- arm64v8 (RPi4)
Build and Start the Physical Twin on a RPi 3/4
You need to configure the correct I2C device in the env
folder (ARCHES-PiCar-X/Picar-X/env
). Which env is used, can be seen in the docker compose file you want to execute.
- arm32v7 (RPi3)
- arm64v8 (RPi4)
Let the ARCHES PiCar-X Drive
After you start all Docker containers, you can switch into one of the containers and publish a picarx_msgs/Drive message, which will move the DTP with a certain speed and steering angle.
- Start the Digital Twin Prototype
- Start the Physical Twin
Next Steps
- Visit the Digital Twin Concept page to get more information on the digital twin concept we are demonstrating with ARCHES piCar-X
- Visit the Explore page to get more information on how you can use the PiCar-X to explore implementations, functions, and setups of digital twins.
Troubleshooting
Sometimes there can be problems with the I2C devices (e.g. a folder was created upon mounting) or the GPIO pin was not removedproperlly. See Troubleshooting page for solutions.