ISR UC / ISR_Mini-explorer

Energy harvesting mobile robot. Developed at Institute of Systems and Robotics — University of Coimbra.

Dependents:   Mapping VirtualForces_debug OneFileToRuleThemAll VirtualForces_with_class ... more

Embed: (wiki syntax)

« Back to documentation index

robot.h File Reference

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.
void config_init_nrf ()
 Initializes the NRF24 module for comunication.
double receiveValue (void)
 Receives a number from the Arduino.
void sendValue (long int Value)
 Sends a number to the Arduino.
void sendMatrix (int(*matrix)[18], int row, int column)
 Sends matrix to arduino.
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

void config_init_nrf (  )

Initializes the NRF24 module for comunication.

Note: if the module is broken or badly connected this init will cause the code to stop, if all these messages don't appear thats the case

Definition at line 504 of file robot.h.

static unsigned int get_distance_front_sensor (  ) [static]

Returns front sensor value.

Definition at line 798 of file robot.h.

static unsigned int get_distance_left_sensor (  ) [static]

Returns left sensor value.

Definition at line 769 of file robot.h.

static unsigned int get_distance_right_sensor (  ) [static]

Returns right sensor value.

Definition at line 826 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 345 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 317 of file robot.h.

void init_robot_pins (  )

Initializes the necessary robot pins.

Definition at line 904 of file robot.h.

void initEncoders (  )

Set the initial position for the "incremental" enconder and "starts" them.

Definition at line 387 of file robot.h.

void initRobot ( void   )

Initializes all the pins and all the modules necessary.

Definition at line 971 of file robot.h.

long int L_encoder (  )

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 412 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 183 of file robot.h.

void Odometria (  )

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 1002 of file robot.h.

long int R_encoder (  )

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 400 of file robot.h.

long int read16_mcp3424 ( char  addr )

Reads adc of the battery.

Parameters:
addr- Address to read
Returns:
The voltage of the batery

Definition at line 430 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 159 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 267 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 292 of file robot.h.

double receiveValue ( void   )

Receives a number from the Arduino.

Returns:
The value send by the arduino

Definition at line 528 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 224 of file robot.h.

void sendMatrix ( int(*)  matrix[18],
int  row,
int  column 
)

Sends matrix to arduino.

Parameters:
matrix- Matrix of numbers to send [0..255]
row- Number of rows
column- Number of columns

Definition at line 624 of file robot.h.

void sendValue ( long int  Value )

Sends a number to the Arduino.

Parameters:
Value- number to be sent to the Arduino

Definition at line 557 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 135 of file robot.h.

void timer_event (  )

Calculate the value of both encoder "incremental" every 10 ms.

Definition at line 371 of file robot.h.

float value_of_Batery (  )

Reads adc of the battery.

Returns:
The voltage of the batery

Definition at line 478 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 448 of file robot.h.