Difference between revisions of "Pan Tilt Camera"

From PaparazziUAV
Jump to navigation Jump to search
m
(add to modules category and remove unit="deg")
Line 1: Line 1:
<categorytree style="float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;" mode=pages>Modules</categorytree>
== Pan/Tilt Video Camera Mechanism ==
== Pan/Tilt Video Camera Mechanism ==


Line 77: Line 79:


  <section name="CAM" prefix="CAM_">
  <section name="CAM" prefix="CAM_">
   <define name="TILT_MAX"      value="30"  unit="deg"/>
   <define name="TILT_MAX"      value="30"/>
   <define name="TILT_NEUTRAL"  value="0"    unit="deg"/>
   <define name="TILT_NEUTRAL"  value="0"/>
   <define name="TILT_MIN"      value="-30"  unit="deg"/>
   <define name="TILT_MIN"      value="-30"/>
   <define name="TILT0"        value="0"    unit="deg"/>
   <define name="TILT0"        value="0" />


   <define name="PAN_MAX"    value="45" unit="deg"/>
   <define name="PAN_MAX"    value="45"/>
   <define name="PAN_NEUTRAL" value="0" unit="deg"/>
   <define name="PAN_NEUTRAL" value="0"/>
   <define name="PAN_MIN"    value="-45"  unit="deg"/>
   <define name="PAN_MIN"    value="-45"/>
   <define name="PAN0"          value="0" unit="deg"/>
   <define name="PAN0"          value="0"/>
  </section>
  </section>


Line 132: Line 134:
2=... (see your way point file)
2=... (see your way point file)


[[Category:Hardware]]
[[Category:Hardware]] [[Category:User_Documentation]] [[Category:Modules]]

Revision as of 02:13, 8 October 2014

Pan/Tilt Video Camera Mechanism

Paparazzi currently allows to automatically move (follow a waypoint) a one axis pitch or roll camera as well as a two axis yaw-fixed-then-pitch camera.

Two axis yaw-fixed, pitch-move mechanism
One axis roll
One axis pitch


The camera control is made of normal servos. Usually servos have a turn angle of about 90°. This is changed electrically so that they can do a 180°. It is achieved by adding two serial resistors at both sides of the potentiometer (P1), one for increasing the usable angle (R1) and the other for moving the middle position to a useful angle (R2). Therefore a servo with a 270° potentiometer is needed. Very small and light servos have 180° potentiometers, these do not allow a 180° degrees sweep. Cut the outer two connections between the potentiometer and the board to insert the resistors. The values for R1 and R2 should be found out by testing as there might be serial resistors on the servo board that affect the values. Start with about 1/2 the value of P1 for R1 and change R1 until you get a little more than 180° sweep. Then insert and modify R2 to set neutral back to the middle position of the potentiometer.



                    ^
                   /
             ----------
     *-------I   /    I-------*
     I       ----------       I
     I         /     P1       I
     I         I              I
     I         I              I
    ---        I             ---
    I I        I             I I
    I I        I             I I
    I I        I             I I
    --- R1     I             --- R2
     I         I              I
     I         I              I

If you don't want to bother modifying your servo to 180°, use a 180° servo strecher for your standard servo [ServoCity] or [RobotMarketPlace] or buy a 180° servo [ServoCity] or [Becker]

The Paparazzi software makes planes circle clockwise (use negative radius for counter-clockwise) so the default view is to the right side of the plane. The pan servo neutral makes the camera look to the right with 0° given, 90° is to the back and -90° is to the front. The tilt servo neutral makes the camera look down with 0° given, 90° is to the right and -90° is to the left (all values are used in radian in the software). If the camera looks to the right side of the plane, the picture is upright. It is upside down when looking to the left. That is corrected with the MPEG decoding software on the laptop by mirroring. The pan servo is fixed in the plane and the tilt servo is moved by the pan servo and moves the camera.

pan servo, tilt set to 90°, looking from top:

  plane front
 
      ^
      I
      I  45°
      I /
      I/
      I------- 0°
      I\
      I \
      I  -45°
      I

  plane rear

tilt servo, pan set to 0°, looking from back:

     
    plane left --------------- plane right
                    / I \
                   /  I  \
                -45°  I   45°
                      0°

tilt servo is moved by the pan servo and moves the camera.


Add this to your Aircraft file to the right place:

   <servo name="CAM_PAN"  no="3" min="2000" neutral="1550" max="1000"/>
   <servo name="CAM_TILT" no="6" min="1000" neutral="1550" max="2000"/>

   <axis name="CAM_TILT" failsafe_value="0"/>
   <axis name="CAM_PAN"  failsafe_value="0"/>

   <set command="CAM_PAN"  value="@YAW"/>
   <set command="CAM_TILT" value="@GAIN1"/>

   <set servo="CAM_PAN"  value="@CAM_PAN"/>
   <set servo="CAM_TILT" value="@CAM_TILT"/>

 <section name="CAM" prefix="CAM_">
   <define name="TILT_MAX"      value="30"/>
   <define name="TILT_NEUTRAL"  value="0"/>
   <define name="TILT_MIN"      value="-30"/>
   <define name="TILT0"         value="0" />

   <define name="PAN_MAX"     value="45"/>
   <define name="PAN_NEUTRAL" value="0"/>
   <define name="PAN_MIN"     value="-45"/>
   <define name="PAN0"          value="0"/>
 </section>

  <modules main_freq="60">
    <load name="cam_point.xml">
      <define name="POINT_CAM_PITCH_ROLL"  value="1"/>
      <define name="SHOW_CAM_COORDINATES" value="1"/>
    </load>
  </modules>

It make use of cam.c and point.c in sw/airborne/modules/cam_control/

When you load cam.xml in your settings of your aircraft session you can tune this:


THE MODE:

OFF =0

ANGLES=1 (look at angle that you chose in the angle tap)

NADIR=2 (look down)

XY_TARGET=3 (looks to the coordinates where you activate it, look here)

WP_TARGET=4 (looks to the way point that you chose in the target tap, cam_target_wp)

AC_TARGET=5 (looks at an aircraft, activate traffic_info.c)


ANGLES:

set your pan tilt angle for the Angles mode=1


TARGET:

set the way point you want to look at

1=home

2=... (see your way point file)