Skip to content

Commit a828b31

Browse files
committed
Updat eth modify limb to work
1 parent 8feeaef commit a828b31

File tree

1 file changed

+24
-10
lines changed
  • src/main/java/com/neuronrobotics/bowlerstudio/scripting/cadoodle/robot

1 file changed

+24
-10
lines changed

src/main/java/com/neuronrobotics/bowlerstudio/scripting/cadoodle/robot/ModifyLimb.java

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public List<CSG> process(List<CSG> incoming) {
104104
}
105105
manager.render();
106106
} else {
107-
throw new RuntimeException("Failed to find builder or limb " + limbName + " " + builderName);
107+
throw new RuntimeException("Failed to find limb: " + limbName + " or builder: " + builderName);
108108
}
109109
return back;
110110
}
@@ -118,7 +118,7 @@ public File getFile() throws NoSuchFileException {
118118
* @return the base
119119
*/
120120
public TransformNR getBase() {
121-
return undo ? base : basePrevious;
121+
return !isUndo() ? base : basePrevious;
122122
}
123123

124124
/**
@@ -133,7 +133,7 @@ public ModifyLimb setBase(TransformNR base) {
133133
* @return the tip
134134
*/
135135
public TransformNR getTip() {
136-
return undo ? tip : tipPrevious;
136+
return !isUndo() ? tip : tipPrevious;
137137
}
138138

139139
/**
@@ -148,7 +148,7 @@ public ModifyLimb setTip(TransformNR tip) {
148148
* @return the elbow
149149
*/
150150
public TransformNR getElbow() {
151-
return undo ? elbow : elbowPrevious;
151+
return !isUndo() ? elbow : elbowPrevious;
152152
}
153153

154154
/**
@@ -174,17 +174,17 @@ public DHParameterKinematics getLimb() {
174174
/**
175175
* @param newLimb the newLimb to set
176176
*/
177-
public void setLimb(DHParameterKinematics newLimb) {
177+
public ModifyLimb setLimb(DHParameterKinematics newLimb) {
178178
this.newLimb = newLimb;
179-
basePrevious = newLimb.getRobotToFiducialTransform();
180-
tipPrevious = newLimb.getCurrentPoseTarget();
181-
179+
basePrevious = newLimb.getRobotToFiducialTransform().copy();
180+
tipPrevious = newLimb.getCurrentTaskSpaceTransform().copy();
181+
return this;
182182
}
183183

184184
@Override
185185
public void undo() {
186186
MobileBaseBuilder builder = getRobots().get(getBuilderName());
187-
undo = true;
187+
setUndo(true);
188188
//System.out.println("Undo ModifyLimb");
189189
try {
190190
builder.build();
@@ -197,7 +197,7 @@ public void undo() {
197197
@Override
198198
public void redo() {
199199
MobileBaseBuilder builder = getRobots().get(getBuilderName());
200-
undo = false;
200+
setUndo(false);
201201
//System.out.println("Redo ModifyLimb");
202202
try {
203203
builder.build();
@@ -207,4 +207,18 @@ public void redo() {
207207
}
208208
}
209209

210+
/**
211+
* @return the undo
212+
*/
213+
public boolean isUndo() {
214+
return undo;
215+
}
216+
217+
/**
218+
* @param undo the undo to set
219+
*/
220+
public void setUndo(boolean undo) {
221+
this.undo = undo;
222+
}
223+
210224
}

0 commit comments

Comments
 (0)