https://github.com/s7our-squad/rc-car-ros2
A ROS2 project for autonomous car racing RC CAR. Code can run both in the physical car, as well as in simulation.
https://github.com/s7our-squad/rc-car-ros2
automation autonomous-car cpp14 follow-the-gap pid-control python3 rc-car ros ros2 rviz2 time-to-collision
Last synced: 18 days ago
JSON representation
A ROS2 project for autonomous car racing RC CAR. Code can run both in the physical car, as well as in simulation.
- Host: GitHub
- URL: https://github.com/s7our-squad/rc-car-ros2
- Owner: S7our-Squad
- License: mit
- Created: 2024-03-23T11:35:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-03T13:55:07.000Z (10 months ago)
- Last Synced: 2025-04-10T00:51:02.694Z (18 days ago)
- Topics: automation, autonomous-car, cpp14, follow-the-gap, pid-control, python3, rc-car, ros, ros2, rviz2, time-to-collision
- Language: Python
- Homepage:
- Size: 849 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RC CAR Robot in ROS2
A ROS2 project for autonomous car racing RC CAR. Code can run both in the physical car, as well as in simulation.
# Demo
Below is a demo of the car in the Simulation env:
[](https://youtu.be/2zpEKH0zm0g)
# Installation
**Supported System:**
- Windows 10, macOS, and Ubuntu without an NVIDIA gpu (using [noVNC](https://novnc.com/info.html))
**Install the following dependencies:**
- **Docker** Follow the instructions [here](https://docs.docker.com/install/linux/docker-ce/ubuntu/) to install Docker. A short tutorial can be found [here](https://docs.docker.com/get-started/) if you're not familiar with Docker. If you followed the post-installation steps you won't have to prepend your docker and docker-compose commands with sudo.
- Additionally you'll need **docker-compose**. Follow the instruction [here](https://docs.docker.com/compose/install/) to install docker-compose.## Getting Started
1. Clone this repo
```bash
git clone https://github.com/S7our-Squad/RC-CAR-ROS2.git
cd RC-CAR-ROS2
```2. Bringup the noVNC container and the sim container with docker-compose:
```bash
docker compose up
```3. In a separate terminal, run the following, and you'll have the a bash session in the simulation container. [`tmux`](https://hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/) is available for convenience.
```bash
docker exec -it rc-car-ros2-sim-1 /bin/bash
```4. In your browser, navigate to [http://localhost:8080/vnc.html](http://localhost:8080/vnc.html), you should see the noVNC logo with the connect button. Click the connect button to connect to the session.
## Launching the Simulation
1. `tmux` is included in the container, so you can create multiple bash sessions in the same terminal.
2. To launch the simulation, make sure you source both the ROS2 setup script and the local workspace setup script. Run the following in the bash session from the container:```bash
source /opt/ros/foxy/setup.bash
source install/local_setup.bash
ros2 launch simulator gym_bridge_launch.py
```A rviz window should pop up showing the simulation either on your host system or in the browser window depending on the display forwarding you chose.
You can then run another node by creating another bash session in `tmux`.
# Configuring the simulation
- The configuration file for the simulation is at `simulator/config/sim.yaml`.
- Topic names and namespaces can be configured but is recommended to leave uncahnged.
- The map can be changed via the `map_path` parameter. You'll have to use the full path to the map file in the container. The map follows the ROS convention. It is assumed that the image file and the `yaml` file for the map are in the same directory with the same name. See the note below about mounting a volume to see where to put your map file.
- The `num_agent` parameter can be changed to either 1 or 2 for single or two agent racing.
- The ego and opponent starting pose can also be changed via parameters, these are in the global map coordinate frame.The entire directory of the repo is mounted to a workspace `/sim_ws/src` as a package. All changes made in the repo on the host system will also reflect in the container. After changing the configuration, run `colcon build` again in the container workspace to make sure the changes are reflected.
# Keyboard Teleop
The keyboard teleop node from `teleop_twist_keyboard` is also installed as part of the simulation's dependency. To enable keyboard teleop, set `kb_teleop` to `True` in `sim.yaml`. After launching the simulation, in another terminal, run:
```bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard
```Then, press `i` to move forward, `u` and `o` to move forward and turn, `,` to move backwards, `m` and `.` to move backwards and turn, and `k` to stop in the terminal window running the teleop node.
## About Us
S7our Squad team at the University of Ibn Tofail, we work on autonomous systems (cars), led by professor BOUKIR Khawla. Current members composed of OKHADIR Hamza, GHIATI Mustapha, KHATIB Mouad and EL-LOUH Youssef.