@@ -138,9 +138,13 @@ echo("CLEARANCE_FROM_FRONT_WHEELS =", ARM_PIVOT_Y + ARM_HORIZONTAL_REACH - WHEEL
138138ARM_TUBE_SIZE = TUBE_3X3_1_4; // 3"x3" arm tubing
139139ARM_SPACING = TRACK_WIDTH; // Distance between arm centerlines
140140
141- // Default arm position: lowered to ground (animation_time=0)
141+ // Looping animation: 0->0.5 = arms go up, 0.5->1 = arms come back down
142+ // This creates a smooth loop where the animation returns to start position
143+ animation_phase = animation_time < 0.5 ? (animation_time * 2 ) : (2 - animation_time * 2 );
144+
145+ // Default arm position: lowered to ground (animation_phase=0)
142146// ARM_GROUND_ANGLE is the angle below horizontal needed to reach ground
143- ARM_LIFT_ANGLE = - ARM_GROUND_ANGLE + (animation_time * (60 + ARM_GROUND_ANGLE)); // Animate from ground to raised
147+ ARM_LIFT_ANGLE = - ARM_GROUND_ANGLE + (animation_phase * (60 + ARM_GROUND_ANGLE)); // Animate from ground to raised and back
144148
145149// Cross beam positions along arm length (from pivot)
146150// First cross beam positioned for bucket cylinder attachment
@@ -217,7 +221,11 @@ BUCKET_HEIGHT = 450;
217221// At ground position (ARM_LIFT_ANGLE = -ARM_GROUND_ANGLE), bucket tilts forward to lay flat
218222// The bucket bottom is horizontal when bucket tilt = ARM_GROUND_ANGLE (compensates for arm angle)
219223BUCKET_GROUND_TILT = ARM_GROUND_ANGLE; // Tilt needed to make bottom flat when arm at ground
220- BUCKET_TILT_ANGLE = BUCKET_GROUND_TILT + (animation_time * (45 - BUCKET_GROUND_TILT)); // From flat to curled
224+ BUCKET_MAX_CURL = 60 ; // Maximum curl angle when fully raised
225+
226+ // Bucket actuates with the arm using the same animation_phase for looping
227+ // Starts flat on ground, curls up as arm rises, then uncurls as arm lowers
228+ BUCKET_TILT_ANGLE = BUCKET_GROUND_TILT + (animation_phase * (BUCKET_MAX_CURL - BUCKET_GROUND_TILT)); // From flat to curled and back
221229
222230// =============================================================================
223231// HYDRAULIC CYLINDER MOUNTING POINTS
@@ -882,11 +890,12 @@ module oriented_cylinder(base_pt, target_pt, bore, rod, stroke, extension) {
882890
883891 translate (base_pt)
884892 rotate (a = angle, v = axis) {
885- hydraulic_cylinder(bore, rod, stroke, false , extension, "clevis" );
893+ // Scale cylinder to exactly span between mounts using total_length
894+ hydraulic_cylinder(bore, rod, stroke, false , extension, "clevis" , len);
886895
887- // Base clevis pin with nuts
896+ // Base clevis pin with nuts (pin axis along X to match lug holes)
888897 translate ([0 , 0 , - 10 ])
889- rotate ([90 , 0 , 0 ]) {
898+ rotate ([0 , 90 , 0 ]) {
890899 // Pin
891900 color ("Silver" )
892901 cylinder (d= clevis_pin_dia, h= clevis_pin_length, center= true , $ fn= 24 );
@@ -906,7 +915,7 @@ module oriented_cylinder(base_pt, target_pt, bore, rod, stroke, extension) {
906915
907916 translate (target_pt)
908917 rotate (a = angle, v = axis)
909- rotate ([90 , 0 , 0 ]) {
918+ rotate ([0 , 90 , 0 ]) { // Pin axis along X to match lug holes
910919 // Pin
911920 color ("Silver" )
912921 cylinder (d= rod_pin_dia, h= rod_pin_length, center= true , $ fn= 24 );
@@ -1376,7 +1385,7 @@ module wheel_assemblies() {
13761385 for (i = [0 :3 ]) {
13771386 translate (positions[i])
13781387 rotate ([0 , 0 , 90 ])
1379- rotate ([animation_time * 360 , 0 , 0 ]) // Spin animation
1388+ rotate ([0 , animation_time * 360 , 0 ]) // Spin around axle (wheel axis is Y)
13801389 {
13811390 wheel(WHEEL_DIAMETER, WHEEL_WIDTH, 150 , true );
13821391
@@ -1535,9 +1544,12 @@ module bobcat_quick_attach_plate() {
15351544 }
15361545
15371546 // Bucket cylinder attachment points - TYPE A: U-Channel from 3"x3" tube with pins
1538- for (x = [- flange_spacing/2 , flange_spacing/2 ]) {
1539- translate ([x, plate_thick + 40 , - 60 ]) // Near top of plate
1540- rotate ([0 , 0 , 90 ])
1547+ // Bucket cylinder lugs: align with cylinder line and bring inward toward machine center
1548+ for (side = [- 1 , 1 ]) {
1549+ x = side * BUCKET_CYL_X_SPACING; // Match arm-side cylinder X offset
1550+ y = plate_thick + 20 ; // Tuck closer to the plate (inboard)
1551+ z = - 60 ; // Height on plate
1552+ translate ([x, y, z])
15411553 u_channel_lug_with_pin(TUBE_3X3_1_4, 80 , BOLT_DIA_3_4 + 2 );
15421554 }
15431555}
0 commit comments