Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BeautifulMemeProject by
Diff: programs.cpp
- Revision:
- 11:7b3ee540ba56
- Parent:
- 10:1b09d4bb847b
- Child:
- 12:daa53285b6e4
--- a/programs.cpp Mon Oct 26 23:58:08 2015 +0000
+++ b/programs.cpp Tue Oct 27 00:13:49 2015 +0000
@@ -1,26 +1,15 @@
/// PsiSwarm Beautiful Meme Project Source Code
-/// Version 0.1
+/// Version 0.2
/// James Hilder, Alan Millard, Homero Elizondo, Jon Timmis
/// University of York
-// Programs.cpp - Various PsiSwarm Programs for Beautiful Meme Project
+// programs.cpp - Various PsiSwarm Programs for Beautiful Meme Project
#include "main.h"
-float battery_low_threshold = 3.63; // Threshold at which to interrupt program and start recharging routine: suggest 3.55
-float battery_high_threshold = 3.97; // Threshold at which to end battery recharging routine and resume normal program: suggest 4.0
-
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// head_to_bearing_program
char was_turning = 0;
-enum random_walk_state {random_walk, turn_towards, interact, turn_away, avoid_obstacle};
-enum random_walk_state internal_state = random_walk;
-char action_timeout = 0;
-char interaction_timeout = 0;
-char random_walk_timeout = 0;
-float previous_left_motor_speed = 0.5;
-float previous_right_motor_speed = 0.5;
-int obstacle_avoidance_threshold = 300;
-char recharge_power_check_count = 0;
-char battery_low_count = 0;
///The head to bearing program moves towards a given bearing (eg 0 for the beacon or 180 for the opposite wall) and keeps going until an obstacle is detected in front of it
void head_to_bearing_program(int target_bearing)
@@ -67,7 +56,15 @@
}
}
-/// Recharging program
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// recharging_program
+
+char recharge_power_check_count = 0;
+char battery_low_count = 0;
+
void recharging_program()
{
switch(recharging_state) {
@@ -170,7 +167,21 @@
}
}
-///Alan's Random Walk\Obstacle Avoid and Robot Interaction Program
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// curved_walk_with_interaction_program (Alan's Random Walk\Obstacle Avoid and Robot Interaction Program)
+
+enum random_walk_state {random_walk, turn_towards, interact, turn_away, avoid_obstacle};
+enum random_walk_state internal_state = random_walk;
+char action_timeout = 0;
+char interaction_timeout = 0;
+char random_walk_timeout = 0;
+float previous_left_motor_speed = 0.5;
+float previous_right_motor_speed = 0.5;
+int obstacle_avoidance_threshold = 300;
+
void curved_random_walk_with_interaction_program()
{
if(internal_state == random_walk) {
@@ -291,12 +302,24 @@
}
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// straight_random_walk_with_interaction_program
+
void straight_random_walk_with_interaction_program()
{
}
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// find_space_program
+
void find_space_program()
{
