![]() |
PID Subsystem using direct PWM ouput
I am using a PID subsystem to control our arm. When I start the command to setToSetpoint(setpoint), the PID subsystem actually accesses the PWM port directly, and as I have already made an instance of that PWM port for teleop, I get a NullPointerException for a used PWM port. This stops our code, and is basically detrimental to all our PID controllers. Its worth noting that all of our motor objects are outside of the PID classes, mostly for organization. I am using custom methods to control those motors. These custom commands are perfectly functional, and are not the problem (We use them in teleop). How can I make it so that the PID subsystem does not "reach" into the other portions of the code, and just give the output. Thats it. Is there a workaround for this, or is this not common? I have had very little luck with PID control systems and I am getting fed up with how it has been implemented in the wpilibj libraries. Maybe making my own algorithm might work better.
|
Re: PID Subsystem using direct PWM ouput
Could you post your PIDSubsystem.
|
Re: PID Subsystem using direct PWM ouput
Code:
package Subsystems;For further detail into the PIDOutput... Code:
public void move(double speed){leftArm() and rightArm() are as followed Code:
private SpeedController leftArm;BTW PWM port 5 is leftArm, which is the one that gets allocated wrongly. |
Re: PID Subsystem using direct PWM ouput
Hmm... The PIDSubsystem doesn't do much behind the scenes, it just kind of takes your input and spits back an output.
It seems more likely to me that you have maybe created an arm somewhere else as well or maybe two PIDArms? Maybe you didn't get rid of all the references to Arm in the code when you stuck in PIDArm... That would be where I first look for the problem. |
Re: PID Subsystem using direct PWM ouput
That's what I found too. Thanks. :)
Although Im not using PID anymore, as the buttons on smartdashboard do not properly implement the command. |
| All times are GMT -5. The time now is 10:05. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi