Go to Post "Rookie" just means you are new to the game, not that your team isn't as skilled as many already in the competition. - Bill Moore [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 27-01-2016, 22:29
ahartnet's Avatar
ahartnet ahartnet is offline
Registered User
AKA: Andrew Hartnett
FRC #5414 (Pearadox)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2005
Location: Houston, Texas
Posts: 202
ahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond repute
Re: LifeCam USBCamera changing settings from Java

Robert,

I was actually able to get almost exactly what you have to work. The only difference is I made sure to update the camera before opening the camera and starting the capture.

Code:
public class Robot extends IterativeRobot {

    Preferences prefs;
    CameraServer server;
    USBCamera targetCam;
    public static int g_exp;

    /**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public void robotInit() {

    	prefs = Preferences.getInstance();
    	g_exp = prefs.getInt("exp", 1);
    	SmartDashboard.putNumber("Exp", g_exp);
    	
    	targetCam = new USBCamera("cam0");
    	targetCam.setBrightness(5);
//     We actually still had trouble setting exposure. It didn't actually like values 0-100. We found that setting the brightness did enough though.
//    	targetCam.setExposureManual(g_exp); 
    	targetCam.updateSettings();
    	
    	SmartDashboard.putNumber("Brightness", targetCam.getBrightness());
    	
    	targetCam.openCamera();
    	
	server = CameraServer.getInstance();
        server.setQuality(50);

        server.startAutomaticCapture(targetCam);
    }
We then don't get anything in the teleopPeriodic. In order to change the parameter for brightness (or exposure) you could change the value on the smart dashboard, click on the tab 2nd from the top on the left side of the driver station and click robot code restart (or whatever it's called). You don't need to do a full reboot.

Now if you find anyway to turn off the autofocus...that'd be handy.
__________________
Team 451 The Cat Attack, Student Alumni (2005)
Team 1646 Precision Guessworks, Mentor (2006-2008)
Team 2936 Gatorzillas, Mentor (2011-2014)
Team 5414 Pearadox, Mentor (2015-Present)
 


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:28.

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