From 5445f21de1f55fe4be4d92fe37a043c4ad592e2e Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Wed, 19 Jun 2024 12:08:03 -0300 Subject: [PATCH] Moved to gazebo classic --- Dockerfile | 10 +++++++--- skel/Desktop/simulated-drone/sim_drone.py | 16 +++++++++------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index c1f90f4..af761fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,16 @@ COPY --link --from=git.spirirobotics.com/spiri/gazebo-resources:latest /plugins RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' RUN sh -c 'curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -' +RUN sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' +RUN sh -c "wget https://packages.osrfoundation.org/gazebo.key -O - | apt-key add -" RUN apt-get clean RUN apt-get update && apt-get upgrade --yes -RUN apt-get install --yes gz-garden -RUN apt-get install --yes ros-noetic-desktop +#RUN apt-get install --yes gz-garden +RUN apt-get remove gz-garden +RUN apt-get install --yes ros-noetic-desktop gazebo11 libgazebo11 libgazebo11-dev #Install ROS @@ -21,7 +24,8 @@ WORKDIR /opt/spiri-sdk RUN git clone --depth 1 -b v1.15.0-beta1 https://github.com/PX4/PX4-Autopilot.git --recursive WORKDIR /opt/spiri-sdk/PX4-Autopilot/ #Precompile px4 -RUN make px4_sitl_default +#RUN make px4_sitl_default +RUN DONT_RUN=1 make px4_sitl gazebo-classic RUN pip3 install typer-slim loguru sh diff --git a/skel/Desktop/simulated-drone/sim_drone.py b/skel/Desktop/simulated-drone/sim_drone.py index ab9102e..8443dbe 100755 --- a/skel/Desktop/simulated-drone/sim_drone.py +++ b/skel/Desktop/simulated-drone/sim_drone.py @@ -16,9 +16,7 @@ logger.add( sys.stdout, format="{time} {level} {extra} {message}" ) -px4Path = os.environ.get( - "SPIRI_SIM_PX4_PATH", "/opt/spiri-sdk/PX4-Autopilot/build/px4_sitl_default/bin/px4" -) +px4Path = os.environ.get("SPIRI_SIM_PX4_PATH", "/opt/spiri-sdk/PX4-Autopilot/") logger.info(f"SPIRI_SIM_PX4_PATH={px4Path}") px4 = sh.Command(px4Path) @@ -125,11 +123,15 @@ def start(sys_id: int = 1, extra_apps: List[pathlib.Path] = []): MAVROS_SIM_FCU_PORT=str(14539 + sys_id), DRONE_SYS_ID=str(sys_id), ): - instance_id = sys_id - 1 # PX4 will add 1 to the instance ID to get sysID - px4Instance = px4( - "-d", i=instance_id, _out=outputLogger("px4", instance_id), _bg=True + # Run the make px4_sitl gazebo-classic command + px4_command = sh.make( + "px4_sitl", + "gazebo-classic", + _bg=True, + _out=outputLogger("px4", sys_id), + _cwd=px4Path, ) - processes.append(px4Instance) + processes.append(px4_command) logger.info("Starting drone stack, this may take some time") docker_stack = sh.docker.compose( "--project-name",