Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non breaking methods plus deprecation notice #1347

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/org/myrobotlab/service/InMoov2Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ public static DHRobotArm getDHRobotArm(String name, String side) {
return arm;
}

@Deprecated /* use onMove */
public void onMoveArm(HashMap<String, Double> map) {
onMove(map);
}

public void onMove(Map<String, Double> map) {
moveTo(map.get("bicep"), map.get("rotate"), map.get("shoulder"), map.get("omoplate"));
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/myrobotlab/service/InMoov2Hand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.myrobotlab.framework.Registration;
Expand Down Expand Up @@ -489,7 +490,12 @@ public LeapData onLeapData(LeapData data) {
return data;
}

@Deprecated /* use onMove */
public void onMoveHand(HashMap<String, Double> map) {
onMove(map);
}

public void onMove(Map<String, Double> map) {
moveTo(map.get("thumb"), map.get("index"), map.get("majeure"), map.get("majeure"), map.get("pinky"), map.get("wrist"));
}

Expand Down
41 changes: 33 additions & 8 deletions src/main/java/org/myrobotlab/service/InMoov2Head.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;

import org.myrobotlab.framework.Service;
Expand Down Expand Up @@ -142,15 +143,34 @@ public void disable() {
eyelidRight.disable();
}

public long getLastActivityTime() {
public Long getLastActivityTime() {

long lastActivityTime = Math.max(rothead.getLastActivityTime(), neck.getLastActivityTime());
lastActivityTime = Math.max(lastActivityTime, eyeX.getLastActivityTime());
lastActivityTime = Math.max(lastActivityTime, eyeY.getLastActivityTime());
lastActivityTime = Math.max(lastActivityTime, jaw.getLastActivityTime());
lastActivityTime = Math.max(lastActivityTime, rollNeck.getLastActivityTime());
lastActivityTime = Math.max(lastActivityTime, eyelidLeft.getLastActivityTime());
lastActivityTime = Math.max(lastActivityTime, eyelidRight.getLastActivityTime());
Long lastActivityTime = Math.max(rothead.getLastActivityTime(), neck.getLastActivityTime());
if (getPeer("eyeX") != null) {
lastActivityTime = Math.max(lastActivityTime, eyeX.getLastActivityTime());
}
if (getPeer("eyeY") != null) {
lastActivityTime = Math.max(lastActivityTime, eyeY.getLastActivityTime());
}
if (getPeer("jaw") != null) {
lastActivityTime = Math.max(lastActivityTime, jaw.getLastActivityTime());
}
if (getPeer("rollNeck") != null) {
lastActivityTime = Math.max(lastActivityTime, rollNeck.getLastActivityTime());
}
if (getPeer("rollNeck") != null) {
lastActivityTime = Math.max(lastActivityTime, rothead.getLastActivityTime());
}
if (getPeer("rollNeck") != null) {
lastActivityTime = Math.max(lastActivityTime, neck.getLastActivityTime());
}

if (getPeer("eyelidLeft") != null) {
lastActivityTime = Math.max(lastActivityTime, eyelidLeft.getLastActivityTime());
}
if (getPeer("eyelidRight") != null) {
lastActivityTime = Math.max(lastActivityTime, eyelidRight.getLastActivityTime());
}
return lastActivityTime;
}

Expand Down Expand Up @@ -199,7 +219,12 @@ public void lookAt(Double x, Double y, Double z) {
log.info("object distance is {},rothead servo {},neck servo {} ", distance, rotation, colatitude);
}

@Deprecated /* use onMoov */
public void onMoveHead(HashMap<String, Double> map) {
onMove(map);
}

public void onMove(Map<String, Double> map) {
moveTo(map.get("neck"), map.get("rothead"), map.get("eyeX"), map.get("eyeY"), map.get("jaw"), map.get("rollNeck"));
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/myrobotlab/service/InMoov2Torso.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.myrobotlab.framework.Service;
import org.myrobotlab.io.FileIO;
Expand Down Expand Up @@ -93,7 +94,12 @@ public void disable() {
lowStom.disable();
}

@Deprecated /* use onMove */
public void onMoveTorso(HashMap<String, Double> map) {
onMove(map);
}

public void onMove(Map<String, Double> map) {
moveTo(map.get("topStom"), map.get("midStom"), map.get("lowStom"));
}

Expand Down