@(#) $Header: /usr/local/scalawags_cvs/Scalawags/Simulator2006/Victor884.wc,v 1.1 2006/03/13 23:15:57 abrown Exp $
Victor884 is a function which simulates the odd behavior of the motor controller of the same name from Innovation First. This is the only approved motor controller for the FIRST Robotic kit for most of the years I have been involved.
If you choose to include the details of the Victor884's behavior in your simulation you will want to source Victor884.tcl in TheRobot.tcl. One or more calls to this function will them be made in this same file.
Victor884 has no GUI view. It takes in three numbers and returns one.
There is one proc[edure] in Victor884.tcl.
proc Victor884 {{topzero} {botzero} {inputval}} \
The dead zone is relative to the input value. Because of the way this dead zone is implemented there are output values which are unreachable by this motor controller.
|
Victor needs to be called each cycle. Tractortank will do this when it is subscribed to Cycle. But Victor returns a number from 0 to 255. Tractortank requires a number from -1.0 to 1.0. So you need to wrap the Victor884 call in a ifibyte2fract call.
::Tractortank::new tractor1 $labelname 120 256 20 \
{$::pwm16} {$::pwm15} \
{[ifibyte2fract $::pwm16 -1]} {[ifibyte2fract $::pwm15 1]} \
{[ifibyte2fract [Victor884 142 112 $::pwm16] -1} \
{[ifibyte2fract [Victor884 142 112 $::pwm15] 1} \
{::leftdist} {::rightdist} {10} {10} \
{$::simseconds} "#7f8f7f" "pwm16 pwm15"
Victor884 simulates the observed behaviour of the Victor motor speed control units. At inputs close to 128, output is zero. Once the input gets strong enough for the Victor to recognize it, the victor's output jumps well above zero output. Thus there is no way to get a near-zero output.
In summary the output of the Victor is nonlinear and discontinuous. This behaviour is simulated.