Go to Post I love it when there is someone that obviously "gets it". - 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

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-03-2015, 18:53
jfitz0807 jfitz0807 is offline
Registered User
FRC #2877 (Ligerbots)
Team Role: Parent
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Newton, MA
Posts: 67
jfitz0807 is an unknown quantity at this point
Re: HELP! CommandGroup not working

Our mechanical team is currently working some repairs so I can't try executing a commandGroup from a button. I will try as soon as practicable. That's a great suggestion.

Charles (CBF) has our Test Bot at home. I am still at the venue.
Reply With Quote
  #2   Spotlight this post!  
Unread 13-03-2015, 19:04
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 431
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: HELP! CommandGroup not working

For you auto modes, all the addSequential calls that you're making within the robotinit function should be made directly within the CommandGroup classes that you have in the Command package.

The commandgroup comments in wpilib for the addsequential function state that calls should be made in the constructor of the CommandGroup. I haven't gone through the source code to see why exactly, but if for nothing else it helps keep your code more organized/readable.
__________________
http://team2168.org
Reply With Quote
  #3   Spotlight this post!  
Unread 13-03-2015, 19:11
jfitz0807 jfitz0807 is offline
Registered User
FRC #2877 (Ligerbots)
Team Role: Parent
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Newton, MA
Posts: 67
jfitz0807 is an unknown quantity at this point
Re: HELP! CommandGroup not working

We had tried that first, but it was giving the same behavior. We were grasping at straws. The Orange Hat guys here thought it was worth a try so we gave it a go.
Reply With Quote
  #4   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,685
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
  #5   Spotlight this post!  
Unread 13-03-2015, 20:32
cbf cbf is offline
Registered User
FRC #2877
 
Join Date: Feb 2012
Location: Newton, MA
Posts: 74
cbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nice
Re: HELP! CommandGroup not working

Kevin --

Thanks for looking at this. Actually, pretty much all the glitches you point out we've already fixed. Sorry for the confusion about branches, but the latest is at: https://github.com/ligerbots/Recycle...tialDartmouth2.

Note that one of the orange hats at the UMass Dartmouth meet today suggested moving the AddSequentials out of the autonomous class constructors, but it made no difference. I'll probably move them back in.

There are likely more errors to be discovered -- if could only at least get our autonomous command groups to be run..
Reply With Quote
  #6   Spotlight this post!  
Unread 13-03-2015, 21:13
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,685
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

Putting kids to bed, so I can't delve deeper right now. I'll admit I was looking at things before your Friday commit so I could see what y'all were talking about. I'll try to have more thoughts in an hour or two. I'm suspicious of default commands you might be running hanging things.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #7   Spotlight this post!  
Unread 13-03-2015, 22:05
cbf cbf is offline
Registered User
FRC #2877
 
Join Date: Feb 2012
Location: Newton, MA
Posts: 74
cbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nice
Re: HELP! CommandGroup not working

Well here's a new data point:

All of our Autonomous Command classes had a #include "../robot.h" in them (the students can be pretty sloppy about these things). I had meant to clean this up, but you know.. more important things like actually making the program work got in the way.

Simply out of suspicion, I decided to clean these up.

Now our "do nothing" autonomous command is successfully executed, but unfortunately the ones that actually do something still never return from
Scheduler::GetInstance()->Run();

I'm guessing that there was some C++ class, possibly even name confusion.

At least this is now looking less hopeless and somewhat debuggable. The tree has been updated with this.
Reply With Quote
  #8   Spotlight this post!  
Unread 13-03-2015, 22:51
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,685
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

*blinks* how are you determining that things are/aren't running at 9pm at night? Are you running your code on FRCSim?
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #9   Spotlight this post!  
Unread 13-03-2015, 22:59
cbf cbf is offline
Registered User
FRC #2877
 
Join Date: Feb 2012
Location: Newton, MA
Posts: 74
cbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nice
Re: HELP! CommandGroup not working

Test Bot sitting in my basement.

We bought two of the new control systems. One is on a standard AndyMark kit chassis that's similar enough to the real robot to run our production code (with a bunch of run time checks -- like (if (RobotMap::testBot) ...) for all the stuff that's missing (mainly our elevator, which we try to simulate).

The test Bot is failing to run the autonomous just as well as the real bot..
Reply With Quote
  #10   Spotlight this post!  
Unread 13-03-2015, 23:02
cbf cbf is offline
Registered User
FRC #2877
 
Join Date: Feb 2012
Location: Newton, MA
Posts: 74
cbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nice
Re: HELP! CommandGroup not working

Btw, it's 11PM here.. East Coast. And I'm checking out for the night. Maybe it'll be clearer in the morning.
Reply With Quote
  #11   Spotlight this post!  
Unread 14-03-2015, 09:54
cbf cbf is offline
Registered User
FRC #2877
 
Join Date: Feb 2012
Location: Newton, MA
Posts: 74
cbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nice
Re: HELP! CommandGroup not working

We fixed it. No time for full explanation now, but needless to say, it's my opinion that key confusion in SmartDashboard Put commands should not set up a condition that disables the robot..

I'll post more details, and maybe make a small repro case if people are interested.
Reply With Quote
Reply


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 01:03.

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