Gazebo: Q&A Forum - RSS feed source question and answer forum for GazeboenCopyright Askbot, 2010-2011.Mon, 01 Apr 2019 11:09:23 -0500Setting physics engine time step explicitly Hello, I am currently using gazebo with ODE to simulate fluids, with the fluid simulation part being done with an external framework. The fluid simulation is making use of an adaptive timestep, which changes during the simulation. The way that the communication between gazebo and the fluid dynamics engine is done is through a world plugin. As the fluid timestep is adaptive, it is necessary to use the same time step for both the physical and the fluid simulation. Is there a way to achieve this programmatically? I see that I can specify the timestep through the physics engine pointer doing something like this this->world->GetPhysicsEngine()->SetMaxStepSize(TimeManager::getCurrent()->getTimeStepSize()); , where the getTimeStepSize refers to the fluid simulation. I am doing the update on every ConnectWorldUpdateEnd event. But this does not guarantee that the timestep will be the same, since it only sets the maximum step size, not the actual time step size. Is that enough? Any help would be appreciated. Best, ManosManosAngelidisMon, 01 Apr 2019 11:09:23 -0500 plugin tutorial, models not in the EntityTree Hi, Following the World Plugin tutorial I noticed something strange. After spawning the different models, they are not yet taken into account by the plugin. For instance if you try World::PrintEntityTree(), it won't show the spawned models. Is there a way to acces spawned model in the world plugin? Thanks for your helpkincurtFri, 16 Nov 2018 06:21:36 -0600 a URDF file from a World Plugin (gazebo without ROS), I am using gazebo to perform some robotics simulations. To this purpose I am using a Model Plugin to control my model and want to use a World Plugin to spawn the scenario of the simulation. Doing it this will allow me in the future to easily run several different scenario easily. The problem is that my models are .urdf files and it seems that the Wolrd class only allows to insert .sdf files. I tried using commands like `gz sdf -p` to convert the files but without succes, when I try to load them I always get this kind of errors while testing the spawn with `gz model` [Err] [] URI doesn't exist[package://robot/model/materials/scripts/robot.material] or [Err] [] Unable to download model[model://robot/model/meshes/Waist.STL] The corresponding lines in the .urdf would be: <gazebo reference="Leg"> <visual> <material> <script> <uri>package://robot/model/materials/scripts/robot.material</uri> <name>robot/darkgrey</name> </script> </material> </visual> </gazebo> and <geometry name="Waist_visual"> <mesh filename="package://robot/model/meshes/Waist.STL" scale="0.03937 0.03937 0.03937"/> </geometry> It should be noted that the models were previously spawned with ROS, but I decided to stop using it and only use the gazebo API which is less heavy to use. Do you know if there is a way of directly spawning .urdf models with a World Plugin or if not a way of doing it without ROS? Thanks for your help!kincurtThu, 15 Nov 2018 08:41:53 -0600 world pose for each step of simulation would I obtain joint world pose data for each step in a simulation? I have a model plugin that can get the joint position *before* the simulation is run, but how do I get the joint world pose for each simulation step? Thanks!jcMon, 13 Aug 2018 23:09:43 -0500 to define a new frame of Reference for world and model ? : 7.13.1 <br />Ubuntu : 16.04 I need to make a NED (North East Down) frame for world and model. Is there a way to define a new Reference frame which can be used for further simulations ? If not, Is there a way to transform from one frame to other ?<br /> Thanks in advance !pkSun, 22 Jul 2018 02:30:07 -0500 orthographic camera there a way to set the zoom for an orthographic camera from a world file? Using pose for a perspective camera works fine. When using an orthographic camera that is perpendicular with an axis the pose value for the perpendicular axis does not work. Any ideas?jcMon, 06 Aug 2018 13:49:39 -0500 to run sketchup made warehouse. When I upload the .dae file it either does not load or is extremely slow. Is there a way to reduce the size of this file or a way to successfully run a file of this size in Gazebo? .dae file size is around 35MB. I have tried to reduce size in sketchup using various methods and I have gotten it as small as I can get it. I have seen people run much larger and more complex models in gazebo so I do no know why mine will not work properlyJccurrenWed, 11 Jul 2018 11:21:53 -0500 lighting pattern error in gazebo with'm running a custom .world file with a custom collada mesh and textures in a gazebo environment. Looking at the images streaming through my /image_raw topic however, I'm observing a constantly shifting lighting pattern in the simulation. Regions of light and shadow are erratically shifting on the ground. How can I rectify this?[C:\fakepath\light_error1.png](/upfiles/15312458382405488.png) [C:\fakepath\light_error2.png](/upfiles/15312458549161881.png)asabetTue, 10 Jul 2018 13:04:49 -0500 mesh is missing textures'm trying to import a dae model from sketchup into my gazebo environment, but the textures are missing. [C:\fakepath\gazebo_custom_model.png](/upfiles/15312422521061968.png) This is my launch file: [C:\fakepath\](/upfiles/ How do I fix this?asabetTue, 10 Jul 2018 12:06:14 -0500 there any libraries of .world environment in sdf version 1.4 Hi everyone, is there a good website regrouping realistic .world file model in sdf version 1.4 ? all i could find was only available on sdf version 1.6... Thank you in advance StanSmoothWed, 28 Feb 2018 03:11:45 -0600 truth map for a gazebo world like the willowgarage model all, I use the turtlebot in the willowgarage world to create a semantic mapping system. As the actual mapping (using gmapping for example) is not the most important part of this effort, I would like to be able to use ground truths for the start as well. I found a way to get the ground truth pose (using the topic /gazebo/model_states), but now I also want a way to get the ground truth map, or at least some way to construct such a map. Is that possible? Alternatively, is there a way to provide gmapping with the ground truth pose such that it just builds perfect maps (assuming a static world)? Ultimately I would like to have a tf frame /mobile_base_groudntruth and a map topic /map_groundtruth. Any help is very much appreciated! Best, KoenkoenlekFri, 28 Mar 2014 12:18:06 -0500 is the sun added twice to a world file? I have created a new world using the GUI and save this world as .world file then the sun is added twice. I found at the top of the world file: <light name='sun' type='directional'> <cast_shadows>1</cast_shadows> <pose frame=''>0 0 10 0 -0 0</pose> <diffuse>0.8 0.8 0.8 1</diffuse> <specular>0.1 0.1 0.1 1</specular> <attenuation> <range>1000</range> <constant>0.9</constant> <linear>0.01</linear> <quadratic>0.001</quadratic> </attenuation> <direction>-0.5 0.5 -1</direction> </light> and at the bottom of the file this: <light name='sun'> <pose frame=''>0 0 10 0 -0 0</pose> </light> Why is the sun added twice?KnuepplTue, 16 Jan 2018 04:24:24 -0600 Mesh, into MeshManager, via SDF to a model in a world: how? Howdy folks, I am trying to get to the bottom of how exactly a mesh is loaded in Gazebo. I am working on a Gazebo Plugin that generates trees procedurally such that I can create a forest where each tree's geometry/shape is unique (more or less). I have figured out how to convert a procedurally generated tree to a Mesh, and then add this Mesh to MeshManager: gazebo::common::Mesh * treeMesh = procTreeFunction(); treeMesh->SetName("Tree_1234"); gazebo::common::MeshManager::Instance()->AddMesh(treeMesh); But what I am currently struggling with what to do next in order to see this tree in my Gazebo world, and what follows is questionable and is what I need some help with. So next I am creating an SDF model string: modelStr << "<sdf version='" << SDF_VERSION << "'>" "<model name='" Tree_1234 "'>" "<pose>" << pose << "</pose>" "<link name='link'>" "<velocity_decay>" "<linear>0.01</linear>" "<angular>0.01</angular>" "</velocity_decay>" "<inertial><mass>" << _mass << "</mass>" "<inertia>" "<ixx>" << Ixx << "</ixx>" "<iyy>" << Iyy << "</iyy>" "<izz>" << Izz << "</izz>" "<ixy>" << 0.0 << "</ixy>" "<ixz>" << 0.0 << "</ixz>" "<iyz>" << 0.0 << "</iyz>" "</inertia>" "</inertial>" "<collision name='collision'>" "<geometry>" "<mesh>" "<uri>" Tree_1234 "</uri>" "</mesh>" "</geometry>" "</collision>" "<visual name='visual'>" "<geometry>" "<mesh>" "<uri>" Tree_1234 "</uri>" "</mesh>" "</geometry>" "<material>" "<ambient>" << _materialAmbient[0] << " " << _materialAmbient[1] << " " << _materialAmbient[2] << " " << _materialAmbient[3] <<"</ambient>" "<diffuse>" << _materialDiffuse[0] << " " << _materialDiffuse[1] << " " << _materialDiffuse[2] << " " << _materialDiffuse[3] <<"</diffuse>" "<specular>" << _materialSpecular[0] << " " << _materialSpecular[1] << " " << _materialSpecular[2] << " " << _materialSpecular[3] <<"</specular>" "<emissive>" << _materialEmissive[0] << " " << _materialEmissive[1] << " " << _materialEmissive[2] << " " << _materialEmissive[3] <<"</emissive>" "</material>" "</visual>" "</link>" "</model>" "</sdf>"; And then I add the model to my world sdf::SDF sdfDescription.SetFromString(modelStr.str()); _parent->InsertModelSDF(sdfDescription); However, instead of seeing a tree, I am seeing a cube (that appears to be a unit cube of 1 m^3). The cuboid is rendered in the correct material settings and at the right location. It's just not a tree :) Does anyone have an idea what I might be doing wrong? Thanks in advance!! GaltoGalto2000Sat, 11 Nov 2017 20:17:30 -0600 to reflect the change of parameters of bounce? wanted to simulate motion of bouncing ball. So I changed parameters(restitution_coefficient, threshold, min_depth, and so on)in world file(SDF). But in my simulation, the motion of a ball was strange. In spite of changing restitution_coefficient, the height of bounce was not change at all. I researched the cause, but I couldn't find. Here( is my world file. Does anyone know the cause? ViperSun, 19 Nov 2017 09:13:34 -0600 my saved World with Ros turtlebot and not the playground Guys, until now i always used : roslaunch turtlebot_gazebo turtlebot_world.launch so i got the default map with my turtlebot and the objects around. Now i make my own map and saved it. I create my own launch files like the launch files for turtlebot_world.launch. I only changed the world name to my new one. When i try to load my world i got always the empty world example world. Do i need further changes ? My best solution was to delete the playground world and copy my world in there. Is there a better solution ? I hope some one can help me.BaumboonMon, 23 Oct 2017 03:24:36 -0500 generating worlds (from Google Earth KML files) folks I have a bunch of Google Earth KML files with polygons indicating buildings, paths, special areas and pins indicating feature locations such as trees, poles, benches, etc. I'd like to convert this into a gazebo world - does anybody know if there is already a body of work on this subject that I can get access to (and build upon)? I suppose at this points, some tutorials and examples on procedurally building Gazebo worlds in general would also be very helpful. I have been Googling left and right on this subject, but didn't find much. I was initially thinking on creating a parser that reads the KML file, and then spits out a .world file, but I probably could also create a Gazebo plugin that reads in the KML file and then generates the world accordingly. Does anyone have an opinion on these approaches, one vs the other or some other way? Thanks in advance Galto Galto2000Sun, 08 Oct 2017 18:01:06 -0500 to add a mode which is downloaded to the world by add <uri>model:</uri> try to compile the world about UAV, I downloaded the SDF file, and I can insert this model into gazebo. When I try to compile the .world file, I add the .sdf and .config to the same file with the .world. I and the model to the world by using <uri> </uri>,however, it shows that gazebo can not find the model. What should I do to add the model to the world?![image description](/upfiles/15049731082802547.png)Ji CaiSat, 09 Sep 2017 11:05:47 -0500 constantly crashing!!! all, I'm following [this]( tutorial to populate a gazebo world with cob_objects. So, first I run: $ export ROBOT=cob4-2 $ export ROBOT_ENV=ipa-apartment $ roslaunch cob_bringup_sim robot.launch Then, in another terminal, I run: $ export ROBOT=cob4-2 $ export ROBOT_ENV=ipa-apartment $ roslaunch cob_default_env_config upload_object_locations.launch $ rosrun cob_bringup_sim table_tv and gazebo crashes. And I get this as error: Error [] Unable to set value [-nan -nan -nan] for key[size] gzserver: /build/ogre-1.9-mqY1wq/ogre-1.9-1.9.0+dfsg1/OgreMain/src/OgreNode.cpp:630: virtual void Ogre::Node::setScale(const Ogre::Vector3&): Assertion `!inScale.isNaN() && "Invalid vector supplied as parameter"' failed. Error [] Unable to set value [-nan -nan -nan] for key[size] gzclient: /build/ogre-1.9-mqY1wq/ogre-1.9-1.9.0+dfsg1/OgreMain/src/OgreNode.cpp:630: virtual void Ogre::Node::setScale(const Ogre::Vector3&): Assertion `!inScale.isNaN() && "Invalid vector supplied as parameter"' failed. Aborted (core dumped) Please, can someone explain me where is the problem? Thanks.federico.nardiMon, 28 Aug 2017 06:48:50 -0500 to add color to a wall from the inside, I am using .world file to generate a room. In the room, I have colored each wall differently, however, from the inside, the walls stay grey. I was wondering if there is a way to change the color of the walls from inside. Thanks kchledowskiThu, 10 Aug 2017 08:53:10 -0500 set to be fixed to world keeps jittering**Background**: I want to set one of the box object to be fixed to the world. **What I have tried**: if an object set to be fixed to the world, it will keeps jittering. According to my search, some say it could be [inertia problem]( Though I change it according to [formula of uniform 3d object](, and it still doesn't work **Source code**: Here is the [wall.xacro]( // script I show has commented the below code Code below used to make box object fixed to world. <!-- wall fixed to the world--> <link name="world"/> <joint name="base_link_fixed" type="fixed"> <parent link="world"/> <child link="wall_link"/> </joint> **Problem**: However, the box turns out to be jittering all the time like dancing!! ![box_jitter](/upfiles/1497189287135148.png) **Solution Found** Thank WarwickWagon's answer. The first solution works well.shawnyshSun, 11 Jun 2017 08:58:14 -0500 settings not working My world file `` is: <?xml version="1.0"?> <sdf version="1.4"> <world name="default"> <include> <uri>model://ground_plane</uri> </include> <include> <uri>model://sun</uri> </include> <model name="my_mesh"> <pose>0.2 0 0 0 0 0</pose> <static>true</static> <link name="pad_body"> <inertial> <pose>0.315 0 0.0885 0 0 0</pose> <mass>100.0</mass> <inertia> <ixx>1.0</ixx> <ixy>0.0</ixy> <ixz>0.0</ixz> <iyy>1.0</iyy> <iyz>0.0</iyz> <izz>1.0</izz> </inertia> </inertial> <collision name="collision"> <geometry> <mesh> <uri>model://visual/taskpad.dae</uri> </mesh> </geometry> </collision> <visual name="visual"> <geometry> <mesh> <uri>model://visual/taskpad.dae</uri> </mesh> </geometry> </visual> </link> </model> </world> </sdf> But the inertial settings not working, after run the following command, $ gazebo gazebo always show its mass and moment of inertial as gazebo default values. Any help will be appreciated! jacknlliuTue, 30 May 2017 02:46:54 -0500 in world cycle made a world plugin that spawns and deletes specific objects, but i don't fully understand the world update cycle. This question arose when comparing the ROS and Gazebo communication system. In ROS, we can decide when to dispatch callbacks using spinOnce, but in Gazebo I do not know when the callbacks are executed. So my question is: When are the callbacks executed? Is this process asynchronous due to Boost.Asio? jbgaFri, 28 Oct 2016 10:26:16 -0500 between loading a model in gzclient and in world file ! In my model's plugin i change its name and sdf in the Load() function. If i load two models inside the .world file, the changes in the name and SDF are well accepted and correctly displayed in gzclient. If i load one model in the .world file and the other by "hand" using gzclient, the first model has all the changes correctly done, but the other doesn't. What's the catch here ? Thanks !wicked88Tue, 23 Aug 2016 12:22:30 -0500 in environment(world) control. there ! , Do you have any recommended method in order to create the world that we can interact with it . such as - turn on , off the lights - open , close the doors manually and automatically with the script (py,C++ is alright) . i have read through the tutorial and i cannot find the way to deal with it directly . So , i decided to post here to be the reference for the guy who is new to the gazebo like me. c3mxTue, 19 Jul 2016 03:57:34 -0500 to delete a model with an world plugin I wrote a WorldPlugin similar to the [factory example]( and now I want to delete a added model but how? The following approach does not work :-( void delete(const std::string& name){ # Info world_ is of type physics::WorldPtr physics::ModelPtr p = world_->GetModel(name); p->RemoveChildren(); } Greetings MarkusMarkus BaderThu, 10 Apr 2014 05:19:46 -0500 a PRM from a Gazebo world, I have a Gazebo world, just with walls, and a simple robot with sdf. I would like to create a PRM (probabilistic roadmap) of my environment, without using any camera to map the environment. Is there any way to do this directly? I know OMPL does, but, how can I validate states and edges of the PRM just having a gazebo world? My question is: there is something out of the box which I can use? Thank you very muchDurathMon, 18 Jul 2016 12:06:16 -0500 to build a circuit in gazebo [Update visuals at runtime] all, I am trying to build a circuit in Gazebo but I don't know how I can manage this task. In particular I don't know if I have to Necessarily create a .world file or I can just create a texture for example. I have an image of this circuit and also I can have a gis file, could these files help me? Someone had already faced with this kind of work? Thanks in advance. [copied from comments by moderator] I am sorry if I was so inaccurate. I am using Gazebo7 without ROS and I am writing some code for path plannig in autonomous cars scenario. As clarified today by my Ph.D. tutor I just have to update the ground plane texture at runtime. More in detail: I have a module that using Gazebo messages (I don't already know which ones) sends at certain time intervals an image that represents the actual state of the road (for example lanes) and I just want that Gazebo draws for me the new road UPDATE Hi all and Hi Peter, I tried to do do what you said but I am not sure that I have done the right things (in fact it doesn't work). Actually I started from the tutorial at to manage the messages and from your code to update the model. More precisely: 1: I build a world in which I put a ground model with the texture that I have to modify at runtime. 2: I used all the code that I linked to manage the message exchange but in the function create() I put the code of my interest. I used this function because it seems that is the function that performs the operation when a message arrives. I modified the function in the following way (I commented the initFile because I don't know the perfect meaning and I don't know how to use it and if I have to use it): public: void create(CollisionMapRequestPtr &msg) { std::cout << "Received message" << std::endl; modelSDF.reset(new sdf::SDF); std::cout << "After Reset"<<std::endl; // sdf::initFile("root.sdf", modelSDF); sdf::readFile("~/.gazebo/models/my_ground_plane/model.sdf", modelSDF); std::cout<< "After reading"<<std::endl; world->InsertModelSDF(*modelSDF); std::cout << "After inserting"<<std::endl; } Obviously the prints are useful just for debug. As to me it seems to be reasonable. 3:I send a message as shown in the tutorial and before to send it I change the image that I would like use as new texture (is an image exchange so I change the file but I use the same name). 4: I receive the following output (wrong and I have texture no update): Subscribing to: ~/collision_map/command [Err] [] Light [sun] not found. Use topic ~/factory/light to spawn a new light. Received message After Reset Error [] Error finding file [~/.gazebo/models/my_ground_plane/model.sdf]. After reading After inserting Error [] Error parsing XML from string: Error reading end tag. [Err] [] Unable to read sdf string[<?xml version='1.0'?> <sdf version='1.6'> </> </sdf>] It is saying that cannot find the model but I am sure that the model is in the specified path. Thanks in advance, I hope I was clear insavaresefWed, 08 Jun 2016 07:56:37 -0500 to project from world to image pixel coordinates in a CameraSensor plugin have written a gazebo CameraSensor plugin to draw sparse features from a map, based on the frustrum of the camera. I can get the frustrum information (HFOV, VFOV, near and far clip) from ```sensors::CameraSensor::Camera()```, and I can work out the camera extrinsics from the link and sensor pose. What I can't seem to work out is how is perform an inverse pinhole projection from world coordinates (X,Y,Z) to image plane coordinates (U,V). Is this possible with the Gazebo API or do I need to use the image_geometry package in ROS to achieve this?Andrew SymingtonFri, 22 Apr 2016 16:56:32 -0500 world via messages looked through the Messages API and tried to use WorldModify messages like this: * send a WorldModify message with `remove` set to `true` and `world_name` set to `default` to close the current world (also tried to reference the world with "worlds/") * send a WorldModify message with `create` set to `true` and `world_name` set to, for example, `worlds/` in order to open a new world The result is that if I have the client open it crashes, otherwise (if gazebo is running headless) nothing changes. I have also tried to first pause the world then send the WorldModify messages and then do a reset with a WorldReset message but again nothing happened. I check with `gz topic -e /gazebo/world/modify` that gazebo receives the messages, so I guess I'm not using them properly. Is it possible to open/close worlds via messages? If it is, how do you do that?gshopovWed, 23 Mar 2016 16:44:38 -0500 models from other package's launch files guys, is it possible to distribute world models (incl. dae-files) and vehicle models in different packages? I've got the following package structure using Gazebo 2.2.3: > ` catkin_ws/src/model_package` contains the *.world files including references to the respective *.dae files > ` catkin_ws/src/robot_package` contains the robot description as well as the respective controller,ros plugins and launch files When i try to reference the world file of the model_package in the launch file of the robot in the robot_package via <arg name="world_name" default="$(find model_package)/worlds/"/> i obtain the error > Error [] File or path does not exist[""] > Error [] No mesh specified I assume, that the linked mesh cannot be loaded. The mesh itself is referenced like <geometry> <mesh><uri>file://Road.dae</uri></mesh> </geometry> The world can be loaded from any launch file inside the model package. I just checked the GAZEBO_RESOURCE_PATH and GAZEBO_MODEL_PATH. The variables are set correctly to the directory, where both the world file and the dae-file are placed. Any suggestions? Best regards,IlluminaturWed, 20 Jan 2016 04:50:25 -0600