Go to Post If you are stupid about this and violate the rules, and thereby cause your alliance to lose a match, then your alliance partners will gang up on you and violate your robot. - dlavery [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
  #9   Spotlight this post!  
Unread 13-03-2015, 20:22
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,728
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: HELP! CommandGroup not working

At least one thing you're doing wrong is reusing Commands all over the place in your CommandGroups and such. For instance:
Code:
AddSequential(Robot::oi->canUp);
That's wrong. You can't reuse Commands like this, especially in CommandGroups. Here's the relevant code from WPILib:
Code:
void Command::Start()
{
	LockChanges();
	if (m_parent != NULL)
		wpi_setWPIErrorWithContext(CommandIllegalUse, "Can not start a command that is part of a command group");

	Scheduler::GetInstance()->AddCommand(this);
}
So once you call that CommandGroup constructor with that bad AddSequential, the command instance for your CanUp button gets a parent added to it and will no longer work because that instance now thinks it's part of a CommandGroup. So everywhere you have this design anti-pattern:
Code:
AddSequential(Robot::oi->canUp);
You should replace with something like:
Code:
AddSequential(new PositionElevator(1, true));
It's more annoying, but thems the breaks.

I'm still looking at other things. Your AutonomousInit is screwy. You're starting the ZeroElevator command in there. Twice. Commands ONLY run when Scheduler->Run() is called. It's never called in AutonInit, so that command only starts to run at the first call of AutonomousPeriodic. You've already added a CommandGroup requiring the elevator after that, so I'm pretty sure the Zero Elevator command gets immediately cancelled without even initializing.

I'm not sure about your idea for triggering commands from other commands. I've never needed to do it, so I have no idea if it will work.

My only other suggestion at the moment is to start up NetConsole, cause it gives you much more detailed debugging info and you might be able to tell what's hanging up the scheduler there.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
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 00:37.

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