diff --git a/Modules/RobotKit/Examples/RobotKitExample/Sources/Views/RobotKitExperimentView.swift b/Modules/RobotKit/Examples/RobotKitExample/Sources/Views/RobotKitExperimentView.swift index 452bbcc191..99f6241864 100644 --- a/Modules/RobotKit/Examples/RobotKitExample/Sources/Views/RobotKitExperimentView.swift +++ b/Modules/RobotKit/Examples/RobotKitExample/Sources/Views/RobotKitExperimentView.swift @@ -14,14 +14,10 @@ struct RobotKitExperimentView: View { Button("Launch Synchronous Sequence", systemImage: "play.circle") { self.robotkit.append(actions: [ .motion(.spin(.clockwise, speed: 1), duration: .seconds(4), parallel: []), - .motion(.stop, duration: .seconds(3), parallel: [ - // .lights(.full(.belt, in: .red), duration: .seconds(3)), + .motion(.stop, duration: .seconds(3), parallel: []), + .motion(.spin(.counterclockwise, speed: 0.8), duration: .seconds(4), parallel: [ + .blink(.seconds(0.2), duration: .seconds(2), parallel: []), ]), - .blink(.seconds(0.2), duration: .seconds(5), parallel: []), -// .motion(.spin(.counterclockwise, speed: 0.8), duration: .seconds(4), parallel: [ -// .blink(.seconds(0.2), duration: .seconds(2), parallel: []), -// ]), -// .pause(duration: .infinity), ]) self.robotkit.executeSync() diff --git a/Modules/RobotKit/Sources/RobotKit/ActionMotion.swift b/Modules/RobotKit/Sources/RobotKit/ActionMotion.swift index ed46b7d333..183183e0e9 100644 --- a/Modules/RobotKit/Sources/RobotKit/ActionMotion.swift +++ b/Modules/RobotKit/Sources/RobotKit/ActionMotion.swift @@ -19,6 +19,14 @@ final class ActionMotion: RobotActionProtocol { } log.debug("motion - start task - move") self.robot.move(self.motion) + for action in self.parallelActions { + log.debug("motion - start task - parallel action \(action)") + Task { + try await action.object.execute() + } +// /* async let _ = */ try action.object.execute() + log.debug("motion - start task - parallel action \(action) ✅") + } try await Task.sleep(for: self.duration) log.debug("motion - end task") } diff --git a/Modules/RobotKit/Sources/RobotKit/RobotAction.swift b/Modules/RobotKit/Sources/RobotKit/RobotAction.swift index 0883ed4878..887bcf9755 100644 --- a/Modules/RobotKit/Sources/RobotKit/RobotAction.swift +++ b/Modules/RobotKit/Sources/RobotKit/RobotAction.swift @@ -6,8 +6,9 @@ import Foundation public enum RobotAction { case motion(Robot.Motion, duration: Duration, parallel: [RobotAction] = []) -// case lights(Robot.Lights, duration: Duration, parallel: [RobotAction] = []) + case blink(Duration, duration: Duration, parallel: [RobotAction] = []) + // case lights(Robot.Lights, duration: Duration, parallel: [RobotAction] = []) // case pause(duration: Duration) // MARK: Public