Go to Post What has happened has happened. Humans were involved, mistakes made. Clarification will come... - Wetzel [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 15-01-2013, 20:14
rudun's Avatar
rudun rudun is offline
Registered User
FRC #0496 (Royals)
Team Role: Coach
 
Join Date: Jan 2009
Rookie Year: 2005
Location: Babylon
Posts: 47
rudun is an unknown quantity at this point
Converting between camera normalized data and servo

I have been trying to have a servo attached to the camera x axis twist to turn it so the center image is the center of the target. Since the normalized output in the vision target is a value that shows it to the left or right of the center of the image, you should be able to take that and convert it to the scale a servo uses. Then make changes to the servo until it and the target are centered.

The issue I am having is figuring out how to normalize the ranges. I have gotten this far, I do not think I am lost, but that I am just not understanding the math, or the proper procedure for determining it. Suggestions or help would be greatly appreciated.
I tried following the math on this page http://stackoverflow.com/questions/1471370/normalizing-from-0-5-1-to-0-1
not sure if this is the right method or not
Code:
            double servoChange = ((report.center_mass_x_normalized-(-1))/2);
                        System.out.println("Servo Change: " + servoChange);
                        double servoInput = CameraX.get()-servoChange;
                               if(servoChange > 1) {
                        servoChange = 1; }
                    else if(servoChange < 0) {
                        servoChange = 0;
                    }
                        CameraX.set(servoInput);

Last edited by rudun : 15-01-2013 at 20:23.
  #2   Spotlight this post!  
Unread 15-01-2013, 21:38
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Converting between camera normalized data and servo

It seems odd that you are pinning servoChange but don't use the value and use servoInput instead.

The other variable is how the servo is mounted. It could be that the serverInput should be the cameraS.get() + servoChange.

Greg McKaskle
  #3   Spotlight this post!  
Unread 16-01-2013, 14:53
rudun's Avatar
rudun rudun is offline
Registered User
FRC #0496 (Royals)
Team Role: Coach
 
Join Date: Jan 2009
Rookie Year: 2005
Location: Babylon
Posts: 47
rudun is an unknown quantity at this point
Re: Converting between camera normalized data and servo

Ok, reworked it a little. What i am getting for a servo change is usually over 1 at current testing. So i think i am back to trying to get the values scaled correctly.

Code:
                        servoChange = ((report.center_mass_x_normalized-(-1))/2);
                        
                        servoChange += CameraX.get();
                        System.out.println(servoChange);
                        CameraX.set(servoChange);
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 02:31.

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