Motor in Autonomous?

I have a motor I want to go up for about 5seconds in automous mode. How would I program that, Visuals are awesome I’m a newbie, thanks

The default auto code needs to be enabled and they you would replace the RobotDrive with a Motor Set. If you don’t have safety config on the motor, there is no need to use the RobotDrive style of delay, you can use a sequence structure and a delay.

The attached image/visual shows some code that sets a motor to full speed one direction for five seconds and then sets it to speed zero.

Greg McKaskle





I copied what you provided in the picture but to a bigger scale, the motor claws go down, but it sure doesn’t seem like 6 seconds, and after that short burst of like a second nothing seems to happen, I must be doing something wrong in my code, but what could it be? My goal in autonomous is to have a claw come down an arm for 6 seconds, and after that the arm will go forward for 3 seconds, and after that the hooks will go forward for another 6 seconds for 15 seconds total. If anyone sees any errors please tell me, thanks, visuals are awesome I’m a newbie





The code looks fine. Do you have 12V power to the digital breakout board? If not, it will work erratically.

Greg McKaskle

I just had a quick question about that my team is doing the same code but with different motors. But we want that the sequence repeats itself 3 times(For each frisbee) and then it sets the output of those motors to 0, how would I do that?

FOR LOOP

Separate out the last frame (the set all to zero) and place the three Motor Set output out off to the right. (remove the last empty frame). Wire up the 3 MotorControlDevRef to each of the three. Then put a For Loop around JUST the “Flat Sequence Structure”. Do not include the three (3) “MotorContolRefNum Registry Get” keep them off to the left or the last three Motor Sett Output keep them off to the right. Right click on the Auto Indexing terminals on the right side of the For Loop where the wires are now broken and select “Tunnel Mode > Last Value”

Create a constant from the For Loop Count Terminal [N] and set it to ‘3’

I am still confused on implementing what you just described me. Can you possibly show me an code that explains what you mean. Is it suppose to look like this?





That look pretty good.

Does it work?

3 sec seems a little long for some of the shooter that I have seen.

One team that I work with has a rotating cam action and they fire very close to 1 per sec.

I have one team that used a while loop instead of a for loop to run for the whole 15 secs. It just kept shooting even when there were no disc to shoot. It helped with a retry when one disc failed to drop into position at first.

"Right click on the Auto Indexing terminals on the right side of the For Loop where the wires are now broken and select “Tunnel Mode > Last Value”

This is the part I don’t quiet understand I can’t find those broken wires. I right click on the FOR Loop but I don’t get one of those options. How would you do it using a While Loop? An No we hadn’t tested it yet.

The pic posted by Ben (BPtigers) had four sections with the last sections where he stops all the motors at the end (writes zeros).

To keep the shooter motors spinning in between disc you don’t want to stop them until all 3 disc are shot.

So I instructed you to keep those outside of the for loop.
But you only used 3 sets of controls (which is perfectly OK) and did not use the last set after the For Loop (again no problem).

If you had done as I had suggested and wired up the thick pink Ref wire to VIs to right of the For Loop, the For Loop defaults to “Auto Indexing” and you would have gotten an Array of pink Ref. The “Motor Set Output” VI to right do not accept Arrays as input.

So you need to tell the For Loop not to Auto Index.

Try it! Put a “Motor Set Output” outside to the right of the For Loop and wire one of the pink Ref wires from inside the for loop to it. You should get a broken wire.

Then fix the broken wire by

Right click on the Auto Indexing terminals on the right side of the For Loop where the wires are now broken and select "Tunnel Mode > Last Value

Do LabVIEW programmers everywhere a favor and vote for this ides on the LabVIEW idea Exchange
Smart autocorrecting autoindexing

I think I got it! Is it suppose to look like this?

So I want the shooters(1+2) to be on all 15 seconds. An then we shoot a frisbee, load again, and then shoot again two times.





Yes that looks correct as far as the LabVIEW programming.

But I do not know the finer details of YOUR system so you have to fine tune it.

Do you need to move 3 disc or only 2 disc into the Shooter?

From your delays, the For Loop will take more than 20 sec to cycle two times. The 15 sec Autonomous will abort this code before it has time to finish.

Also I see some code above this that seems to move your robot. Do you need to wait until the robot is at “stand still” before firing disc? Then you will need to work on that in a similar way.