Go to Post FIRST may very well be the healthiest drug on the market. - Herodotus [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 11-02-2016, 10:55
Kevin Zhang Kevin Zhang is offline
Registered User
FRC #3501
 
Join Date: Dec 2014
Location: usa
Posts: 2
Kevin Zhang is an unknown quantity at this point
DriveTrain TankDrive Control

Hello,
Our team has been experimenting with controlling our robot drivetrain better for driver assist. We wanted to make a basic command to drive the robot for a certain distance using encoders. However we have been having a lot of trouble.

We can get very accurate encoder data from the drivetrain that is accurate to about 2 cm but unless we drive the drivetrain at around 0.2 percentvbus speed(basically unmoving) if we cut the motors off when the robot hits the desired encoder value, the momentum carries the robot forward another couple of feet

As a result I tried to control the robot using a PID control algorithm. I have a very good understanding of PID and as a project to help with understanding created a PID controlled beam balance to balance a ball. However, the PID Control objects for wpilib are very confusing. We are using CanTalon SRX to control a tank drive with 2 talons per side controlling a 2 cim vex gearbox with encoders connected to each canTalon

We've tried different approaches that all have issues that have stranded us because of the lack of documentation.

1) Instantiate a PIDController object with each of the talons assigned to each and control through that way.
Problems
-Only the front two talons have encoders attached because the gearbox only has one encoder each
-PIDController have a setSetpoint() method but I have no idea what how to select what the setpoint is( can i just change it to speed or position control and it'll do it for me)
-I realized that the Talons can use different controlModes which I assumed would resolve this problem but PID controllers don't work with Talons.

2) Just use the inherent PID objects inside the Talons
Problems
-When a setpoint is set through position, the drivetrain moves in the opposite direction that it should(If we set the talon to setpoint 256 ticks the drivetrain starts at 0 and goes backward so the encoder reads negative and never reads 256.
-When the setpoint is flipped(-256), the drivetrain also flips and starts reading positive.

3) Implementing our own PID
-We can get error and find the setpoint to set the motors but the motors are set in a -1 to 1 fashion so we don't know how to convert m/s or ft/s setpoint measurements to the motors.

Could anyone explain to me how exactly the PID control for the drivetrain works and how exactly we can accurately move a certain distance. This doesn't have to be encoders connected to Talons. Encoders can be separate objects. Code isn't necessary, I just need a bridge between the theory and the actual implementation from how to get the error to how exactly we can set the setpoint on the motors accurately so that it drives the right distance.

Thanks
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:44.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi