-
Notifications
You must be signed in to change notification settings - Fork 101
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
Variable scan frequence #26
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,6 +187,18 @@ void LMS1xx::setScanDataCfg(const scanDataCfg &cfg) { | |
buf[len - 1] = 0; | ||
} | ||
|
||
void LMS1xx::setOutputRange(const scanOutputRange &cfg) { | ||
char buf[100]; | ||
sprintf(buf, "%c%s 1 %X %X %X%c", 0x02, "sWN LMPoutputRange", | ||
cfg.angleResolution, cfg.startAngle, cfg.stopAngle, 0x03); | ||
|
||
write(sockDesc, buf, strlen(buf)); | ||
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.
Since However, if any of the I think it'd be better to take the length from the return value of |
||
|
||
int len = read(sockDesc, buf, 100); | ||
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. What's the meaning of the third param of the |
||
|
||
buf[len - 1] = 0; | ||
} | ||
|
||
scanOutputRange LMS1xx::getScanOutputRange() const { | ||
scanOutputRange outputRange; | ||
char buf[100]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,14 +45,9 @@ int main(int argc, char **argv) | |
outputRange = laser.getScanOutputRange(); | ||
} | ||
|
||
//check if laser is fully initialized, else reconnect | ||
//assuming fully initialized => scaningFrequency=5000 | ||
if (cfg.scaningFrequency != 5000) { | ||
laser.disconnect(); | ||
ROS_INFO("Waiting for laser to initialize..."); | ||
} | ||
|
||
} while (!laser.isConnected() || cfg.scaningFrequency != 5000); | ||
} while (!laser.isConnected()); | ||
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. Maybe we should have an additional check instead, not forcing anything, but a sanity check to be completely sure the configuration is good. |
||
|
||
if (laser.isConnected()) { | ||
ROS_INFO("Connected to laser."); | ||
|
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.
Set