Quote:
|
Originally Posted by Phil Roth
I'm trying to fully understand the code and working with the External ISRs first. It seems their sole purpose is to measure the amount of time of the active low pulse, categorize it as beacon 1 or 2, and then update Sensor_Stats[0].Beacon_Count[n] accordingly. Beacon 0 pulses every 1 MS and Beacon 2 pulses every 2 MS.
|
Actually, the beacon 0 pulse width is 1ms, the beacon 1 pulse width is 2ms. The beacon flashes every 10ms for a beacon rate of 100Hz.
Quote:
|
Originally Posted by Phil Roth
SO:
SENSOR #1
Sensor_Stats[0].Beacon_Count[0] increments a running count of pulses from beacon 1
Sensor_Stats[0].Beacon_Count[1] increments a running count of pulses from beacon 2
SENSOR #2
Sensor_Stats[1].Beacon_Count[0] increments a running count of pulses from beacon 1
Sensor_Stats[1].Beacon_Count[1] increments a running count of pulses from beacon 2
SENSOR #3
Sensor_Stats[2].Beacon_Count[0] increments a running count of pulses from beacon 1
Sensor_Stats[2].Beacon_Count[1] increments a running count of pulses from beacon 2
SENSOR #4
Sensor_Stats[3].Beacon_Count[0] increments a running count of pulses from beacon 1
Sensor_Stats[3].Beacon_Count[1] increments a running count of pulses from beacon 2
Ideally counts for beacon #1 should be incremented 26 times for beacon 1 and 13 times for beacon 2 when the Timer_1_Int_handler runs
Every 26.2MS, Timer_1_int_handler subtracts the "last" running count of pulses from the "new" running count of pulses to determine the number of pulses that occured over the last 26.2MS perion.
|
As the beacon rate is 100Hz (=10ms), the counts for both beacon types will increment by 2 or 3 everytime the timer_1_int_handler executes.
Quote:
|
Originally Posted by Phil Roth
SO:
Sensor_Stats[0].Beacon_Quality[0] = Number of pulses that sensor #1 received from beacon 1 that occurred during the last 26.2 MS
Sensor_Stats[0].Beacon_Quality[1] = Number of pulses that sensor #1 received from beacon 2 that occurred during the last 26.2 MS
Sensor_Stats[1].Beacon_Quality[0] = Number of pulses that sensor #2 received from beacon 1 that occurred during the last 26.2 MS
Sensor_Stats[1]Beacon_Quality[1] = Number of pulses that sensor #2 received from beacon 2 that occurred during the last 26.2 MS
Sensor_Stats[2].Beacon_Quality[0] = Number of pulses that sensor #3 received from beacon 1 that occurred during the last 26.2 MS
Sensor_Stats[2].Beacon_Quality[1] = Number of pulses that sensor #3 received from beacon 2 that occurred during the last 26.2 MS
Sensor_Stats[3].Beacon_Quality[0] = Number of pulses that sensor #4 received from beacon 1 that occurred during the last 26.2 MS
Sensor_Stats[3].Beacon_Quality[1] = Number of pulses that sensor #4 received from beacon 2 that occurred during the last 26.2 MS
End result is:
The values held in the element Beacon.Quality[n] are the number of pulses from each sensor that occurr every 26.2MS where n = beacon #1 or #2. These values are updated every 26.2MS
|
Yes, this is correct except the beacons are #0 and #1
Quote:
|
Originally Posted by Phil Roth
There are 4 sensors index by Sensor_Stats[n]
where n = of of 4 sensors
|
Yes, with index values of 0-3. How the individual sensors map to loacations on the tracker assembly is noted at the top of tracker.c
Quote:
|
Originally Posted by Phil Roth
Ideally Beacon.Quality[n] should be contain 26 for beacon #1 and 13 for beacon #2.
|
No, ...Beacon.Quality[n] should contain 2 or 3 when the beacon is in view. The algorithm in tracker.c assumes the beacon is in view of that particular sensors "quality" is greater than 0.
Quote:
|
Originally Posted by Phil Roth
Is this basically what's happenning in receiver.c ??
|
Yes, you have a very good grasp of how it works
Quote:
|
Originally Posted by Phil Roth
Sorry to be so "anal" but I like to fully understand how the code works in order to understand the entire system and move on to understanding tracker.c and then navigate.c where the rubber meets the road.
|
No problem at all. This is a great discussion that other folks can hopefully learn from.
Quote:
|
Originally Posted by Phil Roth
All this while trying to work out out an approach to manage current
|
Have a look at Rich Petras' code in navigate.c for an example of motor stall detection using the new current sensors.
Quote:
|
Originally Posted by Phil Roth
I guess my weekend is shot.
|
Sorry, dude, whether you know it or not, your next five weekends are shot

.
-Kevin