Skip to content

Instantly share code, notes, and snippets.

@madhephaestus
Last active January 17, 2024 16:00
Show Gist options
  • Save madhephaestus/b1bc6c6cb6058ec81dbc8ede0e851299 to your computer and use it in GitHub Desktop.
Save madhephaestus/b1bc6c6cb6058ec81dbc8ede0e851299 to your computer and use it in GitHub Desktop.
Move a limb attached to a MobileBase
/.settings
/.project
/.classpath
/.cproject
/cache/
/*.class
import org.apache.commons.io.IOUtils;
import com.neuronrobotics.bowlerstudio.physics.*;
import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine
import com.neuronrobotics.bowlerstudio.threed.*;
import com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics
import com.neuronrobotics.sdk.addons.kinematics.MobileBase
import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR
import com.neuronrobotics.sdk.common.DeviceManager
import com.neuronrobotics.sdk.util.ThreadUtil
MobileBase base;
//Check if the device already exists in the device Manager
if(args==null){
base=DeviceManager.getSpecificDevice( "MediumKat",{ScriptingEngine.gitScriptRun( "https://github.com/OperationSmallKat/SmallKat_V2.git", "loadRobot.groovy", [ "https://github.com/OperationSmallKat/greycat.git", "MediumKat.xml","GameController_22"] )})
}else
base=args.get(0)
println "Now we will move just one leg"
DHParameterKinematics leg0 = base.getAllDHChains().get(1)
double zLift=25
println "Start from where the arm already is and move it from there with absolute location"
TransformNR current = leg0.getCurrentPoseTarget();
current.translateZ(zLift);
leg0.setDesiredTaskSpaceTransform(current, 2.0);
ThreadUtil.wait(2000)// wait for the legs to fully arrive
println "and reset it"
current.translateZ(-zLift);
leg0.setDesiredTaskSpaceTransform(current, 2.0);
ThreadUtil.wait(2000)// wait for the legs to fully arrive
current.translateX(zLift);
leg0.setDesiredTaskSpaceTransform(current, 2.0);
ThreadUtil.wait(2000)
println "wait for the legs to fully arrive"
println "and reset it"
current.translateX(-zLift);
leg0.setDesiredTaskSpaceTransform(current, 2.0);
ThreadUtil.wait(2000)
println " wait for the legs to fully arrive"
current.translateY(-zLift);
leg0.setDesiredTaskSpaceTransform(current, 2.0);
ThreadUtil.wait(2000)
println " wait for the legs to fully arrive"
println "and reset it"
current.translateY(zLift);
leg0.setDesiredTaskSpaceTransform(current, 2.0);
ThreadUtil.wait(2000)
println " wait for the legs to fully arrive"
return null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment