From e0f9d2d89f2786df7d76d718018498445762dec3 Mon Sep 17 00:00:00 2001 From: mickey li Date: Wed, 24 Nov 2021 23:38:56 +0000 Subject: [PATCH 1/5] updated px4 to latest --- simulator/base/core/Dockerfile | 1 + simulator/base/px4/px4builder.Dockerfile | 2 +- simulator/base/px4/sitl.Dockerfile | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/simulator/base/core/Dockerfile b/simulator/base/core/Dockerfile index 743fc9d..183ab2f 100644 --- a/simulator/base/core/Dockerfile +++ b/simulator/base/core/Dockerfile @@ -59,6 +59,7 @@ RUN apt-get update \ libjansson-dev \ libtinyxml-dev \ xvfb \ + python3-jinja2 \ && rm -rf /var/lib/apt/lists/* # Install nvm diff --git a/simulator/base/px4/px4builder.Dockerfile b/simulator/base/px4/px4builder.Dockerfile index c3ab08c..76dd9a9 100644 --- a/simulator/base/px4/px4builder.Dockerfile +++ b/simulator/base/px4/px4builder.Dockerfile @@ -6,7 +6,7 @@ FROM px4io/px4-dev-simulation-focal as px4builder # Fetch the PX4 code RUN git clone --recurse-submodules -j4 --depth 1 --shallow-submodules -j4 \ - -b v1.11.3 https://github.com/PX4/PX4-Autopilot /src/PX4-Autopilot + -b v1.12.3 https://github.com/PX4/PX4-Autopilot /src/PX4-Autopilot # Switch to the workdir WORKDIR /src/PX4-Autopilot diff --git a/simulator/base/px4/sitl.Dockerfile b/simulator/base/px4/sitl.Dockerfile index 03742a0..94d7b9a 100644 --- a/simulator/base/px4/sitl.Dockerfile +++ b/simulator/base/px4/sitl.Dockerfile @@ -6,8 +6,8 @@ INCLUDE+ ./px4builder.Dockerfile # Add support for remote host in SITL & build it -RUN git fetch --recurse-submodules=no origin fe7908feb0de5ee8a4465619098f09b987ab011d \ - && git cherry-pick --no-commit fe7908feb0de5ee8a4465619098f09b987ab011d +# RUN git fetch --recurse-submodules=no origin fe7908feb0de5ee8a4465619098f09b987ab011d \ +# && git cherry-pick --no-commit fe7908feb0de5ee8a4465619098f09b987ab011d RUN make px4_sitl FROM ros:foxy-ros-base-focal From 28848d7184e16a0f9b6d5b319886d3c861065386 Mon Sep 17 00:00:00 2001 From: mickey li Date: Wed, 24 Nov 2021 23:41:05 +0000 Subject: [PATCH 2/5] Updated vehicle_setup script to use jinja2 --- simulator/vehicles/iris/Dockerfile | 2 +- .../iris/{xacro_launch.sh => vehicle_setup.sh} | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) rename simulator/vehicles/iris/{xacro_launch.sh => vehicle_setup.sh} (61%) diff --git a/simulator/vehicles/iris/Dockerfile b/simulator/vehicles/iris/Dockerfile index 3963ed0..b530aa2 100644 --- a/simulator/vehicles/iris/Dockerfile +++ b/simulator/vehicles/iris/Dockerfile @@ -5,7 +5,7 @@ FROM ${REGISTRY}uobflightlabstarling/starling-sim-base-px4:${VERSION} # Copy in the vehicle launch file COPY iris.launch.xml /ros_ws/launch/ COPY spawn_iris.sh /ros_ws/ -COPY xacro_launch.sh /ros.env.d/xacro/setup.bash +COPY vehicle_setup.sh /ros.env.d/10_vehicle/setup.bash ENV PX4_SITL_PORT 4560 ENV PX4_INSTANCE 0 diff --git a/simulator/vehicles/iris/xacro_launch.sh b/simulator/vehicles/iris/vehicle_setup.sh similarity index 61% rename from simulator/vehicles/iris/xacro_launch.sh rename to simulator/vehicles/iris/vehicle_setup.sh index 22917ed..054bfa8 100755 --- a/simulator/vehicles/iris/xacro_launch.sh +++ b/simulator/vehicles/iris/vehicle_setup.sh @@ -3,12 +3,17 @@ echo "---- xacro_launch.sh START ------------" src_path="/src/PX4-Autopilot" echo "Generating ${PX4_SIM_MODEL} instance ${PX4_INSTANCE} sysid ${PX4_SYSID}" -python3 ${src_path}/Tools/sitl_gazebo/scripts/xacro.py ${src_path}/Tools/sitl_gazebo/models/rotors_description/urdf/${PX4_SIM_MODEL}_base.xacro \ - rotors_description_dir:=${src_path}/Tools/sitl_gazebo/models/rotors_description \ - mavlink_tcp_port:=${PX4_SITL_PORT} \ - -o /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.urdf +python3 ${src_path}/Tools/sitl_gazebo/scripts/jinja_gen.py ${src_path}/Tools/sitl_gazebo/models/${PX4_SIM_MODEL}/${PX4_SIM_MODEL}.sdf.jinja ${src_path}/Tools/sitl_gazebo \ + --mavlink_tcp_port $((4560+${PX4_SYSID})) --mavlink_udp_port $((14560+${PX4_SYSID})) --mavlink_id $((1+${PX4_SYSID})) \ + --gst_udp_port $((5600+${PX4_SYSID})) --video_uri $((5600+${PX4_SYSID})) --mavlink_cam_udp_port $((14530+${PX4_SYSID})) \ + --output-file /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.sdf -gz sdf -p /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.urdf > /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.sdf +# python3 ${src_path}/Tools/sitl_gazebo/scripts/xacro.py ${src_path}/Tools/sitl_gazebo/models/rotors_description/urdf/${PX4_SIM_MODEL}_base.xacro \ +# rotors_description_dir:=${src_path}/Tools/sitl_gazebo/models/rotors_description \ +# mavlink_tcp_port:=${PX4_SITL_PORT} \ +# -o /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.urdf + +# gz sdf -p /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.urdf > /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.sdf echo "Model TCP Port set to: ${PX4_SITL_PORT}" echo "Specific SDF saved to /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.sdf" From ec4f6f6757166b45add0a7198969bc8ab9ebab4f Mon Sep 17 00:00:00 2001 From: mickey li Date: Thu, 25 Nov 2021 12:34:55 +0000 Subject: [PATCH 3/5] Updated automated port allocations --- docker-compose-2-drones.yml | 2 ++ simulator/vehicles/iris/vehicle_setup.sh | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docker-compose-2-drones.yml b/docker-compose-2-drones.yml index e7b8a46..8b99416 100644 --- a/docker-compose-2-drones.yml +++ b/docker-compose-2-drones.yml @@ -20,6 +20,7 @@ services: - "PX4_SIM_HOST=localhost" - "PX4_INSTANCE=0" - "IGNORE_FAILURE=true" + - "ENABLE_VIRTUAL_FRAMEBUFFER=false" depends_on: - simhost pid: "host" # Share Process ID Namespace @@ -70,6 +71,7 @@ services: - "PX4_INSTANCE=1" - "IGNORE_FAILURE=true" - "PX4_SIM_INIT_LOC_X=2" + - "ENABLE_VIRTUAL_FRAMEBUFFER=false" depends_on: - simhost pid: "host" # Share Process ID Namespace diff --git a/simulator/vehicles/iris/vehicle_setup.sh b/simulator/vehicles/iris/vehicle_setup.sh index 054bfa8..a9b3b4a 100755 --- a/simulator/vehicles/iris/vehicle_setup.sh +++ b/simulator/vehicles/iris/vehicle_setup.sh @@ -3,18 +3,16 @@ echo "---- xacro_launch.sh START ------------" src_path="/src/PX4-Autopilot" echo "Generating ${PX4_SIM_MODEL} instance ${PX4_INSTANCE} sysid ${PX4_SYSID}" -python3 ${src_path}/Tools/sitl_gazebo/scripts/jinja_gen.py ${src_path}/Tools/sitl_gazebo/models/${PX4_SIM_MODEL}/${PX4_SIM_MODEL}.sdf.jinja ${src_path}/Tools/sitl_gazebo \ - --mavlink_tcp_port $((4560+${PX4_SYSID})) --mavlink_udp_port $((14560+${PX4_SYSID})) --mavlink_id $((1+${PX4_SYSID})) \ - --gst_udp_port $((5600+${PX4_SYSID})) --video_uri $((5600+${PX4_SYSID})) --mavlink_cam_udp_port $((14530+${PX4_SYSID})) \ +python3 ${src_path}/Tools/sitl_gazebo/scripts/jinja_gen.py \ + ${src_path}/Tools/sitl_gazebo/models/${PX4_SIM_MODEL}/${PX4_SIM_MODEL}.sdf.jinja ${src_path}/Tools/sitl_gazebo \ + --mavlink_tcp_port ${PX4_SITL_PORT} \ + --mavlink_udp_port $((${PX4_OFFBOARD_PORT_BASE}+${PX4_INSTANCE})) \ + --mavlink_id ${PX4_SYSID} \ + # --gst_udp_port $((5600+${PX4_INSTANCE})) \ + # --video_uri $((5600+${PX4_INSTANCE})) \ + # --mavlink_cam_udp_port $((14530+${PX4_INSTANCE})) \ --output-file /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.sdf -# python3 ${src_path}/Tools/sitl_gazebo/scripts/xacro.py ${src_path}/Tools/sitl_gazebo/models/rotors_description/urdf/${PX4_SIM_MODEL}_base.xacro \ -# rotors_description_dir:=${src_path}/Tools/sitl_gazebo/models/rotors_description \ -# mavlink_tcp_port:=${PX4_SITL_PORT} \ -# -o /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.urdf - -# gz sdf -p /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.urdf > /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.sdf - echo "Model TCP Port set to: ${PX4_SITL_PORT}" echo "Specific SDF saved to /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.sdf" From da883f0d61538e4723cf04b15e0e59def82ab3a0 Mon Sep 17 00:00:00 2001 From: mickey li Date: Fri, 3 Dec 2021 13:42:45 +0000 Subject: [PATCH 4/5] Updated sed changes in sitl dockerfile inline with most recent version --- simulator/base/px4/sitl.Dockerfile | 10 +++++----- simulator/vehicles/iris/vehicle_setup.sh | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/simulator/base/px4/sitl.Dockerfile b/simulator/base/px4/sitl.Dockerfile index 94d7b9a..716cc25 100644 --- a/simulator/base/px4/sitl.Dockerfile +++ b/simulator/base/px4/sitl.Dockerfile @@ -27,17 +27,17 @@ ENV PX4_SIM_FORCE_USE_SET_POSITION false ENV SIM_WD /sim_wd # Modify startup script to use environment for server IP -RUN sed -i 's/simulator start -c $simulator_tcp_port/simulator start -t $PX4_SIM_IP $simulator_tcp_port/' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/rcS +RUN sed -i 's/simulator start -c $simulator_tcp_port/simulator start -t $PX4_SIM_IP $simulator_tcp_port/' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator # Modify startup script to add partner IP for offboard script -RUN sed -i 's/\(mavlink start -x -u $udp_offboard_port_local -r 4000000 -m onboard -o $udp_offboard_port_remote\)/\1 -t $PX4_OFFBOARD_IP/' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/rcS +RUN sed -i 's/\(mavlink start -x -u $udp_offboard_port_local -r 4000000 -m onboard -o $udp_offboard_port_remote\)/\1 -t $PX4_OFFBOARD_IP -p/' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/px4-rc.mavlink # Modify startup script to enable mavlink broadcasting -RUN sed -i '/param set IMU_INTEG_RATE 250/a param set MAV_BROADCAST 1' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/rcS +RUN sed -i '/param set IMU_INTEG_RATE 250/a param set MAV_${px4_instance}_BROADCAST 1' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/rcS # Modify startup script to change range of udp offboard remote connection ports (and remove line for if px4_instance > 9) -RUN sed -i 's/udp_offboard_port_remote=$((14540+px4_instance))/udp_offboard_port_remote=$((PX4_OFFBOARD_PORT_BASE+px4_instance))/' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/rcS -RUN sed -i '/[ $px4_instance -gt 9 ] && udp_offboard_port_remote=14549 # use the same ports for more than 10 instances to avoid port overlaps/d' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/rcS +RUN sed -i 's/udp_offboard_port_remote=$((14540+px4_instance))/udp_offboard_port_remote=$((PX4_OFFBOARD_PORT_BASE+px4_instance))/' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/px4-rc.mavlink +RUN sed -i '/[ $px4_instance -gt 9 ] && udp_offboard_port_remote=14549 # use the same ports for more than 10 instances to avoid port overlaps/d' /src/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/px4-rc.mavlink # Add entrypoint to handle PX4_SIM_HOST instead of IP COPY entrypoint.sh /entrypoint.sh diff --git a/simulator/vehicles/iris/vehicle_setup.sh b/simulator/vehicles/iris/vehicle_setup.sh index a9b3b4a..8895e5a 100755 --- a/simulator/vehicles/iris/vehicle_setup.sh +++ b/simulator/vehicles/iris/vehicle_setup.sh @@ -8,9 +8,6 @@ python3 ${src_path}/Tools/sitl_gazebo/scripts/jinja_gen.py \ --mavlink_tcp_port ${PX4_SITL_PORT} \ --mavlink_udp_port $((${PX4_OFFBOARD_PORT_BASE}+${PX4_INSTANCE})) \ --mavlink_id ${PX4_SYSID} \ - # --gst_udp_port $((5600+${PX4_INSTANCE})) \ - # --video_uri $((5600+${PX4_INSTANCE})) \ - # --mavlink_cam_udp_port $((14530+${PX4_INSTANCE})) \ --output-file /tmp/${PX4_SIM_MODEL}_${PX4_SYSID}.sdf echo "Model TCP Port set to: ${PX4_SITL_PORT}" From ec0523595620ef93bd652772d609b7b1f1c554b4 Mon Sep 17 00:00:00 2001 From: Mickey Li Date: Thu, 9 Dec 2021 11:43:40 +0000 Subject: [PATCH 5/5] Reverted docs url and tested on non-host networks --- README.md | 2 +- simulator/base/px4/sitl.Dockerfile | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 47209b3..d76ec4e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This systems provides a number of key features. ## Documentation -Please refer to the documentation at [https://starlinguas.github.io/ProjectStarling/](https://starlinguas.github.io/ProjectStarling/) for detailed instructions and explanations of how to use this system. +Please refer to the documentation at [https://docs.starlinguas.dev/](https://docs.starlinguas.dev/) for detailed instructions and explanations of how to use this system. The documentation is built using [MKDocs](https://www.mkdocs.org/) and can be served locally. diff --git a/simulator/base/px4/sitl.Dockerfile b/simulator/base/px4/sitl.Dockerfile index 716cc25..db9df48 100644 --- a/simulator/base/px4/sitl.Dockerfile +++ b/simulator/base/px4/sitl.Dockerfile @@ -6,8 +6,6 @@ INCLUDE+ ./px4builder.Dockerfile # Add support for remote host in SITL & build it -# RUN git fetch --recurse-submodules=no origin fe7908feb0de5ee8a4465619098f09b987ab011d \ -# && git cherry-pick --no-commit fe7908feb0de5ee8a4465619098f09b987ab011d RUN make px4_sitl FROM ros:foxy-ros-base-focal