Chapter 2. Understanding Services

Services are the basic building blocks for robotics applications built with Microsoft Robotics Studio (MSRS). This chapter will focus specifically on what makes up a service and how it is used to manage and control a robot’s sensors and actuators. You will learn how services manage state and handle sending and receiving messages. You will also learn how services handle subscriptions and communication with other services. Finally, you will learn how a service handles output and embeds a resource such as a reference to an external dynamic-link library (DLL) file.

Defining a Robotics Application

Before defining a service, let’s look at what makes up a robotics application. In terms of the robots you will be working with, the robot is just a physical device that is typically mobile and contains several sensors used to monitor the environment. Sensors are used to measure things such as the intensity of light or the distance from the robot to another object. Without any programming, the addition of a sensor is useless. You must have some piece of software that collects raw data from these sensors and then processes the results.

In addition to sensors, a robot also contains output devices known as actuators. A small speaker or light-emitting diode (LED) would qualify as an actuator. Actuators allow the robot to respond to the environment based on the information received from the sensors.

For example, a small, wheeled robot may have a bumper sensor, and you could create a program that read data from this sensor. While driving the robot, if the data returned from the sensor indicated that the bumper had been pushed, you could assume the robot had hit an object. You could add code to the program that stopped the robot from driving and then alerted someone by flashing one of the LED lights or sending a beeping sound to the speaker. In the example just described, the data from the bumper sensor was the input, and the signal to stop driving and flash a light or send a beeping sound was the output.

A robotics application is similar to other types of applications in that it receives input, performs some kind of processing, and then returns results as output. What makes the robotics application so unique is that this typically involves more than one form of input and output, and they can all be functioning at the same time. Multiple sensors and actuators can be located on a single robot. One sensor may be collecting data at the same time that output is sent to an actuator. All of these operations need to happen synchronously, or at the same time, in order for the robot to remain responsive at all times.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.244.86