Psi Swarm Code V0.41 [With Beautiful Meme program]

Dependencies:   PsiSwarmLibrary mbed

Fork of BeautifulMemeProjectBT by Alan Millard

Committer:
jah128
Date:
Tue Mar 15 00:58:43 2016 +0000
Revision:
30:513457c1ad12
Added serial handling for Psi Console

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jah128 30:513457c1ad12 1 /// PsiSwarm Beautiful Meme Project Source Code
jah128 30:513457c1ad12 2 /// Version 0.41
jah128 30:513457c1ad12 3 /// James Hilder, Alan Millard, Homero Elizondo, Jon Timmis
jah128 30:513457c1ad12 4 /// University of York
jah128 30:513457c1ad12 5
jah128 30:513457c1ad12 6
jah128 30:513457c1ad12 7 #ifndef BMEME_H
jah128 30:513457c1ad12 8 #define BMEME_H
jah128 30:513457c1ad12 9
jah128 30:513457c1ad12 10 #include "main.h"
jah128 30:513457c1ad12 11 #include "beacon.h"
jah128 30:513457c1ad12 12 #include "programs.h"
jah128 30:513457c1ad12 13 #include "vector.h"
jah128 30:513457c1ad12 14 #include <math.h>
jah128 30:513457c1ad12 15
jah128 30:513457c1ad12 16 // Define the on-period for a IR pulse in microseconds (eg 50000 for 2Hz system, 25000 for a 4Hz system or 20000 for a 5Hz system)
jah128 30:513457c1ad12 17 #define BEACON_PERIOD 25000
jah128 30:513457c1ad12 18
jah128 30:513457c1ad12 19
jah128 30:513457c1ad12 20 // Define the on-period for a IR pulse in microseconds (eg 50000 for 2Hz system, 25000 for a 4Hz system or 20000 for a 5Hz system)
jah128 30:513457c1ad12 21 #define BEACON_PERIOD 25000
jah128 30:513457c1ad12 22
jah128 30:513457c1ad12 23 extern char beacon_found; // This will be a 1 if beacon is detected, 0 if it isn't
jah128 30:513457c1ad12 24 extern int beacon_heading; // The heading from the last time the beacon was detected
jah128 30:513457c1ad12 25 extern char robots_found[8]; // These will be a 1 when the respective robot [excluding self] was detected during the previous 500ms window
jah128 30:513457c1ad12 26 extern int robots_heading[8]; // These are the headings from the last time the respective robots were detected
jah128 30:513457c1ad12 27 extern unsigned short robots_distance[8]; // This is the maximum sensor value from the last time the respective robot was detected
jah128 30:513457c1ad12 28 extern unsigned short reflected_sensor_data[8]; // The reflected IR values when this robots emitters are on
jah128 30:513457c1ad12 29 extern unsigned short background_sensor_data[8];// The raw IR values when no robot (or beacon) should have its IR on
jah128 30:513457c1ad12 30 extern char disable_ir_emitters;
jah128 30:513457c1ad12 31 extern char step_cycle;
jah128 30:513457c1ad12 32 extern char target_reached;
jah128 30:513457c1ad12 33 extern char recharging_state;
jah128 30:513457c1ad12 34 extern char prog_name [17];
jah128 30:513457c1ad12 35 extern char prog_info [17];
jah128 30:513457c1ad12 36 extern char main_program_state;
jah128 30:513457c1ad12 37 extern char program_changed;
jah128 30:513457c1ad12 38 extern char program_run_init;
jah128 30:513457c1ad12 39 extern float battery_low_threshold;
jah128 30:513457c1ad12 40 extern float battery_high_threshold;
jah128 30:513457c1ad12 41 extern int flocking_headings[8];
jah128 30:513457c1ad12 42
jah128 30:513457c1ad12 43 char * get_program_name(int index);
jah128 30:513457c1ad12 44 void set_program(int index);
jah128 30:513457c1ad12 45 void set_program_info(char * info);
jah128 30:513457c1ad12 46
jah128 30:513457c1ad12 47 void update_display(void);
jah128 30:513457c1ad12 48 void display_debug_info(void);
jah128 30:513457c1ad12 49
jah128 30:513457c1ad12 50 void bmeme_user_code_setup(void);
jah128 30:513457c1ad12 51 void bmeme_user_code_loop(void);
jah128 30:513457c1ad12 52 void bmeme_handle_switch_event(char switch_state);
jah128 30:513457c1ad12 53 void bmeme_handle_user_serial_message(char * message, char length, char interface);
jah128 30:513457c1ad12 54
jah128 30:513457c1ad12 55 void display_ir_readings(void);
jah128 30:513457c1ad12 56 void out(const char* format, ...) ;
jah128 30:513457c1ad12 57
jah128 30:513457c1ad12 58 #endif