Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed reinitialize function #121

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions rcb4/armh7interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,12 @@ def open(self, port="/dev/ttyUSB1", baudrate=1000000, timeout=0.01):
except serial.SerialException as e:
print(f"Error opening serial port: {e}")
raise serial.SerialException(e)
ack = self.check_ack()
if ack is not True:
return False
# After powering on, the ACK value becomes unstable for some reason,
# so the process is repeated several times.
for _ in range(10):
ack = self.check_ack()
if ack is True:
break
self.check_firmware_version()
self.copy_worm_params_from_flash()
self.search_worm_ids()
Expand Down
6 changes: 1 addition & 5 deletions ros/kxr_controller/node_scripts/rcb4_ros_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,11 +1027,7 @@ def reinitialize_interface(self):
rospy.loginfo("Reinitialize interface.")
self.unsubscribe()
self.interface.close()
self.interface = self.setup_interface()
if self.read_current:
serial_call_with_retry(self.interface.switch_reading_servo_current, enable=True, max_retries=3)
if self.read_temperature:
serial_call_with_retry(self.interface.switch_reading_servo_temperature, enable=True, max_retries=3)
self.setup_interface_and_servo_parameters()
self.subscribe()
rospy.loginfo("Successfully reinitialized interface.")

Expand Down
Loading