Skip to content

Commit

Permalink
Always wait on hardware if hardware is true.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbharatheesha committed Feb 11, 2025
1 parent dcae733 commit 6858e48
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,19 @@ Status VelodyneHwInterface::get_sensor_configuration(SensorConfigurationBase & s

VelodyneStatus VelodyneHwInterface::init_http_client()
{
try {
http_client_driver_->init_client(sensor_configuration_->sensor_ip, 80);
if (!http_client_driver_->client()->isOpen()) {
http_client_driver_->client()->open();
while (true) {
try {
http_client_driver_->init_client(sensor_configuration_->sensor_ip, 80);
if (!http_client_driver_->client()->isOpen()) {
http_client_driver_->client()->open();
}
return Status::OK;
} catch (const std::exception & ex) {
std::cerr << "Error initializing lidar: " << ex.what() << std::endl;
std::cerr << "Retrying after 5 seconds..." << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(5));
}
} catch (const std::exception & ex) {
VelodyneStatus status = Status::HTTP_CONNECTION_ERROR;
return status;
}
return Status::OK;
}

void VelodyneHwInterface::string_callback(const std::string & str)
Expand Down

0 comments on commit 6858e48

Please sign in to comment.