View Single Post
  #4   Spotlight this post!  
Unread 09-05-2016, 16:41
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: Continuous Feedback Sensor on CANTalon

Quote:
Originally Posted by TimTheGreat View Post
So if the sensor is at 200 and I want it to go to 1000 it will go backwards 223?
So assuming 1024 units per rotation (analog sensor), if you want to go "backwards" set the target to -23. This will move backwards by -223 (since your current position is 200), instead of moving forward by 800 (pos200=>pos1000).

The basic idea is if you want to move forward, use the appropriate multiple of your target position in the positive direction. If you want to move reverse, use the appropriate multiple in the negative direction. If you want to servo using the shortest distance, calculate how far the target is moving forward, and moving backwards, pick the shortest one, and use that as the final set point.

Attached is an excel sheet demonstrating a few examples of how to do this.
Attached Files
File Type: xlsx continuous_wheel.xlsx (13.2 KB, 14 views)
Reply With Quote