embedded system library for e-puck  1.0.1
A redesigned API library for the e-puck robot platform
 All Data Structures Files Functions Variables Enumerations Enumerator Modules Pages
Files
Basic Concepts

Introducing some commonly used new variable types in this library. More...

Files

file  el_clock.h
 
file  el_common.h
 

Detailed Description

Introducing some commonly used new variable types in this library.

New Variable Types

'el_handle' (reference of an internal object)

This is the handle type to be used in this library for referring dynamically created objects. A 'handle' is similar to a pointer to an object, which are generally used to refer to some object. However, a handle does not include any information about structure of the object. Thus, a handle can only be used to refer to an object but not access the data inside the object. All operations towards such type of object need to be achieved by its related functions.

'el_time' (a time duration in millisecond)

Any function argument uses 'el_time' as its type means that the argument is a time duration that given by a integer millisecond.

In this library, the other way to pass a time to a timing related function is to give the fraction form. In that case, the unit is always second (See el_process_wait_fraction for example).

'el_index' (component index)

A variable of this type is typically used to refer to a hardware component. Regardless of the physical arrangement in the circuit, the indices of the components in the same module is made to be in serial and always start from 0, for example, 0 for left stepper motor and 1 for right stepper motor. Typically, macros are defined to assign a readable tag to the indices, for example, "EL_LED_RING_2" and "EL_LED_RING_3".

'el_index' is a signed type in which a negative value typically has specific meaning. For example, for the led module, -1 ("EL_LED_RING_ALL") means all leds on the ring of the e-puck.

Masterclock and Timing

Masterclock of the system is an incremental timer that keeps increasing after the system is initialized. In each real time second, Masterclock will be increased by 144000. Masterclock is mainly used to calculate the interval between two time points.

Any time stored in the system is interpreted as a integer times of the materclock unit (1/144000 sec). Therefore, masterclock determines the precision of time stored in the system. For instance, 1/60 sec and 1/1000 sec can both be stored as a integer without any loss as 2400 and 144 correspondingly. Whereas, the integer interpretation of 1/70 sec (about 14.2857142 ms) will be rounded to 2057, which causes the actual time stored in the system become 14.2847222 ms. This applies to all timing related functions such as el_timer_start or el_process_wait.