TrapezoidProfileCommand

class commands2.TrapezoidProfileCommand(*args, **kwargs)[source]

Bases: Command

A command that runs a wpimath.trajectory.TrapezoidProfile. Useful for smoothly controlling mechanism motion.

Creates a new TrapezoidProfileCommand that will execute the given wpimath.trajectory.TrapezoidProfile. Output will be piped to the provided consumer function.

Parameters:
  • profile – The motion profile to execute.

  • output – The consumer for the profile output.

  • goal – The supplier for the desired state

  • currentState – The supplier for the current state

  • requirements – The subsystems required by this command.

end(interrupted) None[source]

The action to take when the command ends. Called when either the command finishes normally, or when it interrupted/canceled.

Do not schedule commands here that share requirements with this command. Use andThen() instead.

Parameters:

interrupted – whether the command was interrupted/canceled

execute() None[source]

The main body of a command. Called repeatedly while the command is scheduled.

initialize() None[source]

The initial subroutine of a command. Called once when the command is initially scheduled.

isFinished() bool[source]

Whether the command has finished. Once a command finishes, the scheduler will call its commands2.Command.end() method and un-schedule it.

Returns:

whether the command has finished.