Commit 34065ebf authored by Sam Horvath's avatar Sam Horvath
Browse files

ENH: Replaced atuomatic calibration with a preset calibration value

parent 547f3bcd
......@@ -47,7 +47,6 @@ VRPNArduinoDeviceClient::cleanUpModule()
//Module cleanup is causing TCP errors - seems to work fine without it
//m_vrpnAnalog->unregister_change_handler(this, analogChangeHandler);
//m_vrpnAnalog.reset();
}
......
......@@ -106,7 +106,7 @@ VRPNDeviceServer::initModule()
{
SerialInfo connectionSettings = m_SerialInfoMap[name];
//open with 6 channels (max needed for IMU, can use less)
m_deviceConnections->add(new vrpn_Streaming_Arduino(name.c_str(), m_serverConnection, connectionSettings.port, 6,connectionSettings.baudRate));
m_deviceConnections->add(new vrpn_Streaming_Arduino(name.c_str(), m_serverConnection, connectionSettings.port, 6, connectionSettings.baudRate));
} break;
default:
{
......
......@@ -61,40 +61,43 @@ FLSCameraController::setArduinoDevice(std::shared_ptr<VRPNArduinoDeviceClient> a
}
void
FLSCameraController::recalibrate()
FLSCameraController::setAngleCalibration(const double angle)
{
if (arduinoActive & calibrated)
{
if (arduinoClient->getRoll() != 0)
{
m_rollOffset = arduinoClient->getRoll();
std::cout << "FLS Camera Controller: Calibration complete" << std::endl;
calibrated = true;
}
else
{
std::cout << "FLS Camera Controller: Cannot calibrate - device still warming up" << std::endl;
}
}
m_rollOffset = angle;
}
double FLSCameraController::getAngleCalibration()
{
return m_rollOffset;
}
void
FLSCameraController::runModule()
FLSCameraController::recalibrate()
{
//Get head angle from Arduino, performing calibration if this is the first valid report
if (arduinoActive & calibrated)
{
this->setCameraHeadAngleOffset(arduinoClient->getRoll() - m_rollOffset);
}
else if (arduinoActive)
if (arduinoActive)
{
if (arduinoClient->getRoll() != 0)
{
std::cout << "FLS Camera Controller: Autocalibration complete" << std::endl;
m_rollOffset = arduinoClient->getRoll();
std::cout << "FLS Camera Controller: Calibration complete" << std::endl;
calibrated = true;
}
else
{
std::cout << "FLS Camera Controller: Cannot calibrate - bad input from device" << std::endl;
}
}
}
void
FLSCameraController::runModule()
{
//Get head angle from Arduino
if (arduinoActive)
{
this->setCameraHeadAngleOffset(arduinoClient->getRoll() - m_rollOffset);
}
auto roff = Quatd(Eigen::AngleAxisd(m_cameraHeadAngleOffset*PI / 180., Vec3d(0., 0., 1.)));
this->setCameraRotationOffset(roff);
......
......@@ -54,6 +54,12 @@ public:
void setCameraHeadAngleOffset(const double angle);
const double getCameraHeadAngleOffset() const;
///
/// \brief Get/Set the cameraHead angle calibration offset
///
void setAngleCalibration( const double angle);
double getAngleCalibration();
///
/// \brief Get/Set the angulation
///
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment