Class Crab
java.lang.Object
com.marginallyclever.ro3.node.Node
com.marginallyclever.ro3.node.nodes.crab.Crab
Crab controller demo.
Leg index
0 - center left 1 - front right 2 - front left 3 - center right 4 - back left 5 - back right Forward 2 1 3 x 0 Right 4 5
Pose format
pose is a compact array of 18 doubles. the format is coxa/femur/tibia for each leg. the sequence
follows the leg index.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final String[]static final javax.vecmath.Vector3d[]static final intstatic final doublestatic final doublestatic final doublestatic final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidforward(double speed) voidfromJSON(org.json.JSONObject from) Deserialize this node and its children from a JSON object and its children.getBody()voidgetComponents(List<JPanel> list) Build a Swing Component that represents this Node.getIcon()Set a custom icon for this node.double[]getPose()Get all 18 joint angles that we care about.voididle()booleannodeIsPartOfMe(Node target) voidraiseTorso(double amount) voidsetChosenStrategy(CrabWalkStategy chosenStrategy) voidsetPose(double[] list) Set the 18 joint angles that we care about.voidsolveKinematicsForOneLeg(CrabLeg leg, javax.vecmath.Point3d newPosition) If the kinematics are unsolvable the angles will be NaN and the leg bones will disappear.voidstrafeRight(double speed) voidturnLeft(double speed) voidupdate(double dt) Called every frame.Methods inherited from class com.marginallyclever.ro3.node.Node
addAttachListener, addChild, addChild, addDetachListener, addReadyListener, addRenameListener, findByPath, findChild, findChild, findFirstChild, findFirstSibling, findNodeByID, findParent, findParent, getAbsolutePath, getChildren, getName, getParent, getRootNode, getUniqueID, hasParent, isNameUsedBySibling, removeAttachListener, removeChild, removeDetachListener, removeReadyListener, removeRenameListener, setName, toJSON, witnessProtection
-
Field Details
-
NUM_LEGS
public static final int NUM_LEGS- See Also:
-
COXA
public static final double COXA- See Also:
-
FEMUR
public static final double FEMUR- See Also:
-
TIBIA
public static final double TIBIA- See Also:
-
CENTER_X
public static final double CENTER_X- See Also:
-
COXA_X
public static final double COXA_X- See Also:
-
COXA_Y
public static final double COXA_Y- See Also:
-
COXA_OFFSET
public static final double COXA_OFFSET- See Also:
-
FEMUR_OFFSET
public static final double FEMUR_OFFSET- See Also:
-
SITTING_HEIGHT
public static final double SITTING_HEIGHT- See Also:
-
DEFAULT_STANDING_HEIGHT
public static final double DEFAULT_STANDING_HEIGHT- See Also:
-
STANDING_EPSILON
public static final double STANDING_EPSILON- See Also:
-
TOE_STEP_HEIGHT
public static final double TOE_STEP_HEIGHT- See Also:
-
legOffsets
public static final javax.vecmath.Vector3d[] legOffsets -
legNames
-
-
Constructor Details
-
Crab
public Crab()
-
-
Method Details
-
getComponents
Description copied from class:NodeBuild a Swing Component that represents this Node.- Overrides:
getComponentsin classNode- Parameters:
list- the list to add components to.
-
getIcon
-
update
-
nodeIsPartOfMe
-
getPose
public double[] getPose()Get all 18 joint angles that we care about.- Returns:
- see the post description in the class header.
-
setPose
public void setPose(double[] list) Set the 18 joint angles that we care about.- Parameters:
list- see the post description in the class header.
-
solveKinematicsForOneLeg
If the kinematics are unsolvable the angles will be NaN and the leg bones will disappear.- Parameters:
leg- the leg to movenewPosition- the desired world position of the toe tip.
-
setChosenStrategy
-
getChosenStrategy
-
turnLeft
public void turnLeft(double speed) -
forward
public void forward(double speed) -
strafeRight
public void strafeRight(double speed) -
raiseTorso
public void raiseTorso(double amount) -
idle
public void idle() -
fromJSON
public void fromJSON(org.json.JSONObject from) Description copied from class:NodeDeserialize this node and its children from a JSON object and its children. Classes that override this method should call super.fromJSON(). When they do it will trigger the creation of child nodes. The child nodes will then call their own fromJSON() methods. -
getBody
-