Package org.horizon36596.simloop.viz
Class TurretSketchDefinition.Builder
java.lang.Object
org.horizon36596.simloop.viz.TurretSketchDefinition.Builder
- Enclosing class:
- TurretSketchDefinition
Step-by-step builder. Everything is required except the background colour and the joints above the yaw;
build() fails loudly rather than defaulting anything that would change what is drawn.-
Method Summary
Modifier and TypeMethodDescriptionaddJoint(JointDefinition joint) Append a joint riding on the turret, stated in the robot frame at yaw zero.backgroundColorHex(String backgroundColorHex) Canvas background.build()Validates the turret-specific rules and produces the definition.canvasSizeInches(double widthInches, double heightInches) The canvas the chain above the turret is drawn on.yaw(RobotVector3 pivotInches, RevoluteJointDefinition yawJoint) The yaw: a point on its axis and the joint itself.
-
Method Details
-
yaw
public TurretSketchDefinition.Builder yaw(RobotVector3 pivotInches, RevoluteJointDefinition yawJoint) The yaw: a point on its axis and the joint itself.- Parameters:
pivotInches- a point on the yaw axis, robot frame, inchesyawJoint- the yaw joint; its rotation axis must be vertical- Returns:
- this builder
-
canvasSizeInches
The canvas the chain above the turret is drawn on. It must hold that chain at full reach, measured from the turret, and be at least twice its furthest horizontal reach (theMechanismSketchcanvas-origin rule).- Parameters:
widthInches- canvas width in inchesheightInches- canvas height in inches- Returns:
- this builder
-
backgroundColorHex
Canvas background. Defaults to black.- Parameters:
backgroundColorHex- the colour as"#RRGGBB"- Returns:
- this builder
-
addJoint
Append a joint riding on the turret, stated in the robot frame at yaw zero. The first one mounts on the yaw joint's tip, and each later one on the tip of the one before.- Parameters:
joint- the joint; its name must be unique within this mechanism, and differ from the yaw's- Returns:
- this builder
-
build
Validates the turret-specific rules and produces the definition. The joints above the yaw are validated again, in the turret's own plane, whenTurretSketchbuilds their drawing.- Returns:
- the definition, ready to hand to
TurretSketch - Throws:
IllegalArgumentException- if the yaw or its pivot is missing, the yaw axis is not vertical, nothing points sideways to say which way the turret faces, the canvas size or colour is invalid, or two joints share a name.
-