Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.venv
.mongo_data
*.pyc
48 changes: 48 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM ubuntu:20.04

WORKDIR /code

# Set noninteractive mode
ENV DEBIAN_FRONTEND=noninteractive

# Install Python3 and pip
RUN apt-get update && \
apt-get install -y python3-pip

# Install system dependencies
RUN apt-get install -y \
g++ \
gcc \
gfortran \
liblapack-dev \
libffi-dev \
libssl-dev \
python3-dev \
build-essential \
wget \
libfreetype6-dev \
libpng-dev \
libportaudio2 \
portaudio19-dev \
libasound-dev \
libjack-dev \
libgl1-mesa-glx

# Set environment variables
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

COPY requirements.txt /code
RUN pip3 install -r requirements.txt

COPY . .

# ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
# ENV POSTGRES_DB=${POSTGRES_DB}
# ENV POSTGRES_USER=${POSTGRES_USER}
# ENV DB_HOST_FOR_BACKEND=${DB_HOST_FOR_BACKEND}
# ENV DB_PORT_FOR_BACKEND=${DB_PORT_FOR_BACKEND}

EXPOSE 5000

CMD ["python3", "PythonClient/server/simulation_server.py"]
3 changes: 3 additions & 0 deletions backend/PythonClient/airsim/JSON_files/cesium.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
30 changes: 30 additions & 0 deletions backend/PythonClient/airsim/JSON_files/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"SettingsVersion": 1.2,
"SimMode": "Multirotor",
"ClockType" : "SteppableClock",
"Vehicles" : {
"PX4" : {
"VehicleType" : "PX4Multirotor",
"UseSerial" : false,
"LockStep" : true,
"UseTcp" : true,
"TcpPort" : 4560,
"ControlPortLocal" : 14540,
"ControlPortRemote" : 14580,
"Sensors" : {
"Barometer" : {
"SensorType" : 1,
"Enabled" : true,
"PressureFactorSigma" : 0.0001825
}
},
"Parameters" : {
"NAV_RCL_ACT" : 0,
"NAV_DLL_ACT" : 0,
"COM_OBL_ACT" : 1,
"LPE_LAT" : 38.6348,
"LPE_LON" : 90.2336
}
}
}
}
10 changes: 8 additions & 2 deletions backend/PythonClient/multirotor/airsim_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ def __init__(self):

@staticmethod
def load_airsim_setting():
with open(os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'settings.json', 'r') as f:
current_pwd = os.getcwd()
settings_path = os.path.join(current_pwd, "PythonClient", "airsim", "JSON_files", "settings.json")
with open(settings_path, mode = 'r') as f:
#with open(os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'settings.json', 'r') as f:
setting_json = json.load(f)
return setting_json

@staticmethod
def load_cesium_setting():
with open(os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'cesium.json', 'r') as f:
current_pwd = os.getcwd()
settings_path = os.path.join(current_pwd, "PythonClient", "airsim", "JSON_files", "cesium.json")
with open(settings_path, mode = 'r') as f:
#with open(os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'cesium.json', 'r') as f:
cesium_json = json.load(f)
return cesium_json

Expand Down
22 changes: 16 additions & 6 deletions backend/PythonClient/multirotor/control/simulation_task_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,20 @@ def __remove_non_default_params(single_drone_setting_copy):

@staticmethod
def __save_settings_dot_json(new_setting_dot_json):
with open(os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'settings.json',
'w') as outfile:
current_pwd = os.getcwd()
settings_path = os.path.join(current_pwd, "PythonClient", "airsim", "JSON_files", "settings.json")
with open(settings_path, mode = 'w') as outfile:
#with open(os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'settings.json',
#'w') as outfile:
json.dump(new_setting_dot_json, outfile, indent=4)

@staticmethod
def __save_cesium_dot_json(cesium_setting):
with open(os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'cesium.json',
'w') as outfile:
current_pwd = os.getcwd()
settings_path = os.path.join(current_pwd, "PythonClient", "airsim", "JSON_files", "cesium.json")
with open(settings_path, mode = 'w') as outfile:
#with open(os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'cesium.json',
#'w') as outfile:
json.dump(cesium_setting, outfile, indent=4)

def stop(self):
Expand Down Expand Up @@ -521,7 +527,9 @@ def __environment_check():
"""
Initialize json files if do not exist
"""
file_path = os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'settings.json'
current_pwd = os.getcwd()
file_path = os.path.join(current_pwd, "PythonClient", "airsim", "JSON_files", "settings.json")
#file_path = os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'settings.json'
if not os.path.exists(file_path):
open(file_path, 'w').close()
default_settings = {
Expand All @@ -539,7 +547,9 @@ def __environment_check():
with open(file_path, 'w') as outfile:
json.dump(default_settings, outfile, indent=4)

file_path = os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'cesium.json'

file_path = os.path.join(current_pwd, "PythonClient", "airsim", "JSON_files", "cesium.json")
#file_path = os.path.join(os.path.expanduser('~'), "Documents", "AirSim") + os.sep + 'cesium.json'
if not os.path.exists(file_path):
open(file_path, 'w').close()
default_settings = {
Expand Down
2 changes: 1 addition & 1 deletion backend/PythonClient/server/simulation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,5 @@ def get_map():


if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
app.run(host='0.0.0.0', port=5000, debug = True)
# makes it discoverable by other devices in the network
4 changes: 2 additions & 2 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgpack-rpc-python
numpy==1.25.0
numpy==1.24.4
numpy_stl==3.0.1
pyaudio
msgpack-rpc-python
opencv-contrib-python
matplotlib==3.7.1
flask==2.3.2
Expand Down
82 changes: 82 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Use root/example as user/password credentials
version: '3.9'

services:

mongo_db:
image: mongo
restart: always
container_name: mongo_db
environment:
MONGO_INITDB_ROOT_USERNAME: uav_user
MONGO_INITDB_ROOT_PASSWORD: uavPassword
expose:
- 27017
volumes:
- ./.mongo_data:/data/db
ports:
- 27017:27017
env_file:
- ./dockerConfig.env
networks:
- backend_network

mongo-express:
image: mongo-express
restart: always
container_name: mongo-express
ports:
- 8081:8081
expose:
- 8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: uav_user
ME_CONFIG_MONGODB_ADMINPASSWORD: uavPassword
ME_CONFIG_MONGODB_URL: mongodb://uav_user:uavPassword@mongo_db:27017/
ME_CONFIG_BASICAUTH: false
networks:
- backend_network
env_file:
- ./dockerConfig.env

python_backend:
build:
context: ./backend
dockerfile: Dockerfile
restart: always
env_file:
- ./dockerConfig.env
container_name: python_backend
ports:
- 5000:5000
networks:
- frontend_network
- backend_network
depends_on:
- mongo_db
- mongo-express
expose:
- 5000

frontend:
build:
context: ./frontend
dockerfile: Dockerfile
restart: always
env_file:
- ./dockerConfig.env
container_name: frontend
ports:
- 3000:3000
networks:
- frontend_network
expose:
- 3000
depends_on:
- mongo_db
- mongo-express
- python_backend

networks:
backend_network:
frontend_network:
1 change: 1 addition & 0 deletions dockerConfig.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MONGO_DB_USERNAME=uav_user
1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"@mui/lab": "5.0.0-alpha.118",
"@mui/material": "^5.11.5",
"@mui/system": "5.15.20",
"@mui/styles": "5.11.2",
"@mui/x-date-pickers": "5.0.17",
"@react-google-maps/api": "2.18.1",
"@testing-library/jest-dom": "^5.16.5",
Expand Down