I have carefully looked at the framework auto ind code, but I am still a bit fuzzy.
the driverstation inputs that are fed into the “Left Right Straight” case stucture; how do I pick which one is set?
also just using the default framework, the robot ALWAYS runs in reverse
any ideas on how to fix this?
my team is using mecanum wheels (which run perfectly in teleop), how do I adjust the code to use this drive system?
for reference, our IR sensors are rigged to connect the white cable to DIO, but I have tried the auto code negating the IR input already to no avail.
I have tried doing a complicated alternate drive system as follows:
in “open.vi” I open 3 drive motor control VI’s “MainDrive”(4motor) “AutoFront”(2 motor) and “AutoRear” (2 motor)
the four motors are wired appropriately.
In teleop, I run the MainDrive to mecanum cartesian
In Auto, I pass the X axis control to the X input on AutoFront and AutoBack, and pass the Y axis control to the Y input on AutoFront and AutoBack
I expected this to work somewhat, but by doing this, not only did it not work, it prevented my teleop code from working AND shortened the run time in auto to less than 4 seconds.
can anyone help me?
I am coding this alone and have never used labview before
I
For it driving in reverse:
Do you have the motor invert booleans setup right for your wiring in begin.vi?
If this was the case, you should see similar issues in teleop, but it sounds like you are creating seperate dev. Ref.s for auto and teleop. you shouldn’t be doing that - I’m not sure if opening two drives pointing to the same pwm channels will break something, but you certainly shouldn’t need to do it this way. If you want to do it that way, I would at least try to close the drive when auto finishes, and then open the drive w/ holonomic after.
I would suggest watching this video @ frc master, it should help resolve any lingering questions you have about how the default code is supposed to work
The case structure selects them by converting the true/false inputs from the IR sensors into 1s and 0s of a binary number, and from there into a decimal number. That is why the cases read “7” “1” “0” etc…
You really don’t need to understand that though.
The default framework doesn’t open the IR sensors in begin.vi, I suspect that is causing your problems. Open 3 DIOs, named IR1, IR2, IR3, wire the sensors to the digital sidecar to match the pwm selected on the open.
You do not need to alter the code for mecanum drive, just make sure the same 4wheel drive reference is wired into the arcade drive vi.
I don’t think there is any reason on any normal robot to open more than one drive.
Alone on the first year? That’s rough but a lot of fun. Let me know if I should explain this in more detail or if you need help with anything else.
If you’re a new programmer, or at least new to LabVIEW, I would recommend totally ignoring the default autonomous code. Our programing team looked at it and then decided, this doesn’t make any sense, lets write our own.
We mounted our sensors in a triangle that we placed in the front of the robot, so that one was about 2.5’’ more forward then the rest. The code was actually very simple. We had a loop feeding 0.5 for both joystick values into our drive.vi until “left sensor” OR “right sensor” OR “middle sensor” was tripped.
Then it moved in to another loop that feed 0.8 for both joystick values in to our drive.vi; however when the left sensor was tripped the left value dropped to 0.5, and visa versa. We did this by arraying the boolens we got from the sensors, turning then in to a number, and then feeding the number in to a case statement that contained the constants we feed in to the drive.vi as the joystick values. This loop would stop when any combination of sensors that wasn’t just the left or just the right was tripped.
This followed the line GREAT and stopped when it got to the end. It’s simple (don’t worry it’s much easier to see then to say), easy to debug, and above all works really well.
I did open and close the IR sensors, so that is not the issue.
And I was asking about the case structure that had the conditions “Left” “Right” “Straight” not the “0” “1” “7” struc
any ideas about the backwards movement?
I think I may just have to redo this whole thing
Probe the joystick values when your robot is driving forward in tele. Compare that to the values when auto should drive forward.
If the joystick needs to be a positive number to drive forward, change the Steering Power or Y Power to have positive numbers.
If tele uses negative numbers to go forward, then anywhere else in the code using the same ref should use negative numbers. That implies that the Drive ref has been reopened and opened differently than the one used in tele.
As for the default code, why would you ignore it? Especially if it works or almost works and needs to be tweaked? Writing your own code is great, especially once you understand the problem well enough to see ways of improving the working solution. What you describe of your code actually sounds very similar to the default code modified to only follow the straight line. Can you describe the differences? In general, it would also be useful to know what about the default code was confusing.