fix: restrict PID config serial output to debug mode, default to debug

- gimbal_node: skip 0xA8 frame send when not in debug mode
- chassis_node: skip 0xA8 frame send when not in debug mode
- chassis_node: change default mode from auto to debug
This commit is contained in:
dev01
2026-06-07 13:45:15 +08:00
parent 3f956d5f29
commit 74c470a8fa
2 changed files with 13 additions and 1 deletions
@@ -61,7 +61,7 @@ class ChassisNode(Node):
Float32, '/chassis/feedforward', 10 Float32, '/chassis/feedforward', 10
) )
self._current_mode = 'auto' self._current_mode = 'debug'
self._read_thread = threading.Thread( self._read_thread = threading.Thread(
target=self._serial_read_loop, daemon=True target=self._serial_read_loop, daemon=True
@@ -118,6 +118,12 @@ class ChassisNode(Node):
self._write_frame(data) self._write_frame(data)
def _pid_config_callback(self, msg: String): def _pid_config_callback(self, msg: String):
if self._current_mode != 'debug':
self.get_logger().warn(
'Chassis PID config only allowed in debug mode, '
f'current mode: {self._current_mode}')
return
try: try:
pid = json.loads(msg.data) pid = json.loads(msg.data)
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
@@ -107,6 +107,12 @@ class GimbalNode(Node):
self._write_frame(data) self._write_frame(data)
def _pid_config_callback(self, msg: String): def _pid_config_callback(self, msg: String):
if self._current_mode != 'debug':
self.get_logger().warn(
'PID config only allowed in debug mode, '
f'current mode: {self._current_mode}')
return
try: try:
pid = json.loads(msg.data) pid = json.loads(msg.data)
except json.JSONDecodeError as e: except json.JSONDecodeError as e: