Skip to content

Commit

Permalink
🔀️ Merge branch 'hugo/feature/Add-RemoteArrowStandard'
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Apr 10, 2024
2 parents ec7dcbf + cafcde6 commit 4005779
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 25 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Leka - iOS Monorepo
# Copyright APF France handicap
# SPDX-License-Identifier: Apache-2.0

version: 1.0.0

uuid: 5554CD696BB6492594082C5F8F895A85
name: remote_standard_arrows

created_at: "2024-03-04T18:07:12.519606"
last_edited_at: "2024-04-10T16:32:10.108131"
status: published

authors:
- leka

skills:
- sensory_interaction
- gross_motor_skills

tags:
- robot_movements
- robot_colors

hmi:
- tablet_robot

types:
- one_on_one
- group

locales:
- en_US
- fr_FR

l10n:
- locale: fr_FR
details:
icon: remote_standard_arrows

title: Commande Standard
subtitle: Flèches

short_description: Contrôle Leka avec la télécommande, fais le se déplacer,
changer de couleur ou lance le renforçateur de ton choix

description: |
La Commande Standard offre plusieurs fonctionnalités pour contrôler le robot :
- La Commande Fléchée pour téléguider le robot
- Les 5 renforçateurs de Leka
- Une commande colorée pour colorer le robot dans différentes couleurs
instructions: |
- Pour faire se déplacer Leka, utiliser la Commande Fléchée en bas à gauche de l'écran. Appuyer sur les flèches pour choisir la direction du robot.
- Pour lancer un ou plusieurs renforçateurs, appuyer sur leurs différents icones à gauche de l'écran de l'iPad.
- Pour allumer le robot dans différentes couleurs, utiliser la commande colorée en bas à droite de l'écran.
- locale: en_US
details:
icon: remote_standard_arrows

title: Remote Standard
subtitle: Arrows

short_description: |
Control Leka with the remote control, make him move, change color or throw the reinforcer of your choice
description: |
The Remote Standard offers several features to control the robot:
- The Remote Arrow to remotely guide the robot
- Leka’s 5 reinforcers
- The colorful command to color the robot in different colors
instructions: |
- To move Leka, use the Remote Arrow at the bottom left of the screen. Press the arrows to choose the direction of the robot.
- To launch one or more reinforcers, press their different icons on the left of the iPad screen.
- To turn the robot on in different colors, use the colored command at the bottom right of the screen.
exercises_payload:
options:
shuffle_exercises: false
shuffle_groups: false

exercise_groups:
- group:
- instructions:
- locale: fr_FR
value: Contrôle Leka avec la télécommande, fais le se déplacer, changer
de couleur ou lance le renforçateur de ton choix
- locale: en_US
value: Control Leka with the remote control, make him move, change color
or throw the reinforcer of your choice
interface: remoteStandardArrow
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
version: 1.0.0

uuid: E85F0498A29047E893631397592CC444
name: remote_standard
name: remote_standard_joystick

created_at: "2024-03-04T18:07:12.519606"
last_edited_at: "2024-03-05T09:42:38.078478"
last_edited_at: "2024-04-10T16:32:10.108131"
status: published

authors:
Expand Down Expand Up @@ -39,7 +39,7 @@ l10n:
icon: remote_standard

title: Commande Standard
subtitle: null
subtitle: Joystick

short_description: Contrôle Leka avec la télécommande, fais le se déplacer,
changer de couleur ou lance le renforçateur de ton choix
Expand All @@ -60,7 +60,7 @@ l10n:
icon: remote_standard

title: Remote Standard
subtitle: null
subtitle: Joystick

short_description: |
Control Leka with the remote control, make him move, change color or throw the reinforcer of your choice
Expand Down Expand Up @@ -90,4 +90,4 @@ exercises_payload:
- locale: en_US
value: Control Leka with the remote control, make him move, change color
or throw the reinforcer of your choice
interface: remoteStandard
interface: remoteStandardJoystick
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ l10n:

content:
- remote_colored_arrows-D91BDA161F8E455CA8A71881F1D2E923
- remote_standard-E85F0498A29047E893631397592CC444
- remote_standard_joystick-E85F0498A29047E893631397592CC444
- remote_standard_arrows-5554CD696BB6492594082C5F8F895A85
3 changes: 2 additions & 1 deletion Modules/ContentKit/Sources/Exercise/Exercise+Interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public extension Exercise {
case dragAndDropIntoZones
case dragAndDropToAssociate
case danceFreeze
case remoteStandard
case remoteStandardJoystick
case remoteStandardArrow
case remoteArrow
case hideAndSeek
case musicalInstruments
Expand Down
3 changes: 2 additions & 1 deletion Modules/ContentKit/Sources/Exercise/Exercise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public struct Exercise: Decodable {
case (.melody, .none):
self.payload = try container.decode(MidiRecordingPlayer.Payload.self, forKey: .payload)

case (.remoteStandard, .none),
case (.remoteStandardJoystick, .none),
(.remoteStandardArrow, .none),
(.remoteArrow, .none),
(.hideAndSeek, .none),
(.pairing, .none):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,19 @@ extension RemoteArrowView {
@State private var isPressed = false

let arrow: Arrow
let size: CGFloat
let onChanged: () -> Void
let onReleased: () -> Void

var body: some View {
Circle()
.fill(.white)
.frame(width: 200, height: 200)
.frame(width: self.size, height: self.size)
.overlay {
Image(systemName: self.arrow.name)
.resizable()
.foregroundColor(self.arrow.color.screen)
.frame(width: 80, height: 100)
.frame(width: self.size / 2.5, height: self.size / 2)
}
.shadow(color: .black.opacity(0.1), radius: 10, x: 0, y: 0)
.scaleEffect(self.isPressed ? 0.95 : 1.0)
Expand All @@ -78,7 +79,7 @@ extension RemoteArrowView {
}

#Preview {
RemoteArrowView.ArrowButton(arrow: .counterclockwise) {
RemoteArrowView.ArrowButton(arrow: .counterclockwise, size: 200) {
print("Button pressed")
} onReleased: {
print("Button released")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SwiftUI

extension RemoteArrowView {
struct CircleLayout: Layout {
let xPosition: CGFloat

func sizeThatFits(proposal: ProposedViewSize, subviews _: Subviews, cache _: inout ()) -> CGSize {
proposal.replacingUnspecifiedDimensions()
}
Expand All @@ -16,7 +18,7 @@ extension RemoteArrowView {
let posY = bounds.midY

for (index, subview) in subviews.enumerated() {
var point = CGPoint(x: 180, y: 0)
var point = CGPoint(x: self.xPosition, y: 0)
.applying(CGAffineTransform(rotationAngle: CGFloat(angle) * CGFloat(index - 1)))

point.x += posX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,33 @@ import SwiftUI

struct RemoteArrowView: View {
let robot = Robot.shared
let size: CGFloat
let xPosition: CGFloat

var body: some View {
CircleLayout {
ArrowButton(arrow: .up) {
CircleLayout(xPosition: self.xPosition) {
ArrowButton(arrow: .up, size: self.size) {
self.robot.move(.forward(speed: 1))
self.robot.shine(.all(in: ArrowButton.Arrow.up.color))
} onReleased: {
self.robot.stopMotion()
self.robot.stopLights()
}
ArrowButton(arrow: .clockwise) {
ArrowButton(arrow: .clockwise, size: self.size) {
self.robot.move(.spin(.clockwise, speed: 1))
self.robot.shine(.all(in: ArrowButton.Arrow.clockwise.color))
} onReleased: {
self.robot.stopMotion()
self.robot.stopLights()
}
ArrowButton(arrow: .down) {
ArrowButton(arrow: .down, size: self.size) {
self.robot.move(.backward(speed: 1))
self.robot.shine(.all(in: ArrowButton.Arrow.down.color))
} onReleased: {
self.robot.stopMotion()
self.robot.stopLights()
}
ArrowButton(arrow: .counterclockwise) {
ArrowButton(arrow: .counterclockwise, size: self.size) {
self.robot.move(.spin(.counterclockwise, speed: 1))
self.robot.shine(.all(in: ArrowButton.Arrow.counterclockwise.color))
} onReleased: {
Expand All @@ -43,5 +45,5 @@ struct RemoteArrowView: View {
}

#Preview {
RemoteArrowView()
RemoteArrowView(size: 200, xPosition: 180)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Leka - iOS Monorepo
// Copyright APF France handicap
// SPDX-License-Identifier: Apache-2.0

import DesignKit
import RobotKit
import SwiftUI

extension RemoteStandard {
struct ArrowCommand: View {
// MARK: Internal

var body: some View {
HStack(spacing: 150) {
VStack(spacing: 200) {
Spacer()

RemoteArrowView(size: 130, xPosition: 130)
}

RadialLayout(firstButtonPosX: -120, firstButtonPosY: -200, angle: 90.0) {
LedZoneSelectorView(displayMode: self.displayMode)

ForEach(DisplayMode.allCases, id: \.self) { mode in
LedZoneSelectorView.ModeButton(mode: mode, displayMode: self.$displayMode)
}
}
}
}

// MARK: Private

@State private var displayMode = DisplayMode.fullBelt
}
}

#Preview {
RemoteStandard.ArrowCommand()
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ enum RemoteStandard {
}
}

struct MainView: View {
struct JoystickCommand: View {
// MARK: Internal

var body: some View {
Expand Down Expand Up @@ -75,5 +75,5 @@ enum RemoteStandard {
}

#Preview {
RemoteStandard.MainView()
RemoteStandard.JoystickCommand()
}
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,14 @@ public struct ActivityView: View {
data: self.viewModel.currentExerciseSharedData
)

case .remoteStandard:
RemoteStandard.MainView()
case .remoteStandardJoystick:
RemoteStandard.JoystickCommand()

case .remoteStandardArrow:
RemoteStandard.ArrowCommand()

case .remoteArrow:
RemoteArrowView()
RemoteArrowView(size: 200, xPosition: 180)

case .hideAndSeek:
HideAndSeekView(
Expand Down
12 changes: 10 additions & 2 deletions Specs/jtd/activity.jtd.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,14 @@
}
}
},
"remoteStandard": {
"remoteStandardJoystick": {
"properties": {
"instructions": {
"ref": "$exercise/instructions"
}
}
},
"remoteStandardArrow": {
"properties": {
"instructions": {
"ref": "$exercise/instructions"
Expand Down Expand Up @@ -308,7 +315,8 @@
"dragAndDropIntoZones",
"dragAndDropToAssociate",
"danceFreeze",
"remoteStandard",
"remoteStandardJoystick",
"remoteStandardArrow",
"remoteArrow",
"hideAndSeek",
"musicalInstruments",
Expand Down

0 comments on commit 4005779

Please sign in to comment.