Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#620 Stage: Support for power interface

open
Stage (103)
5
2012-12-16
2010-08-31
Jan Schlüter
No

Both Stage 3.2.2 and the git version do not support the power interface any more. This patch reintroduces it.
To achieve that, I rewrote the libstageplugin/p_power.cc InterfaceModel such that it translates the Model's PowerPack data into the proper Player format and offers it via the power interface for any Model. I created two different versions:
a) offers the power interface for any Model, just like the speech interface is currently implemented, by specifying an empty model type for InterfacePower. Disadvantage: The interface is available even if the model does not have a power pack (i.e. no joules or joules_capacity attribute).
b) offers the interface only for Models that have a PowerPack, by treating model type "power" as a special case in Model::GetUnusedModelOfType. This code is untested, I just wanted to convey the idea. If you think this is a better solution than a) and would like me to create a tested patch, please ask me.
The patches are against Stage 3.2.2, but I could create patches against the latest git version if somebody tells me where to obtain it. To patch, copy the patch files (a.patch and a2b.patch) into the Stage source directory and issue "patch -p1 -i a.patch" for solution a), optionally followed by "patch -p1 -i a2b.patch" for solution b).

Discussion

  • Jan Schlüter
    Jan Schlüter
    2010-08-31

    Two possible solutions for reintroducing the power interface to Player/Stage, a.patch and a2b.patch, in a tar file.

     
    Attachments
  • Rich Mattes
    Rich Mattes
    2010-09-15

    The latest git version of Stage is available at github. You can check it out using the command "git clone git://github.com/rtv/Stage.git"

     
  • Jan Schlüter
    Jan Schlüter
    2010-09-15

    Thanks, Rich. There is so much outdated information about the Stage repositories on the sourceforge pages, I wanted to make sure I get the right one.

    The existing patch (a.patch) can be applied to the git version as well, and seems to work perfectly. I can read out the battery state (Joules and Charging) both in playerv and my client program. Feel free to try yourself and adopt the patch.

    However, "energy output" and "energy stored" are no longer visualized in the Stage window, even if I request it. Try "stage fasr.world" in the worlds directory to verify. This worked with Stage 3.2.2, but not with the git version (independent of my patch). Apart from that, the git version does not let me drag around objects any longer or use drag and drop to scroll the map when zoomed in, instead it selects and moves some previously invisible object called "_ground_model". I will continue to use Stage 3.2.2 for these reasons.

    By the way, to compile Stage, I had to uncomment the line "# ${OPENGL_LIBRARIES} # is it safe to remove these permantently?" in libstage/CMakeLists.txt, otherwise I got linking errors like "undefined reference to 'gluSphere'" when make tried linking libstage.so. Shall I open another bug report and file in a patch for this?

     
  • Rich Mattes
    Rich Mattes
    2010-09-16

    I've been doing a little bit of legwork trying to get the backlog of patches on the tracker ready to be merged into Stage. I've got quite a few in my Stage branch already (github.com/jpgr87/Stage). I applied your power patches in my branch, they seem to work for me as well.

    I'm not sure why you needed to uncomment the opengl libraries,they should be included in the fltk_ldflags. Go ahead and open a bug describing your system setup, and the output of fltk_ldflags (add a line like MESSAGE(STATUS ${FLTK_LDFLAGS}) and run CMake)