I’m trying to implement a simple Gazebo plugin that adapts the elevation of the roads extracted with OSM to the DEM file of the same region. For this purpose, I attended to accumulate all the roads in a world file as physics::RoadPtr objects. World class still lacks a proper support for the Road objects, therefore I came out with a workaround that uses Base and SDF objects to load the correct road portions. Below is an example code:
physics::BasePtr road_base = world->BaseByName(road_name); physics::RoadPtr road(new physics::Road(road_base)); sdf::ElementPtr tmp = road_base->GetSDF(); road->Load(tmp);
I expect the road to be properly loaded. However when I execute
road->Print("") to see whether it&
;s filled, only the name of road is seen. Moreover, #39
road->Points.size() gives 0 and
road->GetWidth() outputs garbage values. Either Load function is not accurately implemented or I make a mistake at some point.
When I looked to the source of Load function, I noticed that it uses
Base->Load(sdf::ElementPtr). However, there is a problem in Base->Load at line 84. At the end it calls Base::RegisterIntrospectionItems(), which is empty. I think it’s deliberately left empty to be implemented in the future, however the physics::Road API does not work as expected due to this problem. T
his makes me wonder that any class inherits from Base should have a problem loading SDF portions, since the problem is at Base.
EDIT: RegisterIntrospectionItems seems to be a protected function, which expects inheriting classes to implement itself. API specifies Link, Joint and Model classes implement it. Road also inherits from Base class, but does not implement it, which results in the current problem.
I’m open to any suggestion for a proper workaround other than editing the Gazebo source and having a source build, at least for the time being.