@@ -392,21 +392,19 @@ def teleop_step(
392
392
for name in self .leader_arms :
393
393
pos = self .leader_arms [name ].read ("Present_Position" )
394
394
pos_tensor = torch .from_numpy (pos ).float ()
395
- # Instead of pos_tensor.item(), use tolist() to convert the entire tensor to a list
396
395
arm_positions .extend (pos_tensor .tolist ())
397
396
398
- # (The rest of your code for generating wheel commands remains unchanged)
399
- x_cmd = 0.0 # m/s forward/backward
400
- y_cmd = 0.0 # m/s lateral
397
+ y_cmd = 0.0 # m/s forward/backward
398
+ x_cmd = 0.0 # m/s lateral
401
399
theta_cmd = 0.0 # deg/s rotation
402
400
if self .pressed_keys ["forward" ]:
403
- x_cmd += xy_speed
401
+ y_cmd += xy_speed
404
402
if self .pressed_keys ["backward" ]:
405
- x_cmd -= xy_speed
403
+ y_cmd -= xy_speed
406
404
if self .pressed_keys ["left" ]:
407
- y_cmd += xy_speed
405
+ x_cmd += xy_speed
408
406
if self .pressed_keys ["right" ]:
409
- y_cmd -= xy_speed
407
+ x_cmd -= xy_speed
410
408
if self .pressed_keys ["rotate_left" ]:
411
409
theta_cmd += theta_speed
412
410
if self .pressed_keys ["rotate_right" ]:
@@ -584,8 +582,8 @@ def body_to_wheel_raw(
584
582
# Create the body velocity vector [x, y, theta_rad].
585
583
velocity_vector = np .array ([x_cmd , y_cmd , theta_rad ])
586
584
587
- # Define the wheel mounting angles with a -90° offset.
588
- angles = np .radians (np .array ([240 , 120 , 0 ]) - 90 )
585
+ # Define the wheel mounting angles (defined from y axis cw)
586
+ angles = np .radians (np .array ([300 , 180 , 60 ]) )
589
587
# Build the kinematic matrix: each row maps body velocities to a wheel’s linear speed.
590
588
# The third column (base_radius) accounts for the effect of rotation.
591
589
m = np .array ([[np .cos (a ), np .sin (a ), base_radius ] for a in angles ])
@@ -641,8 +639,8 @@ def wheel_raw_to_body(
641
639
# Compute each wheel’s linear speed (m/s) from its angular speed.
642
640
wheel_linear_speeds = wheel_radps * wheel_radius
643
641
644
- # Define the wheel mounting angles with a -90° offset.
645
- angles = np .radians (np .array ([240 , 120 , 0 ]) - 90 )
642
+ # Define the wheel mounting angles (defined from y axis cw)
643
+ angles = np .radians (np .array ([300 , 180 , 60 ]) )
646
644
m = np .array ([[np .cos (a ), np .sin (a ), base_radius ] for a in angles ])
647
645
648
646
# Solve the inverse kinematics: body_velocity = M⁻¹ · wheel_linear_speeds.
0 commit comments