Fork of
ISR_Mini-explorer
by ISR UC
« Back to documentation index
robot.h File Reference
Go to the source code of this file.
Functions
void Odometria ()
Updates the position and orientation of the robot based on the data from the encoders.
void tca9548_select_ch (char ch)
Selects the wich infrared to comunicate.
long int read_Infrared (char ch)
Get ADC value of the chosen infrared.
void leftMotor (short int Dir, short int Speed)
Sets speed and direction of the left motor.
void rightMotor (short int Dir, short int Speed)
Sets speed and direction of the right motor.
long int read_L_encoder ()
Reads Position of left magnetic encoder.
long int read_R_encoder ()
Reads Position of right magnetic encoder.
long int incremental_R_encoder ()
Calculates and returns the value of the right "incremental" encoder.
long int incremental_L_encoder ()
Calculates and returns the value of the left "incremental" encoder.
void timer_event ()
Calculate the value of both encoder "incremental" every 10 ms.
void initEncoders ()
Set the initial position for the "incremental" enconder and "starts" them.
long int R_encoder ()
Returns to the user the value of the right "incremental" encoder.
long int L_encoder ()
Returns to the user the value of the right "incremental" encoder.
long int read16_mcp3424 (char addr)
Reads adc of the battery.
void write_mcp3424 (int n_bits, int ch, int gain, char addr)
Reads adc of the battery.
float value_of_Batery ()
Reads adc of the battery.
static unsigned int get_distance_left_sensor ()
Returns left sensor value.
static unsigned int get_distance_front_sensor ()
Returns front sensor value.
static unsigned int get_distance_right_sensor ()
Returns right sensor value.
void init_robot_pins ()
Initializes the necessary robot pins.
void initRobot (void)
Initializes all the pins and all the modules necessary.
Detailed Description
Definition in file robot.h .
Function Documentation
static unsigned int get_distance_front_sensor
(
)
[static]
Returns front sensor value.
Definition at line 625 of file robot.h .
static unsigned int get_distance_left_sensor
(
)
[static]
Returns left sensor value.
Definition at line 596 of file robot.h .
static unsigned int get_distance_right_sensor
(
)
[static]
Returns right sensor value.
Definition at line 653 of file robot.h .
long int incremental_L_encoder
(
)
Calculates and returns the value of the left "incremental" encoder.
Returns: The value of "tics" of the left encoder since it was initialized
Definition at line 344 of file robot.h .
long int incremental_R_encoder
(
)
Calculates and returns the value of the right "incremental" encoder.
Returns: The value of "tics" of the right encoder since it was initialized
Definition at line 316 of file robot.h .
Initializes the necessary robot pins.
Definition at line 731 of file robot.h .
Set the initial position for the "incremental" enconder and "starts" them.
Definition at line 386 of file robot.h .
Initializes all the pins and all the modules necessary.
Definition at line 798 of file robot.h .
Returns to the user the value of the right "incremental" encoder.
Returns: The value of "tics" of the right encoder since it was initialized
Definition at line 411 of file robot.h .
void leftMotor
(
short int
Dir ,
short int
Speed
)
Sets speed and direction of the left motor.
Parameters:
Dir - Direction of movement, 0 for back, or 1 for fron
Speed - Percentage of speed of the motor (1..100)
Note: Because of differences in the motors they need to be calibrated, test the robot going front and back at different speeds and see if it makes a straigth line
Definition at line 182 of file robot.h .
Updates the position and orientation of the robot based on the data from the encoders.
Note: Needs to be calibrated for each robot, in this case the radius of the whells is 3.55 and the distance between them is 7.4
Definition at line 829 of file robot.h .
Returns to the user the value of the right "incremental" encoder.
Returns: The value of "tics" of the right encoder since it was initialized
Definition at line 399 of file robot.h .
long int read16_mcp3424
(
char
addr )
Reads adc of the battery.
Parameters:
Returns: The voltage of the batery
Definition at line 429 of file robot.h .
long int read_Infrared
(
char
ch )
Get ADC value of the chosen infrared.
Parameters:
ch - Infrared to read (1..5)
Note: for the values of ch it reads (0-right, ... ,4-left, 5-back)
Definition at line 158 of file robot.h .
long int read_L_encoder
(
)
Reads Position of left magnetic encoder.
Returns: The absolute position of the left wheel encoder (0..4095)
Definition at line 266 of file robot.h .
long int read_R_encoder
(
)
Reads Position of right magnetic encoder.
Returns: The absolute position of the right wheel encoder (0..4095)
Definition at line 291 of file robot.h .
void rightMotor
(
short int
Dir ,
short int
Speed
)
Sets speed and direction of the right motor.
Parameters:
Dir - Direction of movement, 0 for back, or 1 for fron
Speed - Percentage of speed of the motor (1..100)
Note: Because of differences in the motors they need to be calibrated, test the robot going front and back at different speeds and see if it makes a straigth line
Definition at line 223 of file robot.h .
void tca9548_select_ch
(
char
ch )
Selects the wich infrared to comunicate.
Parameters:
ch - Infrared to read (1..5)
Definition at line 134 of file robot.h .
Calculate the value of both encoder "incremental" every 10 ms.
Definition at line 370 of file robot.h .
float value_of_Batery
(
)
Reads adc of the battery.
Returns: The voltage of the batery
Definition at line 477 of file robot.h .
void write_mcp3424
(
int
n_bits ,
int
ch ,
int
gain ,
char
addr
)
Reads adc of the battery.
Parameters:
n_bits - Resolution of measure
ch - Chose value to read, if voltage or current of solar or batery
gain -
addr - Address to write to
Definition at line 447 of file robot.h .