Gazebo | Ignition | Community
Ask Your Question

Gazebo Fortress Custom plugins causing scene to not load

asked 2023-07-28 01:09:59 -0500

Ubuntu 22.04

Gazebo: Ignition Fortress

gazebo plugin: 1

Context, I've been trying to get a force sensor plugin working in gazebo fortress, however all the ones I've found are either for gazebo classic, or just fail to run with little documentation (an issue that plagues a lot of modern gazebo imo). my next solution was to create a custom plugin that solved my needs.

Currently I've created the example system plugin following the Gazebo API guides on creating system plugins. and after spending some time figuring out that you need to set the gazebo plugin path I've got a plugin that builds in cmake correctly and is loaded by gazebo. however once it loads it prevents the scene from being created, leaving me with a blank window.

Here are the relevant files

World file (including plugin)

<sdf version='1.9'>
<world name='default'>
<physics name='1ms' type='ignored'>

  <uri> Plane</uri>
<gravity>0 0 0</gravity>
<magnetic_field>6e-06 2.3e-05 -4.2e-05</magnetic_field>
<atmosphere type='adiabatic' />
  <ambient>0.4 0.4 0.4 1</ambient>
  <background>0.7 0.7 0.7 1</background>
<light name='sun' type='directional'>
  <pose>0 0 10 0 -0 0</pose>
  <direction>-0.5 0.1 -0.9</direction>
  <diffuse>0.8 0.8 0.8 1</diffuse>
  <specular>0.2 0.2 0.2 1</specular>

</plugin> </world> </sdf>



 #include <ignition/gazebo/System.hh>
 #include <ignition/plugin/Register.hh>
 namespace sample_system

class SampleSystem: public ignition::gazebo::System, 
    public ignition::gazebo::ISystemPostUpdate, 
    // public ignition::gazebo::ISystemPreUpdate, 
    // public ignition::gazebo::ISystemUpdate,
    public ignition::gazebo::ISystemConfigure
        ~SampleSystem() override;

        void PostUpdate(const ignition::gazebo::UpdateInfo &_info, const ignition::gazebo::EntityComponentManager &_ecm) override;
        // void PreUpdate(const ignition::gazebo::UpdateInfo &_info, ignition::gazebo::EntityComponentManager &_ecm) override;
        // void Update(const ignition::gazebo::UpdateInfo &_info, ignition::gazebo::EntityComponentManager &_ecm) override;
        void Configure(const ignition::gazebo::Entity &_entity,
            const std::shared_ptr<const sdf::Element> & _sdf,
            ignition::gazebo::EntityComponentManager &_ecm,
            ignition::gazebo::EventManager &/*_eventMgr*/);
        ignition::gazebo::Entity linkEntity;
// sample_system::SampleSystem::ISystemPreUpdate,
// sample_system::SampleSystem::ISystemUpdate,


#include "gazebo_system_plugin.hpp"
#include <ignition/gazebo/Model.hh>
#include <ignition/gazebo/Util.hh>
using namespace sample_system;
using namespace ignition::gazebo::v6;



void SampleSystem::Configure(const Entity &_entity,
const std::shared_ptr<const sdf::Element> & _sdf,
EntityComponentManager &_ecm,
EventManager &/*_eventMgr*/

void SampleSystem::PostUpdate(const UpdateInfo &_info,
const EntityComponentManager &_ecm){
// ignmsg << "SampleSystem::PostUpdate - " << _info.simTime.count() << std::endl;
// I have commented this out so that the ...
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2023-08-08 20:04:14 -0500

The solution to this is given in the following resolved git issue. but ultimately its that when you load a custom plugin, gazebo then doesn't load any of the default plugins, requiring you to manually add them to your world sdf file as well.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2023-07-28 01:01:49 -0500

Seen: 119 times

Last updated: Aug 08 '23