Auto Code NOT Running (as expected)

Here’s a screen capture of auto code.
As it is supposed to run, shooter starts immediatly.
After 3 second wait, conveyor2 starts.
After 7.5 seconds, conveyor1 starts.
All run until end of Auto.

BUT all turn on at beginning of Auto at the same time.

:confused:

I know in previous years we could get the time-elapsed for the auto-period and use that to control the operations. Now, ???





The problem is with your usage of the millisecond timer. It has no reference time (i.e. millisecond zero is just an arbitrary point in time). Therefore, you have to measure the change in timer value, which will give you milliseconds elapsed. Try the attached snippet instead.

timer.png


timer.png

That would likely do the trick, but it’s now commented out because (in theory) the Kinect should be able to replace it!

On a similar note, what are the X and Z axis on the Kinect? ie which bodily function does what? We have Y good! (the arms)

Autonomous Independent is only called once, when autonomous mode begins, and runs until it’s done (or until it’s aborted by the framework when teleop mode begins). It’s not like Teleop, which gets called every time new data arrives from the Driver Station and needs to finish quickly. If you want to do different things at different times, you’ll have to put the code that reads the time and decides what to do inside a while loop.

But since you’re just doing a sequence of events with delays between them, you can use a Flat Sequence structure very effectively. See the attached code snippet. (You can put it inside a case structure to control whether or not it runs, based on the joystick throttle the way you did it in your code.)

snippet.png


snippet.png

The default gestures in the FRC Kinect Server do not map anything to the X or Z axis, they always return 0. Note that Alan’s point about loops also applies to Kinect code. Your Kinect code must be in a loop to read new values from the Kinect and update motors with them.

Lana?:stuck_out_tongue: Yeah that is EXACTLY what we were looking at.

Shucks, that’ll take more thinking…thinking always gets me in trouble…

So just put everything in one giant loop w/ a FALSE wired to the Terminator? On second thought, that may be a bad idea… I have bad memories of that angry little doggie…

Heh, that should have said Alan.

Yes, a big while loop with false on the terminator should work just fine. Make sure to put a Wait Ms VI in there, 20 to 50ms should work well.

Okay, but any infinite loops are on your tab next week, I’ve already footed the bill my team gives the programmers long enough!

As long as you have not modified Robot Main, the Autonomous Independent VI will be automatically terminated when the robot changes modes, regardless of whether it is currently “caught” in a loop or not.

Would passing Ultrasonic and Joystick data to the Dashboard inside Robot Main qualify as “modification”?

Nope, that should be fine.

Annnddddddddd, (drum roll please)

It doesn’t work. Error #-44061 at Leftand Right Motors, standard loop starvation code. The joystick z-throttle selector works.

We have a loop around all Auto Code, with a Wait in there of 20, and tried again w/ 50. Loop starvation every time!

Also, sending kinect2 yaxis back to dashboard. Always sends “0”, even when doing the floppy chicken!

So therefore, is it some error in setting up the Kinect, or can the robot not reliabley interpret the Kinect data?

If you run the default dashboard, does the Kinect “green man” and Y-axis data show up?

yep. The little bars work fine, but the robot won’t reliably read the kinect and sentd that data back to a custom readout, and yes the indicator works properly just like the other 2 windows we have right above it.

I think if the dashboard can finally get the proper data, then the robot auto code will work fine.

The output of your feedback node in that snippet never changes.

Alrighty, I sacrifice confidentiality for operation.


begin.png
send2dashboard.png



begin.png
send2dashboard.png

Nor is it supposed to. If I recall correctly, the OP wanted something to do with total time elapsed since the start of auto mode (i.e. drive motor A for 7 seconds, then turn it off). The snippet will calculate the total time elapsed since the first iteration (not the time elapsed since the previous iteration, which is what I think you interpreted it to be). Make sense?

However, I probably could have phrased my explanation of the code better. Saying change in timer value probably implied change over one iteration, rather than over total execution. I intended the latter.

By any chance do you have the Driver Station I/O Tab set to Enhanced Mode without the Cypress connected?

That’s a unique case (bug) where the Kinect data will not get sent properly to the robot, but will be seen just fine on the Dashboard Kinect skeleton feedback.

Left and right motors are never set in your auto loop. If you open it, leave the safety enabled, and don’t update it, the RobotDrive will complain and set it to zero.

If you set the left right drive, I predict the error will go away. Other choice is to disable the safety. This is primarily there to make debugging safer and isn’t required by the field. If debugging with it off, the robot should be on blocks since a breakpoint will leave drive motors running.

I couldn’t tell if you had a Kinect issue or not. Please summarize the symptoms.

Greg Mckaskle

OK sorry I misunderstood the OP’s intent.