Skip to content

Commit ed0454d

Browse files
committed
chore: change print to logging
1 parent 1885350 commit ed0454d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
port: /dev/tty.usbmodem5AE60581751
22
fps: 20
3-
log_level: DEBUG
3+
log_level: INFO
44
hardware_mode: normal # normal,310b,rk3588
55
control_mode: inverse # inverse, act

src/arm_inverse_controller.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
import math
23
import time
34
import traceback
@@ -85,7 +86,7 @@ def p_control_loop(cmd, current_x, current_y, current_obs, kp=0.5):
8586
current_target = target_positions[joint_name]
8687
new_target = int(current_target + value)
8788
target_positions[joint_name] = new_target
88-
print(f"Update target position {joint_name}: {current_target} -> {new_target}")
89+
logging.debug(f"Update target position {joint_name}: {current_target} -> {new_target}")
8990

9091
if len(move_command_list) > 0:
9192
for key, value in move_command_list:
@@ -99,7 +100,7 @@ def p_control_loop(cmd, current_x, current_y, current_obs, kp=0.5):
99100
joint2_target, joint3_target = inverse_kinematics(current_x, current_y)
100101
target_positions['arm_shoulder_lift'] = joint2_target
101102
target_positions['arm_elbow_flex'] = joint3_target
102-
print(
103+
logging.debug(
103104
f"Update x coordinate: {current_x:.4f}, Update y coordinate: {current_y:.4f}, joint2={joint2_target:.3f}, joint3={joint3_target:.3f}")
104105

105106
# Apply pitch adjustment to wrist_flex
@@ -113,7 +114,7 @@ def p_control_loop(cmd, current_x, current_y, current_obs, kp=0.5):
113114
else:
114115
p_control_loop.step_counter = 0
115116
if p_control_loop.step_counter % 100 == 0:
116-
print(
117+
logging.debug(
117118
f"Current pitch adjustment: {pitch:.3f}, wrist_flex target: {target_positions['arm_wrist_flex']:.3f}")
118119

119120
# Extract current joint positions
@@ -142,7 +143,7 @@ def p_control_loop(cmd, current_x, current_y, current_obs, kp=0.5):
142143
if robot_action:
143144
return robot_action, current_x, current_y
144145
except Exception as e:
145-
print(f"P control loop error: {e}")
146+
logging.debug(f"P control loop error: {e}")
146147
traceback.print_exc()
147148
return {}, current_x, current_y
148149

0 commit comments

Comments
 (0)