Conventions and coding style
Your are strongly asked to learn the conventions (cough cough... rules) and to respect them. The use of them from all of us will allow to read and understand the code and structure of the applications. Moreover, some conventions used in OpenRDK core will let you understand immediately the behavior of a function. Of course, you are free to use or not use the advices in the "Coding style" paragraph (instead, you are required to follow them if you write code for the OpenRDK framework itself).
Units of measurements
In order to avoid a mess and unnecessary conversion, in OpenRDK there exist only these units of measurements: meters, seconds, kilograms, radians, celsius degrees. Of course you can use whatever fancy unit of measurement for fancy quantities (e.g., eV, lumen, etc.), but for the quantities measured by the units of measurements above, you are asked to use only those ones. This means that every length should be measured in meters, every weight in kilograms, every time in seconds, etc.
If you get some quantity from outside OpenRDK, that is measured in different units of measurements (i.e., centimeters instead of meters), you should convert that immediately while entering in OpenRDK and convert it in other ways (i.e., parsec) only a moment before exporting it to an application outside the OpenRDK.
Radians are an exception, in the sense that in the code you should always have radians, but for visualization purposes (or configuration files), they are written in degrees for ease of understanding (but, again, they are translated in degrees just a moment before being displayed, and converted in radians as soon as they are read from a configuration file).
You can use "subdirectories" in the property names, in order to have a more readable repository. Some widely used "subdirectories" of the modules are:
For consistency, the following is important also if you want to use your own coding style in your project. All properties in the repository must have a name that:
So these are legal names:
These are not:
OpenRDK reference system
In the following picture, you can see how the world reference system and the image that represents a metric grid map (
A map-image, in OpenRDK is an image (i.e., a grid of pixels), referenced in the world. In particular, the
Finally, look at how the x and y coordinates of the world and of the image increase and decrease with respect to each other: when world x increases, the pixel x coordinate (also called "column" in a matrix) also increases, when world y increases, the pixel y coordinate (also called "row" in a matrix) decreases.
Objects passed by pointer
Inside many functions, objects passed by a pointer. The convention is that if the pointer is passed to constant object, the objetct property keeps remaining to the caller (and it could not be differently). Though, if the pointer is not to a constant object, the object's ownership passes always to the called function.
void Session::queuePush(CUrl url, RDK2::Object* obj);
in this case, whichever object inserted in the queue will become property of the queue (that is: you should not delete that object nor keeping the pointer).
Passing pointers to