# Command Groups
###### tags: `程式組教程`
應該沒有寫錯吧 :cry:
## 簡介
對於一個機器人而言,在一段時間內完成一個 Command 是很輕鬆的、很快速的,但當要同時完成多個 Command 時,則要將他們群組或排列,讓我們能明確且完整的傳達指令給機器人。
## SequentialCommandGroup
依照順序完成指令,有點像是電路中的「串聯」
> runs a list of commands in sequence
## ParallelCommandGroup
同時完成指令,有點像是電路中的「並聯」
> execute at the same time
## ParallelDeadlineGroup
與上面相同一樣是同時完成指令,但當特定的指令完成後,所有指令都停止。
> the deadline group ends when a specific command (the “deadline”) ends, interrupting all other commands in the group that are still running at that point.
## 範例

```java=
new SequentialCommandGroup(
new DriveToGoal(m_drive),
new ParallelCommandGroup(
new RaiseElevator(m_elevator),
new SetWristPosition(m_wrist)),
new ScoreTube(m_wrist));
```
## 參考資料
- [Command Groups](https://docs.wpilib.org/en/stable/docs/software/commandbased/command-groups.html)