Club robotique de Sophia-Antipolis

Home > POBOTpedia > Programmation > Découvrir > Microsoft Robotics Studio > MRS Example: Show me a picture when you see a fire

MRS Example: Show me a picture when you see a fire

Tuesday 10 October 2006, by Chris

This examples shows how to use a TPA81 passive infra red sensor to detect a fire and then tell the user and show a picture of the fire using the Visual Programing Language.

This examples uses a tool called Visual Programing Language which is a part of MRS and lets you program using drag and drop, a bit like the Lego program bricks.

You may laugh at such a tool, but it can be an effective way of quickly combining services to test a strategy, and opens up the use of MRS to those who do not want to spend a month getting their head around the ccr, generics, iterators and service architectures.

The TPA81 Thermopile Array (View Documentation) can test the temperature of 8 pixels and control a servo to allow panning of the sensor.

The default configuration is shown below:

Here it is set up to update and store each pixel’s temperature and move the servo with a 100 milisecond gap between each poll.

We could use the TPA81Map service to show us exactly where the hot spot is:

But in this example, we will just use the TPA81 Hardware service by dragging it into the Visual Programing Language window and making the following program:

This simple program starts by a 2 second wait, then does a ’Get’ of the sensor service every half a second. Note that the TPA81 is itself polling the device every 100 milliseconds, so we could have made this polling much faster. Indeed a more elegant aproach would have been to subscribe to the TPA81 to get notifications of each sensor change.

If the temperature of pixel zero of module zero is above 40C, it will send some text to the Text-To-Speech service to say ’Fire 48C’, and launch a browser url to show the latest picture available from the webcam service. After this it does a 5 second pause, so as not to flood your browser too much.

This very simple program is unlikely to win you any competitions, but gives you the idea of ways in which tools like the Visual Programing Language can open up robotics programing to newcomers who want results fast - All power to them, I say.

Chris Kilner

Any message or comments?

pre-moderation

Warning, your message will only be displayed after it has been checked and approved.

Who are you?

To show your avatar with your message, register it first on gravatar.com (free et painless) and don’t forget to indicate your Email addresse here.

Enter your comment here

This form accepts SPIP shortcuts {{bold}} {italic} -*list [text->url] <quote> <code> and HTML code <q> <del> <ins>. To create paragraphs, just leave empty lines.