Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   General Forum (http://www.chiefdelphi.com/forums/forumdisplay.php?f=16)
-   -   Navigate.c Current Sense code=only one polarity (http://www.chiefdelphi.com/forums/showthread.php?t=24784)

Dale(294engr] 04-02-2004 23:39

Navigate.c Current Sense code=only one polarity
 
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))
{

Dale(294engr] 05-02-2004 16:25

Re: Navigate.c Current Sense code=only one polarity
 
Quote:

Originally Posted by Dale(294engr]
It appears the sample code senses only one overcurrent direction.

A simple fix is to place the Current Sensor in series w/ battery side of the V884. (black lead suggested as 'safest').

All Fwd & Rev motion will have the same current Polarity (2.5-4v for 0-75A)
Direction of current may be determined by joystick position if needed.

Below represents some ideas for implementing bi-direction current processing,
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))
{


[color=DarkSlateBlue]A simple fix is to place the Current Sensor in series w/ battery side of the V884. (black lead suggested as 'safest').

All Fwd & Rev motion will have the same current Polarity (2.5-4v for 0-75A)
Direction of current may be determined by joystick position if needed.


All times are GMT -5. The time now is 15:10.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi