02-09-2011 06:53 PM
nathand wrote:
If I remember correctly the joystick axis value is something like -32000 to +32000, so try setting the limits to +10 to -10. I
The joystick axis values are floats that range between +/- 1.
02-09-2011 07:18 PM
Well,
For clarification of what I am trying to do:
My team's robot is set up having a wheel with motor on each side (parrallel to as well) of the robot.
I wish to make coding so that Joystick 1 will make the robot move directly forward, backward, left, and right. (So the left and right motors run for Forward/Backward and the front and back motors run for Left/Right) (right and back motors are negated since the motors are facing opposite directions)
Then Joystick 2 will make the robot turn. (run all motors same direction [in a circle])
So, I just tried to make a case structure saying that if either of the Axis from Joystick 1 are not equal to zero then the structure would be true causing joystick 1 to run how it should on the motors; and if the axis do equal zero then Joystick 2 will work how it should on the motors.
(not really any expierence with Case structures so please check over that) also the labview file is attached.
Thanks,
Davis Catherman
02-09-2011 11:47 PM
sciencewhiz wrote:
The joystick axis values are floats that range between +/- 1.
Thanks, I must have been thinking of the standard LabVIEW joystick VIs.
Davis, you're on the right track, but your code has some logic problems. Although it's legal LabVIEW syntax, you won't get the result you expect by putting two floating point values through an OR. What you want to do is check each number individually against 0, then take the OR of those two boolean results (booleans are the green wires). You also want to use "In Range and Coerce" as I suggested earlier, instead of "Equals," because it is likely that the joystick does not return to exactly 0 when it's not being pushed.
I still don't understand why you want the second joystick since pushing the first one diagonally will have the same effect of running all 4 motors, although in two corners the motors will be running against each other. If you only want one axis from the first joystick active at a time, you need more logic to decide which axis has precedence.
02-10-2011 06:09 AM
Thanks,
I was having trouble finding the "In Range and Coerce". Where is it located in the "right click menu"?
And to give more precedence to 1 axis on joystick 1, would i use another "In Range and Coerce" but probably with smaller values?
Thanks,
Davis Catherman
02-10-2011 10:35 AM
"In Range and Coerce" is in the equality palette, same place you found the equals. You can find a function by name by right-clicking to bring up the palette, the clicking the search button at upper right.
02-10-2011 10:58 AM
Another thought that just occured to me is that your drivetrain is the same as what the holonomic drive VIs expect, except that it is rotated 45 degrees. You could use some trig to rotate your joystick inputs 45 degrees and then feed those into the holonomic drive vi.
02-10-2011 11:48 AM
well,
I will look more into your idea science. (didnt see the post til just now cause 2nd page)
But for the "In Range and Coerce" function.
How should it be arranged? and How should the terminals be connected (especially the "In Range and Coerce" to "Case Selector")?
Provided 2 pictures below, and attached the VIs.
PIC 1
PIC 2
Thanks,
Davis Catherman
02-10-2011 12:06 PM
@sciencewhiz
After some thought, i realized that will not work with the default omni coding. Since that still runs all 4 motors when i only want 2 for going forward.
Thats why when i run that coding, the robot will move diagonally. (thats why the 45 degree angle to side setup works)
Thanks,
Davis Catherman
02-10-2011 03:22 PM
I suggested In Range as a way to check if the axis is close to zero, meaning it's not currently being pushed. So your limits for the function should be just above and just below zero. If you don't understand how to wire it, have you looked at the help? Put probes on the outputs of Get Axis (click the wire while your code is executing), play with the joystick a bit, and see if you can determine reasonable limits. As for how to wire it up, experiment a bit! LabVIEW makes this easy. In your project explorer, click on "My Computer," then create a new VI (selecting My Computer first causes the new VI to execute on your machine, not on the cRIO, although you can change that later). You can then put controls and indicators in your new VI, plug in some values, and see what works very quickly.
02-10-2011 04:46 PM
Well, I missed this post (my school decided to cut off internet to make it faster)
But just a bit ago i wired up in the way that seemed most logical.
and guess what, IT WORKS !!!!!!!!!!!!!!!!!!!!!
I had to change some other simple setting (like axis and 1 negation) to tweak the code. But the robot easily runs smoothly in all directions and spins nicely. I will make a post to show a video of the success (try to get it up tomorrow). (Coding picture below and the VI is attached)
From here, I will add it to my Arm System coding and we will make driver team selections and i will set it up for an option to be a three axis joystick.
Also, I will start work on the autonomous coding, attempt the line following stuff, get camera to work, and finally set up 2 servos to move on either joystick or buttons.
Thanks for all the HELP, @nathand and @sciencewhiz.
My team and I GREATLY appreciate it. We are looking forward to the VCU regional.
Thanks,
Davis Catherman
US FIRST team 539