WIP: Multi-Vehicle SITL + Gazebo #6

Closed
unsalted_salt wants to merge 0 commits from ros2 into master
Member

Key changes;

  1. Docker services are on the host network.
  2. Bash script to create gazebo entities.
  3. sim_drone.py to start ardupilot, mavproxy and mavros2 services.
  4. Single vehicle gazebo sim can be started; SIM_DRONE_COUNT=1 in .env , then execute docker compose --profile ui --profile uav-sim up. Click Launch Gazebo on the menu.
  5. Multi-vehicle sim requires 2 terminal sessions. docker compose --profile ui up for gazebo. Second terminal python3 sim_drone.py to start services.

Current issue(s);

@traverseda

  1. sim_drone.py cleanup function is problematic. You need to remove all the created/stopped services before running the script again. I just do docker container prune to remove all stopped containers. This is not ideal.
Key changes; 1. Docker services are on the host network. 2. Bash script to create gazebo entities. 3. `sim_drone.py` to start ardupilot, mavproxy and mavros2 services. 4. Single vehicle gazebo sim can be started; `SIM_DRONE_COUNT=1` in `.env` , then execute `docker compose --profile ui --profile uav-sim up`. Click `Launch Gazebo` on the menu. 5. Multi-vehicle sim requires 2 terminal sessions. `docker compose --profile ui up` for gazebo. Second terminal `python3 sim_drone.py` to start services. Current issue(s); @traverseda 1. sim_drone.py cleanup function is problematic. You need to remove all the created/stopped services before running the script again. I just do `docker container prune` to remove all stopped containers. This is not ideal.
unsalted_salt added 10 commits 2024-10-29 11:06:08 -03:00
Owner

Can guiTools/ardupilot_gazebo be a sub-module? I note we have custom SDF files in that, so it will likely require creating a new repo internally. The SDF files have the exec bit set. I don't think that's correct. chmod -x the-sdf.sdf should fix it.

Can `guiTools/ardupilot_gazebo` be a sub-module? I note we have custom SDF files in that, so it will likely require creating a new repo internally. The SDF files have the exec bit set. I don't think that's correct. `chmod -x the-sdf.sdf` should fix it.
unsalted_salt added 1 commit 2024-10-29 17:01:24 -03:00
Author
Member

@aqua3

@aqua3
Owner

For the sake of book keeping, I'm quoting my previous comment from the old SDK repository which is now obsolete:

Currently, it looks like you decide the number of drones to spawn by changing the for loop in the entrypoint file spawn_drones.sh. And you must make sure to use the same number when spinning up the rest of the docker containers through sim_drone.py.

I think we should use environment variables. For example, an environment variable SIM_DRONE_COUNT that is fed into gazebo-master to be passed to the entrypoint file and is also used by the sim_drone.py file to spin up the appropriate number of container groups. This way, we eliminate the need to explicitly pass the number in the command.

We can go a step further with this and make a .env file that holds multiple environment variables that are relevant to both. This would also allow an end user to just edit the one env file.

Will provide more feedback later today after taking a closer look at the new updates.

For the sake of book keeping, I'm quoting my previous comment from the old SDK repository which is now obsolete: > Currently, it looks like you decide the number of drones to spawn by changing the for loop in the entrypoint file spawn_drones.sh. And you must make sure to use the same number when spinning up the rest of the docker containers through sim_drone.py. > > I think we should use environment variables. For example, an environment variable SIM_DRONE_COUNT that is fed into gazebo-master to be passed to the entrypoint file and is also used by the sim_drone.py file to spin up the appropriate number of container groups. This way, we eliminate the need to explicitly pass the number in the command. > > We can go a step further with this and make a .env file that holds multiple environment variables that are relevant to both. This would also allow an end user to just edit the one env file. Will provide more feedback later today after taking a closer look at the new updates.
unsalted_salt added 1 commit 2024-10-31 12:20:21 -03:00
unsalted_salt added 1 commit 2024-10-31 12:27:21 -03:00
unsalted_salt added 2 commits 2024-10-31 13:28:33 -03:00
unsalted_salt added 1 commit 2024-10-31 13:28:59 -03:00
unsalted_salt changed title from Multi-Vehicle SITL + Gazebo to WIP: Multi-Vehicle SITL + Gazebo 2024-11-01 10:12:23 -03:00
traverseda reviewed 2024-11-01 11:52:00 -03:00
@ -0,0 +1,29 @@
#!/bin/bash
Owner

add set -e so the script fails on any sub-command error.

add `set -e` so the script fails on any sub-command error.
unsalted_salt marked this conversation as resolved
unsalted_salt added 1 commit 2024-11-01 12:20:18 -03:00
unsalted_salt added 2 commits 2024-11-01 12:47:44 -03:00
unsalted_salt added 1 commit 2024-11-01 15:32:56 -03:00
Owner

The environment variables look good, I think it'll be beneficial to reorganize the order in which the environment variables show up into 3 groups:

  • Group 1: DRONE_SYS_ID, TRACKER_INSTANCE, SERIAL0_PORT, SITL_PORT, MAVROS2_PORT, MAVROS1_PORT, FDM_PORT_IN, GSTREAMER_UDP_PORT, ROS_MASTER_URI
  • Group 2: ARDUPILOT_VEHICLE, WORLD_FILE_NAME, WORLD_NAME, DRONE_MODEL
  • Group 3: SIM_DRONE_COUNT

The rationale here is that group 1 is probably never going to be changed by the average SDK user, group 2 may need to be changed a bit, and group 3 is what we expect will be modified the most.

The environment variables look good, I think it'll be beneficial to reorganize the order in which the environment variables show up into 3 groups: * **Group 1**: DRONE_SYS_ID, TRACKER_INSTANCE, SERIAL0_PORT, SITL_PORT, MAVROS2_PORT, MAVROS1_PORT, FDM_PORT_IN, GSTREAMER_UDP_PORT, ROS_MASTER_URI * **Group 2**: ARDUPILOT_VEHICLE, WORLD_FILE_NAME, WORLD_NAME, DRONE_MODEL * **Group 3**: SIM_DRONE_COUNT The rationale here is that group 1 is probably never going to be changed by the average SDK user, group 2 may need to be changed a bit, and group 3 is what we expect will be modified the most.
Owner

Another note, I think it might be good to make the GCS port (14550) an environment variable too. QGC automatically connects to 14550 by default (This can be disabled, but not changed as far as I know). It would be good to future proof by making this port configurable from the SDK side.

Another note, I think it might be good to make the GCS port (14550) an environment variable too. QGC automatically connects to 14550 by default (This can be disabled, but not changed as far as I know). It would be good to future proof by making this port configurable from the SDK side.
unsalted_salt added 1 commit 2024-11-04 11:47:34 -04:00
unsalted_salt added 3 commits 2024-11-04 17:29:38 -04:00
traverseda closed this pull request 2024-11-05 10:28:17 -04:00
Owner

Merged in manually in order to squash merge conflicts

Merged in manually in order to squash merge conflicts

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Spiri/spiri-sdk#6
No description provided.