Rotorcraft Waypoint motion controller
=====================================


**Motion controller using force and torque to move a rotorcraft to a waypoint.**


This controller will receive a 3D destination point and heading
and make the robot move to that location by changing attitude.
This controller is meant for rotorcrafts like quadrotors.


.. cssclass:: properties morse-section

Configuration parameters for rotorcraft waypoint motion controller
------------------------------------------------------------------


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

- ``HorizontalPgain`` (float, default: ``0.10471975511965978``)
	proportional gain for the outer horizontal position [xy] loop
- ``HorizontalDgain`` (float, default: ``0.13962634015954636``)
	derivative gain for the outer horizontal position [xy] loop
- ``VerticalPgain`` (float, default: ``8``)
	proportional gain for the altitude loop
- ``VerticalDgain`` (float, default: ``8``)
	derivative gain for the altitude loop
- ``YawPgain`` (float, default: ``12.0``)
	proportional gain for yaw control of the inner loop
- ``YawDgain`` (float, default: ``6.0``)
	derivative gain for yaw control of the inner loop
- ``RollPitchPgain`` (float, default: ``9.7``)
	proportional gain for roll/pitch control of the inner loop
- ``RollPitchDgain`` (float, default: ``2``)
	derivative gain for roll/pitch control of the inner loop
- ``MaxBankAngle`` (float, default: ``0.5235987755982988``)
	limit the maximum roll/pitch angle of the robot. This                   effectively limits the horizontal acceleration of the robot
- ``Target`` (string, default: ``"wp_target"``)
	name of a blender object in the scene. When specified,                   this object will be placed at the coordinates given to                   the actuator, to indicate the expected destination of                    the robot. Make sure that this object has NO_COLLISION


.. cssclass:: fields morse-section

Data fields
-----------


This actuator reads these datafields at each simulation step:

- ``x`` (float, initial value: ``0.0``)
	waypoint x coordinate in meters
- ``y`` (float, initial value: ``0.0``)
	waypoint y coordinate in meters
- ``z`` (float, initial value: ``0.0``)
	waypoint z coordinate in meters
- ``yaw`` (float, initial value: ``0.0``)
	desired heading angle in radians
- ``tolerance`` (float, initial value: ``0.2``)
	waypoint tolerance in meters

*Interface support:*

- :tag:`ros`  as PoseReader (:py:mod:`morse.middleware.ros.read_pose.PoseReader`)
- :tag:`socket`  as straight JSON deserialization (:py:mod:`morse.middleware.socket_datastream.SocketReader`)
- :tag:`yarp`  as yarp::Bottle (:py:mod:`morse.middleware.yarp_datastream.YarpReader`)


.. cssclass:: services morse-section

Services for Rotorcraft Waypoint motion controller
--------------------------------------------------

- ``goto(x, y, z, yaw, tolerance)`` (non blocking)
    Go to a new destination.
    
    The service returns when the destination is reached within
    the provided tolerance bounds.
    
    
  - Parameters

    - ``x``: x coordinate of the waypoint (meter)
    - ``y``: y coordinate of the waypoint (meter)
    - ``z``: z coordinate of the waypoint (meter)
    - ``yaw``: orientation of the waypoint (radian)
    - ``tolerance``: distance considered to decide that the                   waypoint has been reached (meter)

- ``get_properties()`` (blocking)
    Returns the properties of a component.
    
    
  - Return value

    a dictionary of the current component's properties  

- ``get_configurations()`` (blocking)
    Returns the configurations of a component (parsed from the properties).
    
    
  - Return value

    a dictionary of the current component's configurations  

- ``get_status()`` (blocking)
    Return the current status (Transit or Arrived)
    
- ``setdest(x, y, z, yaw, tolerance)`` (blocking)
    Set a new waypoint and returns.
    
    The robot will try to go to this position, but the service 
    caller has no mean to know when the destination is reached
    or if it failed.
    
    In most cases, the asynchronous service 'goto' should be
    preferred.
    
    
  - Parameters

    - ``x``: x coordinate of the waypoint (meter)
    - ``y``: y coordinate of the waypoint (meter)
    - ``z``: z coordinate of the waypoint (meter)
    - ``yaw``: orientation of the waypoint (radian)
    - ``tolerance``: distance considered to decide that the                   waypoint has been reached (meter)

  - Return value

    True (if the robot is already moving, the previous          target is replaced by the new one) except if the          destination is already reached. In this case, returns          False. 



.. cssclass:: examples morse-section

Examples
--------


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

.. code-block:: python


    from morse.builder import *
    
    robot = ATRV()
    
    # creates a new instance of the actuator
    rotorcraftwaypoint = RotorcraftWaypoint()

    # place your component at the correct location
    rotorcraftwaypoint.translate(<x>, <y>, <z>)
    rotorcraftwaypoint.rotate(<rx>, <ry>, <rz>)
    
    robot.append(rotorcraftwaypoint)
    
    # define one or several communication interface, like 'socket'
    rotorcraftwaypoint.add_interface(<interface>)

    env = Environment('empty')
    

.. cssclass:: files morse-section

Other sources of examples
+++++++++++++++++++++++++

- `Source code <../../_modules/morse/actuators/rotorcraft_waypoint.html>`_
- `Unit-test <../../_modules/base/rotorcraft_waypoint_testing.html>`_




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