Pan-Tilt Unit

A generic actuator to control pan-tilt supports

This actuator reads the rotation values for pan and tilt, and applies them to the pan-tilt unit that must be set as children of this actuator. Angles are expected in radians.

Unlike most other actuators, the Pan-Tilt unit is composed not only of an Empty object, but it also includes two meshes. These are the PanBase and the TiltBase that must also be imported when using this actuator. These meshes will rotate to produce the effect of a real Pan-Tilt unit.

Note

When mounting a camera or stereo unit on top of the Pan-Tilt unit, make sure to parent the camera to the PTU object.

This component can be configured to be operated manually as well as through data from a middleware. When using manual mode, the pan and tilt segments can be rotated using the following keys:

  • Page Up tilt up
  • Page Down tilt down
  • Home pan left
  • Insert pan right

Configuration parameters for Pan-Tilt Unit

You can set these properties in your scripts with <component>.properties(<property1>=..., <property2>=...).

  • Speed (float, default: 1.0)
    Rotation speed, in rad/s
  • Tolerance (float, default: 0.005235987755982988)
    (no documentation available yet)
  • Manual (boolean, default: False)
    If true, the PTU can only move via the keyboard.

Data fields

This actuator reads these datafields at each simulation step:

  • pan (float, initial value: 0.0)
    Pan value, in radians
  • tilt (float, initial value: 0.0)
    Tilt value, in radians

Interface support:

Services for Pan-Tilt Unit

  • get_configurations() (blocking)

    Returns the configurations of a component (parsed from the properties).

    • Return value

      a dictionary of the current component’s configurations

  • get_pan_tilt() (blocking)

    Returns the current angles for the pan and tilt segments.

    • Return value

      a couple of float, representing respectively the pan and the tilt of the platine, in radian.

  • get_properties() (blocking)

    Returns the properties of a component.

    • Return value

      a dictionary of the current component’s properties

  • look_at_object(obj_name) (non blocking)

    Move the platine to look in the direction of the given object.

    • Parameters
      • obj_name: the (Blender) name of an object present in the scene
  • look_at_point(x, y, z) (non blocking)

    Move the platine to look towards a given point. The point is expected to be given in the world reference

    • Parameters
      • x: x coordinate of the target point (in meter)
      • y: y coordinate of the target point (in meter)
      • z: z coordinate of the target point (in meter)
  • set_pan_tilt(pan, tilt) (non blocking)

    Move the platine to a given target position, represented by an angle couple.

    • Parameters
      • pan: Target pan angle, in radian
      • tilt: Target tilt angle, in radian
  • set_property(prop_name, prop_val) (blocking)

    Modify one property on a component

    • Parameters

      • prop_name: the name of the property to modify (as shown the documentation)
      • prop_val: the new value of the property. Note that there is no checking about the type of the value so be careful
    • Return value

      nothing

Examples

The following examples show how to use this component in a Builder script:

from morse.builder import *

# adds a default robot (the MORSE mascott!)
robot = Morsy()

# creates a new instance of the actuator
ptu = PTU()

# place your component at the correct location
ptu.translate(<x>, <y>, <z>)
ptu.rotate(<rx>, <ry>, <rz>)

robot.append(ptu)

# define one or several communication interface, like 'socket'
ptu.add_interface(<interface>)

env = Environment('empty')

Other sources of examples

(This page has been auto-generated from MORSE module morse.actuators.ptu.)