|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Problems with USB camera(Lifecam)
Alan,
We tried what you said but we still are getting the following errors
Last edited by PredaFran : 03-09-2016 at 02:47 PM. |
|
#2
|
|||||
|
|||||
|
Re: Problems with USB camera(Lifecam)
It sounds like you might have fumbled some of the commas or semicolons when you moved the cam0(0) line. Can you post the part of the code that you modified?
I'm assuming you retyped the errors into the post by hand rather than copying them, because of the missing zero in cam(0). If you actually did copy and paste, then it seems you introduced a misspelling it when you moved it in your code. |
|
#3
|
|||
|
|||
|
Re: Problems with USB camera(Lifecam)
I have double checked the comas and semicolons and nothing seems weird, but you are welcome to check if you want to.
Code:
#include "WPILib.h"
class Robot: public SampleRobot
{
// robot drive system
RobotDrive ArcadeRobot;
Joystick joy, joy2;
Servo ServoX, ServoY;
double servoIn, servoIn2;
VictorSP intake;
TalonSRX flywheel;
USBCamera cam0;
public:
Robot() :
ArcadeRobot(0,1),
joy(0),
joy2(1),
ServoX(5),
ServoY(4),
intake(3),
flywheel(2),
cam0(0)
{
cam0.SetWhiteBalanceAuto();
cam0.SetExposureAuto();
flywheel.SetSafetyEnabled(false);
intake.SetSafetyEnabled(false);
ArcadeRobot.SetExpiration(0.1);
}
/**
* Runs the motors with arcade steering.
*/
void OperatorControl()
{
while (IsOperatorControl() && IsEnabled())
{
if (joy2.GetRawButton(3))
{
//ShootLowGoal();
intake.Set(-1.0);
}
if (joy2.GetRawButton(5))
{
//ShootHighGoal();
intake.Set(1.0);
}
if (joy2.GetRawButton(4))
{
//ShootLowGoal();
flywheel.Set(-1.0);
}
if (joy2.GetRawButton(6))
{
//ShootHighGoal();
flywheel.Set(1.0);
}
servoIn = (joy.GetY() +1)*0.5;
servoIn2 = (joy.GetX() +1)*0.5;
ServoX.Set(servoIn);
ServoY.Set(servoIn2);
ArcadeRobot.ArcadeDrive(joy2);
Wait(0.005);
}
}
};
START_ROBOT_CLASS(Robot)
|
|
#4
|
|||
|
|||
|
Re: Problems with USB camera(Lifecam)
Shouldn't the USBCamera constructor called with cam0("cam0", true) ?
|
|
#5
|
|||||
|
|||||
|
Re: Problems with USB camera(Lifecam)
Quote:
Quote:
USBCamera (std::string name, bool useJpeg) http://first.wpi.edu/FRC/roborio/rel...USBCamera.html Are you just trying to view the cam on dashboard, or are you trying vision processing? If you just want to view on dashboard, it is probably easier to just use CameraServer. http://first.wpi.edu/FRC/roborio/rel...eraServer.html |
|
#6
|
|||
|
|||
|
Re: Problems with USB camera(Lifecam)
Check your CPU usage. Ours skyrocketed when we enabled the camera, no matter the resolution / fps. We had two incidents on the field when we could not drive, but other motors worked just fine. It turns out we were hovering at 110% cpu usage for all of our matches, and that somehow disabled the drivetrain. Our rudimentary solution was to use a raspberry pi with MJPG streamer to get the feed to our driverstation.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|