Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8e818ce
feat: docker dev env and compose and short docs
marhcouto Apr 19, 2024
d4522d2
fix: added db3 to ignore
marhcouto Apr 19, 2024
bc080da
fix entrypoint.sh
lourenco31 Apr 22, 2024
474d6cc
fix: fixed entrypoint script
marhcouto Apr 26, 2024
deb91a9
fix: removed foxglove from entrypoint and fixed docker compose2
marhcouto May 13, 2024
e59d4f8
fix: increased timeout for start to not trigger error
marhcouto May 22, 2024
7af3d35
fix: removed .gitkeep
marhcouto May 24, 2024
d97829a
added script to fix launch
yvesb04 May 24, 2024
c96cc5f
(refactor): removed ports mapping and simplified overall
brunovdias May 30, 2024
1c38549
(docs): added more to usage_tutorial
brunovdias Jun 3, 2024
73db354
(docs): fix made
brunovdias Jun 4, 2024
985477f
(docs): added dev container part
brunovdias Jun 4, 2024
7dae615
Merge pull request #1 from fs-feup/clean_up
marhcouto Jun 7, 2024
9dc064d
fix(docker): fixed tutorial
marhcouto Jun 14, 2024
399af44
fix(README): organized README
marhcouto Jun 14, 2024
dbdef30
fix(docker): moved information to tutorial
marhcouto Jun 14, 2024
325dcde
fix(config): reset config
marhcouto Jun 14, 2024
a4b7e1b
fix(docker-tutorial): note on communication settings
marhcouto Jun 14, 2024
ddea814
Merge branch 'master' into master
marhcouto Jun 14, 2024
bcea3b3
fix: fixed car showing up weird in Foxglove and steering being in the…
marhcouto Jun 16, 2024
283a95b
Merge pull request #2 from fs-feup/control-mock
marhcouto Jun 20, 2024
b96517c
fix(vehicle-model): adjusted vehicle model to not use gear ratio
marhcouto Jun 24, 2024
072cae4
fix(config): fixed perception sensors not showing up and adjusted params
marhcouto Jun 29, 2024
3db07dc
add: up-to-date with original repository
teixdavide Sep 27, 2024
87c824f
Merge remote-tracking branch 'origin/main' into original-repository
teixdavide Sep 30, 2024
05c3198
Merge pull request #3 from fs-feup/original-repository
teixdavide Oct 2, 2024
8e7b7a4
fix: solved a part of the launch file
teixdavide Oct 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .devcontainer/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This files is meant to be used as an example for the .env file,
# which sets the username variable for the dev container
# You should duplicate this file, change the name of the copy to
# '.env' and edit the variable's value
# This might not be necessary for linux
USERNAME=your_username # Necessary for windows at least
# If it doesnt work, include "export USERNAME=your_username" in the Dockerfile
1 change: 1 addition & 0 deletions .devcontainer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
40 changes: 40 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM ros:iron-ros-base-jammy
ARG USERNAME=USERNAME
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create the user
RUN groupadd --gid "$USER_GID" "$USERNAME" \
&& useradd --uid "$USER_UID" --gid "$USER_GID" -m "$USERNAME" \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo "$USERNAME" ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/"$USERNAME" \
&& chmod 0440 /etc/sudoers.d/"$USERNAME" \
&& apt-get clean

# Install dependencies
RUN apt update && apt upgrade -y \
&& apt install -y python3-pip \
&& apt install ros-"$ROS_DISTRO"-rviz2 -y \
&& apt install openssh-client -y \
&& apt install openssh-server -y \
&& apt install git -y \
&& apt install vim -y \
&& apt install python-is-python3 -y \
&& apt install clang-format -y \
&& apt install bear -y \
&& apt install curl -y \
&& curl -s https://deb.nodesource.com/setup_16.x | sudo bash \
&& apt install nodejs -y \
&& pip install black \
&& pip install rosbags \
&& pip install PyQT5 \
&& apt install ros-$ROS_DISTRO-xacro -y \
&& apt clean

RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /home/"$USERNAME"/.bashrc
ENV SHELL /bin/bash
USER $USERNAME
CMD ["/bin/bash"]
51 changes: 51 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "ROS 2 Development Container",
"privileged": true,
"remoteUser": "${localEnv:USERNAME}",
"build": {
"dockerfile": "Dockerfile",
"args": {
"USERNAME": "${localEnv:USERNAME}"
}
},
"features": {
"ghcr.io/itsmechlark/features/act:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"workspaceFolder": "/home/ws",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ws,type=bind",
"customizations": {
"vscode": {
"extensions":[
"ms-vscode.cpptools",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools-extension-pack",
"twxs.cmake",
"donjayamanne.python-extension-pack",
"eamodio.gitlens",
"ms-iot.vscode-ros",
"GitHub.vscode-github-actions"
]
}
},
"containerEnv": {
"DISPLAY": "unix:0",
"ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST",
"ROS_DOMAIN_ID": "42"
},
"runArgs": [
"--net=host",
"--ipc=host",
"--pid=host",
"-e", "DISPLAY=${env:DISPLAY}"
],
"mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
"source=/dev/dri,target=/dev/dri,type=bind,consistency=cached",
"source=${localWorkspaceFolder}/cache/iron-ros-base-jammy/build,target=/home/ws/build,type=bind",
"source=${localWorkspaceFolder}/cache/iron-ros-base-jammy/install,target=/home/ws/install,type=bind",
"source=${localWorkspaceFolder}/cache/iron-ros-base-jammy/log,target=/home/ws/log,type=bind"
],
"postCreateCommand": "sudo apt update && rosdep update && rosdep install --from-paths src --ignore-src -y && sudo chown -R ${localEnv:USERNAME} /home/ws/",
"initializeCommand": "echo Initialize...."
}
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
**/build/*
**/install/*
**/log/*
*.db3
!.vscode/settings.json
!.vscode/c_cpp_properties.json
.vscode/*
__pycache__/
__pycache__/
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/opt/ros/iron/include/**",
"/usr/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": false
}
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ We provide an example launch file (example.launch.py) which shows an example of

The sensors and vehicle model are configured using config files. Examples are provided in the config folder. Things such as the discipline or the path of the track file or config files are defined using ros2 parameters.

The default vehicle model provided is rather simple and just meant to be a starting point. You are encouraged to integrate your own vehicle model by implementing the `IVehicleModel` class
The default vehicle model provided is rather simple and just meant to be a starting point. You are encouraged to integrate your own vehicle model by implementing the `IVehicleModel` class.

## Docker Dev Container

A [Dockerfile](./.devcontainer/Dockerfile) is configured that already contains all the dependencies. It can be used with a [dev container environment](./.devcontainer) or launched independently wiht the [docker-compose](./docker-compose.yml) file. For more info, check the [docs folder](./doc/docker_usage.md).

# Contributing
Contributions in any form (reports, feedback, requests, submissions) are welcome. Preferably create an Issue or Pull request for that.
Expand All @@ -51,4 +55,4 @@ The initial version was developed at Elbflorace by:
* Alexander Phieler (Main development)
* Niklas Leukroth (Track and Config file parser)
* Sergio Antuna (Artwork)
* Tim Hanel (3d car model integration)
* Tim Hanel (3d car model integration)
8 changes: 3 additions & 5 deletions config/mainConfig.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pacsim:
timeouts:
start: 60 # time to trigger first timekeeping gate
start: 300 # time to trigger first timekeeping gate
acceleration: 25
autocross: 300
skidpad: 90
Expand All @@ -10,8 +10,6 @@ pacsim:
doo_detect: true
uss_detect: true
finish_validate: true

cog_frame_id_pipeline: "cog" # name of the cog frame in the autnomous pipeline
cog_frame_id_pipeline: "car" # name of the cog frame in the autnomous pipeline
broadcast_sensors_tf2: true

pre_transform_track: true # transform track such that starting pose also seems to be the origin of the track
pre_transform_track: true # transform track such that starting pose also seems to be the origin of the track
6 changes: 3 additions & 3 deletions config/perception.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ perception_sensors:
orientation: [0.0,0.0,0.0]
observation:
min_range: 1
max_range: 45
max_range: 20
min_angle_horizontal: -1.0472
max_angle_horizontal: 1.0472
min_angle_vertical: -0.2181662
max_angle_vertical: 0.2181662

detection:
prob_min_dist: 0.99
prob_decrease_dist_linear: 0.01
prob_decrease_dist_quadratic: 0.00012
prob_decrease_dist_linear: 0.001
prob_decrease_dist_quadratic: 0.000012
min_prob: 0.1

classification:
Expand Down
32 changes: 32 additions & 0 deletions doc/docker_usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# How to use

## Docker Compose

The simulator is inside a docker container, which by running it, the simulator will also be launched. To do this, run the following command on your terminal:

```bash
docker compose up
```

The *docker-compose.yml* file uses the same Docker image as the development container (Image in [.devcontainer folder](../.devcontainer)) and executes the [entrypoint.sh script](./entrypoint.sh) at startup.

## Code Development - Dev Container

In case you want to do some work inside the container, by using the Dev Containers extension in VSCode the process becomes very simple, since there is a .devcontainer which contains the configuration for a development container for that purpose.

To run this, first you need to install some extensions. You can get them through here [Remote Development Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack).
Then you need to create some cache folders. This can be done by running the following commands:

```bash
./environment_setup.sh
```
Finally do Ctrl + Shift + P and choose the option:

- Dev Containers: Rebuild and Reopen in container

## General Notes

For the simulator to communicate with your system, make sure to set the ROS Domain ID to the same value in both systems:
```sh
export ROS_DOMAIN_ID=42
```
41 changes: 41 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
services:
pacsim:
container_name: pacsim-container
image: pacsim-pacsim
build:
context: .
dockerfile: .devcontainer/Dockerfile
args:
USERNAME: "${USERNAME}"
environment:
DISPLAY: "${DISPLAY}"
ROS_AUTOMATIC_DISCOVERY_RANGE: "LOCALHOST"
ROS_DOMAIN_ID: "42"
volumes:
- type: bind
source: "./"
target: /home/ws
- type: bind
source: "/tmp/.X11-unix"
target: "/tmp/.X11-unix"
consistency: cached
- type: bind
source: "/dev/dri"
target: "/dev/dri"
consistency: cached
- type: bind
source: "./cache/iron-ros-base-jammy/build"
target: "/home/ws/build"
- type: bind
source: "./cache/iron-ros-base-jammy/install"
target: "/home/ws/install"
- type: bind
source: "./cache/iron-ros-base-jammy/log"
target: "/home/ws/log"
network_mode: host
ipc: host
pid: host
command: >
bash -c "cd /home/ws/ && ./entrypoint.sh"


11 changes: 11 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /bin/bash
sudo apt update &&
rosdep update &&
rosdep install --from-paths src --ignore-src -y &&
colcon build &

wait $!

cd /home/ws/ &&
source ./install/setup.bash &&
ros2 launch pacsim example.launch.py
4 changes: 4 additions & 0 deletions environment_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
mkdir -p ./cache/iron-ros-base-jammy/build
mkdir -p ./cache/iron-ros-base-jammy/install
mkdir -p ./cache/iron-ros-base-jammy/log
4 changes: 1 addition & 3 deletions launch/example.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ def generate_launch_description():
executable='robot_state_publisher',
name='robot_state_publisher',
output='screen',
parameters=[{'use_sim_time':True}, {'publish_frequency':float(1000),
'robot_description': Command(['xacro',' ',xacro_path])
}],
parameters=[{'use_sim_time':True}, {'publish_frequency':float(1000),}],
arguments=[xacro_path])
return LaunchDescription([nodePacsim, nodePacsimShutdownEventHandler, robot_state_publisher])
10 changes: 5 additions & 5 deletions src/VehicleModel/VehicleModelBicycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ class VehicleModelBicycle : public IVehicleModel
double avgRatio = 0.5 * (this->innerSteeringRatio + this->outerSteeringRatio);
if (in > 0)
{
this->steeringAngles.FL = this->innerSteeringRatio * in;
this->steeringAngles.FR = this->outerSteeringRatio * in;
this->steeringAngles.FL = this->innerSteeringRatio * in / avgRatio;
this->steeringAngles.FR = this->outerSteeringRatio * in / avgRatio;
}
else
{
this->steeringAngles.FL = this->outerSteeringRatio * in;
this->steeringAngles.FR = this->innerSteeringRatio * in;
this->steeringAngles.FL = this->outerSteeringRatio * in / avgRatio;
this->steeringAngles.FR = this->innerSteeringRatio * in / avgRatio;
}
return;
}
Expand Down Expand Up @@ -179,7 +179,7 @@ class VehicleModelBicycle : public IVehicleModel
Eigen::Vector3d vFront = vCog + omega.cross(rFront);
Eigen::Vector3d vRear = vCog + omega.cross(rRear);

double rpm2ms = this->wheelRadius * 2.0 * M_PI / (this->gearRatio * 60.0);
double rpm2ms = this->wheelRadius * 2.0 * M_PI / 60;

bool stillstand = (vCog.norm() < 0.1) && (std::abs(this->angularVelocity.z()) < 0.001);

Expand Down
14 changes: 14 additions & 0 deletions track_editor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Track Generator

## Dependencies

- PyQT5 (```pip install PyQT5```)

## Using

To run the track generator:

```sh
cd track_editor # if you are not in this folder already
python main.py
```
Loading