simulation organization and cleanup

- new modules/simulation directory to collect all simulators and related modules
 - new Tools/simulation directory to collect and organize scattered simulation submodules, scripts, etc
 - simulation module renamed to simulator_mavlink
 - sih renamed to simulator_sih (not a great name, but I wanted to be clear it was a simulator)
 - ignition_simulator renamed to simulator_ignition_bridge
 - large sitl_target.cmake split by simulation option and in some cases pushed to appropriate modules
 - sitl targets broken down to what's actually available (eg jmavsim only has 1 model and 1 world)
 - new Gazebo consistently referred to as Ignition for now (probably the least confusing thing until we fully drop Gazebo classic support someday)
This commit is contained in:
Daniel Agar
2022-08-25 09:10:03 -04:00
parent 6b2509cbba
commit 4040e4cdf2
200 changed files with 1778 additions and 2806 deletions
+2 -2
View File
@@ -23,8 +23,8 @@
"timeout_min": 10
},
{
"model": "typhoon_h480_ctrlalloc",
"vehicle": "typhoon_h480_ctrlalloc",
"model": "typhoon_h480",
"vehicle": "typhoon_h480",
"test_filter": "[controlallocation]",
"timeout_min": 10
}
+15 -9
View File
@@ -10,6 +10,9 @@ import threading
import errno
from typing import Any, Dict, List, TextIO, Optional
PX4_GAZEBO_MODELS = "Tools/simulation/gazebo/sitl_gazebo/models"
PX4_GAZEBO_WORLDS = "Tools/simulation/gazebo/sitl_gazebo/worlds"
class Runner:
def __init__(self,
@@ -223,12 +226,12 @@ class GzserverRunner(Runner):
self.env["GAZEBO_PLUGIN_PATH"] = \
os.path.join(workspace_dir, build_dir, "build_gazebo")
self.env["GAZEBO_MODEL_PATH"] = \
os.path.join(workspace_dir, "Tools/sitl_gazebo/models")
os.path.join(workspace_dir, PX4_GAZEBO_MODELS)
self.env["PX4_SIM_SPEED_FACTOR"] = str(speed_factor)
self.cmd = "stdbuf"
self.args = ["-o0", "-e0", "gzserver", "--verbose",
os.path.join(workspace_dir,
"Tools/sitl_gazebo/worlds",
PX4_GAZEBO_WORLDS,
"empty.world")]
def has_started_ok(self) -> bool:
@@ -261,20 +264,23 @@ class GzmodelspawnRunner(Runner):
self.env["GAZEBO_PLUGIN_PATH"] = \
os.path.join(workspace_dir, build_dir, "build_gazebo")
self.env["GAZEBO_MODEL_PATH"] = \
os.path.join(workspace_dir, "Tools/sitl_gazebo/models")
os.path.join(workspace_dir, PX4_GAZEBO_MODELS)
self.cmd = "gz"
if os.path.isfile(os.path.join(workspace_dir,
"Tools/sitl_gazebo/models",
PX4_GAZEBO_MODELS,
self.model, self.model + ".sdf")):
model_path = os.path.join(workspace_dir,
"Tools/sitl_gazebo/models",
PX4_GAZEBO_MODELS,
self.model, self.model + ".sdf")
elif os.path.isfile(os.path.join(workspace_dir,
"Tools/sitl_gazebo/models",
PX4_GAZEBO_MODELS,
self.model, self.model + "-gen.sdf")):
model_path = os.path.join(workspace_dir,
"Tools/sitl_gazebo/models",
PX4_GAZEBO_MODELS,
self.model, self.model + "-gen.sdf")
else:
raise Exception("Model not found")
@@ -325,8 +331,8 @@ class GzclientRunner(Runner):
self.name = "gzclient"
self.cwd = workspace_dir
self.env = dict(os.environ, **{
"GAZEBO_MODEL_PATH": os.path.join(workspace_dir,
"Tools/sitl_gazebo/models")})
"GAZEBO_MODEL_PATH":
os.path.join(workspace_dir, PX4_GAZEBO_MODELS)})
self.cmd = "gzclient"
self.args = ["--verbose"]
+2 -2
View File
@@ -4,9 +4,9 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
PX4_SRC_DIR=${DIR}/..
source /opt/ros/${ROS_DISTRO:-kinetic}/setup.bash
source ${PX4_SRC_DIR}/Tools/setup_gazebo.bash ${PX4_SRC_DIR} ${PX4_SRC_DIR}/build/px4_sitl_default
source ${PX4_SRC_DIR}/Tools/simulation/gazebo/setup_gazebo.bash ${PX4_SRC_DIR} ${PX4_SRC_DIR}/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:${PX4_SRC_DIR}:${PX4_SRC_DIR}/Tools/sitl_gazebo
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:${PX4_SRC_DIR}:${PX4_SRC_DIR}/Tools/simulation/gazebo/sitl_gazebo
export ROS_LOG_DIR="$HOME/.ros/ros_logs"
mkdir -p "$ROS_LOG_DIR"