Rotorcraft Velocity motion controller
=====================================


**Motion controller using force and torque to move a rotorcraft with a specified velocity.**


This controller will receive a velocity and yaw rate command
and make the robot move by changing attitude.
This controller is meant for rotorcrafts like quadrotors.


.. cssclass:: properties morse-section

Configuration parameters for Rotorcraft Velocity motion controller
------------------------------------------------------------------


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

- ``HorizontalPgain`` (float, default: ``0.2``)
	proportional gain for the outer horizontal velocity [xy] loop
- ``HorizontalDgain`` (float, default: ``0.8``)
	derivative gain for the outer horizontal velocity[xy] loop
- ``VerticalPgain`` (float, default: ``8``)
	proportional gain for the vertical velocity loop
- ``VerticalDgain`` (float, default: ``2``)
	derivative gain for the vertical velocity loop
- ``YawPgain`` (float, default: ``12.0``)
	proportional gain for yaw control of the inner loop
- ``YawDgain`` (float, default: ``8.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
- ``MaxVelocity`` (float, default: ``2``)
	limit the maximum velocity of the robot.


.. cssclass:: fields morse-section

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


This actuator reads these datafields at each simulation step:

- ``vx`` (float, initial value: ``0.0``)
	desired x velocity in m/s
- ``vy`` (float, initial value: ``0.0``)
	desired y velocity in m/s
- ``vz`` (float, initial value: ``0.0``)
	desired z velocity in m/s
- ``vyaw`` (float, initial value: ``0.0``)
	desired yaw rate radians/s
- ``tolerance`` (float, initial value: ``0.2``)
	velocity tolerance in m/s

*Interface support:*

- :tag:`socket`  as straight JSON deserialization (:py:mod:`morse.middleware.socket_datastream.SocketReader`)
- :tag:`ros`  as TwistReader (:py:mod:`morse.middleware.ros.read_twist.TwistReader`)


.. cssclass:: services morse-section

Services for Rotorcraft Velocity motion controller
--------------------------------------------------

- ``setvel(vx, vy, vz, vyaw, tolerance)`` (blocking)
    Set a new desired velocity and return.
    
    The robot will try to go achieve the desired velocity,
    but the service caller has no mean to know when the
    desired velocity is reached or if it failed.
    
    
  - Parameters

    - ``vx``: x coordinate of the velocity (meter/sec)
    - ``vy``: y coordinate of the velocity (meter/sec)
    - ``vz``: z coordinate of the velocity (meter/sec)
    - ``vyaw``: yaw rate (radian/sec)
    - ``tolerance``: speed difference considered to decide                   whether the desired velocity has been                   reached (meter/sec)

  - Return value

    True, except if the desired velocity is already reached.          In this case, returns False. 

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

    a dictionary of the current component's properties  

- ``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 

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

    a dictionary of the current component's configurations  



.. 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 *
    
    # adds a default robot (the MORSE mascott!)
    robot = Morsy()
    
    # creates a new instance of the actuator
    rotorcraftvelocity = RotorcraftVelocity()

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

    env = Environment('empty')
    

.. cssclass:: files morse-section

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

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




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