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

20160831 031700 polling motor driver #2

Merged
merged 63 commits into from
Sep 19, 2016

Conversation

andySigler
Copy link
Contributor

This PR moves the motor driver away from the OT forked firmware, and works as follows:

  • When a gcode command is sent, driver returns only when b"ok" or similar is received from motor controller
  • Current coordinates are polled using the M114 "show current position" gcode command
    • The response includes the motor controller's target coordinates and it's real-time coordinates
  • To detect when a series of move commands have completed, the wait_for_arrival() method compares the target coordinate to the real-time coordinate, and returns when they're equal

andySigler and others added 24 commits August 11, 2016 16:05
@levthedev
Copy link
Contributor

LGTM, but we need to test it IRL a lot to make sure.

@andySigler
Copy link
Contributor Author

Ready to be merged. This branch has passed thorough testing, running multiple hours on the tests/opentrons_sdk/drivers/random_move.py test. Ran over 24 hours, and all errors occurring have been either firmware or electrical errors.

@SimplyAhmazing
Copy link
Contributor

LGTM

self.motor.move(x=-100)
self.motor.wait_for_arrival()
except RuntimeWarning as e:
self.assertEqual(str(RuntimeWarning('limit switch hit')), str(e))
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting test. You could also do,

with self.assertRaises(RuntimeWarning) as e:
    self.motor.move(x=-100)
    self.motor.wait_for_arrival()

import sys
import time

from opentrons_sdk.drivers.motor import OpenTrons, GCodeLogger
Copy link
Contributor

Choose a reason for hiding this comment

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

GCodeLogger is an unused import

@andySigler andySigler merged commit 43b7cae into master Sep 19, 2016
@andySigler andySigler deleted the 20160831-031700-polling-motor-driver branch September 19, 2016 16:00
@astaff astaff mentioned this pull request Sep 22, 2017
2 tasks
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.

4 participants