SetMotors:
SetCommand (_G, 1, Throttle)
SetCommand (_G, 2, Steering)
RETURN 'SetMotors:
SetMotors:
DIM lastThrottle AS Integer
DIM lastSteering AS Integer
IF Throttle <> lastThrottle THEN
SetCommand (_G, 1, Throttle)
lastThrottle = Throttle
END IF
IF Steering <> lastSteering THEN
SetCommand (_G, 2, Steering)
lastSteering = Steering
END IF
RETURN 'SetMotors:
[code]SetMotors:
SetCommand (_G, 1, Throttle)
SetCommand (_G, 2, Steering)
' PRINT (" MOTOR L = ", Throttle,"\t", " MOTOR R = ", Steering, "\n")
RETURN 'SetMotors:[/code]
'SetMotors:
' DIM lastThrottle AS Integer
' DIM lastSteering AS Integer
' IF (Throttle <> lastThrottle) THEN
' SetCommand (_G, 1, Throttle)
' lastThrottle = Throttle
' END IF
' IF (Steering <> lastSteering) THEN
' SetCommand (_G, 2, Steering)
' lastSteering = Steering
' END IF
'RETURN 'SetMotors:
AUTO_CURRENTSENSORS:
IF CurrentCheckRun AND NOT AutoSensorRun THEN 'this procedure runs until motor current source and sensor polarity are set
DIM BkDelay AS Integer
BkDelay = GetConfig (_BKD)
PRINT ("SENSOR FAILED DURING POLARITY TEST - FaultL: ",FaultL," FaultR: ",FaultR,"\n")
'configure brakes so never released
SetConfig (_DOA, Brake1Pin, 0)
SetConfig (_DOA, Brake2Pin, 0)
'set and later reset BKD to avoid clicking of brakes at end of subroutine
SetConfig (_BKD, 0)
wait (1)
' following two lines to be used if using a contactor that turns on and off with script
' SetCommand (_DSET,ContactorPin) 'sets contactor pin
' wait (1)
'use these two lines for normal motors and matching sensor range
SetCommand (_G, 1, 11) 'throttle channel set to 1% PWM
WHILE abs(GetValue(_MOTPWR,1))<10 OR abs(GetValue(_MOTPWR,2))<10 'wait until motor power has reached 1% for both motors
'use next two lines for testing with small motors and 100A sensors
' SetCommand (_G, 1, 101) '
' WHILE abs(GetValue(_MOTPWR,1))<100 OR abs(GetValue(_MOTPWR,2))<100 'use this for testing with small motors and 100A sensors
wait (1)
END WHILE
IF CurrentSensors = external AND SensorsOK AND FaultL < 3 AND FaultR < 3 THEN
WHILE (NOT LDone OR NOT RDone) AND FaultL < 3 AND FaultR < 3
GoSub CHECK_SENSOR_POLARITY
END WHILE
IF FaultL < 3 AND FaultR < 3 THEN
PRINT ("USING EXTERNAL SENSORS \n")
ELSE
PRINT ("SENSOR FAILED DURING POLARITY TEST - FaultL: ",FaultL," FaultR: ",FaultR,"\n")
END IF
ELSE 'CurrentSensors = internal OR NOT SensorOK OR FaultL >=3 OR FaultR >= 3
IF GetValue (_A,1) <>0 OR GetValue (_A,2 )<> 0 THEN 'current reported for either motor implies
'internal sensors present even if one has failed
CurrentSensors = internal 'use unmodified _A values for MotorCompensation
PRINT ("USING INTERNAL MOTOR AMPS \n")
ELSE 'no internal motor current sensors
CurrentSensors = none 'use enhanced motor current estimates for MotorCompensation
PRINT ("USING ENHANCED MOTOR AMPS \n")
END IF
END IF
IF CurrentSensors = Internal OR CurrentSensors = none OR (LDone AND RDone)
SetCommand (_G, 1, 0) 'throttle channel set to 0
WHILE abs(GetValue(_MOTPWR,1))<>0 OR abs(GetValue(_MOTPWR,2))<>0
wait (1)
END WHILE
'configure brakes to normal operation - released when motor is on
'Roboteq manual has misleading description of _DOA.
'Just setting _DOA to 1 makes brakes operate when motor on, but doesn't specify which motor.
'Correct value is 1 + 16 (=motor1) + 32 (=motor2) = 49
SetConfig (_DOA, Brake1Pin, 49)
SetConfig (_DOA, Brake2Pin, 49)
Wait (1)
' following line to be used if using a contactor that turns on and off from script
' SetCommand (_DRES,ContactorPin) 'resets contactor pin
SetConfig (_BKD, BkDelay)
AutoSensorRun = TRUE
END IF
END IF
RETURN 'AUTO_CURRENTSENSORS
Ok, so what I think you want me to do is to turn on all the print statements for the whole script by setting SuppressPrinting = False in the User Settings section of the script and then send you the log from the Console tab. I'll do that and send it to your email addy you gave me unless to tell me otherwise.
Burgerman wrote:I could. Can you? I have no idea.
LROBBINS wrote:Much of this thread details the attempts, often miserable failures at first and only resolved later on, to make the Roboteq work for wheelchair use. Reading the whole thread would be a terrible slog and very confusing. There is an easier way to get a handle on this, even though as Burgerman has said it's not simple. I have prepared an illustrated user/builder's manual for the CANbus + Roboteq system Rachi is using. It is a long read, but at least it progresses linearly without all the back and forth and side to side meandering that's in this thread. If you PM me your e-mail address I will get you a copy.
Return to Everything Powerchair
Users browsing this forum: No registered users and 193 guests