It is the job of the sensor and controller libraries to take care of interacting with the external hardware. These two libraries interact with the TROM on their own and remove a lot of work form the developers plate. To explain how these libraries work we will walk through an example for each.
The Controller Library
There are many kinds of motors and actuators that can be used to build robots. To keep things simple, for our example we will talk about changing the angle on a joint driven by a single servo.
 |
 |
 |
 |
|
| 1) |
 |
Watching The Controller Library keeps an eye on the TROM watching
for any updates which would require new motor positions. When it sees a
change happen the Controller Library will jump into action. |
|


|
 |
|
| 2) |
 |
Getting Info The first step for the CL is to fetch the
information it needs from the TROM to do it's job. (For our example of a
joint driven by a servo motor the CL would need the following data: the
new angle, servo type, the servo settings for 0, 90 & 180 degrees, and
what controller the servo is attached to.) |
|


|
 |
|
| 3) |
 |
Translation Next the CL has to perform the calculations
necessary to translate the new joint position into the actual servo position. Different motors and controllers need instructions in different formats.
Formats can be in degrees, PWM values, voltages, or even unique numbering systems. It is the job of the CL to figure all this out and translate the new servo position to the controllers language.
|
|


|
 |
|
| 4) |
 |
Delivering the Message Once the CL has calculated the new
motor position it will need to send the new position out to the
controller. Again, the information about which controller the servo is
attached to, which port on the controller, and the controller type is
all stored in the TROM. Using this information the CL knows how to send
the new motor position to the right place. |
|


|
 |
|
| 5) |
 |
Logging the Change Finally, the CL needs to report what the
new motor positions are to the TROM to keep it updated. |
|
The Sensor Library
The Sensor Library does a very similar job as the controller library, but in the reverse direction.
|