|
Re: Program overloading the cRIO?
1) is what's causing the problem, and it's lucky the safetyconfig ("drive loop running too slow")caught it or you'd have a runaway robot.
The robot drive vi expects to get called every 100 milliseconds. If it does not, it shuts down the drive train until it gets called again. See, the problem is that calling the robot drive vi doesn't make the robot go forward for something like half a second and then stop, and then you call it again and it goes forward another half second. No, the vi instead just sets the speed and then has the motors run until it sets another speed.
Now, if you want to have a case structure that will have the robot keep going in the direction it was until the case structure becomes true again, what you have could work. However, it's better to use a feedback node (which keep their value from loop to loop) to just use the last value you sent the vi. So you'd have the value that's going to the robot drive vi go into the back of the arrow and then the output goes into a case structure that either tells the robot drive vi to do what the joystick is saying or do what it was doing last.
However, what you probably want to do is stop the motors if the case structure is true. If that is what you want, put the case structure around the values going to the drive vi, but not the actual vi, just the values. Then have it so that when the structure is false, it gives a value of zero.
|