PR2 robot
=========

.. image:: ../../../media/robots/pr2.png
  :align: center
  :width: 600


The MORSE model of the Willow Garage's PR2 robot.

The PR2 uses the :doc:`armature_actuator <../actuators/armature>`
for control of the armatures.

Model Info
----------

The model is imported from a Collada file that is generated from the
`PR2 URDF file  <http://www.ros.org/wiki/pr2_description>`_.
The .dae file can be found at:
``$MORSE_ROOT/data/robots/pr2/pr2.dae``
The imported .blend file can be found at:
``$MORSE_ROOT/data/robots/pr2/pr2_25_original.blend``

The URDF to Collada converter changed all the object names, so these
were remapped to the original URDF names. A renamed version of the
PR2 model can be found at:
``$MORSE_ROOT/data/robots/pr2/pr2_25_rename.blend`` , this file
includes the script that is used to rename all the objects.

A model with MORSE integration for the armature can be found at
(**This is the model that you probably want to use in MORSE**):
``$MORSE_ROOT/data/robots/pr2/pr2_25_morse.blend``.

TODO
----

- Create sensors and actuators to control the PR2 armature. `A
  SensorActuator class would be handy for this
  <https://sympa.laas.fr/sympa/arc/morse-users/2011-07/msg00099.html>`_.
- Expand the armature to include the hands.
- Add an actuator to control the movement of the PR2 base.
- ROS integration.
- ...



.. cssclass:: properties morse-section

Configuration parameters for pr2 robot
--------------------------------------


You can :

- set the mass of the robot using the builder method :py:meth:`morse.builder.morsebuilder.Robot.set_mass()`
- set the friction coefficient of the robot using the builder method :py:meth:`morse.builder.morsebuilder.Robot.set_friction()`

*No configurable parameter.*

.. cssclass:: services morse-section

Services for PR2 robot
----------------------

- ``set_torso()`` (blocking)
    MORSE Service that sets the z-translation of the torso to original_z + height.
    
- ``get_torso_minmax()`` (blocking)
    Returns the minimum an maximum z-translation that the torso can
    make from the base.  Returns a list [min,max]
    
- ``get_torso()`` (blocking)
    Returns the z-translation of the torso.
    
- ``get_armatures()`` (blocking)
    Returns a list of all the armatures on the PR2 robot.
    
- ``grasp_()`` (blocking)
    Grasp object
    


.. cssclass:: examples morse-section

Examples
--------


The following example shows how to use this component in a *Builder* script:

.. code-block:: python


    from morse.builder import *
    
    # creates a new instance of the robot
    pr2 = PR2()

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

    env = Environment('empty')
    

.. cssclass:: files morse-section

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

- `Source code <../../_modules/morse/robots/pr2.html>`_
- `Unit-test <../../_modules/base/pr2_testing.html>`_




*(This page has been auto-generated from MORSE module morse.robots.pr2.)*
