File tree Expand file tree Collapse file tree 3 files changed +62
-6
lines changed Expand file tree Collapse file tree 3 files changed +62
-6
lines changed Original file line number Diff line number Diff line change
1
+ # Use an official Python image with version 3.6+
2
+ FROM python:3.10-slim
3
+
4
+ # Set the working directory inside the container
5
+ WORKDIR /app
6
+
7
+ # Copy the application code into the container
8
+ COPY . /app
9
+
10
+ # Install required dependencies
11
+ RUN apt-get update && apt-get install -y \
12
+ fontconfig \
13
+ fonts-dejavu-core \
14
+ x11-apps \
15
+ libx11-6 \
16
+ libxext6 \
17
+ libsm6 \
18
+ libxrender1 \
19
+ && rm -rf /var/lib/apt/lists/*
20
+ RUN pip install --no-cache-dir numpy==1.26.4 scipy==1.13.1 osqp==0.6.7 pygame==2.6.1
21
+
22
+ # Expose any required ports (if needed by pygame or other services)
23
+ EXPOSE 8000
24
+
25
+ # Set the default command to run the demo
26
+ CMD ["python3" , "demo.py" ]
Original file line number Diff line number Diff line change @@ -10,15 +10,28 @@ This Python program demonstrates the use of control barrier functions (CBFs) for
10
10
11
11
## Dependencies
12
12
The program was developed and tested in the following environment.
13
- - Python 3.6 +
13
+ - Python 3.9 +
14
14
- ` torch==1.8.1+cpu ` (optional)
15
- - ` osqp==0.6.2.post8 `
16
- - ` pygame==2.3.0 `
17
- - ` numpy==1.16.6 `
18
- - ` scipy==1.1.0 `
15
+ - ` osqp==0.6.7 `
16
+ - ` pygame==2.6.1 `
17
+ - ` numpy==1.26.4 `
18
+ - ` scipy==1.13.1 `
19
19
20
20
## Usage
21
- ### Execution
21
+ ### Execution in docker container (recommended)
22
+ First, install Docker and Docker Compose using the [ official install guide] ( https://docs.docker.com/engine/install/ubuntu/ ) .
23
+
24
+ Then, clone this repository and go into the project folder
25
+ ``` bash
26
+ git clone https://github.com/shaoanlu/CBF_QP_safety_filter.git
27
+ cd CBF_QP_safety_filter
28
+ ```
29
+ To run the application, build the docker image and launch the container
30
+ ``` bash
31
+ docker compose up --build
32
+ ```
33
+
34
+ ### Execution in local environment
22
35
Run ` demo.py ` to start the simulation. A simple version w/ code generation is provided as ` demo_codegen_osqp.py ` .
23
36
``` bash
24
37
python demo.py # a PyGame window will be spawn
Original file line number Diff line number Diff line change
1
+ version : " 3.8"
2
+ services :
3
+ cbf_qp_playground :
4
+ build :
5
+ context : .
6
+ dockerfile : Dockerfile
7
+ container_name : cbf_qp_playground
8
+ ports :
9
+ - " 8000:8000" # Adjust if any other port mapping is necessary
10
+ volumes :
11
+ - .:/app
12
+ - /tmp/.X11-unix:/tmp/.X11-unix # Share the X11 socket for GUI rendering
13
+ environment :
14
+ - DISPLAY=${DISPLAY} # Pass the host's display to the container
15
+ - SDL_VIDEODRIVER=x11 # Use X11 for PyGame
16
+ stdin_open : true
17
+ tty : true
You can’t perform that action at this time.
0 commit comments