We are currently using a raspberry pi connected to a talon srx using CAN. We need to be able to control the motors to shoot a ball at a given speed to shoot a ball. We are building a basketball shooting machine and a spinning flywheel mechanism is used to shoot the basketballs.
We are using the Phoenix tuner to get the PID values to write our own PID loop. However, with our limited experience and the lack of examples using a linux robot controller, we are unsure on how to write a program that meets our needs. We found this example, https://github.com/CrossTheRoadElec/Phoenix-Linux-SocketCAN-Example, which helps but we do not have a joy stick. We are not able to use any FRC/WPILib functionality on the Pi. We have read extensivelly the documentation on https://phoenix-documentation.readthedocs.io/en/latest/, but are still lost.
Our idea is that we want to be able to call the function to control the motors from the gui. the input to the program would be the initial velocity at which the ball needs to be shot at. Then the program would control the motors to run at that speed. We want to use the ctre library on c++ and simply modify the example from the link. Below is a summary of what we want the motor controller program to do. Please help if you know what any of the ctre functions actually do.
- If signal is received to shoot
- calculate rpm needed to shoot ball at initial velocity
- Speed up motors
- Send signal to GUI that rpm has been reached
- If signal to stop is receive
- stop motors
- send signal when motors reach 0 rpm