This repository has been archived by the owner on Jan 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Read all the width as reported by the laser #8
Open
tulku
wants to merge
2
commits into
rosjava:obsolete/master
Choose a base branch
from
tulku:full-width
base: obsolete/master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,8 @@ private void waitUntilReady() { | |
boolean ready = false; | ||
while (!ready) { | ||
ready = true; | ||
// NOTE(Julian Cerruti) At this moment, the sent command does not matter much. | ||
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. Please use your username in NOTEs and TODOs. In this case though, I think you can just write a comment. No one needs to track you down to understand the motivation here. |
||
// Currently fixed to (0; 768) | ||
write("MD0000076800001"); | ||
try { | ||
checkMdmsStatus(); | ||
|
@@ -260,8 +262,9 @@ public void startScanning(final LaserScanListener listener) { | |
@Override | ||
public void run() { | ||
while (true) { | ||
String command = "MD00000768000%02d"; | ||
write(String.format(command, 99)); | ||
String command = String.format("MD%04d%04d000%02d", configuration.getFirstStep(), | ||
configuration.getLastStep(), 99); | ||
write(command); | ||
checkMdmsStatus(); | ||
checkTerminator(); | ||
String scansRemaining = "99"; | ||
|
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.
Why is this change necessary? Is numberOfConfiguredRanges computed incorrectly?
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 will avoid painful debugging and unnecessary crashes in favor of a clear warning message if, for any unanticipated reason, numberOfConfigured ranges doesn't match scan.getRanges().length - as it happened to us when trying to use this code.
The reason numberOfConfiguredRanges could be different than scan.getRanges().length is because the former is calculated at configuration time (FF command) but the number of ranges on each scan can technically be different for each distance acquisition request (MD).
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.
In that case, just set numberOfConfiguredRanges = scan.getRanges().length.
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.
Hmm ... are you sure about that? In most cases both should match. A mismatch between them might indicate a higher-level logic error. I think this will end up being a useful check, it does provide additional information about what's going on to the programmer. And in most circumstances, both numbers should match anyway, particularly with the change below