Go to Post I'm going through waves of excitment and panic all at the same time. - je2164 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-02-2015, 19:03
kmrchiefdelphi kmrchiefdelphi is offline
Registered User
FRC #3950 (Robo Gym)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: North Shore High School
Posts: 5
kmrchiefdelphi is an unknown quantity at this point
CANTalon SetPosition and GetIAccum issues

Hi. We are controlling our drive system using Talon SRX's (firmware 1.1) for control and have the following two issues:
1. Calling SetPosition(0) does not set the encoder position to zero. If we interrogate the encoder (using GetPosition()) after calling SetPosition(0) and after a short wait (>100ms) it returns the value when the encoder was last stopped. We have a Talon SRX with a previous firmware (don't have the rev number) and it is working as expected.

2. We intend to control our drive subsystem using PID and have worked out the values for P, I and D, but we don't understand the scale of the value that is being returned by the method GetIAccum() when running. In our test case, on the CANTalon object, we call Set(10000) and the first IAccum logged, after 100 ms, is ~ 4.5x10^6. Can someone explain why such a large value?

Thanks in advance.
  #2   Spotlight this post!  
Unread 08-02-2015, 21:47
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: 531
ozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond repute
Re: CANTalon SetPosition and GetIAccum issues

1.
SetPosition() seems to work with my setup. If you're sensor is not quadrature be sure to select it using programming API. See section 7 in Talon SRX software reference manual. Tested with firm 1.1. What does the self-test say?

Code:
#include "WPILib.h"
class Robot: public IterativeRobot
{
private:
	CANTalon _t1;
	CANTalon _t2;
	CANTalon _t3;
	CANTalon _t4;
	Joystick _j1;
	bool _lastBtn1;
public:
	Robot() : _t1(1),_t2(2),_t3(3),_t4(4),_j1(1), _lastBtn1(false)
	{
	}
	void TeleopPeriodic()
	{
		float y  = -1 * _j1.GetAxis(Joystick::kYAxis);
		_t1.Set(y);
		_t2.Set(y);
		_t3.Set(y);
		_t4.Set(y);

		bool btn1 = _j1.GetRawButton(1);
		if(btn1 && !_lastBtn1)
			_t1.SetPosition(0);
		_lastBtn1 = btn1;

		long encPos = _t1.GetPosition();

		{/* every 200ms */
			static int loops = 0;
			if(++loops>= (200/20) ){
				loops = 0;

				std::cout << "EncPos:" << encPos << std::endl;

			}
		}
	}

};
START_ROBOT_CLASS(Robot);


2. The units are explained in section 17 in the Talon SRX software reference manual.
Closed Thread


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 21:03.

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