Go to Post I'm very excited for this year, because robots. - pyrtle [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 03-08-2016, 12:34 AM
PredaFran PredaFran is offline
Amateur Programmer
AKA: Francisco
FRC #5285 (Sea Kings Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: California
Posts: 25
PredaFran is an unknown quantity at this point
Problems with USB camera(Lifecam)

Hey there,
We have been experiencing problems trying to integrate the USB camera into our actual driving code. The LifeCam code disables the driving code, specifically the motor controllers, and we are not exactly sure of why. What we have been trying to troubleshoot it for the last week, without any considerable success. Any help is greatly appreciated.




Code:
#include "WPILib.h"
/**
 * This is a demo program showing the use of the RobotDrive class.
 * The SampleRobot 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.
 *
 * WARNING: While it may look like a good choice to use for your code if you're inexperienced,
 * don't. Unless you know what you are doing, complex code will be much more difficult under
 * this system. Use IterativeRobot or Command-Based instead if you're new.
 */
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),
		cam0(0),
		joy(0),
			joy2(1),
			ServoX(5),
			ServoY(4),
			intake(3),
			flywheel(2)

	{
		    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)
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:26 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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