Ok… I’m really new to pbasic so please bare with me. I have a control system that has 3 joysticks rigged together and from that only one cable that goes into a port on the operator interface. How do I get the readings from all 3 joysticks outta one port??? Do I need to know how it was wired? and get the info off of each pin? If so how do I do that? Is there a program to automatically get the variables from my OI???
I know this joystick works cause it worked before but I don’t have the code for it. And I can’t get it at the moment. It’s to control our old kiwi drivetrain. Maybe u’ve seen it… if not check out the pictures section on our site, under season 2002.
Link to site in my sig
You can either take the cable apart and trace the OI port pins back to the joystick pins, or you can put some debug statements in your code.
Each OI port has 4 analog inputs and 4 digital inputs, so you can run two joysticks off the same port and use the x & y axis and both buttons on both joysticks, or (if I recall correctly) you can do what your team did and only use one axis of each joystick.
Since you’re new to pbasic (and I’m assuming you’re new to the IFI control system) you should read the IFI documents. Start with the overview & Quick Start guides, then read the OI & RC Reference guides. The OI reference guide will give you the mapping between OI port and pbasic variable.
After you understand how the pins map to the pbasic variables, you can use them in code. Make sure you properly read in the analog inputs in your SERIN command. Now debug the p1_x, p1_y, p1_wheel, and p1_aux variables (if you’re using a port other than 1, change the 1 to the correct number).
If you still have questions, post them and someone will help you out.
You could also use the dashboard program to figure out which joystick controls each analog input on the port. Just a plug a computer into the dashboard port of the OI, load up the program from IFI, turn on your robot, and move each joystick one at a time. I believe that the names of the inputs your joysticks’ control are the y axis, the x axis, and the auxillary axis, but I may be wrong. BTW, you don’t need to have working code in your robot to use the dashboard, the OI and the RC just need to have a valid link. Hope this helps and good luck!
Thanks a bunch!
Figured it out with the help from both of ya.