Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[modules] use VPATH to make it easier to load external modules #760

Closed
wants to merge 1 commit into from

Conversation

gautierhattenberger
Copy link
Member

With the use of VPATH, external modules can more easily define the list of files to compile using the xml node rather than raw makefile section with global paths.
Also add some options to add custom compile/link flags.
This should allow to improve the use of vision modules for ardrone2 in particular.

Compilation is tested on bare metal, chibios and ardrone autopilots

@flixr
Copy link
Member

flixr commented Jun 25, 2014

But this still means that you need to load the module xml using a realtive path (to sw/ext), right?

@gautierhattenberger
Copy link
Member Author

Yes, at some point you have to tell where are the module files. But with this it is possible (at least much easier) to make the module xml without global path. It is currently the case with the Mjepg vision module for instance. With this you can place the module at different places and it is in the airframe file that you give the path. Maybe it can help to distribute external modules ?
I don't really see an other option except using an environment variable to give search paths for external modules. If it is an option, it can be added later.

@flixr
Copy link
Member

flixr commented Jun 25, 2014

jep, sounds good

@gautierhattenberger
Copy link
Member Author

can I merge it ?

@dewagter
Copy link
Member

Great! Thank you Gautier. How should I change the Mjpeg.xml module?

load name="../sw/ext/ardrone2_vision/modules/Mjpeg.xml"
->
load dir="../sw/ext/ardrone2_vision/modules/" name="Mjpeg.xml"

and then all the relative paths in the Mjpeg.xml can be left out?

@gautierhattenberger
Copy link
Member Author

@dewagter I can send you my example files

I also would like to talk about the vision code, currently a submodule of tudelft. It is not the easiest way to add new stuff there. But I don't know what is the best actually: put all the code into paparazzi repo, split the general lib part (gstreamer, udp, jpeg, ...) and the modules, something else ?

@gautierhattenberger
Copy link
Member Author

My module xml file:

<!DOCTYPE module SYSTEM "../module.dtd">

<module name="Mjpeg">
  <doc>
    <description>Video ARDone 2</description>
  </doc>

  <header>
    <file name="viewvideo.h"/>
  </header>

  <periodic fun="viewvideo_run()" freq="1" start="viewvideo_start()" stop="viewvideo_stop()" autorun="TRUE"/>
  <makefile target="ap">
    <file name="viewvideo.c" dir="modules/Mjpeg"/>
    <file name="jpeg.c" dir="cv/encoding"/>
    <file name="rtp.c" dir="cv/encoding"/>
    <file name="socket.c" dir="lib/udp"/>
    <file name="video.c" dir="lib/v4l"/>
    <file name="ardrone2.c" dir="lib/v4l"/>
    <define name="modules" type="include"/>
    <define name="cv" type="include"/>
    <define name="lib" type="include"/>
    <define name="pthread" type="raw"/>
    <define name="__USE_GNU"/>
    <flag name="LDFLAGS" value="pthread"/>
    <flag name="LDFLAGS" value="lrt"/>
    <flag name="LDFLAGS" value="static"/>
  </makefile>
</module>

And the airframe file:

    <load name="modules/Mjpeg/ViewVideo.xml" dir="sw/ext/ardrone2_vision_enac">
      <define name="VIDEO_SOCK_OUT_OFFSET" value="$(AC_ID)"/>
      <define name="VIDEO_DOWNSIZE_FACTOR" value="4"/>
      <define name="VIDEO_QUALITY_FACTOR" value="70"/>
      <define name="VIDEO_FPS" value="1"/>
    </load>

@gautierhattenberger
Copy link
Member Author

merged with 50b51ce

@gautierhattenberger gautierhattenberger deleted the external_modules branch June 26, 2014 15:22
@flixr flixr added this to the v5.2 milestone Jul 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants