View Single Post
  #1   Spotlight this post!  
Unread 20-02-2012, 16:46
mikets's Avatar
mikets mikets is online now
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Reverse polarity of a victor at declaration?

Quote:
Originally Posted by frdrake View Post
Yea, I'm referring to an individual basis. Right now we're just doing Motor->Set(-MotorCommand) for the ones that are backwards. Just seems like there should be a more elegant solution.
Yes unfortunately, the myRobot.SetInvertedMotor(myRobot.kRearLeftMotor, true) function only handles all the motors for the RobotDrive class. If you have an individual motor for an arm or shooter, for example, I can't find an equivalent "Inverse" function in the WPI library. In our code, we have encapsulated individual motors into a PIDMotor class and provided our own "Inverse" function. There are many quick and dirty ways to do this. One of them is:

When calling the SetSpeed(speed) of a motor, you can do SetSpeed(speed*ARM_MOTOR_INVERSE) where ARM_MOTOR_INVERSE is defined as either -1.0 or 1.0.
__________________
Reply With Quote