Skip to content
Snippets Groups Projects
Commit 01803ad5 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

Merge branch 'FLSCleanup' into 'master'

FLS Calibration changes

See merge request !183
parents 8bfd0748 34065ebf
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ VRPNArduinoDeviceClient::initModule()
m_vrpnAnalog = std::make_shared<vrpn_Analog_Remote>(fullDeviceIp);
m_vrpnAnalog->register_change_handler(this, analogChangeHandler);
m_vrpnAnalog->shutup = true;
}
void
......@@ -43,9 +44,9 @@ VRPNArduinoDeviceClient::runModule()
void
VRPNArduinoDeviceClient::cleanUpModule()
{
m_vrpnAnalog->unregister_change_handler(this, analogChangeHandler);
m_vrpnAnalog.reset();
//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,22 +61,43 @@ FLSCameraController::setArduinoDevice(std::shared_ptr<VRPNArduinoDeviceClient> a
}
void
FLSCameraController::runModule()
FLSCameraController::setAngleCalibration(const double angle)
{
//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)
m_rollOffset = angle;
}
double FLSCameraController::getAngleCalibration()
{
return m_rollOffset;
}
void
FLSCameraController::recalibrate()
{
if (arduinoActive)
{
if (arduinoClient->getRoll() != 0)
{
std::cout << "FLS Camera Controller: Calibration complete; Safe to move camera" << 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
///
......@@ -62,6 +68,8 @@ public:
void setArduinoDevice(std::shared_ptr<VRPNArduinoDeviceClient> aClient);
void recalibrate();
protected:
///
......
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