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:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user