<!DOCTYPE module SYSTEM "module.dtd">

<module name="cv_opticflow" dir="computer_vision">
  <doc>
    <description>
        Compute Optic Flow from Ardrone2 Bottom Camera

        Computes Pitch- and rollrate corrected optic flow from downward looking
        ARDrone2 camera looking at a textured floor.

        - Sonar is required.
        - Controller can hold position
    </description>

    <section name="VISION" prefix="VISION_">
      <define name="HOVER" value="FALSE" description="TRUE/FALSE active or not"/>
      <define name="PHI_PGAIN" value="500" description="optic flow pgain"/>
      <define name="PHI_IGAIN" value="10" description="optic flow igain"/>
      <define name="THETA_PGAIN" value="500" description="optic flow pgain"/>
      <define name="THETA_IGAIN" value="10" description="optic flow igain"/>
      <define name="DESIRED_VX" value="0" description="feedforward optic flow vx"/>
      <define name="DESIRED_VY" value="0" description="feedforward optic flow vy"/>
    </section>
    <define name="DOWNLINK_VIDEO" value="FALSE" description="Also stream video: warning: this makes the optic flow slow: DEBUGGING only" />
    <define name="OPTICFLOW_AGL_ID" value="ABI_SENDER_ID" description="ABI sender id for AGL message (sonar measurement) (default: ABI_BROADCAST)"/>
  </doc>
  <settings>
    <dl_settings>
	<dl_settings NAME="Vision Loop">
        <dl_setting var="activate_opticflow_hover" min="0" step="1" max="1" module="computer_vision/opticflow/hover_stabilization" shortname="hover" param="VISION_HOVER" values="FALSE|TRUE"/>
        <dl_setting var="vision_phi_pgain" min="0" step="1" max="10000" shortname="kp_v_phi" param="VISION_PHI_PGAIN"/>
        <dl_setting var="vision_phi_igain" min="0" step="1" max="1000" shortname="ki_v_phi" param="VISION_PHI_IGAIN"/>
        <dl_setting var="vision_theta_pgain" min="0" step="1" max="10000" shortname="kp_v_theta" param="VISION_THETA_PGAIN"/>
        <dl_setting var="vision_theta_igain" min="0" step="1" max="1000" shortname="ki_v_theta" param="VISION_THETA_IGAIN"/>
        <dl_setting var="vision_desired_vx" min="-5" step="0.01" max="5" shortname="desired_vx" param="VISION_DESIRED_VX"/>
        <dl_setting var="vision_desired_vy" min="-5" step="0.01" max="5" shortname="desired_vy" param="VISION_DESIRED_VY"/>
    </dl_settings>    </dl_settings>
  </settings>

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

  <init fun="opticflow_module_init()"/>

  <periodic fun="opticflow_module_run()" start="opticflow_module_start()" stop="opticflow_module_stop()" autorun="TRUE"/>
  <makefile target="ap">
    <define name="ARDRONE_VIDEO_PORT" value="2002" />

    <file name="opticflow_module.c"/>
    <file name="opticflow_thread.c" dir="modules/computer_vision/opticflow"/>
    <file name="visual_estimator.c" dir="modules/computer_vision/opticflow"/>
    <file name="hover_stabilization.c" dir="modules/computer_vision/opticflow"/>
    <file name="optic_flow_int.c" dir="modules/computer_vision/cv/opticflow"/>
    <file name="fastRosten.c" dir="modules/computer_vision/cv/opticflow/fast9"/>
    <file name="trig.c" dir="modules/computer_vision/cv"/>
    <file name="framerate.c" dir="modules/computer_vision/cv"/>
    <file name="jpeg.c" dir="modules/computer_vision/cv/encoding"/>
    <file name="rtp.c" dir="modules/computer_vision/cv/encoding"/>
    <file name="socket.c" dir="modules/computer_vision/lib/udp"/>
    <file name="v4l2.c" dir="modules/computer_vision/lib/v4l"/>
    <define name="modules/computer_vision/cv" type="include"/>
    <define name="modules/computer_vision/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>
  <makefile target="nps">
    <file name="viewvideo_nps.c"/>
  </makefile>

</module>

