Difference between revisions of "Module/Servo switch"

From PaparazziUAV
Jump to navigation Jump to search
m
(syntaxhighlight)
Line 3: Line 3:


To use it load the servo_switch module:
To use it load the servo_switch module:
<pre>
{{Box Code|conf/airframes/myplane.xml|
<source lang="xml">
   <modules>
   <modules>
     ...
     ...
     <load name="servo_switch.xml"/>
     <load name="servo_switch.xml"/>
   </modules>
   </modules>
</pre>
</source>
}}


Now you only have to declare a servo in your airframe.xml that you
Now you only have to declare a servo in your airframe.xml that you
Line 19: Line 21:
The switch on value is 2000us and switch off is 1000us by default.
The switch on value is 2000us and switch off is 1000us by default.
e.g. in my airframe file I have:
e.g. in my airframe file I have:
<servos>
{{Box Code|conf/airframes/myplane.xml|
  ....
<source lang="xml">
  <servo name="SWITCH" no="7" min="1000" neutral="1500" max="2000"/>
  <servos>
</servos>
    ....
 
    <servo name="SWITCH" no="7" min="1000" neutral="1500" max="2000"/>
  </servos>
</source>
}}


If you want to use a different servo/values you can set that in the
If you want to use a different servo/values you can set that in the
modules section, e.g. for a servo named HATCH:
modules section, e.g. for a servo named HATCH:
<load name="servo_switch.xml">
{{Box Code|conf/airframes/myplane.xml|
    <define name="SERVO_SWITCH_ON_VALUE"  value="1100"/>
<source lang="xml">
    <define name="SERVO_SWITCH_OFF_VALUE" value="1900"/>
  <modules>
    <define name="SERVO_SWITCH_SERVO"    value="SERVO_HATCH"/>
    <load name="servo_switch.xml">
</load>
      <define name="SERVO_SWITCH_ON_VALUE"  value="1100"/>
      <define name="SERVO_SWITCH_OFF_VALUE" value="1900"/>
      <define name="SERVO_SWITCH_SERVO"    value="SERVO_HATCH"/>
  </load>
  </modules>
</source>
}}
Of course you only have to set these parameters here If you do not
Of course you only have to set these parameters here If you do not
want to use the DEFAULT servo (SWITCH) or the default on/off values.
want to use the DEFAULT servo (SWITCH) or the default on/off values.
Line 37: Line 48:
=== Calling from Flight Plan ===
=== Calling from Flight Plan ===
In your flight plan you just call the makro defined in servo_switch.h
In your flight plan you just call the makro defined in servo_switch.h
  <call fun="ServoSwitchOn()"/>
<source lang="xml"><call fun="ServoSwitchOn()"/></source>
or
or
  <call fun="ServoSwitchOff()"/>
<source lang="xml"><call fun="ServoSwitchOff()"/></source>
respectively.
respectively.



Revision as of 15:14, 4 March 2012

This module allows you to easily control a servo output like a switch (e.g. for a hatch, cam trigger, etc) via Flight Plan and GCS (not via RC!).

To use it load the servo_switch module:

File: conf/airframes/myplane.xml
  <modules>
    ...
    <load name="servo_switch.xml"/>
  </modules>

Now you only have to declare a servo in your airframe.xml that you want to use. Previously you had to set up commands, command laws as well.

Configuration

By default the servo_switch module looks for a servo called SWITCH. The switch on value is 2000us and switch off is 1000us by default. e.g. in my airframe file I have:

File: conf/airframes/myplane.xml
  <servos>
    ....
    <servo name="SWITCH" no="7" min="1000" neutral="1500" max="2000"/>
  </servos>

If you want to use a different servo/values you can set that in the modules section, e.g. for a servo named HATCH:

File: conf/airframes/myplane.xml
  <modules>
    <load name="servo_switch.xml">
      <define name="SERVO_SWITCH_ON_VALUE"  value="1100"/>
      <define name="SERVO_SWITCH_OFF_VALUE" value="1900"/>
      <define name="SERVO_SWITCH_SERVO"     value="SERVO_HATCH"/>
   </load>
  </modules>

Of course you only have to set these parameters here If you do not want to use the DEFAULT servo (SWITCH) or the default on/off values.

Calling from Flight Plan

In your flight plan you just call the makro defined in servo_switch.h

<call fun="ServoSwitchOn()"/>

or

<call fun="ServoSwitchOff()"/>

respectively.

Buttons in the GCS

To get buttons for the servo switch module in the GCS add settings_servo_switch.xml to the settings files of your aircraft.