Cart/Login/Help Tutorials Blog Community Contact
Become an Affiliate!




TRS Explained Part 4

The Sensor & Controller Libraries

   
 





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.

 
1)

Monitor
The SL listens to the API's of all the connected sensor hardware for any incoming reports from the sensors.



 
2)

Translation
Sometimes translation is necessary to convert a raw signal into something more clear for the TROM. Sometimes it merely a signal conversion from voltage to distance for example and sometimes more complex algorithms need to be applied to the data. In either case, if any translation needs to be performed the SL takes care of it for the developer at this step.



 
3)

Report
The SL does a fast scan of the TROM to find out where the sensor is in the object model then records the new data.



 
4)

Bonus Step
If the developer has added any sensor related events to their project these events would now fire alerting the program to the new data.

 








Request Time: 2.015625 - SID/ASID: 1022553 | i0vpjnmwrjr1gmvfkzrxqhjq - SERVER: WEB1