mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-31 03:57:45 +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:
@@ -337,15 +337,32 @@ static void init_gazebo(void)
|
||||
std::exit(-1);
|
||||
}
|
||||
|
||||
cout << "Add Paparazzi model path: " << gazebodir + "models/" << endl;
|
||||
cout << "Add Paparazzi paths: " << gazebodir << endl;
|
||||
gazebo::common::SystemPaths::Instance()->AddModelPaths(
|
||||
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
|
||||
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::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
|
||||
// laser range array
|
||||
@@ -378,10 +395,19 @@ static void init_gazebo(void)
|
||||
|
||||
|
||||
// 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::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
|
||||
world_sdf->Root()->GetFirstElement()->InsertElement(vehicle_sdf->Root()->GetFirstElement());
|
||||
|
||||
Reference in New Issue
Block a user