Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package com.ubt.jimu.controller.data.command;
/* loaded from: classes.dex */
public class AccumulatorGear {
public static int a(float f, int i) {
float f2;
float f3;
float f4;
float f5;
float f6;
float f7;
if (f < 0.2f) {
return 0;
}
float f8 = 0.4f;
if (f >= 0.4f) {
if (0.4f > f || f >= 0.6f) {
f8 = 0.8f;
if (0.6f > f || f >= 0.8f) {
f2 = i;
f3 = 384.0f;
f4 = 96.0f;
} else {
f2 = i;
f5 = 320.0f;
f6 = (f - 0.6f) * 64.0f;
}
} else {
f2 = i;
f3 = 274.0f;
f4 = 46.0f;
}
f7 = (((f - f8) * f4) / 0.2f) + f3;
return (int) ((f2 / f7) * 1000.0f);
}
f2 = i;
f5 = 192.0f;
f6 = (f - 0.2f) * 82.0f;
f7 = (f6 / 0.2f) + f5;
return (int) ((f2 / f7) * 1000.0f);
}
}

View File

@@ -0,0 +1,149 @@
package com.ubt.jimu.controller.data.command;
import android.media.MediaPlayer;
import android.os.SystemClock;
import android.text.TextUtils;
import com.ubt.jimu.base.data.CtrlMotionType;
import com.ubt.jimu.controller.data.action.Action;
import com.ubt.jimu.controller.data.action.ActionSequence;
import com.ubt.jimu.controller.data.action.MotorData;
import com.ubt.jimu.controller.data.action.RunningData;
import com.ubt.jimu.controller.data.action.RunningItem;
import com.ubt.jimu.controller.data.action.TurnData;
import com.ubt.jimu.controller.manager.ICommandExecutor;
import com.ubtech.utils.XLog;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/* loaded from: classes.dex */
public class ActionSequenceTask implements Runnable {
private ActionSequence a;
private ICommandExecutor b;
private MediaPlayer c;
private volatile boolean e = false;
private volatile boolean f = false;
private volatile boolean g = true;
private RunningData d = new RunningData();
public ActionSequenceTask(ActionSequence actionSequence, ICommandExecutor iCommandExecutor) {
this.a = actionSequence;
this.b = iCommandExecutor;
}
private void a(Map<Integer, ? extends TurnData> map) {
if (map == null || map.size() <= 0) {
return;
}
long elapsedRealtime = SystemClock.elapsedRealtime();
Iterator<Integer> it = map.keySet().iterator();
while (it.hasNext()) {
int intValue = it.next().intValue();
TurnData turnData = map.get(Integer.valueOf(intValue));
CtrlMotionType ctrlMotionType = CtrlMotionType.servo;
long j = Long.MAX_VALUE;
if (turnData instanceof MotorData) {
ctrlMotionType = CtrlMotionType.motor;
j = ((MotorData) turnData).f();
}
if (turnData.d()) {
this.d.b(new RunningItem(intValue, ctrlMotionType, j, elapsedRealtime));
} else {
this.d.a(new RunningItem(intValue, ctrlMotionType, j, elapsedRealtime));
}
}
}
private synchronized void b() {
if (this.c != null) {
this.c.stop();
this.c.release();
this.c = null;
}
}
public void cancel() {
this.g = false;
this.f = true;
b();
this.d.a();
}
public boolean g() {
boolean a = this.d.a(SystemClock.elapsedRealtime());
XLog.a("Controller", "mIsComplete:%b, mIsCancel:%b, runningData.isAllComplete:%b ", Boolean.valueOf(this.e), Boolean.valueOf(this.f), Boolean.valueOf(a));
return this.f || (this.e && a);
}
@Override // java.lang.Runnable
public void run() {
while (!this.f) {
if (!TextUtils.isEmpty(this.a.g())) {
a(this.a.g());
}
List<Action> a = this.a.a();
if (a != null && a.size() > 0) {
Iterator<Action> it = a.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Action next = it.next();
if (!this.f) {
Map<Integer, MotorData> b = next.b();
if (b != null && b.size() > 0) {
a(b);
this.b.a(new TreeMap(b));
}
Map<Integer, TurnData> e = next.e();
if (e != null && e.size() > 0) {
a(e);
this.b.b(new TreeMap(e));
}
Map<Integer, Integer> c = next.c();
if (c != null && c.size() > 0 && this.b.a(new TreeMap(c), next.d(), next.f()) == -1) {
this.f = true;
this.g = false;
break;
} else {
try {
Thread.sleep(next.a());
} catch (InterruptedException e2) {
e2.printStackTrace();
this.f = true;
Thread.currentThread().interrupt();
}
}
} else {
break;
}
}
}
if (!this.g) {
break;
}
}
this.e = true;
}
private synchronized void a(String str) {
this.c = new MediaPlayer();
try {
this.c.setDataSource(str);
this.c.prepare();
this.c.start();
} catch (IOException e) {
e.printStackTrace();
}
}
public void a(boolean z) {
this.g = z;
}
public ActionSequence a() {
return this.a;
}
}

View File

@@ -0,0 +1,26 @@
package com.ubt.jimu.controller.data.command;
import com.ubt.jimu.controller.manager.ICommandExecutor;
import java.util.Map;
/* loaded from: classes.dex */
public class AngleCommand extends MoveCommand {
private Map<Integer, Integer> a;
private int b;
private int c;
public AngleCommand(Map<Integer, Integer> map, int i, int i2) {
this.c = i;
this.a = map;
this.b = i2;
}
public int a() {
return this.c;
}
@Override // com.ubt.jimu.controller.data.command.MoveCommand
public void a(ICommandExecutor iCommandExecutor) {
iCommandExecutor.a(this.a, a(), this.b);
}
}

View File

@@ -0,0 +1,36 @@
package com.ubt.jimu.controller.data.command;
import com.twitter.sdk.android.core.TwitterAuthConfig;
import com.ubtrobot.jimu.robotapi.PeripheralType;
/* loaded from: classes.dex */
public enum Gear {
EMPTY(0, PeripheralType.SERVO, 0),
FIRST(1, 234, 60),
SECOND(2, 340, 80),
THIRD(3, 446, 100),
FOURTH(4, 552, 120),
FIFTH(5, 658, TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE);
private int level;
private int motorSpeed;
private int turnSpeed;
Gear(int i, int i2, int i3) {
this.level = i;
this.turnSpeed = i2;
this.motorSpeed = i3;
}
public static int getCount() {
return 5;
}
public int getMotorSpeed() {
return this.motorSpeed;
}
public int getTurnSpeed() {
return this.turnSpeed;
}
}

View File

@@ -0,0 +1,19 @@
package com.ubt.jimu.controller.data.command;
import com.ubt.jimu.controller.data.action.MotorData;
import com.ubt.jimu.controller.manager.ICommandExecutor;
import java.util.Map;
/* loaded from: classes.dex */
public class MotorCommand extends MoveCommand {
private Map<Integer, MotorData> a;
public MotorCommand(Map<Integer, MotorData> map) {
this.a = map;
}
@Override // com.ubt.jimu.controller.data.command.MoveCommand
public void a(ICommandExecutor iCommandExecutor) {
iCommandExecutor.a(this.a);
}
}

View File

@@ -0,0 +1,8 @@
package com.ubt.jimu.controller.data.command;
import com.ubt.jimu.controller.manager.ICommandExecutor;
/* loaded from: classes.dex */
public abstract class MoveCommand {
public abstract void a(ICommandExecutor iCommandExecutor);
}

View File

@@ -0,0 +1,19 @@
package com.ubt.jimu.controller.data.command;
import com.ubt.jimu.controller.manager.ICommandExecutor;
/* loaded from: classes.dex */
public class MoveTask implements Runnable {
private MoveCommand a;
private ICommandExecutor b;
public MoveTask(MoveCommand moveCommand, ICommandExecutor iCommandExecutor) {
this.a = moveCommand;
this.b = iCommandExecutor;
}
@Override // java.lang.Runnable
public void run() {
this.a.a(this.b);
}
}

View File

@@ -0,0 +1,34 @@
package com.ubt.jimu.controller.data.command;
import com.ubt.jimu.controller.data.config.AccumulatorConfig;
import com.ubt.jimu.controller.manager.ICommandExecutor;
import java.util.HashMap;
/* loaded from: classes.dex */
public class ShootCommand extends MoveCommand {
private AccumulatorConfig a;
private int b;
public ShootCommand(AccumulatorConfig accumulatorConfig, int i) {
this.a = accumulatorConfig;
this.b = i;
}
@Override // com.ubt.jimu.controller.data.command.MoveCommand
public void a(ICommandExecutor iCommandExecutor) {
if (this.a != null) {
HashMap hashMap = new HashMap(1);
hashMap.put(Integer.valueOf(this.a.getServoID()), Integer.valueOf(this.a.getLaunchAngle() + 120));
if (iCommandExecutor.a(hashMap, this.b, 0) == 0) {
try {
Thread.sleep(this.b);
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
hashMap.put(Integer.valueOf(this.a.getServoID()), Integer.valueOf(this.a.getStartAngle() + 120));
iCommandExecutor.a(hashMap, 100, 0);
}
}
}
}

View File

@@ -0,0 +1,19 @@
package com.ubt.jimu.controller.data.command;
import com.ubt.jimu.controller.data.action.TurnData;
import com.ubt.jimu.controller.manager.ICommandExecutor;
import java.util.Map;
/* loaded from: classes.dex */
public class TurnCommand extends MoveCommand {
private Map<Integer, TurnData> a;
public TurnCommand(Map<Integer, TurnData> map) {
this.a = map;
}
@Override // com.ubt.jimu.controller.data.command.MoveCommand
public void a(ICommandExecutor iCommandExecutor) {
iCommandExecutor.b(this.a);
}
}