Assuming you are following the CommandBased template and defining your buttons in OI you can't conditionally run commands in a command group. Why? The command group is only ever constructed once and reused when ever the button is pressed.
If you are needing to do this you might need to rethink the design and structure of you code. We typically do the core of our control logic in state machines in the Subsystems and then uses commands to change the state.
A less elegant way is to code your commands with a short circuit path. See the example below. We used this on our 30 pt climber in 2013. If the shooter was up we couldn't raise the arm as it would run into the shooter and cause damage. To prevent this if the RaiseArm command was called with the shooter up we finished the command instantly. It is important not to set a mechanism in motion in the initialize method or it will run regardless of the additional condition.
Code:
class RaiseArm : public CommandBase {
public:
RaiseArm() {}
void Initialize() {}
void Execute() {
arm->Raise();
}
bool IsFinished() {
//Finish instantly if the shooter is up so the arm
//won't hit it.
return arm->isUp() || shooter->isUp();
}
void End(){}
void Interrupted() {}
};
If this solution is not adequate or too messy then perhaps you could post a specific example of what you are hoping to do in the command group.