Go to Post And you said it would be an easy game hint... Time to break out the N-Spire and do some number crunching - CalTran [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 23-03-2016, 15:47
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 212
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
PID controller with camera.

Hi, I am working on a command that auto aligns to the center of the goal by rotation and we are getting some overshoot with it so I am implementing a PID control loop. However, the PIDController class takes in a PIDSource and outputs a PIDOutput, so I wrote wrapper classes to write and read raw values (like ints and floats) to a PIDOutput and PIDSource. However, when I call the Enable function on the controller, it instantly crashes. I don't really know why this is happening.

My code is here:
https://github.com/team2053tigertron...lignCenter.cpp

Any help is appreciated,
Drew

Last edited by jreneew2 : 23-03-2016 at 15:57.
  #2   Spotlight this post!  
Unread 23-03-2016, 16:11
nowireless nowireless is offline
Registered User
AKA: Ryan Sjostrand
FRC #3081 (Robo Eagles)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Bloomington, MN
Posts: 4
nowireless is an unknown quantity at this point
Re: PID controller with camera.

It looks like you are using the wrong shared pointer, both Robot and RobotMap they have a shared pointer named visionAlignPID. It looks like the one in Robot does not contain a pointer, while in RobotMap you set the visionAlignPID shared pointer to a PIDController.

I think you should change
Code:
 Robot::visionAlignPID.get()->Enable();
to
Code:
RobotMap::visionAlignPID.get()->Enable();
  #3   Spotlight this post!  
Unread 23-03-2016, 16:27
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 212
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
Re: PID controller with camera.

Alright, it doesn't instantly crash now, but when I call PIDWrite() it crashes. Am I inheriting the PIDSource wrong?
  #4   Spotlight this post!  
Unread 23-03-2016, 16:27
Ozuru's Avatar
Ozuru Ozuru is offline
It's always the programmer's fault.
no team
 
Join Date: May 2013
Rookie Year: 2010
Location: Earth
Posts: 268
Ozuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to behold
Re: PID controller with camera.

It looks like you're using a system that centers itself in the pixel. Jared Russel has talked before about why this isn't a good idea, but the general complaint is that a camera has too high of a latency (even when plugged in via USB or equivalent) to be used in a PID loop. Instead of calculating the offset from the center, try and calculate values that might help you align. The distance, azimuth, and altitude are values that you might be most concerned about.
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 18:33.

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