Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   No camera feed (http://www.chiefdelphi.com/forums/showthread.php?t=83038)

nekng 18-02-2010 20:14

No camera feed
 
I have spent some time trying to get the camera feed to the netbook to work. I have tried the 2010ImageDemo example code as well as my own code (see below). I am fairly sure that the camera is set up correctly because it worked last year, I can access it from it's web interface and I can successfully run the camera set up tool when I plug the camera into the classmate netbook. Does any one have any ideas as to what we need to do to make it work?
Code:

#include "WPILib.h"
#include "Target.h"
#include "DashboardDataSender.h"
/**
 *2010 code
 */
class RobotDemo : public SimpleRobot
{
        Joystick leftStick;
        Joystick rightStick;
        Victor right1;
        Victor right2;
        Victor left1;
        Victor left2;
        Victor bigmotor;
        Victor babymotor;
        int loop;
        DashboardDataSender *dds;

public:
        RobotDemo():

                leftStick(1),
                rightStick(2),
                right1(2),
                right2(1),
                left1(4),
                left2(3),
                bigmotor(5),
                babymotor(6),
                loop(0)
        {
                dds = new DashboardDataSender();
                GetWatchdog().SetExpiration(0.1);
        }

        /**
        * Drive left & right motors for 2 seconds then stop
        */
        void Autonomous(void)
        {
                GetWatchdog().SetEnabled(true);
                GetWatchdog().SetExpiration(1.0);
        }

        /**
        * Runs the motors with tank steering.
        */
        void OperatorControl(void)
        {
                GetWatchdog().SetEnabled(true);
                // Create and set up a camera instance. first wait for the camera to start
                                // if the robot was just powered on. This gives the camera time to boot.
                                printf("Getting camera instance\n");
                                AxisCamera &camera = AxisCamera::GetInstance();
                                printf("Setting camera parameters\n");
                                camera.WriteResolution(AxisCamera::kResolution_320x240);
                                camera.WriteCompression(20);
                                camera.WriteBrightness(0);

                while (IsOperatorControl())
                {
                        GetWatchdog().Feed();
                        GetWatchdog().SetExpiration(1.0);
       
        //                HSLImage *image = camera.GetImage();
                        right1.Set(rightStick.GetY());
                        right2.Set(rightStick.GetY());
                        left1.Set(-leftStick.GetY());
                        left2.Set(-leftStick.GetY()); 
                       
                        if (leftStick.GetRawButton(1)==1)
                                                {
                                                        bigmotor.Set(1.0);
                                                }
                                                else
                                                {
                                                        bigmotor.Set(0.0);
                                                }
                                                if (rightStick.GetRawButton(1)==1)
                                                {
                                                        babymotor.Set(0.3);                               
                                                }
                                                else
                                                {
                                      babymotor.Set(0.0);
                                                }
                       

                        loop++;
                        printf("Loop: %d", loop);
                        dds->sendIOPortData();
                        Wait(.005);                                // wait for a motor update time
                }
        }
};

START_ROBOT_CLASS(RobotDemo);


byteit101 19-02-2010 15:02

Re: No camera feed
 
do you have v20 on the cRIO?
do you have WPILib 4.3?
did you run the Camera config tool?
are you using a crossover cable from port 2 on the cRIO to the cam?
is the camera's status ring green?

nekng 19-02-2010 17:20

Re: No camera feed
 
Yes to all of your questions.

byteit101 19-02-2010 18:30

Re: No camera feed
 
are there any firewalls on the network or computer?
did you update the dashboard to 1.1?
do you have the local dashboard option checked under setup?
have you tried installing dashboard update 1.1 on a different computer with remote dashboard selected under Driverstation setup, and correct IP?
try this code:
Code:

#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
        AxisCamera &cam;
public:
        RobotDemo():cam(AxisCamera::GetInstance())
        {
               
        }

        void Autonomous()
        {
               
        }

        void Operator Control()
        {
       
        }
};


misko 19-02-2010 20:15

Re: No camera feed
 
What accounts are configured on your camera, and what permissions for each account? i.e. in Setup on the camera, select Users, what is the output?
Do you have a user FRC?


All times are GMT -5. The time now is 13:54.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi