Devantech Drivers for Microsoft Robotics Studio - version 0.5
Warning: Robots can be dangerous. They are at least as stupid as the code they run, often more so. Use at your own risk in a padded room free of valuables and people. If you are paranoid, you should read the code line by line and delete anything you don't understand. You have been warned.
Note: This is a work in progress, and not all features behave as expected. For example, some services allow configuration from a web page, but fail to expose the same methods to other services. Others expose too many methods and don't keep internal messages private enough. We will try to make these better over time, but they are not perfect yet.
- I2C Hardware
- CMPS03 Compass
- TPA81 Thermopile Array
- TPA81 Map
- LCD03 Display
- MD23 Dual motor controller with encoders
- SD21 21 channel servo driver
- SD21 Sonar Pan
- SP03 Speech-to-text
- SRF08 Sonar
- SRF235 Sonar
- Running Sample Manifests
This is a collection of drivers that allow many of Devantech's devices to be used from within Microsoft Robotics Studio. It is free to use and tinker with so long as your aims are not commercial - otherwise get in touch.
It started as personal project and has gained much from Davantech's continual help and support, but it not an official Devantech product - please don't blame them for its faults.
In comming releases we will concentrate on improving existing services before adding new devices (SRF02, MD22, MD03, SRF10 etc..). It should be noted that we have not made use of any AJAX connectors to refresh the state of the pages. When you view a page, it shows you the state at that instance and will not refresh without you refreshing the page with either a a right click, or by clicking the name of the service again.
Since earlier versions prepared for the CTPs, the code has been extensively cleaned and refactored. All the main services are now configurable via their web pages and save their state to "/store" if you prefer to tweak the config that way. Many code comments have been added and structures improved. All projects can be started by right clicking and choosing debug. All Microsoft generics can be viewed via the web interface, but don't yet have stylesheets applied.
All the drivers make use of a generic I2C contract, so they could be used with any hardware that supports the generic I2C contract, allowing bytes to be read from and written to devices on the I2C bus. The Generics currently use the namespace www.behavioraltypes.org, but time will tell wether this is a suitable resting place.
Devantech makes two such devices that allow a PC to talk to the I2C bus:
- The USBI2C adapter
One side plugs into a USB port, and the other side speaks I2C
- The RF04/CM02 combination
The RF04 plugs into a USB port and talks wirelessly to the CM02 which is attached to the I2C bus
The I2C Hardaware driver included here supports both of these physical implementations transparently by using the COM version of the FTDI driver.
This service enables your PC to talk to all the devices. It includes some experimental code for scanning the I2C bus for attached
devices and optionaly starting and monitoring services. If you click "Scan I2C bus", you should see the light on your physical I2C hardware flashing
like mad as it attempts a read from every address, and any further reads needed to disambiguate any devices. You should have patience and wait for it to
finsish before refreshing the page to see what it has found. Please don't try to power 100 devices from your USBI2C adaptor - they will misbehave.
Although Devantech's I2C adaptors can use a "scan" command (not the same as bus scanning) to set motor power and read a compass and a bunch of SRF08s for you, this feature is not implemented.
A very simple service that shows you the current heading. This service is missing proper subscription and configuration methods, however, using the web interface or the config file, you can control polling.
TPA81 Thermopile Array
The colors could do with some work. As is, flame will show in red but humans may be difficult to see. If you choose to enable panning, an attached servo will move back and forth so as to enable the map (see below).
The map shows a view of heat readings as the servo attached to the TPA81 pans. The colors show green for likely human heat, and red for hot flame. Although the ambient temperature is filtered out, it will not work well in hot countries where the ambient is close to human heat. Here you might be able to see a human leaning down from his chair and holding a lighter.
Allows you to write text and control the backlight. Send it ASCII text to display on the screen.
The following special sequences can be used for primitive formatting:
- \r - line break
- \t - tab
- \u - up in the same column as the current char
- \d - down in the same colums as the current char
MD23 Dual motor controller with encoders
Shows the state of the encoders and allows you to configure polling. A Pid version of this is in the works, but was not ready for this release. It supports the generic Motor, Encoder, Battery and TwoWheelDifferentialDrive generics, which with the help of the dashboard can allow you to control your robot with a joystick and do primitive "move distance" and "rotate degrees" type commands.
SD21 21 channel servo driver
The central number can be draged left or right to move a servo within the range of the min and max limits that can also be draged. Click in home or speed number to edit. A drag in the interface will be shown immediately without reading back from the SD21 where the servo actually is. Refer to the Devantech docs for detail of the meaning of the speed command but roughly: 0 is fast, and any other number is relative to the amount in miliseconds that is moved every 20ms. i.e 1 is slow, and 20 is pretty fast.
SD21 Sonar Pan
This is a combination service that controls the specified SD21 servo channel and subscribes to a generic Sonar. You will have to configure a sonar such as the SRF08 to poll pretty fast, and start a generic Sonar that references it. (The manifest will do this for you if you have such devices). By using the speed command, a precise, timed pan, will move a servo back and forth, while receiving notifications of any sonar readings and estimating the angle of the servo at that instance. The results are shown in a scope-like image. In future, this service will provide a stream of posed sonar readings in conjunction with a pose from the forthcoming pid drive service and feed this to a mapping service for interpretation.
An alternative to the Microsoft text-to-speech service, for when you don't have a PC or speakers on your robot. You can feed this text and it will speak remarkably well for a hardware device. The Speak phrase takes a number from 1-30 that will say a phrase previously stored by attaching the device to a serial port and uploading a bunch of phrases. Volume, Rate and Pitch take numbers from 0-7. It is best left at Volume zero (max) and low to mid range values for the others.
When you have many sonars, it is best to use the broadcast polling, that instructs the sonars to do their ranging at the same time. If you only want to talk to one, you can switch off the broadcast polling and talk to each device seperately. It supports the Sonar, AnalogueSensor, ContactSensor generics.
Similar to the SRF08 except that the beam is much tighter and broadcast polling isn't supported. It supports the Sonar and ContactSensor generics.
Place the "Devantech" directory in the "samples\Platforms\" directory.
Compile the Devantech.sln solution. Then, you can test a service by right clicking on the Project and choosing Debug -> Start new instance, or start the services from the control panel using the Manifests provided.
Running Sample Manifests
To run a tutorial manifest,
launch the MSRS command prompt, then type
> cd samples\Platforms\Devantech\Config
> dssHost /p:50000 /m:RoboticsTutorial4.Devantech.manifest.xml
(or another of the manifests provided)
They are not finished yet: your feedback, contributions and criticisms are important. Please tell us what you think.