Hey guys, I have a potentiometer that I want to program for our shooter. The basic idea is that we would have a potentiometer on our driver station with a knob (bought from radioshack ::ouch:: ) that will control the speed of our shooter. The knob will start in a position which would have the motor off but once the knob is turned it would turn on the shooter motor and the speed would be get either faster or slower by turning the knob. This is similar to a volume control on a pair of headphones or speakers. I was wondering how I would be able to do this in Labview? We will be using the eStop robotics custom control interface to plug into the driver station because we had problems with the cypress board in the past.
The values of the pot would be the values for the shooter it depends on how far the pot turns. if you go positive 30 degrees that’s a set point from 0 to 10 in motor output, you also could scale the pot down to what ever finer values you would like. You basically have to know what the values are on your pot then from there put set points for certain motor speeds.
According to eStop Robotics, that board gets read as a joystick input on your robot. For the Joystick Open VI, choose the JoystickDevice input to match the location of your eStop CCI on the Driver Station Setup tab. For example, if your CCI is in location 2 on the DS, then your JoystickDevice input would be USB 2 in the robot code.
There is another alternative you could use. On the I/O tab of the DS, when it is set to Compatible Mode, you will see Analog Input sliders. You could read these instead of an external potentiometer. In this case you would read the values on the robot using the WPI Robotics Library>>DriverStation>>Compatibility I/O>>WPI_DriverStationGet Analog Input.vi. Then you would scale it accordingly to drive your motor.
Thanks for the replies, I am wondering what vi’s would I use for the pot?
If you read one of the analog inputs from the I/O board, it will have a range of 0 volts to 3.3 volts. Your output to the motor should be in the range of 0 to 1 because you will be driving it in only one direction.
A simple division of the read analog voltage by 3.3 will yield an output in the range of 0 to 1. So, all you need to do then is feed that to the motor output.
Would the analog input(like a potentiometer) then act as a joystick and the digital inputs act as buttons on the joystick vi’s? That seems to be my understanding.
Ok so I have had success with programming this. Essentially what I did was in Teleop called the joystick vi’s like you normally would when you want to do tank drive or other joystick related things and set the axis 1 as the shooting axis. The reason why I choose axis 1 is because on the board the analog inputs it gives you are call X, Y, Z, R. I assumed they all followed the the same in LV. This worked with great success but the problem I have is that when you turn the POT, you have a neutral position(zero position) where the shooter motor is not running and when you turn the knob to one side it goes forward and the other side spins the motor in reverse. Is there any way where I can take the values from from one extreme and use this as my starting position where the motor spins forward and increases the speed as you turn the knob?
Joystick values range from -1 to +1. You want to run the value through a formula that produces an output from 0 to +1 before you feed that to the motor, right? That’s easy: add one, then divide by two.
Ahh, thanks for this, I completely forgot about adding one and dividing by two.