Full end-to-end hardware integration
Today I created the software components needed to encapsulate the computer to Basic Stamp communications. At the center is the Basic Stamp device class with its endless receive/send loop thread. It receives messages from the BS and sends queued commands to the BS.
Incoming messages get decoded and change the value of sonar and compass sensors. The latter is a special sensor which combines x and y components into a single angle value. The compass sensor just passes on the angle. Later, calibration will be handled by the sensor as well.
On the other side BS output actuators for the masts white and blue LED groups translate value set requests into I/O output commands for specific pins that get queued and executed by the BS device class.
I had to merge the InputDevice and OutputDevice classes to allow for sensors and actuators attached to the same device. This required a bit of dickering with the code, but went smoothly. At one point I hit a snag when the ACmotion class got instantiated, and then instantiated itself once more - singleton with unprotected constructor :-( The effect was a serial port being requested twice, which did not work.
Incoming messages get decoded and change the value of sonar and compass sensors. The latter is a special sensor which combines x and y components into a single angle value. The compass sensor just passes on the angle. Later, calibration will be handled by the sensor as well.
On the other side BS output actuators for the masts white and blue LED groups translate value set requests into I/O output commands for specific pins that get queued and executed by the BS device class.
I had to merge the InputDevice and OutputDevice classes to allow for sensors and actuators attached to the same device. This required a bit of dickering with the code, but went smoothly. At one point I hit a snag when the ACmotion class got instantiated, and then instantiated itself once more - singleton with unprotected constructor :-( The effect was a serial port being requested twice, which did not work.


0 Comments:
Post a Comment
<< Home