Project

General

Profile

Revision 1200

Smart run around produces more of a wall-following behavior at
this point. Rangefinder readings are clearly not in cm. I have assumed that they
give the distance in mm but 50 mm too large. I don't think this is correct,
but the robot does not crash, so I left. The states do what they are
supposed and, for the most part, get triggered when they are supposed. The
forward state does not work (it just stops) if the speed is HALF_SPD rather
than FULL_SPD.

View differences:

smart_run_around_fsm.h
12 12
#define RIGHT 2	// drive forward and to the right
13 13
#define SPIN 3	// turn without traveling (last resort if otherwise stuck)
14 14

  
15
/* conditions on rangefinders (in cm) informing state changes
15
/* conditions on rangefinders (in mm) informing state changes
16
 * distances are 50 greater than in real life, cannot be smaller than 100
16 17
 * naming format: SENSOR_URGENCY
17 18
 * changing these constants affects robot operation
18 19
 */
19
#define IR2_DANGER 5	// dangerously close to front
20
#define IR13_DANGER 10  // dangerously close to sides (looking ahead)
21
#define IR2_INTEREST 15	// notably close to front
22
#define IR45_DANGER 5	// dangerously close to sides (looking sideways)
20
#define IR2_DANGER 150	// 10 cm: dangerously close to front
21
#define IR13_DANGER 200 // 15 cm: dangerously close to sides (looking ahead)
22
#define IR2_INTEREST 300    // 25 cm: notably close to front
23
#define IR45_DANGER 150	// dangerously close to side (looking sideways)
23 24

  
24 25
uint8_t state;	// current state of FSM: FORWARD, LEFT, RIGHT, SPIN
25 26
int16_t d1, d2, d3, d4, d5; // values returned by rangefinders

Also available in: Unified diff