Inverting motor changed potentiometer reading

I’m troubleshooting a subsystem on my tam’s robot (An arm) before a competition tomorrow. We had to replace two motors, so I assumed that I might have to invert one or the other to make it work. However, when I have both moving so they don’t oppose each other, and in the right direction, the potentiometer reading changes to a negative. I’m working with CANTalons, Vex Pro motors, and unknown pots (I didn’t work on this robot last year and no one seems to know!).

The lines that invert my motors:

armRight.follow(armLeft);
armLeft.setInverted(true);
armRight.setInverted(InvertType.OpposeMaster);

The code that displays the pot position:

SmartDashboard.putNumber(“Arm Pot”, armLeft.getSelectedSensorPosition() - offset);

If there’s not enough information here I’d be happy to add more.

you could try inverting the wires of one of the motors to skip the code all together. The problem with the pot could be as to how it is wired into the talon and such so I would try reversing that and worse comes to worse you put the pot in as a variable and then absolute value it so that it is positive

I thought that maybe the issue was that negative voltage was being run across the pot, and when I took the voltage between power and signal it was indeed negative. But when I rewired it so the power pin on the breakout board would wire into sense in the pot, and visa versa, nothing changed. I might try just reversing the polarity of the motors, but it’s kind of difficult without help. I’m the only one working on the robot, and I don’t know much about electrical. And I would just take it as a variable but I’m using the pot as a feedback sensor for MotionMagic. Is there a way to take the absolute value without needing to pass a variable?

I have no idea for the variable question I only know a very little bit about programming and I specialize in electrical

I’m the reverse! Nice to meet a counterpart. If the pot was for some reason having negative voltage run across it, would swapping power and signal fix it?

1 Like

it should if you swap your probes on your multi meter to get a positive voltage than yes

Weird, I’ll try again.

It now reads -300 at rest, rather than -500, which is neither positive nor accurate. I’ll keep working on a programmatic solution.

ok. if you can find some more info on it for me I will try to figure out a solution electrically for you if you want

Set the sensor position to 0 on boot, and make sure your sensor phase is correct. Sensor phase determines the direction the sensor will count and must be set correctly for motion magic or PID to work.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.