-
Notifications
You must be signed in to change notification settings - Fork 113
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
RSDK-2526 unable to move multiaxis gantry #2168
Merged
randhid
merged 8 commits into
viamrobotics:main
from
randhid:RSDK-2526-unable-to-move-a-multi-axis-gantry
Apr 6, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0cc6a4d
Fix indexing error
randhid df9a406
Add simple test
randhid 03873c9
checkotu lcoal branch
randhid b90c89b
Merge
randhid 638218e
Lint
randhid bbbec6c
Add comments to test
randhid caf86f2
Fix failign test
randhid da101d3
Fix second test
randhid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,7 +265,7 @@ func (g *oneAxis) homeTwoLimSwitch(ctx context.Context) error { | |
g.positionLimits = []float64{positionA, positionB} | ||
|
||
// Go backwards so limit stops are not hit. | ||
x := g.rotationalToLinear(0.8 * g.lengthMm) | ||
x := g.linearToRotational(0.8 * g.lengthMm) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oof, this looks like a frustrating bug to find! Nice work here. |
||
err = g.motor.GoTo(ctx, g.rpm, x, nil) | ||
if err != nil { | ||
return err | ||
|
@@ -302,7 +302,7 @@ func (g *oneAxis) homeEncoder(ctx context.Context) error { | |
return nil | ||
} | ||
|
||
func (g *oneAxis) rotationalToLinear(positions float64) float64 { | ||
func (g *oneAxis) linearToRotational(positions float64) float64 { | ||
theRange := g.positionLimits[1] - g.positionLimits[0] | ||
x := positions / g.lengthMm | ||
x = g.positionLimits[0] + (x * theRange) | ||
|
@@ -397,7 +397,7 @@ func (g *oneAxis) MoveToPosition(ctx context.Context, positions []float64, extra | |
return fmt.Errorf("oneAxis %s out of range (%.2f) min: 0 max: %.2f", g.name, positions[0], g.lengthMm) | ||
} | ||
|
||
x := g.rotationalToLinear(positions[0]) | ||
x := g.linearToRotational(positions[0]) | ||
// Limit switch errors that stop the motors. | ||
// Currently needs to be moved by underlying gantry motor. | ||
if len(g.limitSwitchPins) > 0 { | ||
|
@@ -434,6 +434,7 @@ func (g *oneAxis) MoveToPosition(ctx context.Context, positions []float64, extra | |
} | ||
} | ||
|
||
g.logger.Debugf("gantry (%s) going to %.2f at speed %.2f", g.name, x, g.rpm) | ||
err := g.motor.GoTo(ctx, g.rpm, x, extra) | ||
if err != nil { | ||
return err | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spieswl @nfranczak @raybjork if you'd like an update. Also, made
CurrentInputs
andGoToInputs
fallthrough functions rather than copy-pastes of the logic to MoveToPosition and PositionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that matches our patterns in
arm
so I like the consistency.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually opposite from what we have in arm, where GoToInputs is the function that the basic function that is called by MoveToPosition. Can you switch these to be consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's actually more consistent here, the API names are the same, but
gantry.MoveToPosition
is actually a functional analog toarm.MoveToJointPositions
andbase.MoveStraight
/base.Spin
. So this won't change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raybjork pinging you for a response.