|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
||||
|
||||
|
Recording with the Camera
Our team was curious on whether or not the 2009 robot's camera could record while it was on to either a TV tape or computer wirlessly, using Wind River. If it is possible, we were wondering on how we would go about doing this. If it is not possible to do it wirelessly is it possible to do it hooked up with ethernet cord, and tether? TY for any help!
![]() |
|
#2
|
|||||
|
|||||
|
Re: Recording with the Camera
Quote:
-RC |
|
#3
|
|||
|
|||
|
Re: Recording with the Camera
I know for a fact that one of the martian teams used the camera to record "video" (couple of pictures per second), and reviewed it after each match. As to whether the "video" was stored on the robot (and downloaded after the match), or recorded on a laptop during the match, I don't know.
|
|
#4
|
|||
|
|||
|
Re: Recording with the Camera
Doesn't the default LabVIEW Dashboard (for the Driver Station "display") show real-time video (regardless of whether you're using LabVIEW or C on the cRIO)? You should be able to modify the LabVIEW Dashboard to store the images and somehow stitch them together later on.
|
|
#5
|
|||
|
|||
|
Re: Recording with the Camera
The simplest way to record camera video is to stream it to a computer and use a motion screen capture utility to grab it. At competitons, or situations where streaming video back to PC is impractical, you can also use the "image write" function to record each frame as a sperate image to the cRIO's flash, and then FTP into it and use a program to batch-convert the images into a video.
|
|
#6
|
||||
|
||||
|
Re: Recording with the Camera
Quote:
NOTE: yes I then did try the Dashboard with the robot on LabVIEW code, and it would show on my laptop. However, our team would like to keep it in Wind River, so we can still have all the functions that the robot does, instead of re-imaging to LabVIEW, and only having the default operations. Quote:
] |
|
#7
|
||||||
|
||||||
|
Re: Recording with the Camera
Quote:
|
|
#8
|
||||
|
||||
|
Re: Recording with the Camera
No we didn't try the PCVideoServer class. But now you bring it up, do you use the PCVideoServer class to record or take images too?
|
|
#9
|
|||
|
|||
|
Re: Recording with the Camera
The PCVideoServer class sends images on a C++ cRIO back to the dashboard. The LV framework had the equivalent code in by default, but because of deadlines, it needed to be added to the C++ code.
Once the images are send to the dashboard, you can modify the LV dashboard code to take the jpgs and add them to an AVI using the vision VIs on the PC. I'm not at a PC, but I suspect there is an AVI building example if you search for it. Greg McKaskle |
|
#10
|
||||
|
||||
|
Re: Recording with the Camera
Well thank you for all the input on the topic, unfortunately we can't test it tomorrow because we are in the midst of looking for our dongle, and we are using it this Thursday (that is the camera recording thing), so I have to program or do whatever to make it work all in my head for our presentation on that day, so I have no trial and error leeway (this is to get a team started in FLL).
![]() |
|
#11
|
|||
|
|||
|
Re: Recording with the Camera
Quote:
"Image write" is one of the more obscure FRC vision functions that lets you store an Image object acquired from the camera to a file on flash(you can read more about it in the vision api docs) FTP stands for File Transfer Protocol. which, as you might expect, is a system for transferring files between computers. the cRIO can act as an FTP server, meaning that it allows a remote computer to accsess it's internal flash memory. This means that if you use the image write function to record frames, you can use FTP to retrieve the images from the cRIO's memory and animate them. |
|
#12
|
||||
|
||||
|
Re: Recording with the Camera
1318 did some recording, but how/when/with what, you'll have to contact username darkmessenger88 directly (he's the programmer).
http://www.chiefdelphi.com/forums/showpost.php?p=853549 |
|
#13
|
||||
|
||||
|
Re: Recording with the Camera
BTW, I think I forgot to mention that we wanted to record while in teleop mode, I don't think it would make a difference, but can the recording only work in autonomous, or both autonomous and teleop??
|
|
#14
|
|||
|
|||
|
Re: Recording with the Camera
The mode has no effect.
Greg McKaskle |
|
#15
|
||||
|
||||
|
Re: Recording with the Camera
Okay I'm not sure about this code in the PCVideoServer, so if you could give it a glance over tell me any fixes that are apparent to you, it would be great.
NOTE: Look for the line: //----------------------INSERTED CAMERA CODE---------------------- Those are the places I put the camera code, I put it in 3 times: Once outside my infinite while loop [used for a momentary switch], and two times in the infinite while loop once when the button state of the trigger = 1 and once when the button state of the trigger = 0. Please look at the insertion points, and tell me of any corrections that need to be made. [Side Note: I just copied the code out of RobotMain() in the CamertoDashboardExample. Code:
#include "WPILib.h"
#include "vxWorks.h"
#include "AxisCamera.h"
#include "BaeUtilities.h"
#include "FrcError.h"
#include "PCVideoServer.h"
#include "SimpleRobot.h"
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick leftstick; //left joystick initialization
Joystick rightstick; //right joystick initialization
Jaguar roller_left; //Jaguar inittialization for left roller SC
Jaguar roller_right; //Jaguar inittialization for right roller SC
Victor elevator_left; //Victor inittialization for left elevator SC
Victor elevator_right; //Victor initialization for right elevator SC
Servo servo_left; //Servo initializtion for the left servo
Servo servo_right; //Servo intializtion for the right servo
public:
RobotDemo(void):
myRobot(1, 2), // these must be initialized in the same order
leftstick(1),
rightstick(2),
roller_left(3),
roller_right(4),
elevator_left(5),
elevator_right(6),
servo_left(7),
servo_right(8)
{
GetWatchdog().SetExpiration(100);
}
void OperatorControl(void)
{
GetWatchdog().SetEnabled(true);
GetWatchdog().Feed();
// sets all the button states
unsigned char ball_button_state = 1;
unsigned char elevator = 1;
while (IsOperatorControl())
{
GetWatchdog().Feed();
roller_left.Set(1.0);
roller_right.Set(-1.0);
elevator_left.Set(-0.35);
elevator_right.Set(0.35);
//Elevator on off button
//------------------INSERTED CAMERA CODE-----------------------
SetDebugFlag ( DEBUG_SCREEN_ONLY ) ;
/* start camera task */
if (StartCameraTask(13, 0, k320x240, ROT_0) == -1) {
dprintf( LOG_ERROR,"Failed to spawn camera task; exiting. Error code %s",
GetVisionErrorText(GetLastVisionError()) );
}
dprintf(LOG_DEBUG,"Waiting for camera to initialize");
Wait(2.0);
// start up the task serving images to PC
dprintf(LOG_DEBUG,"Starting image server");
PCVideoServer pc;
dprintf(LOG_DEBUG,"Image server Running");
// this code demonstates stopping and restarting the PC image server
Wait(60.0);
dprintf(LOG_DEBUG, "Stopping image server");
pc.Stop();
Wait(10.0);
dprintf(LOG_DEBUG, "Starting image server again");
pc.Start();
Wait(999.0);
dprintf(LOG_DEBUG, "Stopping image server");
StopImageToPCServer(); //can use c or cpp call to stop
dprintf(LOG_DEBUG, "CameraToDashboardExample ending");
//-----------------------------------------------------------
if(leftstick.GetRawButton(6) != elevator)
{
if(leftstick.GetRawButton(6) == 1)
{
elevator_left.Set(0.0);
elevator_right.Set(0.0);
roller_left.Set(0.0);
roller_right.Set(0.0);
}
else
{
elevator_left.Set(-0.35);
elevator_right.Set(0.35);
roller_left.Set(1.0);
roller_right.Set(-1.0);
}
elevator = leftstick.GetRawButton(6);
}
//hold trigger to release balls, let go to bring string back up
while(rightstick.GetRawButton(1) != ball_button_state)
{
GetWatchdog().Feed();
myRobot.TankDrive(-leftstick.GetY(), -rightstick.GetY());
//starts an infinite while loop to have a mometary switch
//so all code needs to be put in the loop since it never breaks out
while(rightstick.GetRawButton(1) == 1)
{
GetWatchdog().Feed();
//----------------------INSERTED CAMERA CODE----------------------
SetDebugFlag ( DEBUG_SCREEN_ONLY ) ;
/* start camera task */
if (StartCameraTask(13, 0, k320x240, ROT_0) == -1) {
dprintf( LOG_ERROR,"Failed to spawn camera task; exiting. Error code %s",
GetVisionErrorText(GetLastVisionError()) );
}
dprintf(LOG_DEBUG,"Waiting for camera to initialize");
Wait(2.0);
// start up the task serving images to PC
dprintf(LOG_DEBUG,"Starting image server");
PCVideoServer pc;
dprintf(LOG_DEBUG,"Image server Running");
// this code demonstates stopping and restarting the PC image server
Wait(60.0);
dprintf(LOG_DEBUG, "Stopping image server");
pc.Stop();
Wait(10.0);
dprintf(LOG_DEBUG, "Starting image server again");
pc.Start();
Wait(999.0);
dprintf(LOG_DEBUG, "Stopping image server");
StopImageToPCServer(); //can use c or cpp call to stop
dprintf(LOG_DEBUG, "CameraToDashboardExample ending");
//-----------------------------------------------------------------------------
//if button is pressed realease balls if angles below met
servo_right.SetAngle(0);
servo_left.SetAngle(180);
myRobot.TankDrive(-leftstick.GetY(), -rightstick.GetY());
roller_left.Set(1.0);
roller_right.Set(-1.0);
elevator_left.Set(-0.35);
elevator_right.Set(0.35);
if(leftstick.GetRawButton(6) != elevator)
{
if(leftstick.GetRawButton(6) == 1)
{
elevator_left.Set(0.0);
elevator_right.Set(0.0);
roller_left.Set(0.0);
roller_right.Set(0.0);
}
else
{
elevator_left.Set(-0.35);
elevator_right.Set(0.35);
roller_left.Set(1.0);
roller_right.Set(-1.0);
}
elevator = leftstick.GetRawButton(6);
}
while(rightstick.GetRawButton(1) == 0)
{
GetWatchdog().Feed();
//----------------------INSERTED CAMERA CODE----------------------
SetDebugFlag ( DEBUG_SCREEN_ONLY ) ;
/* start camera task */
if (StartCameraTask(13, 0, k320x240, ROT_0) == -1) {
dprintf( LOG_ERROR,"Failed to spawn camera task; exiting. Error code %s",
GetVisionErrorText(GetLastVisionError()) );
}
dprintf(LOG_DEBUG,"Waiting for camera to initialize");
Wait(2.0);
// start up the task serving images to PC
dprintf(LOG_DEBUG,"Starting image server");
PCVideoServer pc;
dprintf(LOG_DEBUG,"Image server Running");
// this code demonstates stopping and restarting the PC image server
Wait(60.0);
dprintf(LOG_DEBUG, "Stopping image server");
pc.Stop();
Wait(10.0);
dprintf(LOG_DEBUG, "Starting image server again");
pc.Start();
Wait(999.0);
dprintf(LOG_DEBUG, "Stopping image server");
StopImageToPCServer(); //can use c or cpp call to stop
dprintf(LOG_DEBUG, "CameraToDashboardExample ending");
//-----------------------------------------------------------------------------
servo_right.SetAngle(180);
servo_left.SetAngle(0);
myRobot.TankDrive(-leftstick.GetY(), -rightstick.GetY());
roller_left.Set(1.0);
roller_right.Set(-1.0);
elevator_left.Set(-0.35);
elevator_right.Set(0.35);
if(leftstick.GetRawButton(6) != elevator)
{
if(leftstick.GetRawButton(6) == 1)
{
elevator_left.Set(0.0);
elevator_right.Set(0.0);
roller_left.Set(0.0);
roller_right.Set(0.0);
}
else
{
elevator_left.Set(-0.35);
elevator_right.Set(0.35);
roller_left.Set(1.0);
roller_right.Set(-1.0);
}
elevator = leftstick.GetRawButton(6);
}
if(rightstick.GetRawButton(1) == 1){
break;
}
}
}
ball_button_state = rightstick.GetRawButton(1);
}
GetWatchdog().Feed();
//All the possible drives with 2 joysticks, and 2 speed controllers
myRobot.TankDrive(-leftstick.GetY(), -rightstick.GetY());
}
}
};
START_ROBOT_CLASS(RobotDemo);
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with the camera | frcchile | NI LabVIEW | 5 | 11-02-2009 20:20 |
| PROBLEMS WITH THE CAMERA | RDD | Programming | 2 | 18-02-2007 15:12 |
| problems mounting the camera to the 'bot with the default servo/mount set up | Redneck | Programming | 0 | 16-02-2005 20:53 |
| I need help with the camera | WesleyBalmer | Programming | 7 | 15-01-2005 17:25 |
| Problem with recording, help | Animentor | 3D Animation and Competition | 2 | 22-01-2003 18:21 |