Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Auto won't run (http://www.chiefdelphi.com/forums/showthread.php?t=134387)

dubiousSwain 11-02-2015 19:43

Auto won't run
 
Can anyone tell me why my code won't work?

When I enable the robot, the motors output like they are supposed to for a half second, then seems to hang. The probes stop updating and the motors stop running. Can anyone tell me why this is?

dubiousSwain 11-02-2015 19:54

Re: Auto won't run
 
Update: This is not specific to this auto mode, this is happening in all my auto modes.


dubiousSwain 11-02-2015 20:06

Re: Auto won't run
 
Update: I dropped a bit of sample code in the auto mode selector, and it worked perfectly, so it must be an issue with my code

Alan Anderson 11-02-2015 21:32

Re: Auto won't run
 
Your drive motors are being commanded only once. Things will work better if you add a While around the drive code, with a Wait of 10 or 20 ms to keep the loop from eating up all the CPU time.

The Gyro Get Angle will have to be duplicated inside the loop for the 90 degree turn. (You can't communicate time-varying values into or out of a loop; they take their inputs once when the loop first begins, and produce an output once the loop finally finishes.)

RobotMonkey 11-02-2015 22:12

Re: Auto won't run
 
The motor stopping is probably the safety config kicking in. I am guessing you enabled it in begin. You could either turn it off for auto, or make the the calls less than 100 ms apart.

aeastet 12-02-2015 12:46

Re: Auto won't run
 
If you message me I will give you the code that we use for Auto. I think you will find that it is very straight forward and easy to use.

dubiousSwain 12-02-2015 19:58

Re: Auto won't run
 
Quote:

Originally Posted by Alan Anderson (Post 1442173)
Your drive motors are being commanded only once. Things will work better if you add a While around the drive code, with a Wait of 10 or 20 ms to keep the loop from eating up all the CPU time.

The Gyro Get Angle will have to be duplicated inside the loop for the 90 degree turn. (You can't communicate time-varying values into or out of a loop; they take their inputs once when the loop first begins, and produce an output once the loop finally finishes.)

Thank you so much, I did that and now the drive works perfectly!

I have another problem, if its not a bother:



After the pistons clamp, it doesn't move to the next part of the flat sequence structure. Can anyone spot the problem? I've been looking at it for the past hour.

Alan Anderson 12-02-2015 21:25

Re: Auto won't run
 
Quote:

Originally Posted by dubiousSwain (Post 1442871)
After the pistons clamp, it doesn't move to the next part of the flat sequence structure. Can anyone spot the problem? I've been looking at it for the past hour.

Your "Turn 90 degrees" frame sets the drive state to 4, which I see is supposed to turn at 30% power. But then it immediately sets the state to 3 while it waits for the turn to complete. I assume drive state 3 just sits there doing nothing. Get rid of that extraneous 3 -> State3 underneath the gyro angle indicator in the while loop.

(I suggest that you move the frame labels from above the flat sequence to actually inside the frames they are labeling. That way they will stay connected to the code they are describing if you ever rearrange things.)

aeastet 13-02-2015 11:11

Re: Auto won't run
 
Here is the example code. Let me know if you have any questions.

aeastet 13-02-2015 11:16

Re: Auto won't run
 
How do I attach a zip file?

aeastet 13-02-2015 11:26

Re: Auto won't run
 
1 Attachment(s)
Another try at it.


All times are GMT -5. The time now is 10:25.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi