![]() |
embedded system library for e-puck
1.0.1
A redesigned API library for the e-puck robot platform
|
#include "el_common.h"
Go to the source code of this file.
Data Structures | |
struct | el_stepper_motor_param |
Macros | |
#define | EL_STEPPER_MOTOR_RATE_MAX 1000 |
#define | EL_STEPPER_MOTOR_RATE_MIN 50 |
#define | EL_STEPPER_MOTOR_LEFT 0 |
#define | EL_STEPPER_MOTOR_RIGHT 1 |
#define | EL_EPUCK_FULL_REVOLUTION_STEPS 2512 |
Functions | |
void | el_enable_stepper_motor (void) |
enable the stepper motor module | |
void | el_disable_stepper_motor (void) |
disable the stepper motor module | |
el_stepper_motor_param * | el_stepper_motor_options () |
get the pointer to a static instance of el_stepper_motor_param More... | |
void | el_stepper_motor_options_apply () |
apply the settings stored in el_stepper_motor_options directly More... | |
void | el_stepper_motor_options_reset () |
reset the settings stored in el_stepper_motor_options to default More... | |
void | el_config_stepper_motor (const el_stepper_motor_param *p) |
apply the settings in the given structure More... | |
void | el_stepper_motor_set_speed (el_index i, int u) |
set the stepping rate and direction of a motor More... | |
el_int16 | el_stepper_motor_get_steps (el_index i) |
get the step counter of a motor More... | |
void | el_stepper_motor_set_steps (el_index i, el_int16 n) |
set the step counter of a motor More... | |
void | el_set_wheel_speed (int left, int right) |
change the rotation speed for both of the motors on the e-puck More... | |
el_stepper_motor_param* el_stepper_motor_options | ( | ) |
get the pointer to a static instance of el_stepper_motor_param
void el_stepper_motor_options_apply | ( | ) |
apply the settings stored in el_stepper_motor_options directly
This function is equivalent to "el_config_stepper_motor( el_stepper_motor_options() )".
void el_stepper_motor_options_reset | ( | ) |
reset the settings stored in el_stepper_motor_options to default
This function can be used in combination with el_stepper_motor_options_apply when the default configuration need to be used.
void el_config_stepper_motor | ( | const el_stepper_motor_param * | p | ) |
apply the settings in the given structure
p | pointer to the data structure containing all parameters |
Currently, the parameters are mainly related to the artificial acceleration of the stepper motors, which are typically used to make the motion of the robot more smooth.
For example, the following code enables a linear artificial acceleration with a rate of 2000:
A linear acceleration rate of 2000 means the stepping rate of the motors can reach 1000 from 0 in 0.5 sec. By default, the artificial acceleration is enabled and the acceleration rate is 3000.
void el_stepper_motor_set_speed | ( | el_index | i, |
int | u | ||
) |
set the stepping rate and direction of a motor
i | index of the motor |
u | stepping rate of the motor |
The valid range of the stepping speed is in [-1000,-50] and [50,1000]. This function does handle the range issue internally.
el_int16 el_stepper_motor_get_steps | ( | el_index | i | ) |
get the step counter of a motor
i | index of the motor |
Note: negative motor speeds contribute negative number of steps.
void el_stepper_motor_set_steps | ( | el_index | i, |
el_int16 | n | ||
) |
set the step counter of a motor
i | index of the motor |
u | number of steps |
void el_set_wheel_speed | ( | int | left, |
int | right | ||
) |
change the rotation speed for both of the motors on the e-puck
left | left motor speed |
right | right motor speed |
This function does virtually the same thing as el_stepper_motor_set_speed in just one line.