|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
It appears the sample code senses only one overcurrent direction.
Below represents potential ideas NOT tried code !! dh- it's not clear how(if) neg current is included i.e. for backing into wall (note: current polarity in code depends on sensor wiring direction) Provided code may assume NO reverse motor drive will occur in autonomous ??? assumed: ADC return is int counts (10bits, 0 to 1023 counts) if it was a real voltage proportional to current sensed, ABS(real) would do the job suggest something like this: MAXPOS_CURRENT 700 (511+188) MAXNEG_CURRENT 511-188 511 =midrange =2.5v =0A For two AD Current Sensor channels with different zero current offsets (note that new joysticks have all too easy bump access to wheel ZERO with consequence !) add unsigned char ad01cszero ad02cszero init once @ robot turn-on with no drive (assumes wheel offset proper adj) sum/difference with the counts representing desired +- current limits MAXPOS_CURRENT01 ad01cszero+188 MAXNEG_CURRENT01 ad01cszero-188 // 188 = ~45A MAXPOS_CURRENT02 ad02cszero+188 MAXNEG_CURRENT02 ad02cszero-188 // 188 = ~45A for +-current tests w/AD01 & AD02 each w/theoretical rather than actual measured offset+-current if ( ((left_current[i] > MAXPOS_CURRENT) || (right_current[i] > MAXPOS_CURRENT || left_current[i] < MAXNEG_CURRENT) || (right_current[i] < MAXNEG_CURRENT)) && (Navigator_State != WAIT_TO_DRIVE) && (Navigator_State != AT_TARGET)) { |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Current Monitoring system questions | PyroPhin | Technical Discussion | 44 | 17-02-2003 15:34 |
| What happens / why do motors stall? | DanL | Technical Discussion | 19 | 21-11-2002 07:19 |
| Controller Simulator | Jay | Programming | 14 | 03-04-2002 02:04 |