Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Command stops my teleop process (http://www.chiefdelphi.com/forums/showthread.php?t=154902)

ebernerrd 07-02-2017 17:03

Command stops my teleop process
 
Hey there again!
I've been writing my program in a command-based format. This works fine until I try to run a program through a joystick button. My command runs, but halts my teleop program.

I am not sure what code is useful in this situation. My TeleopDefault.h and .cpp are my teleop control scheme, and I have other commands like "DropGear" and "DropFuel". When I use a joystick buttons' ->WhenPressed() to run the DropGear command, the TeleopDefault stops and does not return.

Any reason for this?
Thank you. I will post code if someone knows which files are needed to diagnose the problem.
-Eric

SamCarlberg 07-02-2017 18:01

Re: Command stops my teleop process
 
Sounds like you have a loop in the commands initialize or execute method

ebernerrd 08-02-2017 14:34

Re: Command stops my teleop process
 
If I place a return statement at the end of the execute statement, should I be okay? Because at the moment I have something like this
Code:

TeleopDefault::Initialize(){
//some code
    button->WhenPressed(new DropGear());
    button->WhenReleased(this);
}

This almost works for now. I will look into it a bit further.

GavinL 08-02-2017 14:55

Re: Command stops my teleop process
 
Are you sure the "button->WhenPressed" stuff should be in initialized?
I'm a bit new to command based but I feel like that should belong in your Execute.
It should go in OI, above text is wrong.

GeeTwo 08-02-2017 15:01

Re: Command stops my teleop process
 
Quote:

Originally Posted by ebernerrd (Post 1642083)
If I place a return statement at the end of the execute statement, should I be okay? Because at the moment I have something like this
Code:

TeleopDefault::Initialize(){
//some code
    button->WhenPressed(new DropGear());
    button->WhenReleased(this);
}

This almost works for now. I will look into it a bit further.

I believe he was referring to a loop in the DropGear command initializer or execute method. These methods should return quickly (milliseconds or less), not have the loop that goes through the entire process of dropping a gear internal to the command. Let the command based robot infrastructure do that.

Joe Ross 08-02-2017 17:27

Re: Command stops my teleop process
 
Quote:

Originally Posted by GavinL (Post 1642091)
Are you sure the "button->WhenPressed" stuff should be in initialized?
I'm a bit new to command based but I feel like that should belong in your Execute.

It should go in OI, not in a command.

GavinL 09-02-2017 00:51

Re: Command stops my teleop process
 
Quote:

Originally Posted by Joe Ross (Post 1642161)
It should go in OI, not in a command.

yeah your right, my bad


All times are GMT -5. The time now is 00:09.

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