- edited description
CChaiHaptics.cpp Error
Issue #66
resolved
The method bool CChaiHaptics::getAllHapticDevicePositions always printed out the following erro: "WARNING : Could not read position of haptic device" even though the device was connected and I could read values from it. Fixed the bug:
Change these lines
int tmp =(*it)->getPosition(tmpv); //Read position into tmpv
Eigen::Vector3d tmp_vec;
tmp_vec<<tmpv(0),tmpv(1),tmpv(2);
*itv = tmp_vec; //Set the positions in the vector
if (0 != tmp)
{ std::cout<<"\nWARNING : Could not read position of haptic device: "<<i; }
to
bool device_ready =(*it)->getPosition(tmpv); //Read position into tmpv
Eigen::Vector3d tmp_vec;
tmp_vec<<tmpv(0),tmpv(1),tmpv(2);
*itv = tmp_vec; //Set the positions in the vector
if (!device_ready)
{ std::cout<<"\nWARNING : Could not read position of haptic device: "<<i; }
The sam error appears in getHapticDeviceRotation. Fix:
scl::sBool CChaiHaptics::getHapticDeviceRotation(
const sUInt arg_id, Eigen::Matrix3d& ret_rot_mat) const
{
if(arg_id >= haptics_handler_->getNumDevices())
{
std::cout<<"\nCChaiHaptics::getHapticDevicePosition() : Error:"
<<"\n\tThe requested haptic ID is greater than the number of connected devices";
return false;
}
// ***********************************************************
// READ DEVICE STATE
// ***********************************************************
cMatrix3d tmpv;
bool device_ready = haptic_devices_[arg_id]->getRotation(tmpv);
if (!device_ready)
{ std::cout<<"\nCChaiHaptics::getHapticDeviceRotation() : WARNING : \n\tCould not read rotation of haptic device: "<<arg_id; }
for (int i=0; i<3; i++) {
for (int j=0; j<3; j++) { ret_rot_mat(i,j) = tmpv(i,j);}
}
return true;
}
Comments (4)
-
reporter -
reporter - edited description
-
repo owner Thanks Fabian!
-
repo owner - changed status to resolved
Fixed as of 982ea9c1861fedd1aa1ae84e1452622d25368560
- Log in to comment