~robot3d-team/robot3d/trunk

« back to all changes in this revision

Viewing changes to docs/YarpAPI.txt

Adding man pages

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
This file is created at Almende B.V. It is open-source software and part of the 
 
2
Common Hybrid Agent Platform (CHAP). A toolbox with a lot of open-source tools, 
 
3
ranging from thread pools and TCP/IP components to control architectures and 
 
4
learning algorithms. This software is published under the GNU Lesser General 
 
5
Public license (LGPL).
 
6
 
 
7
It is not possible to add usage restrictions to an open-source license. 
 
8
Nevertheless, we personally strongly object against this software used by the 
 
9
military, in the bio-industry, for animal experimentation, or anything that 
 
10
violates the Universal Declaration of Human Rights.
 
11
 
 
12
Copyright © 2010        Anne van Rossum <anne@almende.com>
 
13
Author                          Anne van Rossum
 
14
 
 
15
================================================================================
 
16
 
 
17
The Robot3D simulator can receive commands over YARP and will respond by sending
 
18
messages over YARP. The most familiar message format is the "Bottle" defined in
 
19
"yarp/os/Bottle.h".
 
20
 
 
21
The first section will describe syntax details. The other sections will assume
 
22
the syntax is understood.
 
23
 
 
24
================================================================================
 
25
 Overview
 
26
================================================================================
 
27
 
 
28
 * List YARP ports
 
29
 * Sensor configuration 
 
30
 * Camera configuration
 
31
 
 
32
================================================================================
 
33
 List YARP ports
 
34
================================================================================
 
35
 
 
36
Each robot does have a list of sensors, actuators, etc. They all have their own
 
37
YARP port. To obtain the port names, use the following syntax: 
 
38
 
 
39
  RPC_VOCAB_PORT port_type [index] 
 
40
 
 
41
The command in all capitals is a "Vocab". An integer that can be used as a 1-4
 
42
letter string. This makes it possible to write this type of C-statements:
 
43
  switch(vocab_in) {
 
44
  case VOCAB4('p','o','r','t'): // do something
 
45
  }
 
46
 
 
47
The port_type can be "sensor", "actuator", or "all". The index can be used to 
 
48
get the name of only one YARP port.
 
49
 
 
50
The Robot3D simulator will respond with:
 
51
 
 
52
  (port_name* VOCAB_OK) | VOCAB_FAILED
 
53
 
 
54
Here port_name is a string denoting the name of a port. The asterisk "*" means
 
55
that it returns a list (of minimal 1 item). The list ends with a VOCAB_OK. The
 
56
alternative is indicated by the OR operator "|", and would only consist out of
 
57
a vocab VOCAB_FAILED.   
 
58
 
 
59
Example in C++ is given in RFModuleRPC::getRemotePorts.   
 
60
 
 
61
================================================================================
 
62
 Sensor configuration
 
63
================================================================================
 
64
 
 
65
 
 
66
================================================================================
 
67
 Camera configuration
 
68
================================================================================
 
69
 
 
70
Towards the Robot3D simulator
 
71
 
 
72
  RPC_VOCAB_CCAM vocab_side vocab_io parameter [value]
 
73
 
 
74
with 
 
75
 
 
76
  vocab_side    = VOCAB_BACK | VOCAB_FRONT | VOCAB_LEFT | VOCAB_RIGHT
 
77
  vocab_io      = VOCAB_GET | VOCAB_SET
 
78
  parameter     = "MinDistance" | "MaxDistance" | "FlareAngle" | "Frustum" |
 
79
                  "Resolution" | "Background" 
 
80
  value         = float | osg::Vec2 | osg::Vec3 | osg::Vec4
 
81
 
 
82
The value is necessary when setting a parameter using VOCAB_SET, and can be of
 
83
a diversity of types that correspond with the parameter, an angle is a float.
 
84
 
 
85
The response:
 
86
 
 
87
  (value VOCAB_OK) | VOCAB_FAILED
 
88
  
 
89
See: ControlAPI.h