-
Notifications
You must be signed in to change notification settings - Fork 1
Pandora Software Essentials
This document presents software-concerned knowledge which is related to Pandora project. General programming topics below are basic and essential for a modern software engineer to acquire, but thorough studying of these is not a requirement in a robotics project. They are still recommended and consist a good background for a developer. ROS is the middleware that Pandora uses and thus offers the API for software-software and hardware-software communication. This means that ROS-related topics are essential for a developer in Pandora to master.
###1. C++ C++ is the main language used in Pandora. Good knowledge of the language's mechanics and syntax is a must. Also, developing in C++ and knowing how to write a program in C++ are two different skills, as C++ introduces objects as a code tool for state and flow organizing (http://en.wikipedia.org/wiki/Object-oriented_programming). As a result, object oriented programming skills are needed apart from structured programming skills (http://en.wikipedia.org/wiki/Structured_programming). It also includes generics (http://en.wikipedia.org/wiki/Generic_programming). A program takes full advantage of these features when it correctly uses coding techniques that replace structured programming paradigms with object oriented ones. These techniques are called software patterns (http://en.wikipedia.org/wiki/Software_design_pattern) and their usage helps the developer as it equally serves the program. Advantages and some techniques will be discussed in section 2.
To be able to use these techniques correctly and adopt an object oriented programming style, one must know the virtues and vices of C++ very well. A good tutorial to start studying is on this site: http://www.learncpp.com/ The writer analyzes some tricky issues of C++ in whole paragraphs so it is a good start. Taking care of these issues is important to write quality code. Some are being presented below:
- Encapsulation: organization of data and program states into objects means that we hate global variables and there is a good reason for it.
block statements and local variables
global variables
file scope and static things
public and private things
encapsulation
stating friends (friend statement is a bad thing in general)
- Const correctness: giving classes, objects or functions the correct permissions on data that they use according to what they are intended [by the programmer-writer or the programmer-user (if is to be used as an API)] to do with them (read-only or read-and-write ??). To understand this, is necessary to think what means for a function to have as an argument or return object a value, a pointer or a reference.
pointers and const
reference vs pointers
arguments by value
arguments by reference
arguments by address
return by value vs reference vs address
- Type Casting: Safe type casting is a very powerful tool and can unlock some of the greatest tricks in C++, whereas unsafe type casting can unlock the greatest bugs.
conversion and casting
static cast !!
dynamic cast !!
const cast usually a bad thing
reinterpret cast does whatever you like without warnings and with little constraints, useful when one wants to write low level code, but a curse for high level developing
Closing this chapter about C++, the reader must be accustomed with all attributes that consist C++. They must know its basics as well as all concepts about inheritance and templates. Finally they should check libraries that are offered to C++ developers in order to make their lives easier. The most basic are:
- STL which contains the most common data structures (vectors, lists, tuples, pairs, maps etc) in generic form and utilities upon them.
- Boost which is the bread and butter and headache for a modern C++ developer. It is the bread and butter because it delivers the most common things that a programmer needs in a generic way that C++ does not already have it by default (C++11 and on - among other things - are efforts to make canonical into the language most utilities offered by Boost). It is also the headache because of its bad documentation and not always so clear usage of its thingies. Among all Boost's goods you should take some time and read what function binding is (basically means objectifying functions!) and smart pointers. Smart pointers are pointers whose content is deleted when all users/keepers of the same pointer expire (meaning that there are no more active copies of the smart pointer object) or when you decide to do so. Thus, smart pointer objects provide C++ with a Java notion of a reference-object but without the complexes of the garbage collector system that sometimes arise. You are going to see both function-objects and pointer-objects very often so get used to them.
###2. Software Engineering
###3. Software Testing
###4. Tools
###5. The Robot Operating System
###6. Testing in ROS
###7. Robot Simulation
###8. Introduction to Pandora