mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-01 21:07:40 +08:00
[gazebo] Cyberzoo model (#2230)
* First steps towards detailed cyberzoo model. Got transparency working. * Fix ambient lighting of cyberzoo_solid * Import improved model * Fix optitrack cameras * Fix lighting colors * Fix optitrack camera color * Add orange pole and traffic mat objects * Fix orange_pole2 smoothing errors * Fix cyberzoo origin * Add first draft of cyberzoo surroundings * Add updated cyberzoo surroundings and outside walls * Minor fixes to surroundings * Create cyberzoo world To-do: set origin coordinates and rotate environment * Set world coordinates and rotation, fix naming conflict * Add cyberzoo world with orange poles for orange_avoider * Remove old cyberzoo model, fix dependencies * Add daylight in windows on outer walls * Separate cyberzoo model into layers Makes it easier to hide parts of the model in the GUI. * Add cyberzoo surroundings to main model in separate layers * Restore cyberzoo floor collision box * Add cyberzoo props * Minor tweaks to models * Compress textures Reduced texture dimensions. Size of model folder is now approx. 20 MB instead of 60+ MB. * Remove origin marker from worlds * Move CyberZoo models to submodule - All new models are moved to the tudelft/gazebo_models repository, which is included as a submodule in sw/ext/tudelft_gazebo_models/ - Changed vehicle and world SDF loading to use URI's, these can be used with multiple search paths - Added gzclient_launcher.sh script that sets up environment variables before launching gzclient. This prevents errors if the user forgets to add the paths to .bashrc. Added as a tool to control_panel_example.xml
This commit is contained in:
@@ -38,3 +38,7 @@
|
|||||||
[submodule "sw/ext/key_generator"]
|
[submodule "sw/ext/key_generator"]
|
||||||
path = sw/ext/key_generator
|
path = sw/ext/key_generator
|
||||||
url = https://github.com/paparazzi/key_generator.git
|
url = https://github.com/paparazzi/key_generator.git
|
||||||
|
[submodule "sw/ext/tudelft_gazebo_models"]
|
||||||
|
path = sw/ext/tudelft_gazebo_models
|
||||||
|
url = https://github.com/tudelft/gazebo_models.git
|
||||||
|
shallow = true
|
||||||
|
|||||||
-1
@@ -192,7 +192,6 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section name="SIMULATOR" prefix="NPS_">
|
<section name="SIMULATOR" prefix="NPS_">
|
||||||
<define name="GAZEBO_WORLD" value='"ardrone_cyberzoo.world"'/>
|
|
||||||
<define name="ACTUATOR_NAMES" value="nw_motor, ne_motor, se_motor, sw_motor" type="string[]"/>
|
<define name="ACTUATOR_NAMES" value="nw_motor, ne_motor, se_motor, sw_motor" type="string[]"/>
|
||||||
<define name="JSBSIM_MODEL" value="simple_ardrone2" type="string"/>
|
<define name="JSBSIM_MODEL" value="simple_ardrone2" type="string"/>
|
||||||
<define name="SENSORS_PARAMS" value="nps_sensors_params_ardrone2.h" type="string"/>
|
<define name="SENSORS_PARAMS" value="nps_sensors_params_ardrone2.h" type="string"/>
|
||||||
@@ -76,6 +76,7 @@
|
|||||||
<arg flag="-r" constant="3"/>
|
<arg flag="-r" constant="3"/>
|
||||||
</program>
|
</program>
|
||||||
<program name="rtcm2ivy" command="sw/ground_segment/misc/rtcm2ivy"/>
|
<program name="rtcm2ivy" command="sw/ground_segment/misc/rtcm2ivy"/>
|
||||||
|
<program name="Gazebo" command="sw/tools/gzclient_launcher.sh"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section name="sessions">
|
<section name="sessions">
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
#include "subsystems/electrical.h"
|
#include "subsystems/electrical.h"
|
||||||
#include "subsystems/radio_control.h"
|
#include "subsystems/radio_control.h"
|
||||||
#include "subsystems/ahrs.h"
|
#include "subsystems/ahrs.h"
|
||||||
|
|
||||||
|
// Note: use 'git submodule update --init -- sw/ext/tudelft_gazebo_models/'
|
||||||
|
// to download the required models.
|
||||||
|
#define NPS_GAZEBO_WORLD "cyberzoo_orange_poles.world"
|
||||||
</header>
|
</header>
|
||||||
<waypoints>
|
<waypoints>
|
||||||
<waypoint lat="51.990631" lon="4.376796" name="HOME"/>
|
<waypoint lat="51.990631" lon="4.376796" name="HOME"/>
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
<?xml version='1.0'?>
|
|
||||||
<sdf version='1.4'>
|
|
||||||
<model name="cyberzoo">
|
|
||||||
<static>true</static>
|
|
||||||
<pose>0 0 0 0 0 0</pose>
|
|
||||||
|
|
||||||
<link name="floor">
|
|
||||||
<pose>0 0 0.01 0 0 0</pose>
|
|
||||||
<visual name="visual">
|
|
||||||
<geometry>
|
|
||||||
<box>
|
|
||||||
<size>10 10 0.02</size>
|
|
||||||
</box>
|
|
||||||
</geometry>
|
|
||||||
<material>
|
|
||||||
<ambient>0 0 0 1</ambient>
|
|
||||||
<diffuse>0.2 0.8 0.2 1</diffuse>
|
|
||||||
<specular>0.2 0.2 0.2 1</specular>
|
|
||||||
<emissive>0 0 0 0</emissive>
|
|
||||||
</material>
|
|
||||||
</visual>
|
|
||||||
<collision name="collision">
|
|
||||||
<geometry>
|
|
||||||
<box>
|
|
||||||
<size>10 10 0.02</size>
|
|
||||||
</box>
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
</link>
|
|
||||||
|
|
||||||
<link name="north_wall">
|
|
||||||
<pose>0 5 5 0 0 0</pose>
|
|
||||||
<visual name="visual">
|
|
||||||
<geometry>
|
|
||||||
<box>
|
|
||||||
<size>10 0.2 10</size>
|
|
||||||
</box>
|
|
||||||
</geometry>
|
|
||||||
<material>
|
|
||||||
<ambient>0 0 0 1</ambient>
|
|
||||||
<diffuse>0.2 0.2 0.2 1</diffuse>
|
|
||||||
<specular>0 0 0 1</specular>
|
|
||||||
<emissive>0 0 0 0</emissive>
|
|
||||||
</material>
|
|
||||||
</visual>
|
|
||||||
<collision name="collision">
|
|
||||||
<geometry>
|
|
||||||
<box>
|
|
||||||
<size>10 0.2 10</size>
|
|
||||||
</box>
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
</link>
|
|
||||||
|
|
||||||
<link name="east_wall">
|
|
||||||
<pose>5 0 5 0 0 0</pose>
|
|
||||||
<visual name="visual">
|
|
||||||
<geometry>
|
|
||||||
<box>
|
|
||||||
<size>0.2 10 10</size>
|
|
||||||
</box>
|
|
||||||
</geometry>
|
|
||||||
<material>
|
|
||||||
<ambient>0 0 0 1</ambient>
|
|
||||||
<diffuse>0.2 0.2 0.2 1</diffuse>
|
|
||||||
<specular>0 0 0 1</specular>
|
|
||||||
<emissive>0 0 0 0</emissive>
|
|
||||||
</material>
|
|
||||||
</visual>
|
|
||||||
<collision name="collision">
|
|
||||||
<geometry>
|
|
||||||
<box>
|
|
||||||
<size>0.2 10 10</size>
|
|
||||||
</box>
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
</link>
|
|
||||||
|
|
||||||
<link name="south_wall">
|
|
||||||
<pose>0 -5 6.25 0 0 0</pose>
|
|
||||||
<visual name="visual">
|
|
||||||
<geometry>
|
|
||||||
<box>
|
|
||||||
<size>10 0.2 7.5</size>
|
|
||||||
</box>
|
|
||||||
</geometry>
|
|
||||||
<material>
|
|
||||||
<ambient>0 0 0 1</ambient>
|
|
||||||
<diffuse>0.2 0.2 0.2 1</diffuse>
|
|
||||||
<specular>0 0 0 1</specular>
|
|
||||||
<emissive>0 0 0 0</emissive>
|
|
||||||
</material>
|
|
||||||
</visual>
|
|
||||||
<collision name="collision">
|
|
||||||
<geometry>
|
|
||||||
<box>
|
|
||||||
<size>10 0.2 7.5</size>
|
|
||||||
</box>
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
</link>
|
|
||||||
</model>
|
|
||||||
</sdf>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<model>
|
|
||||||
<name>Cyberzoo</name>
|
|
||||||
<version>1.0</version>
|
|
||||||
<sdf version='1.4'>cyberzoo.sdf</sdf>
|
|
||||||
|
|
||||||
<author>
|
|
||||||
<name>Tom van Dijk</name>
|
|
||||||
<email>tomvand@users.noreply.github.com</email>
|
|
||||||
</author>
|
|
||||||
|
|
||||||
<description>
|
|
||||||
Cyberzoo coarse model
|
|
||||||
</description>
|
|
||||||
</model>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<model>
|
|
||||||
<name>Orange Pole</name>
|
|
||||||
<version>1.0</version>
|
|
||||||
<sdf version='1.4'>orange_pole.sdf</sdf>
|
|
||||||
|
|
||||||
<author>
|
|
||||||
<name>Tom van Dijk</name>
|
|
||||||
<email>tomvand@users.noreply.github.com</email>
|
|
||||||
</author>
|
|
||||||
|
|
||||||
<description>
|
|
||||||
Orange pole as used in the TU Delft Cyberzoo.
|
|
||||||
</description>
|
|
||||||
</model>
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<?xml version='1.0'?>
|
|
||||||
<sdf version="1.4">
|
|
||||||
<model name="orange_pole">
|
|
||||||
<pose>0 0 1.0 0 0 0</pose>
|
|
||||||
<static>true</static>
|
|
||||||
<link name="link">
|
|
||||||
<inertial>
|
|
||||||
<mass>1.0</mass>
|
|
||||||
<inertia> <!-- interias are tricky to compute -->
|
|
||||||
<!-- http://answers.gazebosim.org/question/4372/the-inertia-matrix-explained/ -->
|
|
||||||
<ixx>0.083</ixx> <!-- for a box: ixx = 0.083 * mass * (y*y + z*z) -->
|
|
||||||
<ixy>0.0</ixy> <!-- for a box: ixy = 0 -->
|
|
||||||
<ixz>0.0</ixz> <!-- for a box: ixz = 0 -->
|
|
||||||
<iyy>0.083</iyy> <!-- for a box: iyy = 0.083 * mass * (x*x + z*z) -->
|
|
||||||
<iyz>0.0</iyz> <!-- for a box: iyz = 0 -->
|
|
||||||
<izz>0.083</izz> <!-- for a box: izz = 0.083 * mass * (x*x + y*y) -->
|
|
||||||
</inertia>
|
|
||||||
</inertial>
|
|
||||||
<collision name="collision">
|
|
||||||
<geometry>
|
|
||||||
<cylinder>
|
|
||||||
<radius>0.3</radius>
|
|
||||||
<length>2.0</length>
|
|
||||||
</cylinder>
|
|
||||||
</geometry>
|
|
||||||
</collision>
|
|
||||||
<visual name="visual">
|
|
||||||
<geometry>
|
|
||||||
<cylinder>
|
|
||||||
<radius>0.2</radius>
|
|
||||||
<length>2.0</length>
|
|
||||||
</cylinder>
|
|
||||||
</geometry>
|
|
||||||
<material>
|
|
||||||
<ambient>1 0.55 0 1</ambient>
|
|
||||||
<diffuse>1 0.55 0 1</diffuse>
|
|
||||||
<specular>0.1 0.1 0.1 1</specular>
|
|
||||||
<emissive>0 0 0 0</emissive>
|
|
||||||
</material>
|
|
||||||
</visual>
|
|
||||||
</link>
|
|
||||||
</model>
|
|
||||||
</sdf>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
|||||||
<aircraft
|
<aircraft
|
||||||
name="simulate_orange_avoid"
|
name="simulate_orange_avoid"
|
||||||
ac_id="232"
|
ac_id="232"
|
||||||
airframe="airframes/examples/ardrone2_gazebo_cyberzoo.xml"
|
airframe="airframes/tudelft/ardrone2_orangeavoid_course2017_gazebo.xml"
|
||||||
radio="radios/dummy.xml"
|
radio="radios/dummy.xml"
|
||||||
telemetry="telemetry/default_rotorcraft.xml"
|
telemetry="telemetry/default_rotorcraft.xml"
|
||||||
flight_plan="flight_plans/tudelft/course2017_avoid_orange_cyberzoo.xml"
|
flight_plan="flight_plans/tudelft/course2017_avoid_orange_cyberzoo.xml"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</program>
|
</program>
|
||||||
<program name="Environment Simulator" command="sw/simulator/gaia"/>
|
<program name="Environment Simulator" command="sw/simulator/gaia"/>
|
||||||
<program name="NatNet" command="sw/ground_segment/misc/natnet2ivy"/>
|
<program name="NatNet" command="sw/ground_segment/misc/natnet2ivy"/>
|
||||||
<program name="Gazebo" command="gzclient"/>
|
<program name="Gazebo" command="sw/tools/gzclient_launcher.sh"/>
|
||||||
</section>
|
</section>
|
||||||
<section name="sessions">
|
<section name="sessions">
|
||||||
<session name="Bebop basic">
|
<session name="Bebop basic">
|
||||||
|
|||||||
Submodule
+1
Submodule sw/ext/tudelft_gazebo_models added at ccb6baa57a
@@ -337,15 +337,32 @@ static void init_gazebo(void)
|
|||||||
std::exit(-1);
|
std::exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "Add Paparazzi model path: " << gazebodir + "models/" << endl;
|
cout << "Add Paparazzi paths: " << gazebodir << endl;
|
||||||
gazebo::common::SystemPaths::Instance()->AddModelPaths(
|
gazebo::common::SystemPaths::Instance()->AddModelPaths(
|
||||||
gazebodir + "models/");
|
gazebodir + "models/");
|
||||||
|
sdf::addURIPath("model://", gazebodir + "models/");
|
||||||
|
sdf::addURIPath("world://", gazebodir + "world/");
|
||||||
|
|
||||||
|
cout << "Add TU Delft paths: " << pprz_home + "/sw/ext/tudelft_gazebo_models/" << endl;
|
||||||
|
gazebo::common::SystemPaths::Instance()->AddModelPaths(
|
||||||
|
pprz_home + "/sw/ext/tudelft_gazebo_models/models/");
|
||||||
|
sdf::addURIPath("model://", pprz_home + "/sw/ext/tudelft_gazebo_models/models/");
|
||||||
|
sdf::addURIPath("world://", pprz_home + "/sw/ext/tudelft_gazebo_models/world/");
|
||||||
|
|
||||||
// get vehicles
|
// get vehicles
|
||||||
cout << "Load vehicle: " << gazebodir + "models/" + NPS_GAZEBO_AC_NAME + "/" + NPS_GAZEBO_AC_NAME + ".sdf" << endl;
|
string vehicle_uri = "model://" + string(NPS_GAZEBO_AC_NAME) + "/" + string(NPS_GAZEBO_AC_NAME) + ".sdf";
|
||||||
|
string vehicle_filename = sdf::findFile(vehicle_uri, false);
|
||||||
|
if(vehicle_filename.empty()) {
|
||||||
|
cout << "ERROR, could not find vehicle " + vehicle_uri << endl;
|
||||||
|
std::exit(-1);
|
||||||
|
}
|
||||||
|
cout << "Load vehicle: " << vehicle_filename << endl;
|
||||||
sdf::SDFPtr vehicle_sdf(new sdf::SDF());
|
sdf::SDFPtr vehicle_sdf(new sdf::SDF());
|
||||||
sdf::init(vehicle_sdf);
|
sdf::init(vehicle_sdf);
|
||||||
sdf::readFile(gazebodir + "models/" + NPS_GAZEBO_AC_NAME + "/" + NPS_GAZEBO_AC_NAME + ".sdf", vehicle_sdf);
|
if(!sdf::readFile(vehicle_filename, vehicle_sdf)) {
|
||||||
|
cout << "ERROR, could not read vehicle " + vehicle_filename << endl;
|
||||||
|
std::exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
// add or set up sensors before the vehicle gets loaded
|
// add or set up sensors before the vehicle gets loaded
|
||||||
// laser range array
|
// laser range array
|
||||||
@@ -378,10 +395,19 @@ static void init_gazebo(void)
|
|||||||
|
|
||||||
|
|
||||||
// get world
|
// get world
|
||||||
cout << "Load world: " << gazebodir + "world/" + NPS_GAZEBO_WORLD << endl;
|
string world_uri = "world://" + string(NPS_GAZEBO_WORLD);
|
||||||
|
string world_filename = sdf::findFile(world_uri, false);
|
||||||
|
if(world_filename.empty()) {
|
||||||
|
cout << "ERROR, could not find world " + world_uri << endl;
|
||||||
|
std::exit(-1);
|
||||||
|
}
|
||||||
|
cout << "Load world: " << world_filename << endl;
|
||||||
sdf::SDFPtr world_sdf(new sdf::SDF());
|
sdf::SDFPtr world_sdf(new sdf::SDF());
|
||||||
sdf::init(world_sdf);
|
sdf::init(world_sdf);
|
||||||
sdf::readFile(gazebodir + "world/" + NPS_GAZEBO_WORLD, world_sdf);
|
if(!sdf::readFile(world_filename, world_sdf)) {
|
||||||
|
cout << "ERROR, could not read world " + world_filename << endl;
|
||||||
|
std::exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
// add vehicles
|
// add vehicles
|
||||||
world_sdf->Root()->GetFirstElement()->InsertElement(vehicle_sdf->Root()->GetFirstElement());
|
world_sdf->Root()->GetFirstElement()->InsertElement(vehicle_sdf->Root()->GetFirstElement());
|
||||||
|
|||||||
Executable
+6
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# This script sets up the GAZEBO_MODEL_PATH for the gazebo client.
|
||||||
|
export GAZEBO_MODEL_PATH="$PAPARAZZI_HOME/conf/simulator/gazebo/models:$GAZEBO_MODEL_PATH"
|
||||||
|
export GAZEBO_MODEL_PATH="$PAPARAZZI_HOME/sw/ext/tudelft_gazebo_models/models:$GAZEBO_MODEL_PATH"
|
||||||
|
exec gzclient
|
||||||
|
|
||||||
Reference in New Issue
Block a user