![]() |
Re: sample code to move robot autonomously
In your code, when you pass a Boolean true constant to the solenoid vi, it should actuate. Take a look at what you do in Teleop. You're probably unbundling the buttons cluster from the joystick and wiring one Boolean from that into the solenoid vi, right? It should work the same in autonomous, only instead of using a button, we use a Boolean constant. They're both the same type.
If you could, can you take a picture of your Teleop code and how you actuate the solenoid? That will help me see what's going on. |
Re: sample code to move robot autonomously
Hey Luke i found out the problem i used Soleniod to call the solenoid in teleop but had used a small "s" in the autonpmous code .........gosh one littel letter makes a huge difference, maybe labview needs to have a watch dog for goofy programmers:rolleyes:
thanks john for now i think i have it, one more thing i believe should be able to add case structures as i want to add a few more moves in autonomous right???? thanks again John |
Re: sample code to move robot autonomously
Yeah, gotta be careful with that reference registry.
Yep, all you need to do is add states (items) to your enum and add cases in the case structure to handle them. Just make sure to add a condition to move to the new state. Also, check out FRCmastery (lvmastery.com too), they have a state machine video tutorial over there. |
Re: sample code to move robot autonomously
HI me again
In a step back we changed the enum into a type def, when that happens if you right click on the enum there is no way that i can see to add more states, an edit itme never shows up, i did go to properties and there an edit item there but it does not allow changes, i can go back and start from the beginning but add a number of states and then go thru and add all the case states, but it seems to me there must be an easier way, also if I do change the enum to a constant if i were to add any states then the pull down menu at the top of the case loop changes and does not reflect what is in the enum?? thanks again for your help, i do think i am getting way closer to what i want to do. thanks John |
Re: sample code to move robot autonomously
If your enum is now a typedef, then when you want to add items, you need to open the typedef and perform the edits there.
Right-click the enum, open typedef. Right-click THAT enum and you'll be able to modify its properties. When you save/close that typedef, it'll update every instance for you. |
Re: sample code to move robot autonomously
Hey Luke (or anybody out there) . Why doesn't the default autonomous code work!!?? I did all the updates, re-iimaged the cRio, configured the camera but the i get no image!! Your code works. At least we got something happening here, but the image is a no show! Please help!
Thanks. |
Re: sample code to move robot autonomously
That code was a lot of help, thanks. Is it possible to press a button and have the same steps used for the autonomous kicking in teleop?
|
Re: sample code to move robot autonomously
Glad it helped you.
The easiest way to use this code in teleop also is to make it a subvi. To do this, select all the code for the state machine (while loop included). Then, go to the "Edit" menu and select "Make SubVI". LabVIEW with put the code in a new vi and automatically creat the inputs for you. Save this vi, then you can drop it in teleop to use it. Note: for this to work, the state machine must stop the loop when it's done. If you want to run the state machine in autonomous more then once, you can make another state machine which calls the sub state machine. |
Re: sample code to move robot autonomously
Luke i'm having some major problems...I make that autonomous example you attached as my autonomous independent and change the references to fit our drive style. But when i try to run the program i says disabled, enabled, and then watchdog not fed. This 'watchdog not fed' happens not matter what i change to the code, is there any hope for me?!?
|
Re: sample code to move robot autonomously
I'm not sure what could be causing your problems, Sidney. The Autonomous Independent vi reference is set in Begin.vi. Did you update it to point to the new vi? I don't have access to a computer with LabVIEW right now. Worst case, use my vi as a reference and code it in your Autonomous Independent vi.
|
Re: sample code to move robot autonomously
Hey Luke you were such great help, i am trying to incorporate the solenoid and compressor into my existing robot main program. can i maybe do like you said a couple of posts back and make it a sub vi and then just drop it into my autononmous and teleop vi?
thanks much for you help |
| All times are GMT -5. The time now is 18:12. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi