Go to Post "Uh-oh, it's in crazy mode again. Hit the button!" - StephLee [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-01-2013, 17:08
btreyl11 btreyl11 is offline
Registered User
FRC #1599
 
Join Date: Jan 2013
Location: Hanover County
Posts: 2
btreyl11 is an unknown quantity at this point
Exclamation Craziest Bug I'v Ever Seen--C++

My robot is completely ignoring the code we try to put on it and just doing arcade mode. We have tried the robot default code, customizing the simple robot code, rewiring to pwm's and the CAN system. We have renumbered the pwm's in various ways and tried writing the code with and without the DriverStation object. we have tried declaring this object as
Code:
myRobot = new RobotDrive(1,2);
and
Code:
myRobot = new RobotDrive(1,2,3,4);
I honestly don't know what to do and my team want to convert to lab view at this point. I really don't want to do that and would have to resign as head of programming if that happened so PLEASE HELP!!!
  #2   Spotlight this post!  
Unread 22-01-2013, 17:13
MetalJacket's Avatar
MetalJacket MetalJacket is offline
Has read the 2014 manual
AKA: Jesse Gibson
FRC #2068 (The Metal Jackets)
Team Role: CAD
 
Join Date: Oct 2012
Rookie Year: 2011
Location: Virginia
Posts: 164
MetalJacket has a spectacular aura aboutMetalJacket has a spectacular aura aboutMetalJacket has a spectacular aura about
Re: Craziest Bug I'v Ever Seen--C++

Try declaring it as
Code:
RobotDrive *myRobot = new RobotDrive( 1, 2, 3, 4 );
// this creates a pointer to the object's memory location
or
Code:
RobotDrive myRobot( 1, 2, 3, 4 );
If you use the first one and it works, whenever you use any of the object's member functions, you will have to type
Code:
myRobot->TankDrive( /* arguments */ );
as opposed to
Code:
myRobot.TankDrive( /* arguments */ );
which will work for the second version
__________________
Team Role = !artTeam
2011 - Logomotion
- Virginia Regional : Tournament Semi-Finalist, Gracious Professionalism Award
2012 - Rebound Rumble
- Chesapeake Regional : Tournament Finalist, Gracious Professionalism Award
2013 - Ultimate Ascent
- Virginia Regional : Gracious Professionalism Award

Last edited by MetalJacket : 22-01-2013 at 17:17.
  #3   Spotlight this post!  
Unread 22-01-2013, 17:13
William Kunkel William Kunkel is offline
Programming Lead
AKA: Kunkel
FRC #0422 (Mech Tech Dragons)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Richmond, VA
Posts: 94
William Kunkel is an unknown quantity at this point
Re: Craziest Bug I'v Ever Seen--C++

Can you give us more details, preferably code samples?
  #4   Spotlight this post!  
Unread 22-01-2013, 22:58
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,745
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Craziest Bug I'v Ever Seen--C++

It sounds to me like you're not actually downloading code to the robot. This could be because you have something configured wrong or simply because your code has errors and isn't successfully compiling.

First, make sure when you build your code that it's successfully compiled. There will be lots of red and error stuff in the windriver output window if it hasn't compiled.

Next, make sure you have the cRIO, your laptop, and windriver configured correctly.

Go to the Imaging your cRIO Guide and follow it step-by-step. That will make sure that your cRIO and laptop are setup correctly for C++.

Then go to the Building and Downloading a project to the cRIO Guide. I'd recommend doing "Building a robot program" and "Verify that no User Code is running". Then skip ahead to "Loading a program to run on robot startup" and follow along till the end. Running in debug mode is a little more complicated and error prone than just deploying and rebooting. Hopefully after you reboot your robot, whatever code changes you've made will now show up on your robot.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #5   Spotlight this post!  
Unread 23-01-2013, 10:07
GrimmReaper's Avatar
GrimmReaper GrimmReaper is offline
Registered User
FRC #2046 (Bear Metal)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Maple Valley, WA
Posts: 24
GrimmReaper is on a distinguished road
Re: Craziest Bug I'v Ever Seen--C++

Additionally if you think the program is getting loaded onto the cRio properly, you could also run NetConsole. Do a reboot from the drivers station while netconsole is up and watch the boot up. You might spot an error if the code is erroring. then try to enable it and try to drive - see if you get any errors on netconsole at that point.

good luck!
  #6   Spotlight this post!  
Unread 23-01-2013, 10:31
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Craziest Bug I'v Ever Seen--C++

The .out file path that Deploy is set to use is probably not the one you are compiling.
It's probably an old or default path, so check what it is in FIRST Downloader Preferences.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 23-01-2013 at 10:48.
  #7   Spotlight this post!  
Unread 23-01-2013, 13:02
btreyl11 btreyl11 is offline
Registered User
FRC #1599
 
Join Date: Jan 2013
Location: Hanover County
Posts: 2
btreyl11 is an unknown quantity at this point
Re: Craziest Bug I'v Ever Seen--C++

Well my team seems to believe it is not necessarily a problem with our code but, with deploying the c++ code itself onto the robot but yes hear is our prototype drive code:
Code:
#include <WPILib.h>
#include <Vision/RGBImage.h>
#include <Vision/BinaryImage.h>
#include <Math.h>


class RobotDemo : public IterativeRobot
{
	
	
	Joystick* Stick_xy;
	Joystick* Stick_z;
	
	Jaguar* motor1;
	Jaguar* motor2;
	Jaguar* motor3;
	Jaguar* motor4;
	Jaguar* motor5;
	
	PWM* connect1;
	PWM* connect2;
	PWM* connect3;
	PWM* connect4;
	PWM* connect5;
	
	//RobotDrive* myRobot;
	
	Servo* xCam;
	Servo* yCam;
	
	DriverStation* Station;
	DriverStationLCD* Station_out;
	
	

public:
	RobotDemo(void)		// as they are declared above.
	{
		Stick_xy = new Joystick(1);
		Stick_z = new Joystick(2);
		motor1 = new Jaguar(1);
		motor2 = new Jaguar(2);
		motor3 = new Jaguar(3);
		motor4 = new Jaguar(4);
		motor5 = new Jaguar(5);
		
		connect1 = new PWM(1,1);
		connect2 = new PWM(2,2);
		connect3 = new PWM(3,3);
		connect4 = new PWM(4,4);
		connect5 = new PWM(5,5);
		
		
		//myRobot = new RobotDrive(1,2,3,4);
		
		
		
		Station = DriverStation::GetInstance();
		Station_out = DriverStationLCD::GetInstance();
		
	}
	~RobotDemo(void)
	{
		delete Stick_xy;
		delete Stick_z;
		
		delete motor1;
		delete motor2;
		delete motor3;
		delete motor4;
		delete motor5;
		
		//delete myRobot;
	
		delete Station;
		delete Station_out;
		
		delete xCam;
		delete yCam;
	}

	void Autonomous(void)
	{
		
	}

	
	void TeleopContinuous(void)
	{
		
			
			if (Stick_xy->GetRawAxis(2)!= 0)//if the stick is moved up or down
			{
				motor1->SetSpeed(Stick_xy->GetRawAxis(1));
				motor3->SetSpeed(Stick_xy->GetRawAxis(1));
			}
			if(Stick_xy->GetRawAxis(1) != 0)//if the stick moves left or right
			{
				motor2->SetSpeed(Stick_xy->GetRawAxis(2));
				motor4->SetSpeed(Stick_xy->GetRawAxis(2));
			}
			if(Stick_z->GetRawAxis(2)!= 0)//if the z stick moves left or right
			{
				motor1->SetSpeed(Stick_z->GetRawAxis(1));
				motor3->SetSpeed(-(Stick_z->GetRawAxis(1)));
			}
			if(Stick_z->GetRawAxis(1) != 0)
			{
				motor5->SetSpeed(Stick_z->GetRawAxis(1));
			}
			else
			{
				Stop();
			}
			
		
	}
	
	
	void Test() {
		
	}
private:
	void Stop()
	{
		motor1->SetSpeed(0);
		motor2->SetSpeed(0);
		motor3->SetSpeed(0);
		motor4->SetSpeed(0);
	}
	/*void GetCamPosition()
	{
		float xPos = 170 * Stick_z->GetRawAxis(1)+85;
		float yPos = 170 * Stick_xy->GetRawAxis(2)+85;
		
		if(Stick_z->GetRawAxis(2)!= 0)
		{
			while(xCam->SetAngle(2) >insert ammount && xCam->SetAngle(2)<insert Right angle)
			{
			xCam->SetAngle(Stick_z->GetRawAxis(2));
			}
		}
		
	}*/
	void Target()
	{
		/*
		 * MIDDLE GOALS have openings that are 54 in. wide and 21 in. tall
		 * bottom edge of the MIDDLE GOAL is located 88 5/8 in. above the FIELD
		 *----------------------------------------------------------------------
		 * HIGH GOAL is 54 in. wide and 12 in. tall
		 * bottom edge of the opening located 104 1/8 in. above the FIELD
		 */
		
	}
};

START_ROBOT_CLASS(RobotDemo);
some of it has been customized since the last time I posted. And it probably wont be used on the robot this year but, I am just curious how to fix it.
  #8   Spotlight this post!  
Unread 23-01-2013, 13:08
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Craziest Bug I'v Ever Seen--C++

From http://wpilib.screenstepslive.com/s/...software-notes

Quote:
Iterative robot templates no longer have the continuous methods. That is AutonomousContinuous, TeleopContinuous and DisabledContinuous methods are no longer included in the library. If you are looking for similar functionality threads is a possible alternative.
Your code in TeleopContinuous is not being executed. It should be in TeleopPeriodic.
Closed Thread


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 02:23.

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