MARIE SVN Trunk aaplayer MC

From MARIEWiki

Jump to: navigation, search

Contents

Version

SVN trunk


Description

The adapter establishes the communication with a Player server and gives access to multiple robots sensors and actuators using Player C++ client base interfaces.

It is also possible to monitor positions of a list of simulated objects at a configurable fixed frequency.

See the Player project website for more information.

aaplayermc.jpg

Requirements

  • You must have Player 1.6.5 installed before compiling the Multi-Client Player Application Adapter.

See install instructions.

Inputs/Outputs

Actually, for each added robot, aaplayermc sends the laser, odometry, sonar, bumper, infrared, gripper, power, and fiducial data, and accepts the motor and gripper commands. Each inputs or outputs can be turned on and off in the configuration file by having declared or not their corresponding port.

Output data are read from Player server and sent at a configurable frequency.

Input data are forwarded to Player server as soon as they are received.

Simulation Monitoring

It is possible to monitor positions of identified objects of interest in a simulator. Objects of interest are identified with names which are specified in configuration. If a simulation monitoring section is present and valid in the configuration, objects of interest positions will be sent at a fixed configurable frequency on a MARIE port.

Safety Timer

This functionality allows to automatically sends a stop motor command to Player server when no motor command have been received since a per-robot configurable amount of time.


Configuration

Note : see Configuration Description Language for syntax details.

# C adapter
   # C playermc
      o KV serverFrequency (10 Hz)
      
      ! Q robot
         # KV robotname
         # KV portnumber
         # KV hostname
         o KV safetyTime
         
         o Q inputs
            * T port (type = Default, name = motor)
            * T port (type = Default, name = gripperCmd)
         
         o Q outputs
            * T port (type = Default, name = laser)
            * T port (type = Default, name = odometry)
            * T port (type = Default, name = sonar)
            * T port (type = Default, name = bumper)
            * T port (type = Default, name = ir)
            * T port (type = Default, name = gripper)
            * T port (type = Default, name = power)
            * T port (type = Default, name = fiducial)
      
      o Q simulationMonitoring
         # Q simServer
            # KV hostname
            # KV portnumber
            
         # Q monitoredIds
            ! KV monitoredId
            
         o Q output
            o T port (type = Default, name = simulation)
            
         o Q input
            o T port (type = Default, name = simulationCmd)
            
         o KV simMonitoringFreq (1 Hz)


  • serverFrequency : Read from Player server and output data frequency (Hz) (default = 10 Hz)

For each robot:

  • robotname : robot name
  • hostname : Player server hostname
  • portnumber : Player server portnumber
  • safetyTime : Time without motor command before stopping the robot.
  • motor input port : port receiving CommandMotor
  • gripperCmd input port : port receiving CommandGripper
  • laser output port : port sending DataLaser
  • odometry output port : port sending DataOdometry
  • sonar output port : port sending DataSonar
  • bumper output port : port sending DataBumper
  • ir output port : port sending DataIR
  • gripper output port : port sending DataGripper
  • power output port : port sending DataPower
  • fiducial output port : port sending DataList of Data2DPoint correponding to the 2D position of fiducial items

If simulationMonitoring section present, position information of monitored simulation objects (those identified with monitoredIds entries) will be sent on output port at simMonitoringFreq Hz. For simulationMonitoring section :

  • hostname : hostname of the simulator
  • portnumber : port number of the simulation Player server
  • monitoredIds : list simulation objects identifiers
  • monitoredId : simulation object identifier.
  • simulation : output port on which position data are sent regularly. Positions data are put in a DataList of

Named2DPoint. Named2DPoint's names correspond to monitored Ids given in config and thus to simulation objects.

  • simulationCmd : input port. If a DataList of Named2DPoint is received on this port, requests to set positions

of simulation objects corresponding to names in Named2DPoint are sent to the simulator.

  • simMonitoringFreq : frequency of output in Hertz, default to 1Hz.


See available Ports for port configuration details.

There is a valid configuration exemple at the end of the page.

Usage

usage :  aaplayermc -n component_name [-t component_type] [-d director_port_number] [-c configurator_port_number]

      -n     #Specify component's name
              
      -t     #Specify component's control type :
             #  DEFAULT - use when controlled by appman Application Manager (default)
             #  MPI     - use when controlled by ammpi Application Manager
               
      -d     #Specify director server socket port number (mandatory in DEFAULT component's control type)
      -c     #Specify configurator server socket port number (mandatory in DEFAULT component's control type)

The adapter will establish the communication with the Player server and read data from it at initialization. When started, the adapter will forward inputs data to Player server and send outputs data.

Executing aaplayermc in project

This section shows how to use aaplayermc in a Project..

In .setup file, add the following processes :

Stage, Gazebo or other Player server

A Player server must be started before using aaplayermc. To have Application Manager starts the process, add the process with the expected parameters before the aaplayermc process.

Here's an example of a Stage process to be launched :

# T process
   # KV name = Stage
   # KV type = None
   # KV executableName = player
   
   # Q args
      # KV configFile
  • name : Specify a reference name for the process
  • type : Specify component's control type
  • executableName : Specify the executable name
  • configFile : Specify path to Player's .cfg configuration file


aaplayermc

# T process
   # KV name
   # KV type = MARIE:MPI
   # KV executableName = aaplayermc
  
   # KV configFile
  • name : Specify a reference name for the process
  • type : Specify component's control type
  • executableName : Specify the executable name
  • configFile : Specify path to aaplayermc configuration file (see #Configuration)

Executing aaplayermc with appman [deprecated]

This section shows how to use aaplayermc with appman Application Manager from a terminal script.

Start Player server

A Player server must be started before using aaplayermc. To have appman starts the process, add the process with the expected parameters before the aaplayermc process.

Here's an example of a Stage process to be launched :

player path_to_player_cfg_file (.cfg)
sleep 4    # Sleep time (plateform specific)

Player server can take couple of seconds to boot, configure and initialize before being ready. Delays are required and must be adjusted depending on the running platform.

Start component

aaplayermc -n component_name -t MARIE -d director_port_number -c configurator_port_number
sleep 4    # Sleep time (plateform specific)

appman -p configurator_port_number -c sxml:PathToConfigFile
sleep 1    # Sleep time (plateform specific)

appman -p director_port_number -c init
sleep 1    # Sleep time (plateform specific)

appman -p director_port_number -c start

Component can take couple of seconds to boot, configure and initialize before being ready to receive requests on director and configurator ports. Delays are required and must be adjusted depending on the running platform.


Stop component

appman -p director_port_number -c stop
sleep 1    # Sleep time (plateform specific)

Component can take couple of seconds to stop before being ready to receive requests on director and configurator ports. Delay is required and must be adjusted depending on the running platform.

Quit component

appman -p director_port_number -c quit


Authors

  • Patrick Frenette
  • Clement Raievsky

Contributors

  • Yannick Brosseau
  • Carle Cote

License

MARIE - Mobile and Autonomous Robotics Integration Environment Copyright (C) 2004-2006 Yannick Brosseau, Carle Cote

This library and its documentation are free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library and documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You can contact MARIE development team at http://marie.sourceforge.net.





Valid Configuration Exemple

<?xml version="1.0"?>

<playermc elem="conf">
   <adapter elem="conf">
   
      <serverFrequency elem="kv">15</serverFrequency>
      
      <robot elem="q">
         <robotname elem="kv">robot1</robotname>
         <portnumber elem="kv">6667</portnumber>
         <hostname elem="kv">localhost</hostname>
         <safetyTime elem="kv">1000</safetyTime>
         <inputs elem="q">

            <port elem="type">
               <type elem="kv">Default</type>
               <name elem="kv">motor</name>
               <connectionName elem="kv">player_motorCmd1</connectionName>
               <cs elem="type">
                  <type elem="kv">Socket</type>
               </cs>
               <receiveCFBs elem="q">
                  <cfb elem="type">
                     <type elem="kv">MarieXMLExtractor</type>
                     <convertToDataAbstract elem="kv">true</convertToDataAbstract>
                  </cfb>
               </receiveCFBs>
               <datatype elem="kv">any</datatype>
               <description elem="kv"></description>
            </port>

            <port elem="type">
               <type elem="kv">Default</type>
               <name elem="kv">gripperCmd</name>
               <connectionName elem="kv">player_gripperCmd</connectionName>
               <cs elem="type">
                  <type elem="kv">Socket</type>
               </cs>
               <receiveCFBs elem="q">
                  <cfb elem="type">
                     <type elem="kv">MarieXMLExtractor</type>
                     <convertToDataAbstract elem="kv">true</convertToDataAbstract>
                  </cfb>
               </receiveCFBs>
               <datatype elem="kv">any</datatype>
               <description elem="kv"></description>
            </port>
         </inputs>
         <outputs elem="q">
            <port elem="type">
               <type elem="kv">Default</type>
               <name elem="kv">laser</name>
               <connectionName elem="kv">player_laser</connectionName>
               <cs elem="type">
                  <type elem="kv">Socket</type>
                  <hostname elem="kv">localhost</hostname>
               </cs>
               <sendCFBs elem="q">
                  <cfb elem="type">
                     <type elem="kv">MarieXMLFormatter</type>
                  </cfb>
               </sendCFBs>
               <datatype elem="kv">any</datatype>
               <description elem="kv"></description>
            </port>

         </outputs>    
      </robot>

      <robot elem="q">
         <robotname elem="kv">robot2</robotname>
         <portnumber elem="kv">6668</portnumber>
         <hostname elem="kv">localhost</hostname>
         <safetyTime elem="kv">2000</safetyTime>
         <inputs elem="q">

            <port elem="type">
               <type elem="kv">Default</type>
               <name elem="kv">motor</name>
               <connectionName elem="kv">player_motorCmd2</connectionName>
               <cs elem="type">
                  <type elem="kv">Socket</type>
               </cs>
               <receiveCFBs elem="q">
                  <cfb elem="type">
                     <type elem="kv">MarieXMLExtractor</type>
                     <convertToDataAbstract elem="kv">true</convertToDataAbstract>
                  </cfb>
               </receiveCFBs>
               <datatype elem="kv">any</datatype>
               <description elem="kv"></description>
            </port>
            
         </inputs>
         <outputs elem="q">
            
            <port elem="type">
               <type elem="kv">Default</type>
               <name elem="kv">fiducial</name>
               <connectionName elem="kv">player_fiducial2</connectionName>
               <cs elem="type">
                  <type elem="kv">Socket</type>
                  <hostname elem="kv">localhost</hostname>
               </cs>
               <sendCFBs elem="q">
                  <cfb elem="type">
                     <type elem="kv">MarieXMLFormatter</type>
                  </cfb>
               </sendCFBs>
               <datatype elem="kv">any</datatype>
               <description elem="kv"></description>
            </port>

         </outputs>    
      </robot> 
      <simulationMonitoring elem="q">
         <simMonitoringFreq elem="kv">1</simMonitoringFreq>
         <simServer elem="q">
            <hostname elem="kv">localhost</hostname>
            <portnumber elem="kv">6666</portnumber>
         </simServer>
         <input elem="q">
            <port elem="type">
               <type elem="kv">Default</type>
               <name elem="kv">simulationCmd</name>
               <connectionName elem="kv">player_simulationCmd</connectionName>
               <cs elem="type">
                  <type elem="kv">Socket</type>
               </cs>
               <receiveCFBs elem="q">
                  <cfb elem="type">
                     <type elem="kv">MarieXMLExtractor</type>
                     <convertToDataAbstract elem="kv">true</convertToDataAbstract>
                  </cfb>
               </receiveCFBs>
               <datatype elem="kv">any</datatype>
               <description elem="kv"></description>
            </port>
         </input>
         <output elem="q">
            <port elem="type">
               <type elem="kv">Default</type>
               <name elem="kv">simulation</name>
               <connectionName elem="kv">player_simulation</connectionName>
               <cs elem="type">
                  <type elem="kv">Socket</type>
                  <hostname elem="kv">localhost</hostname>
               </cs>
               <sendCFBs elem="q">
                  <cfb elem="type">
                     <type elem="kv">MarieXMLFormatter</type>
                  </cfb>
               </sendCFBs>
               <datatype elem="kv">any</datatype>
               <description elem="kv"></description>
            </port>
         </output>
         <monitoredIds elem="q">
            <monitoredId elem="kv">robot1</monitoredId>
            <monitoredId elem="kv">robot2</monitoredId>
            <monitoredId elem="kv">puck0</monitoredId>
            <monitoredId elem="kv">puck1</monitoredId>
         </monitoredIds>
      </simulationMonitoring>

   </adapter>
</playermc>

Personal tools