-
Notifications
You must be signed in to change notification settings - Fork 127
Description
| cli_ = std::make_unique<httplib::Client>("http://" + host); |
When trying to use the Polyscope X implementation of the Dashboard (wrapping the Robot API) and running the dashboard example, you get the following:
#### Executing 'build/examples/dashboard_example' [1770914731.997967] INFO /home/km/scripts/Universal_Robots_Client_Library/src/primary/primary_client.cpp 67: Starting primary client pipeline [1770914732.048810] INFO /home/km/scripts/Universal_Robots_Client_Library/src/ur/dashboard_client.cpp 62: DashboardClient created for host 10.0.0.76 [1770914732.053958] ERROR /home/km/scripts/Universal_Robots_Client_Library/examples/dashboard_example.cpp 83: Could not connect to dashboard [1770914732.053969] INFO /home/km/scripts/Universal_Robots_Client_Library/src/primary/primary_client.cpp 61: Stopping primary client pipeline Execution of 'build/examples/dashboard_example' failed with exit status 1.
After some debugging it appears this is due to not handling redirects from the Robot API. Many of those calls will trigger a 307 response after which an error is thrown. In order to fix I simply added the ability for the client to follow redirects. Adding the following after the client defintion fixes the issue:
cli_->set_follow_location(true);
So the constructor becomes:
DashboardClientImplX::DashboardClientImplX(const std::string& host) : DashboardClientImpl(host)
{
cli_ = std::make_unique<httplib::Client>("http://" + host);
cli_->set_follow_location(true); // Enable following HTTP redirects
}