RobotCore
1.0
WPILib port to raspberry Pi
Toggle main menu visibility
Loading...
Searching...
No Matches
Mechanism.java
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
package
org.wpilib.command3;
6
7
import
java.util.List;
8
import
java.util.function.Consumer;
9
import
org.wpilib.annotation.NoDiscard;
10
import
org.wpilib.units.measure.Time;
11
21
public
interface
Mechanism
{
28
default
Scheduler
getRegisteredScheduler
() {
29
return
Scheduler
.
getDefault
();
30
}
31
42
default
boolean
controllableDuringDisabled
() {
43
return
false
;
44
}
45
51
@
NoDiscard
52
default
String
getName
() {
53
return
getClass().getSimpleName();
54
}
55
68
default
void
setDefaultCommand
(
Command
defaultCommand) {
69
getRegisteredScheduler
().
setDefaultCommand
(
this
, defaultCommand);
70
}
71
78
default
Command
getDefaultCommand
() {
79
return
getRegisteredScheduler
().
getDefaultCommandFor
(
this
);
80
}
81
88
default
NeedsNameBuilderStage
run
(Consumer<Coroutine> commandBody) {
89
return
new
StagedCommandBuilder
().requiring(
this
).executing(commandBody);
90
}
91
100
default
NeedsNameBuilderStage
runRepeatedly
(Runnable loopBody) {
101
return
run
(
102
coroutine -> {
103
while
(
true
) {
104
loopBody.run();
105
coroutine.yield();
106
}
107
});
108
}
109
120
default
Command
idle
() {
121
return
run
(
Coroutine::park
).
withPriority
(
Command
.
LOWEST_PRIORITY
).
named
(
getName
() +
"[IDLE]"
);
122
}
123
130
default
Command
idleFor
(Time duration) {
131
return
idle
().
withTimeout
(duration);
132
}
133
142
@
NoDiscard
143
default
List<Command>
getRunningCommands
() {
144
return
getRegisteredScheduler
().
getRunningCommandsFor
(
this
);
145
}
146
}
org.wpilib.command3.Coroutine.park
void park()
Definition
Coroutine.java:157
org.wpilib.command3.Scheduler
Definition
Scheduler.java:106
org.wpilib.command3.Scheduler.getDefault
static Scheduler getDefault()
Definition
Scheduler.java:171
org.wpilib.command3.Scheduler.getDefaultCommandFor
Command getDefaultCommandFor(Mechanism mechanism)
Definition
Scheduler.java:252
org.wpilib.command3.Scheduler.getRunningCommandsFor
List< Command > getRunningCommandsFor(Mechanism mechanism)
Definition
Scheduler.java:1286
org.wpilib.command3.Scheduler.setDefaultCommand
void setDefaultCommand(Mechanism mechanism, Command defaultCommand)
Definition
Scheduler.java:211
org.wpilib.command3.StagedCommandBuilder.StagedCommandBuilder
StagedCommandBuilder()
Definition
StagedCommandBuilder.java:242
org.wpilib.annotation.NoDiscard
Definition
NoDiscard.java:20
org.wpilib.command3.Command
Definition
Command.java:98
org.wpilib.command3.Command.LOWEST_PRIORITY
int LOWEST_PRIORITY
Definition
Command.java:106
org.wpilib.command3.Command.withTimeout
default Command withTimeout(Time timeout)
Definition
Command.java:228
org.wpilib.command3.Mechanism
Definition
Mechanism.java:21
org.wpilib.command3.Mechanism.run
default NeedsNameBuilderStage run(Consumer< Coroutine > commandBody)
Definition
Mechanism.java:88
org.wpilib.command3.Mechanism.getName
default String getName()
Definition
Mechanism.java:52
org.wpilib.command3.Mechanism.getDefaultCommand
default Command getDefaultCommand()
Definition
Mechanism.java:78
org.wpilib.command3.Mechanism.runRepeatedly
default NeedsNameBuilderStage runRepeatedly(Runnable loopBody)
Definition
Mechanism.java:100
org.wpilib.command3.Mechanism.setDefaultCommand
default void setDefaultCommand(Command defaultCommand)
Definition
Mechanism.java:68
org.wpilib.command3.Mechanism.getRegisteredScheduler
default Scheduler getRegisteredScheduler()
Definition
Mechanism.java:28
org.wpilib.command3.Mechanism.idle
default Command idle()
Definition
Mechanism.java:120
org.wpilib.command3.Mechanism.controllableDuringDisabled
default boolean controllableDuringDisabled()
Definition
Mechanism.java:42
org.wpilib.command3.Mechanism.idleFor
default Command idleFor(Time duration)
Definition
Mechanism.java:130
org.wpilib.command3.Mechanism.getRunningCommands
default List< Command > getRunningCommands()
Definition
Mechanism.java:143
org.wpilib.command3.NeedsNameBuilderStage
Definition
NeedsNameBuilderStage.java:17
org.wpilib.command3.NeedsNameBuilderStage.named
Command named(String name)
org.wpilib.command3.NeedsNameBuilderStage.withPriority
NeedsNameBuilderStage withPriority(int priority)
org
wpilib
command3
Mechanism.java
Generated by
1.18.0