• No results found

2 Microsoft Robotics Developer Studio

N/A
N/A
Protected

Academic year: 2022

Share "2 Microsoft Robotics Developer Studio"

Copied!
34
0
0

Loading.... (view fulltext now)

Full text

(1)

Survey of Robot Programming Languages

Seminar Report

Submitted in partial fulfilment of the requirements for the degree of

Master of Technology by

Anirban Basumallik Roll No : 09305008

under the guidance of Prof. Kavi Arya

Department of Computer Science and Engineering Indian Institute of Technology, Bombay

April 2010

(2)

Abstract

At the present moment the field of Robotics is extremely varied. The nature of tasks that robots can perform are very distributed and hence controlling or programming different robots need different methods. Many vendors have tried to provide a common platform by abstracting out the differences. In this report we carry out a survey of the different Robot Programming Languages available in the market and assess their pros and cons. Finally, we come up with the needs of a desirable robotics platform that can ease the task of programmers in programming a class of robots more succinctly and effectively.

(3)

CONTENTS CONTENTS

Contents

1 Introduction 3

1.1 Robot Programming Platform . . . 3

1.2 Need for a Platform . . . 3

2 Microsoft Robotics Developer Studio 3 2.1 DSS . . . 4

2.2 CCR . . . 5

2.3 VPL . . . 6

2.4 VSE . . . 7

2.5 Others . . . 8

2.6 Pros, Cons and buzz . . . 8

3 Player/Stage 9 3.1 Player Goals and Design . . . 9

3.2 Stage simulation environment . . . 10

3.3 Working . . . 11

3.4 Pros, Cons and buzz . . . 12

4 URBI 12 4.1 Design philosophy . . . 12

4.2 URBI Technology . . . 13

4.3 Pros, Cons and buzz . . . 14

5 OROCOS 15 5.1 Design philosophy . . . 15

5.2 Pros, Cons and buzz . . . 15

6 Comparative Study 16

7 General Requirements of a Platform 17

8 Conclusion 18

References 19

Appendices 20

A MSRDS Example 20

B Player/Stage Example 28

(4)

2 MICROSOFT ROBOTICS DEVELOPER STUDIO

1 Introduction

This report primarily studies two major robot programming platforms. The first is Microsoft Robotics Developer Studio and the other one is the Player/Stage/Gazebo platform. Their general architecture, popularity in the industry, advantages and disadvantages have been closely studied. There is a brief report on two other platforms, namely, ORoCoS and URBI, which are promising and upcoming platforms. We then attempt to outline the qualities of a desirable robot programming language and suggest how we might go about building it.

1.1 Robot Programming Platform

What we mean by a Robot Programming Platform is:-

• Uniform programming syntax and commands

• Large support for hardware

• Abstraction from differences in hardware

• Availability of libraries for basic and common robotic tasks like joint control, image pro- cessing, and navigation.

Apart from these, the facilities for debugging through simulation and re-usability of compo- nents should be also available.

1.2 Need for a Platform

The need for a Robot Programming Platform arises from the fact that a lot of money needs to be invested in the software part of a Robotics project. Statistically [10], 80% of a project cost goes into software development. The main aim of a Robot Programming Platform is to reduce the project cost by reducing the software development cost. Rather the cost can be redirected to software development in the domain of algorithms and Artificial Intelligence. Having understood the basic needs behind a robotic platform let us now move into studying our first case study, Microsoft Robotics Developer Studio.

2 Microsoft Robotics Developer Studio

Microsoft launched their own Robotic programming platform, Microsoft Robotics Developer Studio (alias MSRDS) which can address a lot of the issues prevalent in the robotics industry.

Powered by the strength of the C# programming language and the rich .NET framework, the MSRDS is a good platform for users. With a well laid out architecture, separate co-ordination library, and user-friendly GUI and simulation support, it makes this product quite a complete package on its own.

MSRDS comprises of the following:-

• DSS: Decentralised Software Services

• CCR: Concurrency and Co-ordination Runtime

• VPL: Visual Programming Language

• VSE: Visual Simulation Environment

(5)

2.1 DSS 2 MICROSOFT ROBOTICS DEVELOPER STUDIO

Figure 1: MSRDS in action of Appendix A

It has also got other features which ensure security of data, generation of log messages and detailed research diagnostics.

Let us have a look at them one by one.

2.1 DSS

DSS [5] stands for Decentralised Software Services. It is a lightweight runtime environment that sits on top of the CCR. It is a state-oriented service model that helps in developing scalable and high performance applications by integrating features like, isolation of services, composition of services, event driven notifications, message passing, and structured state modifications. It combines the notion of REpresentational State Transfer (REST) and Decentralised Software Services Protocol (DSSP) alongwith HTTP as the basis of interaction amongst services. DSSP is a Simple Object Access Protocol (SOAP) based protocol which provides a clean state transfer model which can manipulate states and an event model driven by state changes.

DSS [5] provides robustness by providing advanced error-handling features. Partial failures in sub-part of a system can lead to a complete halting of the whole system. Two types of isolation is needed for a robust system. Data needs to be isolated, as corrupted data can corrupt a service and execution isolation is needed, as one service depending on another service for execution may become unresponsive. A robust system always demands loosely coupled components. Such a system has additional demands of identifying, locating, synchronising, and composing them into one runnable unit. Unlike traditional systems which run as a single unit, DSS provides arrangements for creating, managing, and deploying loosely coupled systems. It has definitions of dependency of services which are verified at the initiation of the service. Having so many individual components running in parallel just adds to the problem of debugging. Locating the source of errors becomes a challenging task. Thus, the notion of observability has been integrated into the core of DSS by assigning a unique identifier for each service and observing the state changes that each service goes through as a part of its internal execution as well as external interaction.

(6)

2.2 CCR 2 MICROSOFT ROBOTICS DEVELOPER STUDIO

Figure 2: A Service Module[5]

Service A service [6] is the basic building block of DSS. A service is an abstraction over computation, it is a logical module. An entity or service has the following:-

• Service Identifier: Unique identifiers for locating an instance of a service. They are just identifiers and does not convey information about context or nature.

• Contract Identifier: These are condensed descriptions of implementations describing the behaviour. These are used to generate proxy dlls to which other services link against rather than directly linking to them.

• State: The state represents the internal states/current status of the service.

• Partners: The system maintains a list of partners who are dependent on the service or on whom the service depends for its proper functioning.

• Handlers: They handle the subscriptions and takes actions on an event occurring.

• Main Port: The main port is the central pipe of communication with all external entities.

It is a CCR Port.

Partnering of Services Services declare each other as partners to work together. Partnering terms also exists which define the extent to which one partner can interact with the other. The following operations are available to interact with one another:-

• Create Services

• Query Services

• Manipulate services

• Subscribe to services

• Terminate Services 2.2 CCR

CCR [4] stands forConcurrency and Coordination Runtime. It addresses the need to manage asynchronous operations, deal with concurrency, exploit parallelism and deal with partial failure.

It encourages the design of loosely coupled components which can be developed independently and make minimal assumptions about other components in the runtime. This approach changes

(7)

2.3 VPL 2 MICROSOFT ROBOTICS DEVELOPER STUDIO

how the user thinks of a program from the the designing process, dealing with concurrency, failure and isolation in a consistent way. Applications which use CCR needs to coordinate through messages, deal with complex failure scenarios, or in other words has to deal with asynchronous programming. This model is also very similar to how heterogeneous hardware and network is built. It is operative in a way such that the whole system is responsive, scalable and efficient in dealing with failure. Some of the major features to mention about it are:-

• It is basically a dll, accessible from any language targeting the .NET Common Language Runtime (CLR).

• It has a data dependent schedule.

• It abstracts out the need to create threads or use semaphores.

• It acts as the glue between the runtime and the services.

• It takes care of load balancing, scheduling and coordinating.

Communication All the services interact through protocols and by exchanging messages.

Network protocols are centered around http at the application layer and tcp in the network layer. The network protocols are e-secure. The system is also capable of communicating with enterprise web service architectures. The communication port maintains two different queues.

One is for the data and the other is for the list of recipients. High level structures like Arbiter makes complicated queue logic look very simple.

Messages The messages exchanged are human readable, serialized into XML over the network.

The content of the messages directly correspond to the impact of the message. They are of the following types: modification, query, get, drop. As a matter of statistics, which gives an idea about the efficiency of the system, on an Intel Dual Core, 3.0 GHz machine, 50,000 messages could be exchanged per second and about 3,000 messages per second could be exchanged over distant machines.

2.3 VPL

VPL [8] stands forVisual Programming Language. As the name suggests, it is a GUI based programming logic system. It is actually a graphical data-flow programming model. The exact logic of the program is represented as sequences of blocks with inputs and outputs, which are connected. In Figure 3, we can see a VPL program, which is more like a logic diagram than a program.

Example In Figure 3, we see a program that makes the computer to count from 1 to 10. The components are needed to be just dragged and dropped from a toolbar and connected as per the flow in which the user wants to program. In the program we see in Figure 3, the execution starts at the left-most red arrow at the Data block having a value of 1. This value is set to the Test variable of the next block and as indicated by the arrow marker. Then the flow goes through the Merge point and continues in two parallel flows. The top flow calculates a string variable whose value is “The number is 1” and then reads it out through the speakers. The other flow enters theIfblock and checks the condition specified. This time the condition is not satisfied, hence, the flow takes theElse route and enters theCalculate block which calculates Test + 1 ⇒ 1 + 1 ⇒ 2 and then enters the variable block which sets the value of the Test variable to2. The flow again enters theMergeblock and splits into two parts. One part speaks out “The number is 2” and the other part continues with the calculation.

(8)

2.4 VSE 2 MICROSOFT ROBOTICS DEVELOPER STUDIO

Figure 3: A VPL program[8]

With the help of the Visual Programming Language, programming becomes very easy. The ease with which the hardware can be referenced completely abstracts out the hardware com- plexity. The ease of use of high level functionalities like text-to-speech can be done very easily.

At the same time, the ease provided here comes at the cost of extreme hardwork given in by the backend designers.

2.4 VSE

VSE stands forVisual Simulation Environment. The VSE provides the simulation to substi- tute hardware. Hardware has multiple disadvantages like high cost, difficulty of debugging and tough to be worked upon concurrently. Whereas simulation has a low barrier to entry and its very easy prototype and test out new ideas. At the same time simulation has a lack of noisy data i.e. assumes a perfect world and it is also tough to model a hardware absolutely perfectly.

Figure 4: Simulation Architecture[7]

Simulation Architecture The simulation architecture comprises of the following as shown in Figure 4:-

• A editor for modelling and debugging

• The simulation engine service

• AGEIA physics engine

(9)

2.5 Others 2 MICROSOFT ROBOTICS DEVELOPER STUDIO

• XNA Graphics Library for 3D rendering

• The display hardware

The simulation engine is also implemented as a DSS service. Just as the hardware would have connected to the platform, the simulation engine does so. Generally 3rd party softwares like Maya or 3DsMax is used to design models with accuracy.

Figure 5: How the simulation entities interact with the corresponding services[7]

The simulator has entities. Each entity represents real world objects like sensors, actuators, obstacles and others. Every entity has two aspects to it. One is the visual component and the other is the physics component. The physics component decides and simulates how the entities interact with each other in the simulator and the visual component decides as to how the entity would look in the simulator. To link the simulation entities with the corresponding services we use xml files, in which we specify the contract identifier and declare it as a partner as shown in Figure 5.

2.5 Others

Apart from the above mentioned features, the platform of MSRDS also provides many other small facilities which are of extreme importance. With such a huge system having a high number of loosely coupled components working in a distributed nature, it is of utmost importance to have a log of all the activities. MSRDS does provide with such logs which are also very important in debugging. At the same time when data is being transferred over the net, security of data can be a major factor. MSRDS also does provide that. Apart from these, it also provides detailed research diagnostics like CPU utilization, list of active and pending queues at each instant and such others.

2.6 Pros, Cons and buzz

MSRDS is a good development environment for designing, executing, and debugging highly scalable, concurrent and distributed robotics applications. It has got extremely efficient backend with a fantastic simulator and with the added advantage of the VPL, robotics applications have become very easy to compose. But at the same time, knowledge of coding is required for some significant work. The complexity of C#, modelling of objects and such others provide a barrier for entry to many people. It also doesn’t provide any special support for real-time applications. Microsoft is doing what it does best: marketing. By organising summits and

(10)

3 PLAYER/STAGE

discussion opportunities in the academic domain and having the big robotic hardware designing firms in its support and confidence, one thing is assured that this product is here to stay and maybe also dominate.

3 Player/Stage

“All the world’s a stage, And all the men and women merely players.”

- William Shakespeare, As You Like It

The project derives its name from the above famous saying. The Player/Stage project began at the USC Robotics Research Lab in 1999. It has since been adopted, modified and extended by researchers from around the world. The Player/Stage project is the standard and the most popular robot programming platform in the open source community. It has got client side programming support for C/C++, Java, Tcl, and Python. It supports a variety of hardware and its modular architecture makes development easy.

3.1 Player Goals and Design

The design philosophy as perceived from the publications [3] and [11] and from usage of the software we identify the following:-

Figure 6: Player Architecture[9]

Player Core Initially Player was designed as asocket-based device server which is connected to a collection of many devices and provided a TCP socket which can be connected to by applications of different languages. The languages which are available are C, C++, Tcl, Python, and Java. The socket based model provides location independence and it can be extended to a distributed nature. At the present moment (i.e. Player 2.0), the core model has been modified to a queue-based message passing system. Each driver has a single incoming queue and they can send messages on the queues of others. The core library is responsible for the message semantics and ensures the coordination of the message passing system. This is an improvement over the multiple heterogeneous queues that existed earlier. Apart from these, the addressing system of the hardwares has also been modified to entertain accurate addressing and providing arrangements for inter-server subscriptions. In Figure 7, a possible connection of different servers is shown.

(11)

3.2 Stage simulation environment 3 PLAYER/STAGE

Figure 7: Potential Player Server connections[11]

Device Model Like the Linux philosophy, Player also deals with a device as a file. Hardwares are dealt with in a manner like operating systems. There is a common interface for all devices of the same type and separatedrivers which glues the interface to the actual hardware.

Transport Layer The transport layer does still have TCP sockets as the basic interface for communication but it has changed the logical entities on the two sides of the socket. On the driver side of the socket there are incoming and outgoing queues, whereas in the communication side of the socket, there has been a change introduced in the format of the packet. Initially it used to be packed C structures, but now it uses an open standard called eXternal Data Representation or XDR. It is an efficient, platform independent, format for common data-types.

3.2 Stage simulation environment

It is a simulation environment for Player that renders the scenarios in 2D. Though the new version has got 3D rendering abilities, it is basically a 2D environment with a concept of elevation.

It is like a plugin that connects to the Player server just in the same manner as the hardware would have connected to it. The idea of Stage’s connectivity is displayed in Figure 8.

Figure 8: Player Stage relationship[9]

(12)

3.3 Working 3 PLAYER/STAGE

In Figure 8, we see that the Stage simulator tricks the Player Server by substituting the hardware and cloning the drivers. Stage was designed with the multi-robot systems (MRS) in mind. Hence speed was more important than accuracy. Another motivation for designing Stage was to substitute hardware and reduce cost. It also gave a chance to experiment with new types of sensors which are not yet available as readymade hardware in the market. It also helps in studying multi robot behaviours, which would have been otherwise very costly.

Some of the major features of Stage [3] are:-

• Optimal fidelity: It looks more into performance than accuracy.

• Linear Scaling with population: The algorithms are such designed that they do not depend on the number of the robots.

• Configurable device models: The sensor models are modelled with a lot of flexibility and to conform as much closely as possible to the actual nature of the hardware. They are fully configurable as much as the original hardware provides.

• Abstraction from Client code: The sensors are available through the Player interface, hence the client code cannot distinguish from the real sensors or the simulated sensors.

Figure 9: Player/Stage in action: An obstacle avoiding robot of Appendix B

3.3 Working

The basic working mechanism of the Player/Stage platform is explained in Figure 8. For its proper functioning, there is a need to understand three file types:-

• .world file: It tells Player/Stage what things are available to put in the world. We describe our robot, any items which populate the world and the layout of the world.

(13)

3.4 Pros, Cons and buzz 4 URBI

• .inc file: They are also of the same format as that of the .world files, but they are generally used to define one entity only. These files are then included in the final .world files which represents the simulation.

• .cfg file: This is the most important file as this specifies which driver to use for which device and the location of the drivers.

Another concept that is needed to be understood, is that of a model. Everything is represented as model in the simulation. The map, objects, obstacles, robots and all are models. Every model has a name and a host of parameters which defines its physical properties like colour, draggable, grippable, and others. There are a lot of built-in models representing the basic needs of robotics like sensors and actuators. Then comes the external code. As mentioned before, the user can code his/her algorithm in various languages like C, C++, Java, and Python according to the user’s wish.

3.4 Pros, Cons and buzz

The logical layout of the architecture and a maintenance of close configurability with its hardware counterparts, gives a close feeling of using hardware rather than software. The ease of use and the simplicity alongwith the usage of our favourite programming language makes it a very popular platform amidst academicians and hobbyists. But the absence of robustness, missing constraints of real-time demands, inability to be ported cleanly on Windows platform and the difficulty of installation causes a hindrance in its popularity. Whatever, the platform of Player/Stage is the de facto standard in the domain of robotics in the open source community.

4 URBI

This is another proprietary Robot Programming Language. URBI stands forUniversal Real- time Behaviour Interface and is developed by a company named Gostai, dedicated to Artificial Intelligence applied to Robotics, based in France. It is basically a new language all together and the company defends their stand as to why a new language is needed for present day robotics applications. Their mission is to provide the users with the best universal robotic platform. The product has been developed by leading Universities in the field of Artificial Intelligence since 2003.

4.1 Design philosophy

URBI’s observation is that we are entering the robotic age and still there is incompatibility in terms of software for the available hardware of robotics. It is much like the problem of having different PC architectures faced by the computer industry in its nascent days. Hence it is their effort to bridge the gap by providing a common platform for robotic applications. The product [2] has been designed with the following principles in mind:-

Flexibility The platform should work with any robot, operating system or programming environment.

Modularity It follows an architecture in which components are modular in nature, hence built and maintained separately. They are all executed together in the platform.

(14)

4.2 URBI Technology 4 URBI

Powerful Abstractions Robotics is a very complex domain and at the same time there exists a lot of redundancy which needs to be abstracted out to increase efficiency and elegance.

Simplicity Another principle which URBI strongly follows is that none of the above things should be tough to understand or use. Things should be so easy such that hobbyists or kids can have a quick kickstart.

4.2 URBI Technology

URBI is quite an innovation in the programming world as it is not just a programming language (urbiScript) but also has a component architecture (UObject) and also several graphical programming tools (urbiStudio). Its integration of control over parallelism in the syntax of the language is a very noble approach. All this along with a familiar C++ like syntax, makes it a very attractive platform.

Lets have a look at the two pillars of their technology:-

• URBI Script: This forms the heart of the technology. It brings totally new features and simplicity in the issues of parallelism and event-based programming. It is also fully interfaced with other languages like C++, Java, Matlab, Python, and Ruby. It doesn’t allow full control of flow to these traditional languages, but just allows it to issue URBI commands using the traditional programming constructs. So basically, it is the URBI server which keeps control over the flow of execution and executes the commands as they keep coming from the user code. Parallelism and events are directly controlled and also visible in the syntax of the urbiScript. Some real-time aspects are also controlled directly by the urbiScript. For instance, if a task has to be spread over a specific time span, then it can be directly specified in the code, just beside where the task is initiated. Figures 10 and 11 exhibit a few of these features.

Figure 10: Event-Handling and Parallelism in urbiScript[2]

In Figure 10, we see both the features of event-handling and parallelism being present.

The event-handling keyword ‘whenever’ declares this piece of code to invoked when the event ‘ball.visible’ (i.e. ball is within camera’s view field) occurs. The ‘headPan’

variable represents the servo motor which controls the movement of the robot’s head about the vertical axis. Similarly, the ‘headTilt’ variable represents the servo motor which controls the robot’s head movement about the horizontal axis. The parallelism feature is represented in the code by the ‘&’ operator. By using it between the two codes, the two commands are executed parallely and we will be able to see that the head of the robot moves along the diagonal towards the ball. Had it been executed serially, then the

(15)

4.3 Pros, Cons and buzz 4 URBI

robot would have first aligned its head along the x-axis of the ball then aligned itself along the y-axis of the ball.

Figure 11: Advanced features in urbiScript[2]

In Figure 11, we see three different pieces of code. In the first code, we see some constraints being attached to the codes. The first line mentions that the ‘neck’ motor’s value will be set to ‘10’ over a ‘timespan’ of ‘450ms’. The second line specifies that the

‘leg’ motor’s value is set to ‘-45’ degrees and the transition occurs at the speed of ‘7.5’

units. The third line says that ‘tail’ motor’s value will be ‘14’ and the transition will occur over a sin wave like motion of amplitude ‘45’ units, and the transition will take place over a period of 4s.

The second part of Figure 11, handles an anomalous behaviour of parallelism, where the same variable may be demanded to be modified and set two different values. Such cases are handled by the ‘blend’ property which defines what to do, when such a situation comes.

For example, in this figure, it is mentioned that it will ‘add’ thus the value of ‘x’ becomes

‘4’ as the effect is added.

The third part of Figure 11, displays some features of code tagging. A part of code, which are inside the curly braces, is tagged as ‘mytag’. That part of code can be referred to from any part of the program by the tag, and commands like stop (to stop the code), freeze (to pause the code), andunfreeze(to start the frozen code) can be executed upon them.

• UObject Architecture: The UObjects are very similar to C++ objects. Infact C++ objects can be very easily converted to UObjects. There was a need to have a different object architecture as they wanted the objects to conform to their overall principle of simplicity and have abstractions over network complexities. The principle can be extended to any distributed object architecture and it bridges the gap between other component architec- tures like CORBA. In UObject architecture it is also possible to add new methods at runtime to a live object.

4.3 Pros, Cons and buzz

The main advantage of the product is the ease with which parallelism and event handling can be done. Some time constraints can also be very easily controlled by the user. The disadvantage would include the pain of having to learn a new language. Even if it does have the facility to integrate with other languages, but it doesn’t give the full control to those languages, rather

(16)

5 OROCOS

they have to generate URBI commands to the URBI server. It is quite a popular product for the hardware that it supports, and its popularity may increase from May, 2010 onwards as it is going to be open source from then onwards.

5 OROCOS

OROCOS stands forOpen RObot COntrol Software. Their aim is to build a generic modular framework for robot and machine control. They just provide libraries for building but does not strictly provide a platform. They give stress on accuracy rather than on computation.

Figure 12: OROCOS libraries[1]

5.1 Design philosophy

Their design philosophy [1] is centered around four libraries, namely:-

• RealTime Toolkit (RTT): This library ensures realtime constraints.

• Orocos Components Library (OCL): This library is used to design components which rep- resents real life entities like sensors and actuators. It uses the KDL.

• Kinematics and Dynamics Library (KDL): It is an application independent framework for modelling and computation of kinematic chains, such as robots, biomechanical human models, computer-animated figures, machine tools, etc.

• Bayesian filtering library (BFL): It is a library which uses statistical models to induce noise into the models, which otherwise assumes a perfect world.

As seen in Figure 13, to build the base of an application, the RTT, BFL and KDL libraries are used. Then for the middle layer OCL is used, above which applications are developed and then used by the final user.

5.2 Pros, Cons and buzz

It is the only platform that takes deep care of realtime issues. Unfortunately, it is not a platform as a whole, hence most of the functionalities of networking, distribution of load, and hardware abstraction is left to the users. Yet, for those who want accurate results, and a perfect simulation, this is the best library to look out for.

(17)

6 COMPARATIVE STUDY

Figure 13: OROCOS application development[1]

6 Comparative Study

Lets present a comparative study [10] of the four main products, in Table 1, which have been discussed above. Thus we can see that each product has its own advantages, disadvantages and

MSRDS Player/Stage URBI OROCOS

Open Source No Yes from May’10 Yes

Windows Yes Emulation Yes No

Linux No Yes Yes Yes

Nature Platform Platform Platform Library

Distributed Yes Partially Yes No

In-built Arm Control No No No Yes

Simulation Yes Yes Yes No

Reusability Yes No Yes Yes

Real-Time No No No Yes

Table 1: Comparative Study of Robot Programming Languages

specialities. In MSRDS, the loosely coupled nature of the DSS library, the distributed nature and efficiency of the CCR library and high quality of simulation gives it an edge. The simplicity and the facility to use our favourite programming language makes Player/Stage a popular platform.

The ease of programming in URBI, as many complexities of real life demands are abstracted out, makes it a very desirable platform. The parallelism handling feature of URBI makes it stand apart from the others. The intricacies and accuracy of the OROCOS library is a challenging task to build from scratch and it serves the purpose of applications which demand perfection.

Having highlighted the dominating features of the above products, we would now like to move onto (Section 7) the description of a desirable robotic platform which has the best features of all the products mentioned above as well as some features totally missing from the above ones.

(18)

7 GENERAL REQUIREMENTS OF A PLATFORM

7 General Requirements of a Platform

After having studied some of the most popular robotic platforms available and having used a few of them, we would like to factor out all the important features of these products and list the requirements of a complete robot programming platform. They are:-

• Abstraction and Uniformity: The foremost requirement of a platform is to provide unifor- mity of commands and syntax to control robots and lay down a complete abstraction over the hardware differences.

• Scalability and Distributed Nature: With the era of distributed computing coming ahead, it is of utmost importance to provide distributed behaviour in the platform or to ensure that it conforms to some standard which would help it to run on a distributed layer.

The issue of scalability can be in general solved by providing a distributed nature but at the same time it needs to be ensured that the scalability should result in linearly scaled performance with increase in size of population.

• Modularity and Re-usability: Another very important issue is that of modularity. Since the real world components are modular by nature, and the hardware components are also generally produced by different vendors, the platform should also deal with them separately. This would help in isolating the errors and would also ease out development as the developers would be only concentrating on a module and deal with it independently of the platform. This would also increase re-usability, as a component developed once can be used perpetually.

• Parallelism and Synchronisation: In robotic applications, it is often required to do two or more tasks in parallel, at the same time not conflicting with each other. Thus paral- lelism and synchronisation should not only be available but also should be well abstracted such that the user does not have to think about the coding complexities of threads and semaphores but should just be concerned with the top level logic of dealing with them.

• Real-Time Constraints: Since robotic applications are all real world applications, handling of real time constraints should be always expected from the platform.

• Error Handling and Debugging: One of the most important issues related to any form of software is the facility to debug it. Having a loosely coupled system distributed over a network, makes the job of debugging tougher. Having a simulation environment does ease the pain of debugging a lot but debugging in the simulation itself can be quite a challenging task.

• In built support for fundamental robotic activities: Fundamental robotic activities like image processing, robotic arm control and such other facilities should be readily available such that the user can concentrate on the algorithm or artificial intelligence component of the system and not waste much time with the subtleties of the coding and handling well established fields.

• Simplicity: Above all, the features provided should be all very simple to learn and use and should not be very complex by itself.

(19)

8 CONCLUSION

8 Conclusion

Thus we have had a study of some interesting products in the world of robotic programming.

We have also had a taste of development using two of them. The pros and cons of various other products in the market have been studied and presented in a manner that brings out the needs of the present situation. Finally, a list of the general requirements of a robot programming platform has been suggested, which if implemented can meet all the varying demands of robotic development with ease.

(20)

REFERENCES REFERENCES

References

[1] Orocos website. Website. http://www.orocos.org, visited in 2010.

[2] Urbi/gostai website. Website. http://www.gostai.com, visited in 2010.

[3] Richard T. Vaughan Brian P. Gerkey and Andrew Howard.The Player/Stage Project: Tools for Multi-Robot and Distributed Sensor Systems. Proceedings of the 11th International Conference on Advanced Robotics (ICAR 2003), pages 317-323, Coimbra, Portugal, June 2003.

[4] Microsoft Corporation. Ccr documentation. Website. http://msdn.microsoft.com/

en-us/library/bb648752.aspx, visited in 2010.

[5] Microsoft Corporation. Dss documentation. Website. http://msdn.microsoft.com/

en-us/library/bb483056.aspx, visited in 2010.

[6] Microsoft Corporation. Microsoft Robotics Developer Studio product Documentation.

[7] Microsoft Corporation. Video tutorials on simulation. Website. http://msdn.microsoft.

com/en-us/robotics/bb383569.aspx, visited in 2010.

[8] Microsoft Corporation. Vpl documentation. Website. http://msdn.microsoft.com/

en-us/library/bb483088.aspx, visited in 2010.

[9] Jennifer Owen. How to use player/stage. Website, 2009. http://playerstage.

sourceforge.net/doc/playerstage_instructions_2.0.pdf.

[10] Michael Somby. A review of robotics software platforms.www.linuxfordevices.com, 2008.

[11] Bruce A. MacDonald Toby H.J. Collett and Brian P. Gerkey.Player 2.0: Toward a Practical Robot Programming Framework. Proceedings of the Australasian Conference on Robotics and Automation (ACRA 2005), Sydney, Australia, December 2005.

(21)

A MSRDS EXAMPLE

Appendices

A MSRDS Example

Here is a code whose screenshot is given in Figure 1.

u s i n g System ;

u s i n g System . C o l l e c t i o n s . G e n e r i c ; u s i n g System . ComponentModel ; u s i n g M i c r o s o f t . Ccr . Core ;

u s i n g M i c r o s o f t . Dss . Core . A t t r i b u t e s ; u s i n g M i c r o s o f t . Dss . S e r v i c e M o d e l . Dssp ;

u s i n g M i c r o s o f t . Dss . S e r v i c e M o d e l . D s s p S e r v i c e B a s e ; u s i n g W3C. Soap ;

u s i n g submgr = M i c r o s o f t . Dss . S e r v i c e s . S u b s c r i p t i o n M a n a g e r ; u s i n g e n g i n e = M i c r o s o f t . R o b o t i c s . S i m u l a t i o n . Engine . Proxy ; u s i n g M i c r o s o f t . R o b o t i c s . S i m u l a t i o n . Engine ;

u s i n g M i c r o s o f t . R o b o t i c s . S i m u l a t i o n . P h y s i c s ; u s i n g M i c r o s o f t . R o b o t i c s . P h y s i c a l M o d e l ;

u s i n g d r i v e = M i c r o s o f t . R o b o t i c s . S e r v i c e s . S i m u l a t i o n . D r i v e . Proxy ; u s i n g l r f = M i c r o s o f t . R o b o t i c s . S e r v i c e s . S i m u l a t i o n . S e n s o r s .

L a s e r R a n g e F i n d e r . Proxy ;

u s i n g s i c k l r f = M i c r o s o f t . R o b o t i c s . S e r v i c e s . S e n s o r s . SickLRF . Proxy ; // F o l l o w i n g a r e u s e d f o r a c c e s s i n g t i m e r t o c r e a t e t i m e o u t t o c a l l a

f u n c t i o n t o d i s p l a y s e n s o r d a t a u s i n g System . Linq ;

u s i n g System . Text ; u s i n g System . Timers ;

namespace L i n e F o l l o w e r T r i a l E n v 1 {

[ C o n t r a c t ( C o n t r a c t . I d e n t i f i e r ) ]

[ DisplayName ( ” L i n e F o l l o w e r T r i a l E n v 1 ” ) ]

[ D e s c r i p t i o n ( ” L i n e F o l l o w e r T r i a l E n v 1 s e r v i c e ( no d e s c r i p t i o n p r o v i d e d ) ” ) ]

c l a s s L i n e F o l l o w e r T r i a l E n v 1 S e r v i c e : D s s p S e r v i c e B a s e {

/// <summary>

/// S e r v i c e s t a t e

/// </summary>

[ S e r v i c e S t a t e ]

L i n e F o l l o w e r T r i a l E n v 1 S t a t e s t a t e = new L i n e F o l l o w e r T r i a l E n v 1 S t a t e ( ) ;

(22)

A MSRDS EXAMPLE

/// <summary>

/// Main s e r v i c e p o r t

/// </summary>

[ S e r v i c e P o r t ( ” / L i n e F o l l o w e r T r i a l E n v 1 ” , A l l o w M u l t i p l e I n s t a n c e s

= t r u e ) ]

L i n e F o l l o w e r T r i a l E n v 1 O p e r a t i o n s m a i n P o r t = new L i n e F o l l o w e r T r i a l E n v 1 O p e r a t i o n s ( ) ;

[ S u b s c r i p t i o n M a n a g e r P a r t n e r ]

submgr . S u b s c r i p t i o n M a n a g e r P o r t submgrPort = new submgr . S u b s c r i p t i o n M a n a g e r P o r t ( ) ;

/// <summary>

/// S i m u l a t i o n E n g i n e p a r t n e r

/// </summary>

[ P a r t n e r ( ” S i m u l a t i o n E n g i n e ” , C o n t r a c t = e n g i n e . C o n t r a c t . I d e n t i f i e r , C r e a t i o n P o l i c y = P a r t n e r C r e a t i o n P o l i c y . U s e E x i s t i n g O r C r e a t e ) ]

e n g i n e . S i m u l a t i o n E n g i n e P o r t s i m u l a t i o n E n g i n e P o r t = new e n g i n e . S i m u l a t i o n E n g i n e P o r t ( ) ;

Port<R a y c a s t R e s u l t> r a y C a s t P o r t = new Port<R a y c a s t R e s u l t>() ;

/// <summary>

/// S e r v i c e c o n s t r u c t o r

/// </summary>

p u b l i c L i n e F o l l o w e r T r i a l E n v 1 S e r v i c e ( D s s p S e r v i c e C r e a t i o n P o r t c r e a t i o n P o r t )

: b a s e ( c r e a t i o n P o r t ) {

}

/// <summary>

/// S e r v i c e s t a r t

/// </summary>

p r o t e c t e d o v e r r i d e v o i d S t a r t ( ) {

//

// Add s e r v i c e s p e c i f i c i n i t i a l i z a t i o n h e r e //

b a s e . S t a r t ( ) ;

// O r i e n t sim camera view p o i n t SetupCamera ( ) ;

// Add o b j e c t s ( e n t i t i e s ) i n our s i m u l a t e d w o r l d PopulateWorld ( ) ;

(23)

A MSRDS EXAMPLE

/// The f o l l o w i n g c o d e e n t e r e d f o r d i s p l a y i n g s e n s o r d a t a p e r i o d i c a l l y

System . Timers . Timer aTimer = new System . Timers . Timer ( ) ; aTimer . E l a p s e d += new E l a p s e d E v e n t H a n d l e r (

d i s p l a y S e n s o r D a t a ) ;

// S e t t h e I n t e r v a l t o 5 s e c o n d s . aTimer . I n t e r v a l = 5 0 0 0 ;

aTimer . Enabled = t r u e ; }

v o i d d i s p l a y S e n s o r D a t a ( o b j e c t s o u r c e , E l a p s e d E v e n t A r g s e ) {

C o n s o l e . W r i t e L i n e ( ” H e l l o World ! ” ) ; R a y c a s t R e s u l t v e r t i c a l R e s u l t s ;

r a y C a s t P o r t . T e s t ( ou t v e r t i c a l R e s u l t s ) ; i f ( v e r t i c a l R e s u l t s != n u l l )

{

f o r e a c h ( R a y c a s t I m p a c t P o i n t impact i n v e r t i c a l R e s u l t s . I m p a c t P o i n t s )

{

C o n s o l e . W r i t e L i n e ( impact . P o s i t i o n . T o S t r i n g ( ) ) ; }

} }

b o o l HasError<T>( P o r t S e t<T, F a u l t> s e n s o r O r F a u l t ) {

F a u l t f a u l t = ( F a u l t ) s e n s o r O r F a u l t ; i f ( f a u l t != n u l l )

{

L o g E r r o r ( f a u l t . ToException ( ) ) ; r e t u r n t r u e ;

} e l s e

r e t u r n f a l s e ; }

p r i v a t e v o i d SetupCamera ( ) {

// S e t up i n i t i a l view

CameraView view = new CameraView ( ) ;

view . E y e P o s i t i o n = new V e c t o r 3 (−0.85 f , 0 . 8 3 f , −0.29 f ) ; view . LookAtPoint = new V e c t o r 3 (−0.34 f , 0 . 6 9 f , −0.14 f ) ; S i m u l a t i o n E n g i n e . G l o b a l I n s t a n c e P o r t . Update ( view ) ; }

p r i v a t e v o i d PopulateWorld ( ) {

(24)

A MSRDS EXAMPLE

AddSky ( ) ; AddGround ( ) ;

AddTable ( new V e c t o r 3 ( 1 , 0 . 5 f , −2) ) ; AddLine ( new V e c t o r 3 ( 1 , 0 , 1 ) ) ; AddLine2 ( new V e c t o r 3 ( 2 , 0 , 1 ) ) ;

AddPioneer3DXRobot ( new V e c t o r 3 ( 1 , 0 . 1 f , 0 ) ) ; }

#r e g i o n CODECLIP 03−3 v o i d AddSky ( )

{

// Add a sky u s i n g a s t a t i c t e x t u r e . We w i l l u s e t h e sky t e x t u r e

// t o do p e r p i x e l l i g h t i n g on e a c h s i m u l a t i o n v i s u a l e n t i t y

SkyDomeEntity sky = new SkyDomeEntity ( ” skydome . dds ” , ” s k y d i f f . dds ” ) ;

S i m u l a t i o n E n g i n e . G l o b a l I n s t a n c e P o r t . I n s e r t ( sky ) ; // Add a d i r e c t i o n a l l i g h t t o s i m u l a t e t h e sun . L i g h t S o u r c e E n t i t y sun = new L i g h t S o u r c e E n t i t y ( ) ; sun . S t a t e . Name = ”Sun ” ;

sun . Type = L i g h t S o u r c e E n t i t y T y p e . D i r e c t i o n a l ; sun . C o l o r = new V e c t o r 4 ( 0 . 8 f , 0 . 8 f , 0 . 8 f , 1 ) ; sun . D i r e c t i o n = new V e c t o r 3 ( 0 . 5 f , −.75 f , 0 . 5 f ) ; S i m u l a t i o n E n g i n e . G l o b a l I n s t a n c e P o r t . I n s e r t ( sun ) ; }

#e n d r e g i o n

#r e g i o n CODECLIP 03−4 v o i d AddGround ( )

{

// c r e a t e a l a r g e h o r i z o n t a l p l a n e , a t z e r o e l e v a t i o n . H e i g h t F i e l d E n t i t y ground = new H e i g h t F i e l d E n t i t y (

” s i m p l e ground ” , // name

” b l a c k S u r f a c e . dds ” , // t e x t u r e image new M a t e r i a l P r o p e r t i e s ( ” ground ” ,

0 . 2 f , // r e s t i t u t i o n 0 . 5 f , // dynamic f r i c t i o n 0 . 5 f ) // s t a t i c f r i c t i o n ) ;

S i m u l a t i o n E n g i n e . G l o b a l I n s t a n c e P o r t . I n s e r t ( ground ) ; }

#e n d r e g i o n

v o i d AddTable ( V e c t o r 3 p o s i t i o n ) {

// c r e a t e an i n s t a n c e o f our custom e n t i t y T a b l e E n t i t y e n t i t y = new T a b l e E n t i t y ( p o s i t i o n ) ;

(25)

A MSRDS EXAMPLE

// Name t h e e n t i t y

e n t i t y . S t a t e . Name = ” t a b l e : ” + Guid . NewGuid ( ) . T o S t r i n g ( ) ; // I n s e r t e n t i t y i n s i m u l a t i o n .

S i m u l a t i o n E n g i n e . G l o b a l I n s t a n c e P o r t . I n s e r t ( e n t i t y ) ; }

#r e g i o n CODECLIP 03−5

v o i d AddLine ( V e c t o r 3 p o s i t i o n ) {

V e c t o r 3 d i m e n s i o n s =

new V e c t o r 3 ( 0 . 5 f , 0 . 0 1 f , 0 . 0 5 f ) ; // m e t e r s

// c r e a t e s i m p l e movable e n t i t y , w i t h a s i n g l e s h a p e S i n g l e S h a p e E n t i t y box = new S i n g l e S h a p e E n t i t y (

new BoxShape (

new B o x S h a p e P r o p e r t i e s ( 1 0 , // mass i n k i l o g r a m s . new Pose ( ) , // r e l a t i v e p o s e d i m e n s i o n s ) ) , // d i m e n s i o n s p o s i t i o n ) ;

box . S t a t e . MassDensity . Mass = 0 ; box . S t a t e . MassDensity . D e n s i t y = 0 ;

// Name t h e e n t i t y . A l l e n t i t i e s must have u n i q u e names box . S t a t e . Name = ” box ” ;

// I n s e r t e n t i t y i n s i m u l a t i o n .

S i m u l a t i o n E n g i n e . G l o b a l I n s t a n c e P o r t . I n s e r t ( box ) ; }

v o i d AddLine2 ( V e c t o r 3 p o s i t i o n ) {

V e c t o r 3 d i m e n s i o n s =

new V e c t o r 3 ( 0 . 5 f , 0 . 0 1 f , 0 . 0 5 f ) ; // m e t e r s

// c r e a t e s i m p l e movable e n t i t y , w i t h a s i n g l e s h a p e S i n g l e S h a p e E n t i t y box = new S i n g l e S h a p e E n t i t y (

new BoxShape (

new B o x S h a p e P r o p e r t i e s ( 1 0 , // mass i n k i l o g r a m s .

new Pose ( new V e c t o r 3 ( 0 , 0 , 0 ) , new Q u a t e r n i o n ( 0 . 0 f , 0 . 3 8 3 f , 0 . 0 f , 0 . 9 2 3 9 f ) ) , // r e l a t i v e p o s e d i m e n s i o n s ) ) , // d i m e n s i o n s

p o s i t i o n ) ;

box . S t a t e . MassDensity . Mass = 0 ; box . S t a t e . MassDensity . D e n s i t y = 0 ;

(26)

A MSRDS EXAMPLE

// Name t h e e n t i t y . A l l e n t i t i e s must have u n i q u e names box . S t a t e . Name = ” box2 ” ;

// I n s e r t e n t i t y i n s i m u l a t i o n .

S i m u l a t i o n E n g i n e . G l o b a l I n s t a n c e P o r t . I n s e r t ( box ) ; }

#e n d r e g i o n

v o i d AddPioneer3DXRobot ( V e c t o r 3 p o s i t i o n ) {

Pioneer3DX r o b o t B a s e E n t i t y = CreateMotorBase ( r e f p o s i t i o n ) ;

// C r e a t e L a s e r e n t i t y and s t a r t s i m u l a t e d l a s e r s e r v i c e L a s e r R a n g e F i n d e r E n t i t y l a s e r = C r e a t e L a s e r R a n g e F i n d e r ( ) ; // i n s e r t l a s e r a s c h i l d t o motor b a s e

r o b o t B a s e E n t i t y . I n s e r t E n t i t y ( l a s e r ) ;

// F i n a l l y i n s e r t t h e motor b a s e and i t s c h i l d s e n s o r // t o t h e s i m u l a t i o n

S i m u l a t i o n E n g i n e . G l o b a l I n s t a n c e P o r t . I n s e r t ( r o b o t B a s e E n t i t y ) ;

}

p r i v a t e L a s e r R a n g e F i n d e r E n t i t y C r e a t e L a s e r R a n g e F i n d e r ( ) {

// C r e a t e a L a s e r Range F i n d e r E n t i t y . // P l a c e i t 10cm above b a s e C e n t e r o f M a s s .

L a s e r R a n g e F i n d e r E n t i t y l a s e r = new L a s e r R a n g e F i n d e r E n t i t y (

new Pose ( new V e c t o r 3 ( 0 , 0 . 1 0 f , 0 ) ) ) ; l a s e r . S t a t e . Name = ” P3DXLaserRangeFinder ” ;

l a s e r . LaserBox . S t a t e . D i f f u s e C o l o r = new V e c t o r 4 ( 0 . 2 5 f , 0 . 2 5 f , 0 . 8 f , 1 . 0 f ) ;

// C r e a t e L a s e r R a n g e F i n d e r s i m u l a t i o n s e r v i c e and s p e c i f y // which e n t i t y i t t a l k s t o

l r f . C o n t r a c t . C r e a t e S e r v i c e ( C o n s t r u c t o r P o r t ,

M i c r o s o f t . R o b o t i c s . S i m u l a t i o n . P a r t n e r s . C r e a t e E n t i t y P a r t n e r (

” h t t p : / / l o c a l h o s t /” + l a s e r . S t a t e . Name) ) ; l a s e r . R e g i s t e r ( r a y C a s t P o r t ) ;

r e t u r n l a s e r ;

(27)

A MSRDS EXAMPLE

}

p r i v a t e Pioneer3DX CreateMotorBase ( r e f V e c t o r 3 p o s i t i o n ) {

// u s e s u p p l i e d e n t i t y t h a t c r e a t e s a motor b a s e // w i t h 2 a c t i v e w h e e l s and one c a s t e r

Pioneer3DX r o b o t B a s e E n t i t y = new Pioneer3DX ( p o s i t i o n ) ; // s p e c i f y mesh .

r o b o t B a s e E n t i t y . S t a t e . A s s e t s . Mesh = ” P i o n e e r 3 d x . bos ” ; // s p e c i f y c o l o r i f no mesh i s s p e c i f i e d .

r o b o t B a s e E n t i t y . C h a s s i s S h a p e . S t a t e . D i f f u s e C o l o r = new V e c t o r 4 ( 0 . 8 f , 0 . 2 5 f , 0 . 2 5 f , 1 . 0 f ) ;

// t h e name below must match m a n i f e s t

r o b o t B a s e E n t i t y . S t a t e . Name = ”P3DXMotorBase ” ;

#r e g i o n CODECLIP 04−1

// S t a r t s i m u l a t e d a r c o s motor s e r v i c e

d r i v e . C o n t r a c t . C r e a t e S e r v i c e ( C o n s t r u c t o r P o r t , M i c r o s o f t . R o b o t i c s . S i m u l a t i o n . P a r t n e r s .

C r e a t e E n t i t y P a r t n e r (

” h t t p : / / l o c a l h o s t /” + r o b o t B a s e E n t i t y . S t a t e . Name) ) ;

#e n d r e g i o n

r e t u r n r o b o t B a s e E n t i t y ; }

/// <summary>

/// H a n d l e s S u b s c r i b e m e s s a g e s

/// </summary>

/// <param name=” s u b s c r i b e ”>t h e s u b s c r i b e r e q u e s t</param>

[ S e r v i c e H a n d l e r ]

p u b l i c v o i d S u b s c r i b e H a n d l e r ( S u b s c r i b e s u b s c r i b e ) {

S u b s c r i b e H e l p e r ( submgrPort , s u b s c r i b e . Body , s u b s c r i b e . R e s p o n s e P o r t ) ;

} } }

[ D a t a Co n t r a c t ]

p u b l i c c l a s s T a b l e E n t i t y : M u l t i S h a p e E n t i t y {

/// <summary>

/// D e f a u l t c o n s t r u c t o r .

/// </summary>

p u b l i c T a b l e E n t i t y ( ) { }

(28)

A MSRDS EXAMPLE

/// <summary>

/// Custom c o n s t r u c t o r , p r o g r a m m a t i c a l l y b u i l d s p h y s i c s p r i m i t i v e s h a p e s t o d e s c r i b e

/// a p a r t i c u l a r t a b l e .

/// </summary>

/// <param name=” p o s i t i o n ”></param>

p u b l i c T a b l e E n t i t y ( V e c t o r 3 p o s i t i o n ) {

S t a t e . Pose . P o s i t i o n = p o s i t i o n ; S t a t e . A s s e t s . Mesh = ” t a b l e 0 1 . o b j ” ; f l o a t t a b l e H e i g h t = 0 . 6 5 f ;

f l o a t t a b l e W i d t h = 1 . 0 5 f ; f l o a t t a b l e D e p t h = 0 . 7 f ; f l o a t t a b l e T h i n k n e s s = 0 . 0 3 f ; f l o a t l e g T h i c k n e s s = 0 . 0 3 f ; f l o a t l e g O f f s e t = 0 . 0 5 f ;

// add a s h a p e f o r t h e t a b l e s u r f a c e BoxShape t a b l e T o p = new BoxShape (

new B o x S h a p e P r o p e r t i e s ( 3 0 ,

new Pose ( new V e c t o r 3 ( 0 , t a b l e H e i g h t , 0 ) ) ,

new V e c t o r 3 ( tableWidth , t a b l e T h i n k n e s s , t a b l e D e p t h ) ) ) ;

// add a s h a p e f o r t h e l e f t l e g

BoxShape t a b l e L e f t L e g = new BoxShape (

new B o x S h a p e P r o p e r t i e s ( 1 0 , // mass i n kg new Pose (

new V e c t o r 3 (−t a b l e W i d t h / 2 + l e g O f f s e t , t a b l e H e i g h t / 2 , 0 ) ) ,

new V e c t o r 3 ( l e g T h i c k n e s s , t a b l e H e i g h t + t a b l e T h i n k n e s s , t a b l e D e p t h ) )

) ;

BoxShape t a b l e R i g h t L e g = new BoxShape (

new B o x S h a p e P r o p e r t i e s ( 1 0 , // mass i n kg new Pose (

new V e c t o r 3 ( t a b l e W i d t h / 2 − l e g O f f s e t , t a b l e H e i g h t / 2 , 0 ) ) ,

new V e c t o r 3 ( l e g T h i c k n e s s , t a b l e H e i g h t + t a b l e T h i n k n e s s , t a b l e D e p t h ) )

) ;

BoxShapes = new L i s t<BoxShape>() ; BoxShapes . Add ( t a b l e T o p ) ;

BoxShapes . Add ( t a b l e L e f t L e g ) ; BoxShapes . Add ( t a b l e R i g h t L e g ) ; }

(29)

B PLAYER/STAGE EXAMPLE

p u b l i c o v e r r i d e v o i d Update ( FrameUpdate update ) {

b a s e . Update ( update ) ; }

}

B Player/Stage Example

Let us now go through an example which will help in understanding the features better:- The robot’s .inc file This file [9](named bigbob.inc) contains the description of the robot as a two dimentional object identified by points of a polygon. The sensor’s nature, positions, count and other physical parameters are also specified here. Here is the file:-

#Bigbob ’ s s o n a r s

d e f i n e b i g b o b s s o n a r s r a n g e r (

# number o f s o n a r s s c o u n t 4

# d e f i n e t h e p o s e o f e a c h t r a n s d u c e r [ xpos ypos h e a d i n g ] s p o s e [ 0 ] [ 0 . 7 5 0 . 1 8 7 5 0 ] #f r l e f t t o o t h

s p o s e [ 1 ] [ 0 . 7 5 −0.1875 0 ] #f r r i g h t t o o t h s p o s e [ 2 ] [ 0 . 2 5 0 . 5 3 0 ] # l e f t c o r n e r s p o s e [ 3 ] [ 0 . 2 5 −0.5 −30] # r i g h t c o r n e r

# d e f i n e t h e f i e l d o f view o f e a c h t r a n s d u c e r

#[ r a n g e m i n range max v i e w a n g l e ] s v i e w [ 0 . 3 2 . 0 1 0 ]

# d e f i n e t h e s i z e o f e a c h t r a n s d u c e r

# [ x s i z e y s i z e ] i n m e t e r s s s i z e [ 0 . 0 1 0 . 0 5 ]

)

# bigbob ’ s b l o b f i n d e r

d e f i n e b i g b o b s e y e s b l o b f i n d e r (

# number o f c o l o u r s t o l o o k f o r c o l o r s c o u n t 2

# which c o l o u r s t o l o o k f o r c o l o r s [ ” o r a n g e ” ” DarkBlue ” ]

# camera p a r a m e t e r s

image [ 1 6 0 1 2 0 ] #r e s o l u t i o n )

# bigbob ’ s l a s e r

(30)

B PLAYER/STAGE EXAMPLE

d e f i n e b i g b o b s l a s e r l a s e r (

# r a n g e m i n 0 . 0

# d i s t a n c e between t e e t h i n m e t r e s range max 0 . 2 5

# d o e s n o t need t o be b i g f o v 20

#p o s e [ 0 . 6 2 5 0 . 1 2 5 0 . 1 2 7 0 ] s i z e [ 0 . 0 2 5 0 . 0 2 5 0 . 0 1 ] )

# bigbob ’ s body

d e f i n e b i g b o b p o s i t i o n (

# a c t u a l s i z e

#s i z e [ 1 . 2 5 1 1 ] s i z e [ 0 . 6 2 5 0 . 5 0 . 5 ]

# Bigbob ’ s c e n t r e o f r o t a t i o n i s o f f s e t from i t s c e n t r e o f a r e a o r i g i n [ 0 . 1 2 5 0 0 0 ]

# e s t i m a t e d mass i n KG mass 1 5 . 0

# t h e s h a p e o f Bigbob b l o c k

(

p o i n t s 6

p o i n t [ 5 ] [ 0 0 ] p o i n t [ 4 ] [ 0 1 ] p o i n t [ 3 ] [ 0 . 7 5 1 ] p o i n t [ 2 ] [ 1 0 . 7 5 ] p o i n t [ 1 ] [ 1 0 . 2 5 ] p o i n t [ 0 ] [ 0 . 7 5 0 ] z [ 0 1 ]

) b l o c k (

p o i n t s 4

p o i n t [ 3 ] [ 1 0 . 7 5 ] p o i n t [ 2 ] [ 1 . 2 5 0 . 7 5 ] p o i n t [ 1 ] [ 1 . 2 5 0 . 6 2 5 ] p o i n t [ 0 ] [ 1 0 . 6 2 5 ]

(31)

B PLAYER/STAGE EXAMPLE

z [ 0 0 . 5 ] )

b l o c k (

p o i n t s 4

p o i n t [ 3 ] [ 1 0 . 3 7 5 ] p o i n t [ 2 ] [ 1 . 2 5 0 . 3 7 5 ] p o i n t [ 1 ] [ 1 . 2 5 0 . 2 5 ] p o i n t [ 0 ] [ 1 0 . 2 5 ] z [ 0 0 . 5 ]

)

# d i f f e r e n t i a l s t e e r i n g model d r i v e ” d i f f ”

# s e n s o r s a t t a c h e d t o b i g b o b b i g b o b s s o n a r s ( )

b i g b o b s e y e s ( ) b i g b o b s l a s e r ( )

o b s t a c l e r e t u r n 1 # Can h i t t h i n g s . l a s e r r e t u r n 1 # r e f l e c t s l a s e r beams r a n g e r r e t u r n 1 # r e f l e c t s s o n a r beams b l o b r e t u r n 1 # Seen by b l o b f i n d e r s )

Themap.inc file specifies the map, on which the robot will move. It is as follows:- d e f i n e map model

(

# sombre , s e n s i b l e , a r t i s t i c c o l o r ” b l a c k ”

# most maps w i l l need a bounding box boundary 1

g u i n o s e 1 g u i g r i d 1

#r a n g e r r e t u r n 1 # r e f l e c t s s o n a r beams g u i m o v e 0

g u i o u t l i n e 0 f i d u c i a l r e t u r n 0 g r i p p e r r e t u r n 0 l a s e r r e t u r n 1 )

The empty.world [9] contains all the information of the environment. It also includes the .inc files defined above. It is as follows:-

i n c l u d e ”map . i n c ”

(32)

B PLAYER/STAGE EXAMPLE

i n c l u d e ” b i g b o b . i n c ”

#i n c l u d e ” s i c k . i n c ”

# s i z e o f t h e whole s i m u l a t i o n s i z e [ 1 5 1 5 ]

# c o n f i g u r e t h e GUI window window

(

s i z e [ 6 5 0 . 0 6 5 0 . 0 ] # i n p i x e l s

# 650/15 rounded up a b i t s c a l e 43 # i n p i x e l s / meter

#s h o w d a t a 1 )

# l o a d an e n v i r o n m e n t bitmap map

(

bitmap ” bitmaps / c a v e . png ” p o s e [ 0 0 0 0 ]

s i z e [ 1 5 15 1 . 6 0 ] )

b i g b o b (

name ” bob1 ” p o s e [−5 −6 0 0 ] c o l o r ” r e d ” )

Theempty.cfgfile [9] specifies the drivers which the Player Server will use. It is as follows:- d r i v e r

(

name ” s t a g e ”

p l u g i n ” s t a g e p l u g i n ” p r o v i d e s [ ” s i m u l a t i o n : 0 ” ]

# l o a d t h e named f i l e i n t o t h e s i m u l a t o r w o r l d f i l e ” empty . w o r l d ”

) d r i v e r (

name ” s t a g e ”

p r o v i d e s [ ” 6 6 6 5 : p o s i t i o n 2 d : 0 ” ” 6 6 6 5 : b l o b f i n d e r : 0 ” ” 6 6 6 5 : l a s e r : 0 ” ” 6 6 6 5 : s o n a r : 0 ” ]

model ” bob1 ” )

The Player Server needs to be invoked after these four files have been defined. To do so, use the following command:-

p l a y e r empty . c f g

(33)

B PLAYER/STAGE EXAMPLE

This will not only initiate the Player server but also the Stage simulation window. The robot can be located in it in red colour.

The user code (code.cpp) [9] which controls the robot is as follows:-

#i n c l u d e <s t d i o . h>

#i n c l u d e <u n i s t d . h>

#i n c l u d e <t i m e . h>

#i n c l u d e <l i b p l a y e r c ++/p l a y e r c ++.h>

u s i n g namespace P l a y e r C c ; u s i n g namespace s t d ;

v o i d A v o i d O b s t a c l e s ( d o u b l e ∗f o r w a r d S p e e d , d o u b l e ∗turnSpeed , SonarProxy &sp )

{

// w i l l a v o i d o b s t a c l e s c l o s e r than 40cm d o u b l e a v o i d D i s t a n c e = . 4 ;

// w i l l t u r n away a t 10 d e g r e e s / s e c i n t avoidTurnSpeed = 1 0 ;

// l e f t c o r n e r i s s o n a r no . 2 // r i g h t c o r n e r i s s o n a r no . 3

i f ( sp [ 2 ] < a v o i d D i s t a n c e ) {

∗f o r w a r d S p e e d = 0 ; // t u r n r i g h t

∗t u r n S p e e d = (−1)∗avoidTurnSpeed ; r e t u r n ;

}

e l s e i f ( sp [ 3 ] < a v o i d D i s t a n c e ) {

∗f o r w a r d S p e e d = 0 ; // t u r n l e f t

∗t u r n S p e e d = avoidTurnSpeed ; r e t u r n ;

}

e l s e i f ( ( sp [ 0 ] < 2∗a v o i d D i s t a n c e ) | | ( sp [ 1 ] < 2∗a v o i d D i s t a n c e ) ) {

// back o f f a l i t t l e b i t

∗f o r w a r d S p e e d = −0 . 3 ;

i f ( sp [ 0 ]<sp [ 1 ] ) // I f l e f t s e n s o r i s c l o s e r t h e n r i g h t s e n s o r

∗t u r n S p e e d = −(rand ( ) %70+20) ; // Take a r i g h t t u r n randomly r a n g i n g between 20 and 90 d e g r e e s e l s e

∗t u r n S p e e d = rand ( ) %70+20; // Take a random l e f t t u r n r e t u r n ;

}

r e t u r n ; // do n o t h i n g }

(34)

B PLAYER/STAGE EXAMPLE

i n t main ( i n t a r g c , c h a r ∗a r g v [ ] ) {

// E n a b l i n g P r o x i e s

P l a y e r C l i e n t r o b o t ( ” l o c a l h o s t ” ) ; P o s i t i o n 2 d P r o x y p2dProxy(& r o b o t , 0 ) ; SonarProxy s o n a r P r o x y (& r o b o t , 0 ) ; B l o b f i n d e r P r o x y blo bPro xy (& r o b o t , 0 ) ; L a s e r P r o x y l a s e r P r o x y (& r o b o t , 0 ) ; // e n a b l e motors

p2dProxy . SetMotorEnable ( 1 ) ; // r e q u e s t g e o m e t r i e s

p2dProxy . RequestGeom ( ) ; s o n a r P r o x y . RequestGeom ( ) ; l a s e r P r o x y . RequestGeom ( ) ;

// b l o b f i n d e r d o e s n t have geometry // some c o n t r o l c o d e

d o u b l e f o r w a r d S p e e d , t u r n S p e e d ; s r a n d ( t i m e (NULL) ) ;

w h i l e ( t r u e ) {

// r e a d from t h e p r o x i e s r o b o t . Read ( ) ;

cout<<”D i s t a n c e :”<<s o n a r P r o x y [0]< <” ”<<s o n a r P r o x y [1]< <” ”<<

s o n a r P r o x y [2]< <” ”<<s o n a r P r o x y [3]< <e n d l ; f o r w a r d S p e e d = . 7 ;

t u r n S p e e d = 0 ;

// c a l l a f u n c t i o n t o a v o i d o b s t a c l e s

A v o i d O b s t a c l e s (& f o r w a r d S p e e d , &turnSpeed , s o n a r P r o x y ) ; // s e t motors

p2dProxy . S e t S p e e d ( f o r w a r d S p e e d , d t o r ( t u r n S p e e d ) ) ; s l e e p ( 1 ) ; // w a i t f o r one s e c o n d

}

r e t u r n 0 ; }

This code should be compiled using:

g++ −o c o d e ‘ pkg−c o n f i g −−c f l a g s p l a y e r c ++‘ c o d e . cpp ‘ pkg−c o n f i g −−

l i b s p l a y e r c ++‘

Then the code should be executed using: ‘./code’ command. This should connect to the Player Server and the robot should start moving according to this algorithm.

References

Related documents

These gains in crop production are unprecedented which is why 5 million small farmers in India in 2008 elected to plant 7.6 million hectares of Bt cotton which

INDEPENDENT MONITORING BOARD | RECOMMENDED ACTION.. Rationale: Repeatedly, in field surveys, from front-line polio workers, and in meeting after meeting, it has become clear that

3 Collective bargaining is defined in the ILO’s Collective Bargaining Convention, 1981 (No. 154), as “all negotiations which take place between an employer, a group of employers

Harmonization of requirements of national legislation on international road transport, including requirements for vehicles and road infrastructure ..... Promoting the implementation

3.6., which is a Smith Predictor based NCS (SPNCS). The plant model is considered in the minor feedback loop with a virtual time delay to compensate for networked induced

1 For the Jurisdiction of Commissioner of Central Excise and Service Tax, Ahmedabad South.. Commissioner of Central Excise and Service Tax, Ahmedabad South Commissioner of

In this thesis, we study a few of them, namely the interlocks between the corporate and state entities, the kind of statements made by these entities in popular media, the bias

The petitioner also seeks for a direction to the opposite parties to provide for the complete workable portal free from errors and glitches so as to enable