master board program  v. 2 - 2018
/home/krtko/robocup_2018/robocup_2018/lines.c File Reference
#include "lines.h"
+ Include dependency graph for lines.c:

Macros

#define PI   3.14159
 
#define SQRT3   1.7321
 

Functions

int32_t abs_int (int32_t x)
 
int32_t max (int32_t x, int32_t y)
 
void calculation_of_motor_speeds (void)
 
void determine_avoiding_direction (void)
 
void calibrate_lines (void)
 
void end_line_calibration (void)
 
msg_t check_line_mailbox (void)
 
void send_to_line_mailbox (msg_t sending_command)
 
 THD_WORKING_AREA (waLineThread, 128)
 
 THD_FUNCTION (LineThread, arg)
 
msg_t check_line (void)
 
msg_t calibration_memory (msg_t command)
 
 THD_WORKING_AREA (waLineSaveThread, 128)
 
 THD_FUNCTION (LineSaveThread, arg)
 
 THD_WORKING_AREA (waLineCalibrationSaveThread, 128)
 
 THD_FUNCTION (LineCalibrationSaveThread, arg)
 
void line_init (void)
 

Variables

thread_t * line_save_thread
 
thread_t * line_calibration_save_thread
 
msg_t msg
 
static msg_t line_commands_queue [LINE_QUEUE]
 
static mailbox_t line_commands
 
adcsample_t line_sensors_values [NUMBER_OF_SENSORS]
 
uint16_t min_line_sensors_values [NUMBER_OF_SENSORS]
 
uint16_t max_line_sensors_values [NUMBER_OF_SENSORS]
 
uint16_t average_line_sensors_values [NUMBER_OF_SENSORS]
 
uint8_t line_calibration_values_out [NUMBER_OF_SENSORS]
 
uint8_t line_calibration_values_in [NUMBER_OF_SENSORS]
 
int32_t line_motor_speeds [NUMBER_OF_MOTORS]
 
static int16_t dx [16] = {83, 56, 20, -20, -56, -83, -98, -98, -83, -56, -20, 20, 56, 83, 98, 98}
 
static int16_t dy [16] = {56, 83, 98, 98, 83, 56, 20, -20, -56, -83, -98, -98, -83, -56, -20, 20}
 
static int16_t line_result
 
static int16_t old_line_result = NO_LINE_DETECTED
 
static int32_t res_x
 
static int32_t res_y
 
static int32_t res_max
 
static int32_t old_x
 
static int32_t old_y
 
static int32_t old_max
 
uint32_t line_timer = LINE_REACTION_TIME
 
uint32_t line_calibration_timer = LINE_CALIBRATION_TIME
 
int8_t line_calibration_state = 0
 
static const ADCConversionGroup line_sensors_cfg1
 
static const ADCConversionGroup line_sensors_cfg2
 
static const ADCConversionGroup line_sensors_cfg3
 
static const ADCConversionGroup line_sensors_cfg
 

Macro Definition Documentation

#define PI   3.14159
#define SQRT3   1.7321

Function Documentation

int32_t abs_int ( int32_t  x)

+ Here is the caller graph for this function:

void calculation_of_motor_speeds ( void  )

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void calibrate_lines ( void  )

+ Here is the caller graph for this function:

msg_t calibration_memory ( msg_t  command)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

msg_t check_line ( void  )

+ Here is the caller graph for this function:

msg_t check_line_mailbox ( void  )

+ Here is the caller graph for this function:

void determine_avoiding_direction ( void  )

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void end_line_calibration ( void  )

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void line_init ( void  )

+ Here is the caller graph for this function:

int32_t max ( int32_t  x,
int32_t  y 
)

+ Here is the caller graph for this function:

void send_to_line_mailbox ( msg_t  sending_command)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

THD_FUNCTION ( LineThread  ,
arg   
)

+ Here is the call graph for this function:

THD_FUNCTION ( LineSaveThread  ,
arg   
)

+ Here is the call graph for this function:

THD_FUNCTION ( LineCalibrationSaveThread  ,
arg   
)
THD_WORKING_AREA ( waLineThread  ,
128   
)

+ Here is the caller graph for this function:

THD_WORKING_AREA ( waLineSaveThread  ,
128   
)
THD_WORKING_AREA ( waLineCalibrationSaveThread  ,
128   
)

Variable Documentation

uint16_t average_line_sensors_values[NUMBER_OF_SENSORS]
int16_t dx[16] = {83, 56, 20, -20, -56, -83, -98, -98, -83, -56, -20, 20, 56, 83, 98, 98}
static
int16_t dy[16] = {56, 83, 98, 98, 83, 56, 20, -20, -56, -83, -98, -98, -83, -56, -20, 20}
static
thread_t* line_calibration_save_thread
int8_t line_calibration_state = 0
uint32_t line_calibration_timer = LINE_CALIBRATION_TIME
uint8_t line_calibration_values_in[NUMBER_OF_SENSORS]
uint8_t line_calibration_values_out[NUMBER_OF_SENSORS]
mailbox_t line_commands
static
msg_t line_commands_queue[LINE_QUEUE]
static
int32_t line_motor_speeds[NUMBER_OF_MOTORS]
int16_t line_result
static
thread_t* line_save_thread
const ADCConversionGroup line_sensors_cfg
static
Initial value:
= {
FALSE,
NULL,
NULL,
0,
ADC_CR2_SWSTART,
ADC_SMPR1_SMP_AN10(ADC_SAMPLE_3) | ADC_SMPR1_SMP_AN11(ADC_SAMPLE_3) |
ADC_SMPR1_SMP_AN12(ADC_SAMPLE_3) | ADC_SMPR1_SMP_AN13(ADC_SAMPLE_3) |
ADC_SMPR1_SMP_AN14(ADC_SAMPLE_3) | ADC_SMPR1_SMP_AN15(ADC_SAMPLE_3),
ADC_SMPR2_SMP_AN0(ADC_SAMPLE_3) | ADC_SMPR2_SMP_AN1(ADC_SAMPLE_3) |
ADC_SMPR2_SMP_AN2(ADC_SAMPLE_3) | ADC_SMPR2_SMP_AN3(ADC_SAMPLE_3) |
ADC_SMPR2_SMP_AN4(ADC_SAMPLE_3) | ADC_SMPR2_SMP_AN5(ADC_SAMPLE_3) |
ADC_SMPR2_SMP_AN6(ADC_SAMPLE_3) | ADC_SMPR2_SMP_AN7(ADC_SAMPLE_3) |
ADC_SMPR2_SMP_AN8(ADC_SAMPLE_3) | ADC_SMPR2_SMP_AN9(ADC_SAMPLE_3),
ADC_SQR1_SQ13_N(ADC_CHANNEL_IN11) | ADC_SQR1_SQ14_N(ADC_CHANNEL_IN12) |
ADC_SQR1_SQ15_N(ADC_CHANNEL_IN13) | ADC_SQR1_SQ16_N(ADC_CHANNEL_IN0) |
ADC_SQR1_NUM_CH(NUMBER_OF_SENSORS),
ADC_SQR2_SQ7_N(ADC_CHANNEL_IN7) | ADC_SQR2_SQ8_N(ADC_CHANNEL_IN14) |
ADC_SQR2_SQ9_N(ADC_CHANNEL_IN15) | ADC_SQR2_SQ10_N(ADC_CHANNEL_IN8) |
ADC_SQR2_SQ11_N(ADC_CHANNEL_IN9) | ADC_SQR2_SQ12_N(ADC_CHANNEL_IN10),
ADC_SQR3_SQ1_N(ADC_CHANNEL_IN1) | ADC_SQR3_SQ2_N(ADC_CHANNEL_IN2) |
ADC_SQR3_SQ3_N(ADC_CHANNEL_IN3) | ADC_SQR3_SQ4_N(ADC_CHANNEL_IN4) |
ADC_SQR3_SQ5_N(ADC_CHANNEL_IN5) | ADC_SQR3_SQ6_N(ADC_CHANNEL_IN6)
}
#define NUMBER_OF_SENSORS
Definition: lines.h:11
const ADCConversionGroup line_sensors_cfg1
static
Initial value:
= {
TRUE,
6,
NULL,
NULL,
0,
ADC_CR2_SWSTART,
0,
ADC_SMPR2_SMP_AN1(ADC_SAMPLE_3) | ADC_SMPR2_SMP_AN2(ADC_SAMPLE_3) |
ADC_SMPR2_SMP_AN3(ADC_SAMPLE_3) | ADC_SMPR2_SMP_AN4(ADC_SAMPLE_3) |
ADC_SMPR2_SMP_AN5(ADC_SAMPLE_3) | ADC_SMPR2_SMP_AN6(ADC_SAMPLE_3),
ADC_SQR1_NUM_CH(6),
0,
ADC_SQR3_SQ1_N(ADC_CHANNEL_IN1) | ADC_SQR3_SQ2_N(ADC_CHANNEL_IN2) |
ADC_SQR3_SQ3_N(ADC_CHANNEL_IN3) | ADC_SQR3_SQ4_N(ADC_CHANNEL_IN4) |
ADC_SQR3_SQ5_N(ADC_CHANNEL_IN5) | ADC_SQR3_SQ6_N(ADC_CHANNEL_IN6)
}
const ADCConversionGroup line_sensors_cfg2
static
Initial value:
= {
TRUE,
5,
NULL,
NULL,
0,
ADC_CR2_SWSTART,
ADC_SMPR1_SMP_AN14(ADC_SAMPLE_3) | ADC_SMPR1_SMP_AN15(ADC_SAMPLE_3),
ADC_SMPR2_SMP_AN7(ADC_SAMPLE_3) | ADC_SMPR2_SMP_AN8(ADC_SAMPLE_3) |
ADC_SMPR2_SMP_AN9(ADC_SAMPLE_3),
ADC_SQR1_NUM_CH(5),
0,
ADC_SQR3_SQ1_N(ADC_CHANNEL_IN7) | ADC_SQR3_SQ2_N(ADC_CHANNEL_IN14) |
ADC_SQR3_SQ3_N(ADC_CHANNEL_IN15) | ADC_SQR3_SQ4_N(ADC_CHANNEL_IN8) |
}
const ADCConversionGroup line_sensors_cfg3
static
Initial value:
= {
TRUE,
5,
NULL,
NULL,
0,
ADC_CR2_SWSTART,
ADC_SMPR1_SMP_AN10(ADC_SAMPLE_3) | ADC_SMPR1_SMP_AN11(ADC_SAMPLE_3) |
ADC_SMPR1_SMP_AN12(ADC_SAMPLE_3) | ADC_SMPR1_SMP_AN13(ADC_SAMPLE_3),
ADC_SMPR2_SMP_AN0(ADC_SAMPLE_3),
ADC_SQR1_NUM_CH(5),
0,
ADC_SQR3_SQ1_N(ADC_CHANNEL_IN10) | ADC_SQR3_SQ2_N(ADC_CHANNEL_IN11) |
ADC_SQR3_SQ3_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ4_N(ADC_CHANNEL_IN13) |
}
adcsample_t line_sensors_values[NUMBER_OF_SENSORS]
uint32_t line_timer = LINE_REACTION_TIME
uint16_t max_line_sensors_values[NUMBER_OF_SENSORS]
uint16_t min_line_sensors_values[NUMBER_OF_SENSORS]
msg_t msg
int16_t old_line_result = NO_LINE_DETECTED
static
int32_t old_max
static
int32_t old_x
static
int32_t old_y
static
int32_t res_max
static
int32_t res_x
static
int32_t res_y
static