Skip to content

RSDK-13461: DRAFT! RFC. Fix build and add features#18

Open
stevebriskin wants to merge 8 commits intomainfrom
fixdriver
Open

RSDK-13461: DRAFT! RFC. Fix build and add features#18
stevebriskin wants to merge 8 commits intomainfrom
fixdriver

Conversation

@stevebriskin
Copy link

The current driver is broken and missing some key features. This is an attempt to fix that. It is best to review this commit by commit....review the first commit from scratch, not as a diff, sorry, it was one big commit.
I focused entirely on the serial model and before merging we need to decide if we should even continue to support the can model if we should just focus on serial and make it good first.

Looking for directional

@stevebriskin stevebriskin changed the title DRAFT! RFC. Fix build and add features RSDK-13461: DRAFT! RFC. Fix build and add features Feb 28, 2026
Copy link

@npmenard npmenard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with first pass. The new version of the drive driver should allow us to make almost everything async so maybe we can avoid threads?
Agree, delete the CAN module

with ThreadPoolExecutor(max_workers=1) as executor:
if odriveSerial.serial_number == "":
odriveSerial.logger.warning("If you are using multiple Odrive controllers, make sure to add their respective serial_number to each component attributes")
odriveSerial.odrv = executor.submit(odrive.find_any).result()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_any is an alias for find_sync so you should be able to invoke without a threadexec no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither worked. something about how the odrive sdk is starting an event loop while one was already started by the viam sdk...i don't recall exactly but i decided that it's not worth debugging for the time being

self.odrv.axis0.controller.input_vel = rps

async def reset_zero_position(self, offset: float, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs):
position = await self.get_position()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use set_abs_pos or set_linear_count


if odriveSerial.odrv.axis0.config.enable_watchdog:
odriveSerial.logger.info("Starting watchdog feed thread for axis0, as it is enabled.")
Thread(target=odriveSerial._periodically_feed_watchdog, daemon=True).start()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async possible?

odriveSerial.vel_limit = odriveSerial.odrv.axis0.controller.config.vel_limit

odriveSerial._stop_event = Event()
Thread(target=odriveSerial._periodically_surface_errors, daemon=True).start()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants