GSoC 2020: Project Plotting UI Ignition

Dear Gazebo community, Hope you are well :smiley: ,
I am Amr Elsersy, a 3rd year computer engineering student @ ASU, Egypt.
I am very interested in software robotics, and i am really excited to contribute in ignition , specially Plotting UI for Ignition Project , i have an experience in Qt C++ Framework in many projects in both (Qt Widget & Qt Quick, QML), i also have experience in ROS as i participated for 2 years in a ROV team that enters the ROV MATE Competition & we use ROS in our project.

And as i am interested in both robotics and qt applications, i felt that this project is the best choice for me.

This field is very interesting for me and i want to get that amazing experience of open source contributing in ignition.

i followed all the tutorials of ignition gui and i got familiar with it. also i learnt Qt Charts in QML and got familiar with it.

i want to know what is the next step that i can do ?
thank you very much for your time :smile:

kindly check my Github : https://github.com/AmrElsersy

1 Like

Hi Amr,

Thank you for your interest in the plotting project! I see youā€™ve already been playing with Ignition GUI and Qt Charts, which is great! Thatā€™s probably the best way you have get a feeling for what the project would be like!

Thatā€™s great! Ignition GUI also has some examples here which are not easy to find, be sure to check those out too. Iā€™d also recommend you go over Ignition Gazeboā€™s tutorials and examples, because those will be important for you to know how to extract data from simulation.

Cheers

Hello Louise, hope you are fine :smile:
i have followed your suggestions for a while and that is what i did :

  • I followed the examples of the ign-gui and knew how to build a gui plugin
  • I followed the tutorials and examples of ign-gazebo and got familiar with it and with its
    entity component structure and learnt how to extract data from it via the ECM
  • I also followed the tutorials-examples of the ign-transport to get familiar with it

I tried to apply all that so i write a code to plot the x-coordinates of a car in ign-gazebo (i used the ā€œlevels.sdfā€ in the examples to get the car & ā€œstandalone keyboardā€ to control it)
and i make 2 plugins , a System plugin & Gui Plugin, the system plugin extracts the position of the car and publish it via ign-transport publisher to the gui plugin, and the gui plugin subscribes to that topic to get the data and plot it via Qt Charts

this is a part of the code, but you can see the whole code at https://github.com/AmrElsersy/Ignition-plotting

i want to ask about your opinion in what i did :smile:
is that is the best way to extract data from ign-gazebo ? via ign-transport ?
or it can be done only by the gui plugin ?
i tried to make the gui plugin and system plugin in one plugin (making the class inherits from Plugin, System and ISystemPostUpdate ) but i had i huge amount of CMake errors :sweat_smile: ,but i guess that they are 2 different types of plugins and cannot be merged, what do you think about that ?

thank you for your time Louise, i will be waiting for you :smile:

1 Like

this is a 30 seconds video shows what i did.

and kindly take a look at the results of the problem of Qt charts in ignition gazebo
https://answers.gazebosim.org/question/24669/qt-charts-with-ignition-gui-plugin/

thanks :smile:

1 Like

Nice, Amr! This is looking awesome!

That sounds like a great approach! Plotting values from Ignition Transport topics is definitely a very common use case that needs to be supported. Iā€™m super impressed you got it to work so fast!

Your publisher system sounds similar to ignition::gazebo::systems::PosePublisher, did you see if thereā€™s any overlap with that?

Thatā€™s definitely one of the ways. I think many users will be using that. The advantage of Ignition Transport is that itā€™s not limited to Ignition Gazebo. Other applications could be publishing on those topics and using your plugin to plot them.

Another use case, specific to Ignition Gazebo, is plotting data directly from components. See below.

Iā€™m not sure if youā€™ve seen this, but thereā€™s a plugin type in Ignition Gazebo which sounds like it does exactly what you want, ignition::gazebo::GuiSystem Iā€™m adding an example on this pull request. That should give you access to components on the GUI. I think that would be the 2nd most common use case for the plot.

I just replied! Youā€™re welcome to open a pull request against ign-guiā€™s default branch with your changes! Be sure to update all other libraries according to this list. Thanks a lot!

1 Like

This is really very helpful :smile: :blue_heart:
no i didnā€™t see it before, this definitely solves the problem, i was using the ign-transport not for only plotting via topics, but also to plot via entitiesā€™s components ! , because i thought that i canā€™t do that in the gui plugin so i made a system plugin and connect it with the gui plugin with ign-transport as a bridge to transfer the entities and components data, but the GuiSystem plugin is a perfect solution ! thank you very much :smile:

I re-implemented the code to use the GuiSystem so that we will implement one plugin that has the logic of the plotting in 2 ways (via ignition transport and entities-components after we get access to the ECM ) and this is the code https://github.com/AmrElsersy/Ignition-plotting/tree/master/gui_system_plugin ,
of course it is hard coded to subscribe to a cretin topic, and access specific component, but the next step is to make the user choose them :love_you_gesture:

this is a 35 seconds video shows the plotting via car position and plotting via ign transport ( publishing via the terminal )

but i had a small problem, that the GuiSystem Plugin can run only via ign gazebo with ign-gui ! i canā€™t run it via only ign-gui, so how can the user use it outside ign-gazebo?
is that normal ??

my updates are in ign-gui only, what do you mean by updating other libraries ?

That sounds great!

Yes, thatā€™s a good point. The GuiSystem only works with ign-gazebo. I think it would be great to:

  • have the bulk of the plotting code on ign-gui, outside a plugin
  • have a pure ign-gui plugin which implements the Ignition Transport interface on top of the plotting code
  • have an ignition::gazebo::GuiSystem which implements the components interface on top

What do you think?

Oh sorry, what I meant is that since this is targeting an unreleased Ignition version (Ignition Dome), youā€™ll need to build several libraries from source. Iā€™d recommend you actually build them all from source, using the branches on the file linked above. You can find instructions here.

:v::fire:

1 Like

sounds a cool idea :smile:
i will work on that and will tell you once i finish :love_you_gesture:

thanks :smile:

1 Like

Hello Louise :smile:

this is what i have done last days

  • i have installed all the libraries listed here from source.

  • i worked on accessing all the transport topics to let the user choose from them which topic to plot , i made a topics model by subclassing QStandaredItemModel and accessed all topics to fill that model to show it to the user.
    in this video i publish 3 different topics with constant value msgs float , double , int , and the user chooses from them and the code checks the type of the subscribed topicā€™s msg and assign a siutable callback to update the values.

  • also i tried to make the 2 plugins ( pure ign-gui plugin & gui system plugin )
    I thought that both plugins will use transport plotting because when simulating any robot, the user may want to plot transport values from his controlling code.
    So i made a transport plotting behavior outside the plugins and made the 2 plugins composite that transport behavior. and the gui system plugin implements also the entity-component plotting .
    this is the code GuiPlotting GazeboPlotting
    and this is a class diagram of the code

  • the GuiPlotting is just an interface between the transport and UML

  • there is a lot of redundant code between GuiPlotting and GazeboPlotting, both have the same functions that QML calls, i couldnā€™t make this functions general and both plugins inheretes them as the 2 plugins has different names and Qml accesses that functions through the plugin name so i had to copy them in the 2 plugins.

also this is a video that shows the running of the plugins

actually after i finished that, i felt that i did something wrong :sweat_smile: or i donā€™t understand the whole design that should be done, as there is a lot of redundant code :sweat_smile:
what do you think about that ?

Cool! Note that weā€™re migrating everything to GitHub. So that gazebodistro file is now here: https://github.com/ignition-tooling/gazebodistro/blob/master/collection-dome.yaml . Also, youā€™ll need to update your entire environment with git clones instead of the old mercurial ones, and manually copy your changes to the new clones.

This is looking great!

Humm good point that QML is using the plugin names. Maybe we can work around this by creating a new class, say PlottingIface, and setting it as a new context property as done here? That should expose the new class to the QML. Then the plugins wouldnā€™t inherit from that class, but they could maybe keep it as a member variable?

This is great! :100:


@claireyywang, feel free to pitch in if you have any ideas.

1 Like

do you mean that i should install all of them from source again ? or just cloning them ?

Ok i tried this, but i couldnā€™t composite any class that inherits from QObject in the Gui Plugin Class ! i donā€™t know why but when i do that it gives me that error

error while loading the library libGuiPlotting.so: undefined symbol: _ZTV17PlottingInterface

it canā€™t see my interface, and when i remove the QOjbect inheretance and Q_OBJECT macro, it works
i tried this in many ways but it dosnā€™t work, and i didnā€™t find any other plugin that do a thing like that, so is it because of ignition or it can be done ?

this is the code https://github.com/AmrElsersy/Ignition-plotting/tree/master/gui_plotting

Hi Amr, I think just cloning repos into /src + copy your changes should be fine. Also quick tip if you are building with colcon, using colcon build --cmake-args -DBUILD_TESTING=OFF can speed up the build process.

That looks like a linking error. We need the QObject for Qt to work. Iā€™ll give a stab at the code.

1 Like

Hi Amr, would you mind adding more documentation on the repo about how you are running/testing your code? The demo you recorded looks amazing, would be great to know how to reproduce it. Also sorry itā€™s taking me a while to figure out the problem. We have a release this week and thatā€™s been hogging my bandwidth. Will get back to you asap.

1 Like

Hi claire :smile:
i added a README file in the repo you can check it
https://github.com/AmrElsersy/Ignition-plotting

Never mind :smile: and thank you

1 Like