Moved to gazebo classic

This commit is contained in:
Alex Davies 2024-06-19 12:08:03 -03:00
parent b912a96868
commit 5445f21de1
2 changed files with 16 additions and 10 deletions

View File

@ -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 '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 '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 clean
RUN apt-get update && apt-get upgrade --yes RUN apt-get update && apt-get upgrade --yes
RUN apt-get install --yes gz-garden #RUN apt-get install --yes gz-garden
RUN apt-get install --yes ros-noetic-desktop RUN apt-get remove gz-garden
RUN apt-get install --yes ros-noetic-desktop gazebo11 libgazebo11 libgazebo11-dev
#Install ROS #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 RUN git clone --depth 1 -b v1.15.0-beta1 https://github.com/PX4/PX4-Autopilot.git --recursive
WORKDIR /opt/spiri-sdk/PX4-Autopilot/ WORKDIR /opt/spiri-sdk/PX4-Autopilot/
#Precompile px4 #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 RUN pip3 install typer-slim loguru sh

View File

@ -16,9 +16,7 @@ logger.add(
sys.stdout, format="<green>{time}</green> <level>{level}</level> {extra} {message}" sys.stdout, format="<green>{time}</green> <level>{level}</level> {extra} {message}"
) )
px4Path = os.environ.get( px4Path = os.environ.get("SPIRI_SIM_PX4_PATH", "/opt/spiri-sdk/PX4-Autopilot/")
"SPIRI_SIM_PX4_PATH", "/opt/spiri-sdk/PX4-Autopilot/build/px4_sitl_default/bin/px4"
)
logger.info(f"SPIRI_SIM_PX4_PATH={px4Path}") logger.info(f"SPIRI_SIM_PX4_PATH={px4Path}")
px4 = sh.Command(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), MAVROS_SIM_FCU_PORT=str(14539 + sys_id),
DRONE_SYS_ID=str(sys_id), DRONE_SYS_ID=str(sys_id),
): ):
instance_id = sys_id - 1 # PX4 will add 1 to the instance ID to get sysID # Run the make px4_sitl gazebo-classic command
px4Instance = px4( px4_command = sh.make(
"-d", i=instance_id, _out=outputLogger("px4", instance_id), _bg=True "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") logger.info("Starting drone stack, this may take some time")
docker_stack = sh.docker.compose( docker_stack = sh.docker.compose(
"--project-name", "--project-name",