Go to Post if your true love is building robots, this makes perfect sense - EddieMcD [more]
Home
Go Back   Chief Delphi > Technical > Motors
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-12-2018, 11:04 PM
ozdave ozdave is offline
Registered User
FRC #6072 (Triton Tech)
Team Role: Mentor
 
Join Date: Nov 2017
Rookie Year: 2017
Location: Newport Beach, CA, USA
Posts: 61
ozdave is an unknown quantity at this point
Using Talon closed loop position mode

Hi

We are using motion profiling to move elevator to position, but then want to hold position once there.

We are setting the Talon into ControlMode.Position, using this code:
Code:
        double curPosn = mTalon.getSelectedSensorPosition(0);
        mTalon.set(ControlMode.Position, curPosn);
The talon seems to be holding, but we can move the elevator away from this point and it does *not* go back.

Have we misunderstood the Position mode, or are we doing soemthing incorrect?

Regards

David
Reply With Quote
  #2   Spotlight this post!  
Unread 02-12-2018, 11:13 PM
nickbrickmaster nickbrickmaster is offline
T-shirt connoisseur
AKA: Nick Schatz
no team
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Eagan MN
Posts: 414
nickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond repute
Re: Using Talon closed loop position mode

Have you tuned the PID constants? It won't apply any gain to reduce the error from that position if your PID constants are zero.

The Talon SRX Software Reference Manual has a guide on tuning position PID. You should also get a little bit of theoretical background on PID before you jump into it. The FRC-PDR site has a good intro here.
__________________
Proceed as if success is inevitable.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-13-2018, 12:29 AM
soundfx's Avatar
soundfx soundfx is offline
Registered User
AKA: Aaron J
FRC #3238 (Cyborg Ferrets)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Anacortes, WA
Posts: 66
soundfx will become famous soon enough
Re: Using Talon closed loop position mode

Quote:
Originally Posted by ozdave View Post
We are setting the Talon into ControlMode.Position, using this code:
Code:
        double curPosn = mTalon.getSelectedSensorPosition(0);
        mTalon.set(ControlMode.Position, curPosn);
Assuming that this code is called in some forum of periodic loop, your code is repeatedly setting the target position at whatever the current position is, meaning that there is never any error calculated. You need to set one position that you calculate as your target, store it as a variable, and don't change it until you want to move again.
__________________


"I got 99 problems but 0.999 ain't 1."
~Orteil
Reply With Quote
  #4   Spotlight this post!  
Unread 02-13-2018, 12:49 AM
ozdave ozdave is offline
Registered User
FRC #6072 (Triton Tech)
Team Role: Mentor
 
Join Date: Nov 2017
Rookie Year: 2017
Location: Newport Beach, CA, USA
Posts: 61
ozdave is an unknown quantity at this point
Re: Using Talon closed loop position mode

Thanks for the responses

@nick - yes, we have been playing with kP, other params are 0. Possible we have not moved kP far enough - will be more adventurous tomorrow.

@soundfx - good thought, but the code is only being called once, when the motion profile is completed. We are attempting to switch form motion profile mode to hold position mode. Should we in fact be calling the set repeatedly?
Reply With Quote
  #5   Spotlight this post!  
Unread 02-13-2018, 08:45 AM
rlance's Avatar
rlance rlance is offline
Registered User
FRC #5550
 
Join Date: Dec 2015
Location: Bethany, OK
Posts: 130
rlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond repute
Re: Using Talon closed loop position mode

We are using the Talon Magic Motion feature to get our elevator to a position. I'm pretty sure we have the P and K set to .2 and I and D set to 0 and it seems to work pretty well. We have a CIM with a 25:1 versaplanetary gearbox moving it.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-13-2018, 11:48 AM
ozdave ozdave is offline
Registered User
FRC #6072 (Triton Tech)
Team Role: Mentor
 
Join Date: Nov 2017
Rookie Year: 2017
Location: Newport Beach, CA, USA
Posts: 61
ozdave is an unknown quantity at this point
Re: Using Talon closed loop position mode

@rlance - thanks for the reply

Does the system hold position once it reaches it?

The issue we are concerned with is holding the position of the elevator steady once the target position is reached.
Reply With Quote
  #7   Spotlight this post!  
Unread 02-13-2018, 11:54 AM
firecrafty's Avatar
firecrafty firecrafty is offline
Registered User
AKA: Ryan Blue
FRC #1018 (Pike RoboDevils)
Team Role: Programmer
 
Join Date: Feb 2017
Rookie Year: 2016
Location: Indianapolis
Posts: 192
firecrafty is a splendid one to beholdfirecrafty is a splendid one to beholdfirecrafty is a splendid one to beholdfirecrafty is a splendid one to beholdfirecrafty is a splendid one to beholdfirecrafty is a splendid one to beholdfirecrafty is a splendid one to beholdfirecrafty is a splendid one to behold
Re: Using Talon closed loop position mode

Does the last point in your motion profile have isLast set to true? Setting isLast to true will make the Talon hold the final point (the point marked isLast) until you tell it not to.
__________________
"Programming is a science. Writing beautiful code is an art."
Any views I express are my own and do not necessarily reflect those of my team.
Reply With Quote
  #8   Spotlight this post!  
Unread 02-13-2018, 11:57 AM
ozdave ozdave is offline
Registered User
FRC #6072 (Triton Tech)
Team Role: Mentor
 
Join Date: Nov 2017
Rookie Year: 2017
Location: Newport Beach, CA, USA
Posts: 61
ozdave is an unknown quantity at this point
Re: Using Talon closed loop position mode

That is interesting - did not realize that. Yes, we have it marked as isLast.

Following the examples on GitHub, we had been changing the mode of the talon at the end of the profile. So do you just leave it alone?

We will test this later today.
Reply With Quote
  #9   Spotlight this post!  
Unread 02-13-2018, 12:19 PM
nickbrickmaster nickbrickmaster is offline
T-shirt connoisseur
AKA: Nick Schatz
no team
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Eagan MN
Posts: 414
nickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond reputenickbrickmaster has a reputation beyond repute
Re: Using Talon closed loop position mode

Have you looked at the Talon self-test mode to determine if it is in fact in position mode, what error it is seeing, and what, if at all, output it is giving?
__________________
Proceed as if success is inevitable.
Reply With Quote
  #10   Spotlight this post!  
Unread 02-13-2018, 12:21 PM
ozdave ozdave is offline
Registered User
FRC #6072 (Triton Tech)
Team Role: Mentor
 
Join Date: Nov 2017
Rookie Year: 2017
Location: Newport Beach, CA, USA
Posts: 61
ozdave is an unknown quantity at this point
Re: Using Talon closed loop position mode

You mean via the web interface? No had not tried that - will do so. Thanks

So your understanding is that it should maintain position against disturbance, without us repeatedly calling?
Reply With Quote
  #11   Spotlight this post!  
Unread 02-13-2018, 01:54 PM
rlance's Avatar
rlance rlance is offline
Registered User
FRC #5550
 
Join Date: Dec 2015
Location: Bethany, OK
Posts: 130
rlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond reputerlance has a reputation beyond repute
Re: Using Talon closed loop position mode

Quote:
Originally Posted by ozdave View Post
Does the system hold position once it reaches it?

The issue we are concerned with is holding the position of the elevator steady once the target position is reached.
Yes, it holds the position. It is possible that our elevator weight or gearing or friction helps with that because when power is cut to the system it lowers on its own at a fairly slow pace.
Reply With Quote
  #12   Spotlight this post!  
Unread 02-13-2018, 01:59 PM
ozdave ozdave is offline
Registered User
FRC #6072 (Triton Tech)
Team Role: Mentor
 
Join Date: Nov 2017
Rookie Year: 2017
Location: Newport Beach, CA, USA
Posts: 61
ozdave is an unknown quantity at this point
Re: Using Talon closed loop position mode

Thanks - will let you know how we go
Reply With Quote
  #13   Spotlight this post!  
Unread 02-15-2018, 02:18 PM
tonypan tonypan is offline
Registered User
AKA: Minxing Pan
FRC #3175 (Knight Vision)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2016
Location: Detroit
Posts: 33
tonypan is an unknown quantity at this point
Re: Using Talon closed loop position mode

My team is trying to use Talon SRX and manetic Encoder to control the scissor lift in a position close loop. The encoder can send the position correctly through the smart dashboard and the talon can drive normally as well. But the set(ControlMode.position, targetPosition) function will not move.
Code:
/*
		 * Scissor lift on POV levels POV 0: loweest (pick up, vault running) POV 90:
		 * switch level POV 180: scale (highest 6ft) POV 270: climb
		 */
		if (operator.getPOV() == 0) {
			leftScissor.set(ControlMode.Position, 0);
			SmartDashboard.putString("Scissor Lift", "Ground Level");
		} else if (operator.getPOV() == 90) {
			leftScissor.set(ControlMode.Position, SWITCH * 4096.0);
			SmartDashboard.putString("Scissor Lift", "Switch Level");
		} else if (operator.getPOV() == 180) {
			leftScissor.set(ControlMode.Position, SCALE * 4096.0);
			SmartDashboard.putString("Scissor Lift", "Scale Level");
		} else if (operator.getPOV() == 270) {
			leftScissor.set(ControlMode.Position, CLIMB * 4096.0);
			SmartDashboard.putString("Scissor Lift", "Climb Level");
		}
Reply With Quote
Reply


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:38 AM.

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


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