Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   absolute minimum for displaying image on dashboard (http://www.chiefdelphi.com/forums/showthread.php?t=82198)

kennypu 08-02-2010 18:59

absolute minimum for displaying image on dashboard
 
Hey,
I was going to finally try and see if I can get some image showing from the camera, and I was wondering, what do I basicly need for the absolute minimum to show the image on the dashboard? So if I were to just copy paste code from the 2010 vision sample, what would I copy paste into my own program to get the images showing? Thanks in advance.

Radical Pi 08-02-2010 19:36

Re: absolute minimum for displaying image on dashboard
 
Calling "AxisCamera::GetInstance();" starts up the task that broadcasts the video to the Dashboard. Put that anywhere in your code and it should run.

kennypu 08-02-2010 20:19

Re: absolute minimum for displaying image on dashboard
 
really? Thats all you need? I was expecting more. I'm assuming that that is merely just to show the camera images, and to actually set exposure, etc. we have to create an axis camera object first? Thank you though, That would be a lot simpler than what I was trying to do.

Radical Pi 08-02-2010 20:32

Re: absolute minimum for displaying image on dashboard
 
The return from that function is an AxisCamera& object, so you want to just use that for the object. Anything that has a GetInstance function should never be created by a user program. Always call GetInstance to create your copy of the object

Teh1337Bix 09-02-2010 03:58

Re: absolute minimum for displaying image on dashboard
 
Anyone sure this works?

kennypu 09-02-2010 19:12

Re: absolute minimum for displaying image on dashboard
 
Quote:

Originally Posted by Teh1337Bix (Post 916223)
Anyone sure this works?

I tried it and no results yet. My DS is updated, and camera should be set correctly.

byteit101 09-02-2010 20:30

Re: absolute minimum for displaying image on dashboard
 
You can also use PCVideoServer (you'll need to include a file, I think its "Vision\PCVideoServer.h")
Code:

class robotclass : ....
{
...
  PCVideoServer pcvs;
public:
    robotclass:
      .....
      ,pcvs()
    {
    ...
    }

......

}


Radical Pi 09-02-2010 21:47

Re: absolute minimum for displaying image on dashboard
 
Quote:

Originally Posted by kennypu (Post 916643)
I tried it and no results yet. My DS is updated, and camera should be set correctly.

Check the console for errors. If the camera is called for an init before the camera is fully booted then the vision code crashes.

slavik262 10-02-2010 09:33

Re: absolute minimum for displaying image on dashboard
 
Quote:

Originally Posted by byteit101 (Post 916701)
You can also use PCVideoServer (you'll need to include a file, I think its "Vision\PCVideoServer.h")
Code:

class robotclass : ....
{
...
  PCVideoServer pcvs;
public:
    robotclass:
      .....
      ,pcvs()
    {
    ...
    }

......

}


A quick note on PCVideoServer:

My team found out the hard way that the camera, when initialized with GetInstance(), starts its own PCVideoServer. Attempting to start a second one blocks the entire thread indefinitely.

Kohala2460 10-02-2010 13:35

Re: absolute minimum for displaying image on dashboard
 
Would the GetInstance(); function be included in the wpilib1764 or do i need to download the Workbench Software update from http://first.wpi.edu/FRC/frccupdates.html

Thankyou, Hopefully can get this going before competition

kennypu 10-02-2010 14:45

Re: absolute minimum for displaying image on dashboard
 
Quote:

Originally Posted by Radical Pi (Post 916751)
Check the console for errors. If the camera is called for an init before the camera is fully booted then the vision code crashes.

when the axis camera has a solid green ring, that means its fully initialized correct? It is always like that so I'm assuming that the initialization is not the problem. I will check the errors though.

EDIT:
I still cannot get the camera to work. first of all, is it possible to access the camera through browser (192.168.0.90) if its connected to the cRIO, and classmate connected to cRIO through the wireless bridge?
secondly, when the cRIO and axis cam is connected, I don't see any activity in the ethernet port. The bridge's port shows the green and orange LEDs going wild, but for the axis cam, there is no light at all. Is this normal? or should there be some type of activity.

SteveGarward 10-02-2010 23:17

Re: absolute minimum for displaying image on dashboard
 
Team 3132 got the camera working last night.

We had gone and changed the IP address of the camera by mistake to the 10. subnet, so the code couldn't communicate with the camera. After resetting the camera IP address, and with the FRC user account configured (with password FRC) it worked with the following line put in our robot class constructor:
AxisCamera &myCamera = AxisCamera::getInstance();

kennypu 13-02-2010 20:34

Re: absolute minimum for displaying image on dashboard
 
hmm..I still can't get the camera working. Rather, now I'm getting the 'watch dog not fed' message in the DS. Does anybody have a suggestion? I have set up the camera, my DS is up-to-date, the only thing I havn't done is the recent update of the workbench, but I am sure that is not necessary as that is for the DS LCD.
Here is my code btw:
Code:

#include "WPILib.h"

#include "Vision/AxisCamera2010.h"
#include "Vision/HSLImage.h"
#include "PIDController.h"
#include "Gyro.h"
#include "Target.h"
#include "DashboardDataSender.h"

//#define MINIMUM_SCORE 0.01

/**
 * This is a demo program showing the use of the RobotBase class.
 * The SimpleRobot class is the base of a robot application that will automatically call your
 * Autonomous and OperatorControl methods at the right time as controlled by the switches on
 * the driver station or the field controls.
 */
bool moveState = false;
class RobotDemo : public SimpleRobot
{
        RobotDrive myRobot; // robot drive system
        Joystick stick; // only joystick
        Jaguar leftMotors;
        Jaguar rightMotors;
        Compressor *m_com;
        //DashboardDataSender *dds;
        //Gyro *gyro;
        //PIDOutput *pidOutput;

public:
        RobotDemo(void):
                myRobot(3, 4),        // these must be initialized in the same order
                stick(1),                // as they are declared above.
                leftMotors(1),
                rightMotors(2)
        {
                m_com = new Compressor(4,2);
                AxisCamera &camera = AxisCamera::getInstance();
                //dds = new DashboardDataSender();
                //gyro = new Gyro(1);
                //pidOutput = new SamplePIDOutput(myRobot);
                GetWatchdog().SetExpiration(0.1);
               
               
        }

        /**
        * Drive left & right motors for 2 seconds then stop
        */
        void Autonomous(void)
        {
                GetWatchdog().SetEnabled(false);
                myRobot.Drive(0.5, 0.0);        // drive forwards half speed
                Wait(2.0);                                //    for 2 seconds
                myRobot.Drive(0.0, 0.0);        // stop robot
        }

        /**
        * Runs the motors with arcade steering.
        */
        void OperatorControl(void)
        {
                GetWatchdog().SetEnabled(true);
                while (IsOperatorControl())
                {
                        GetWatchdog().Feed();
                        //myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
                        if(stick.GetRawButton(1))
                        {
                                moveState = 0;
                        }
                        if(stick.GetRawButton(3))
                        {
                                moveState = 1;
                        }
                        if(moveState == false)
                        {
                                //do nothing
                        }
                        if(moveState == true)
                        {
                                leftMotors.Set(-stick.GetY());
                                rightMotors.Set(stick.GetZ());
                                Wait(0.005);
                        }
                       
                        // 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.
                                        //Wait(10.0);
                                        //printf("Getting camera instance\n");
                       
                }
        }
};

START_ROBOT_CLASS(RobotDemo);

any body see any problems?

byteit101 13-02-2010 20:40

Re: absolute minimum for displaying image on dashboard
 
Quote:

Originally Posted by kennypu (Post 917222)
EDIT:
I still cannot get the camera to work. first of all, is it possible to access the camera through browser (192.168.0.90) if its connected to the cRIO, and classmate connected to cRIO through the wireless bridge?
secondly, when the cRIO and axis cam is connected, I don't see any activity in the ethernet port. The bridge's port shows the green and orange LEDs going wild, but for the axis cam, there is no light at all. Is this normal? or should there be some type of activity.

1. no, the eth ports cannot access each other directly
2. no, there should be some activity

kennypu 13-02-2010 20:51

Re: absolute minimum for displaying image on dashboard
 
thank you for the clarification byteit101.
hmm...Thats interesting then, Why won't the camera connect to the cRIO? I know its not a dead port, because I they both flash when the robot first starts up. However after that there is no activity. Does any body know why?


All times are GMT -5. The time now is 12:34.

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