View Single Post
  #2   Spotlight this post!  
Unread 28-11-2012, 01:42
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 431
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Programming for the Camera

My guess would be that the axis camera isn't at the IP that the Java program is looking at.

So the example makes the camera as follows:
Axiscamera camera; <-- creates an instance in the class body

camera = AxisCamera.getInstance(); <-- initializes it in the constructor



The getInstance() method creates a new camera instance if one doesn't already exist. The code in the library is as follows.
Code:
/**
     * Get a reference to the AxisCamera, or initialize the AxisCamera if it
     * has not yet been initialized. By default this will connect to a camera
     * with an IP address of 10.x.y.11 with the preference that the camera be
     * connected to the Ethernet switch on the robot rather than port 2 of the
     * 8-slot cRIO.
     * @return A reference to the AxisCamera.
     */
    public static synchronized AxisCamera getInstance() {
        if (m_instance == null) {
            DriverStation.getInstance().waitForData();
            int teamNumber = DriverStation.getInstance().getTeamNumber();
            String address = "10."+(teamNumber/100)+"."+(teamNumber%100)+".11";
            m_instance = new AxisCamera(address);
        }
        return m_instance;
    }
So by default its going to use the IP 10.XX.YY.11 where XXYY is your team number (as set in the java project). Example team 2168 would yield the ip: 10.21.68.11.

The getInstance method is overloaded. So if you don't want to change the IP of the camera, you should be able to define it by modifying the getInstance call in your example code as shown below
Code:
camera = AxisCamera.getInstance("192.168.0.90");
Hope that helps.
__________________
http://team2168.org
Reply With Quote