Skip to content
Snippets Groups Projects
Commit 92ce1a77 authored by Johann Mantel's avatar Johann Mantel
Browse files

code formatting

parent eeda820d
No related branches found
No related tags found
No related merge requests found
...@@ -76,10 +76,9 @@ void SickLaserUnit::onInitComponent() { ...@@ -76,10 +76,9 @@ void SickLaserUnit::onInitComponent() {
std::string scannerName; std::string scannerName;
if (false == nhPriv.getParam("scanner_type", scannerName)) { if (false == nhPriv.getParam("scanner_type", scannerName)) {
ROS_ERROR( ROS_ERROR("cannot find parameter "
"cannot find parameter " "scanner_type"
"scanner_type" " in the param set. Please specify scanner_type.");
" in the param set. Please specify scanner_type.");
ROS_ERROR("Try to set %s as fallback.\n", nodeName.c_str()); ROS_ERROR("Try to set %s as fallback.\n", nodeName.c_str());
scannerName = nodeName; scannerName = nodeName;
} }
...@@ -109,7 +108,7 @@ void SickLaserUnit::onInitComponent() { ...@@ -109,7 +108,7 @@ void SickLaserUnit::onInitComponent() {
new sick_scan::SickGenericParser(scannerName); new sick_scan::SickGenericParser(scannerName);
double param; double param;
char colaDialectId = 'A'; // A or B (Ascii or Binary) char colaDialectId = 'A'; // A or B (Ascii or Binary)
if (nhPriv.getParam("range_min", param)) { if (nhPriv.getParam("range_min", param)) {
parser->set_range_min(param); parser->set_range_min(param);
...@@ -163,14 +162,13 @@ void SickLaserUnit::onConnectComponent() { ...@@ -163,14 +162,13 @@ void SickLaserUnit::onConnectComponent() {
ROS_INFO("Start initialising scanner [Ip: %s] [Port: %s]", hostname.c_str(), ROS_INFO("Start initialising scanner [Ip: %s] [Port: %s]", hostname.c_str(),
port.c_str()); port.c_str());
// attempt to connect/reconnect // attempt to connect/reconnect
delete s; // disconnect scanner delete s; // disconnect scanner
if (useTCP) { if (useTCP) {
s = new sick_scan::SickScanCommonTcp(hostname, port, timelimit, parser, s = new sick_scan::SickScanCommonTcp(hostname, port, timelimit, parser,
colaDialectId); colaDialectId);
} else { } else {
ROS_ERROR( ROS_ERROR("TCP is not switched on. Probably hostname or port not set. Use "
"TCP is not switched on. Probably hostname or port not set. Use " "roslaunch to start node.");
"roslaunch to start node.");
exit(-1); exit(-1);
} }
...@@ -181,16 +179,15 @@ void SickLaserUnit::onConnectComponent() { ...@@ -181,16 +179,15 @@ void SickLaserUnit::onConnectComponent() {
isInitialized = true; isInitialized = true;
signal(SIGINT, signal(SIGINT,
SIG_DFL); // change back to standard signal handler after initialising SIG_DFL); // change back to standard signal handler after initialising
if (result == sick_scan::ExitSuccess) // OK -> loop again if (result == sick_scan::ExitSuccess) // OK -> loop again
{ {
if (changeIP) { if (changeIP) {
runState = scanner_finalize; runState = scanner_finalize;
} }
runState = scanner_run; // after initialising switch to run state
runState = scanner_run; // after initialising switch to run state
} else { } else {
runState = scanner_init; // If there was an error, try to restart scanner runState = scanner_init; // If there was an error, try to restart scanner
} }
// Do things after connecting to topics and components. // Do things after connecting to topics and components.
...@@ -222,12 +219,12 @@ void SickLaserUnit::onConnectComponent() { ...@@ -222,12 +219,12 @@ void SickLaserUnit::onConnectComponent() {
void SickLaserUnit::run() { void SickLaserUnit::run() {
while (!task->isStopped()) { while (!task->isStopped()) {
if (result == sick_scan::ExitSuccess) // OK -> loop again if (result == sick_scan::ExitSuccess) // OK -> loop again
{ {
ros::spinOnce(); ros::spinOnce();
result = s->loopOnce(); result = s->loopOnce();
} else { } else {
runState = scanner_finalize; // interrupt runState = scanner_finalize; // interrupt
} }
} }
} }
...@@ -315,4 +312,4 @@ arviz) ...@@ -315,4 +312,4 @@ arviz)
} }
*/ */
} // namespace armarx } // namespace armarx
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment