Running the coast environment - osrf/mbzirc GitHub Wiki

This pages provides a description of the coast environment and demonstrates how to spawn UAVs and USV in this world. It also assume that you have gone through the simple demo tutorial and are familiar with the basics of running the MBZIRC simulator and ROS development tools.

The Coast environment

The entire coast environment is 6km by 6km. The competition area is roughly 10km2 centered in the world. It features 7 vessels that are autonomously moving between way points within the competition area.

coast environment

Spawn Location

The starting gate consists of part water and part land. Here are example commands for spawning the the UAVs and USV.

  1. launch the coast environment. This can take up to a minute due to size of the environment. The first time this world is launched, it will also download 3D models from the mbzirc collection on Fuel

    ros2 launch mbzirc_ros competition_local.launch.py ign_args:="-v 4 -r coast.sdf"
  2. Spawn the USV:

    ros2 launch mbzirc_ign spawn.launch.py name:=usv world:=coast model:=usv x:=-1462 y:=-16.5 z:=0.3 R:=0 P:=0 Y:=0
  3. Spawn a quadrotor with a forward looking camera:

    ros2 launch mbzirc_ign spawn.launch.py name:=quadrotor_1 world:=coast model:=mbzirc_quadrotor x:=-1500 y:=2 z:=4.3 R:=0 P:=0 Y:=0 slot0:=mbzirc_hd_camera
  4. Spawn a hexrotor with a forward looking 3d lidar:

    ros2 launch mbzirc_ign spawn.launch.py name:=hexrotor_1 world:=coast model:=mbzirc_hexrotor x:=-1500 y:=-2 z:=4.3 R:=0 P:=0 Y:=0  slot0:=mbzirc_3d_lidar

You can also put your vehicle and sensor configurations into a single yaml config file and let the simulation launch the environment and spawn the all the vehicles for you, see Configuring platforms via yaml. Below is an example of launching the coast environment with the config_team.yaml configuration file.

ros2 launch mbzirc_ign competition.launch.py world:=coast config_file:=`ros2 pkg prefix mbzirc_ign`/share/mbzirc_ign/config/coast/config_team.yaml

Vessel trajectories

There are 7 vessels in the coast environment, named Vessel A to Vessel G. They move from one waypoint to another in a loop. To change their waypoints, you will need to modify the coast.sdf world file in the source code.

  1. Open the coast.sdf world file and find the TrajectoryFollower plugin for the Vessel you would like to change its waypoints. Here is an example:

          <plugin
            filename="ignition-gazebo-trajectory-follower-system"
            name="ignition::gazebo::systems::TrajectoryFollower">
            <link_name>link</link_name>
            <loop>true</loop>
            <waypoints>
              <waypoint>-1350 20</waypoint>
              <waypoint>-1400 20</waypoint>
            </waypoints>
            <force>45.55</force>
            <torque>45.55</torque>
            <range_tolerance>5</range_tolerance>
            <bearing_tolerance>5</bearing_tolerance>
            <zero_vel_on_bearing_reached>true</zero_vel_on_bearing_reached>
          </plugin>

    The waypoints are defined by the <waypoint> parameters, which consist of x and y coordinates. The vessel will move from its starting position to the first waypoint (-1350 20), then to the second waypoint (-1400 20), and back to its starting point. The process then repeats.

  2. You can change the trajectory by adding, removing, or editing the <waypoint> parameters. For example, the following updates will make the vessel move in a triangle patter after arriving at the first waypoint:

            <waypoints>
              <waypoint>-1350 20</waypoint>
              <waypoint>-1370 40</waypoint>
              <waypoint>-1370 0</waypoint>
              <waypoint>-1350 20</waypoint>
            </waypoints>

By default, the vessels move at a speed of roughly ~1 knot. To change the vessel's cruising speed, you can update the <force> parameter in the TrajectoryFollower plugin. Increasing the force should make it go faster while reducing the force will slow it down. The required force for moving a vessel at the specified velocity can be calculated as:

    max_velocity_mps = max_velocity_knots * 0.5144 # Knots to m/s
    force = (x_u + x_uu * max_velocity_mps) * max_velocity_mps 

where x_u and x_uu are hydrodynamics coefficients. You can find them in the SimpleHydrodynamics plugin in the coast.sdf world file for that vessel specified via the <xU> and <xUU> parameters.

After making the waypoint and velocity changes. You will need to install the workspace for it to take effect:

   colcon build --merge-install --packages-select mbzirc_ign

Objects on vessel

Each vessel carries 2 large objects and 2 small objects. You will only need to identify and retrieve one of each, see Competition Tasks and Time Penalties on testing target identification and retrieval.

By default the objects are attached to the vessel and will only be detached once the target vessel is identified. If you like to test object retrieval locally without going through target vessel identification, you can publish a message to detach the objects:

# Detach objects on Vessel B which is the target vessel in the coast environment
ign topic -t "/Vessel_B/detach" -m ignition.msgs.Empty -p "unused: true"
⚠️ **GitHub.com Fallback** ⚠️