Code Monkey home page Code Monkey logo

Comments (7)

adnanmunawar avatar adnanmunawar commented on June 19, 2024

Hi Kamil,

Hmm, that is odd, I haven't see this before. Can you try one thing, close the ros application, (i.e. terminate roslaunch geomagic_control geomagic_headless.launch). Then take the stylus out of the ink-well and after this rerun the roslaunch geomagic_control geomagic_headless.launch command. Is there any change?

from ros_geomagic.

kamilcetin avatar kamilcetin commented on June 19, 2024

Hi Adnan,

I tried it. But it does not change. I mean that three active encoder joint positions are still 0,0,0 and pose.positions x,y,z are still 0,-110,-35. However, the other gimbal positions and orientation are changing.

It is really strange case.

from ros_geomagic.

adnanmunawar avatar adnanmunawar commented on June 19, 2024

Yeah I haven't seen this one before. I do not have a device with me for a few months to test this out for myself. Looking at the code, the joints are being read here

HDCallbackCode HDCALLBACK device_state_callback(void *pUserData) {
    DeviceState *device_state = static_cast<DeviceState *>(pUserData);
    if (hdCheckCalibration() == HD_CALIBRATION_NEEDS_UPDATE) {
        ROS_DEBUG("Updating calibration...");
        hdUpdateCalibration(calibrationStyle);
    }
    hdBeginFrame(hdGetCurrentDevice());
    //Get angles, set forces
    hdGetDoublev(HD_CURRENT_GIMBAL_ANGLES, device_state->rot);
    hdGetDoublev(HD_CURRENT_POSITION, device_state->position);
    hdGetDoublev(HD_CURRENT_JOINT_ANGLES, device_state->joints);
    hdGetDoublev(HD_CURRENT_TRANSFORM, device_state->transform);

    hduVector3Dd vel_buff(0, 0, 0);
    vel_buff = (device_state->position * 3 - 4 * device_state->pos_hist1
                + device_state->pos_hist2) / 0.002;  //mm/s, 2nd order backward dif
    device_state->velocity = (.2196 * (vel_buff + device_state->inp_vel3)
                              + .6588 * (device_state->inp_vel1 + device_state->inp_vel2)) / 1000.0
            - (-2.7488 * device_state->out_vel1 + 2.5282 * device_state->out_vel2
               - 0.7776 * device_state->out_vel3);  //cutoff freq of 20 Hz
    device_state->pos_hist2 = device_state->pos_hist1;
    device_state->pos_hist1 = device_state->position;
    device_state->inp_vel3  = device_state->inp_vel2;
    device_state->inp_vel2  = device_state->inp_vel1;
    device_state->inp_vel1  = vel_buff;
    device_state->out_vel3  = device_state->out_vel2;
    device_state->out_vel2  = device_state->out_vel1;
    device_state->out_vel1  = device_state->velocity;
    for(int i=0; i<3;i++){
        if (device_state->lock[i]) {
            device_state->force[i] = 0.3 * (device_state->lock_pos[i] - device_state->position[i])
                    - 0.001 * device_state->velocity[i];
        }
    }
    hdSetDoublev(HD_CURRENT_FORCE, device_state->force);

    //Get buttons
    int nButtons = 0;
    hdGetIntegerv(HD_CURRENT_BUTTONS, &nButtons);
    device_state->buttons[0] = (nButtons & HD_DEVICE_BUTTON_1) ? 1 : 0;
    device_state->buttons[1] = (nButtons & HD_DEVICE_BUTTON_2) ? 1 : 0;

    hdEndFrame(hdGetCurrentDevice());

    HDErrorInfo error;
    if (HD_DEVICE_ERROR(error = hdGetError())) {
        hduPrintError(stderr, &error, "Error during main scheduler callback");
        if (hduIsSchedulerError(&error))
            return HD_CALLBACK_DONE;
    }

    float t[7] = { 0., device_state->joints[0], device_state->joints[1],
                   device_state->joints[2] - device_state->joints[1], device_state->rot[0],
                   device_state->rot[1], device_state->rot[2] };
    for (int i = 0; i < 7; i++)
        device_state->thetas[i] = t[i];
    return HD_CALLBACK_CONTINUE;
}

It may be possible that there in an update to the libHD API and we just need to incorporate that.

from ros_geomagic.

RaMathuZen avatar RaMathuZen commented on June 19, 2024

I am using a Geomagic Touch device with an ethernet connection. I did run roslaunch geomagic_control geomagic.launch and I am able to interface it with ROS noetic in Linux Mint 20.3 which is based on Ubuntu Focal 20.04. Also I am able to recieve those data.

from ros_geomagic.

kamilcetin avatar kamilcetin commented on June 19, 2024

Hi, I have noticed that when I do catkin_make I have no errors but have some warnings;

Scanning dependencies of target device_node
[ 85%] Built target geomagic_control_generate_messages
[ 92%] Building CXX object ros_geomagic/geomagic_control/CMakeFiles/device_node.dir/src/device_node.cpp.o
/home/kamil/catkin_ws/src/ros_geomagic/geomagic_control/src/device_node.cpp:250:64: warning: ‘stdcall’ attribute ignored [-Wattributes]
250 | HDCallbackCode HDCALLBACK device_state_callback(void pUserData) {
| ^
/home/kamil/catkin_ws/src/ros_geomagic/geomagic_control/src/device_node.cpp: In function ‘HDCallbackCode device_state_callback(void
)’:
/home/kamil/catkin_ws/src/ros_geomagic/geomagic_control/src/device_node.cpp:303:63: warning: narrowing conversion of ‘device_state->DeviceState::joints.hduVector3D::operator’ from ‘double’ to ‘float’ [-Wnarrowing]
303 | device_state->rot[1], device_state->rot[2] };
| ^
/home/kamil/catkin_ws/src/ros_geomagic/geomagic_control/src/device_node.cpp:303:63: warning: narrowing conversion of ‘device_state->DeviceState::joints.hduVector3D::operator’ from ‘double’ to ‘float’ [-Wnarrowing]
/home/kamil/catkin_ws/src/ros_geomagic/geomagic_control/src/device_node.cpp:302:44: warning: narrowing conversion of ‘(device_state->DeviceState::joints.hduVector3D::operator - device_state->DeviceState::joints.hduVector3D::operator)’ from ‘double’ to ‘float’ [-Wnarrowing]
302 | device_state->joints[2] - device_state->joints[1], device_state->rot[0],
/home/kamil/catkin_ws/src/ros_geomagic/geomagic_control/src/device_node.cpp:303:63: warning: narrowing conversion of ‘device_state->DeviceState::rot.hduVector3D::operator’ from ‘double’ to ‘float’ [-Wnarrowing]
303 | device_state->rot[1], device_state->rot[2] };
| ^
/home/kamil/catkin_ws/src/ros_geomagic/geomagic_control/src/device_node.cpp:303:63: warning: narrowing conversion of ‘device_state->DeviceState::rot.hduVector3D::operator’ from ‘double’ to ‘float’ [-Wnarrowing]
/home/kamil/catkin_ws/src/ros_geomagic/geomagic_control/src/device_node.cpp:303:63: warning: narrowing conversion of ‘device_state->DeviceState::rot.hduVector3D::operator’ from ‘double’ to ‘float’ [-Wnarrowing]
[100%] Linking CXX executable /home/kamil/catkin_ws/devel/lib/geomagic_control/device_node
/usr/bin/ld: warning: libncurses.so.5, needed by /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libHD.so, may conflict with libncurses.so.6
[100%] Built target device_node

When I checked my Ubuntu folders, I have both libncurses.so.5 and libncurses.so.6:
/usr/lib/x86_64-linux-gnu/libncurses.so.5
/usr/lib/x86_64-linux-gnu/libncurses.so.5.9
/usr/lib/x86_64-linux-gnu/libncurses.so.6
/usr/lib/x86_64-linux-gnu/libncurses.so.6.2

Do you think that the problem is related with incorporation between the code and libHD.so or confliction between libncurses.so.5 and libncurses.so.6 ?

from ros_geomagic.

adnanmunawar avatar adnanmunawar commented on June 19, 2024

I don't think that libncurses would cause this runtime issue. Can you try modifying these two lines as below and recompiling and retrying.

Screenshot from 2023-06-08 09-44-07

from ros_geomagic.

kamilcetin avatar kamilcetin commented on June 19, 2024

It does not change for publishg sensor data.

But, when I do catkin_make, now there is no warnings about double / floating. However, there is still warning for conflict on libncurses:

Scanning dependencies of target device_node
[ 85%] Built target geomagic_control_generate_messages
[ 92%] Building CXX object ros_geomagic/geomagic_control/CMakeFiles/device_node.dir/src/device_node.cpp.o
/home/kamil/catkin_ws/src/ros_geomagic/geomagic_control/src/device_node.cpp:250:64: warning: ‘stdcall’ attribute ignored [-Wattributes]
250 | HDCallbackCode HDCALLBACK device_state_callback(void *pUserData) {
| ^
[100%] Linking CXX executable /home/kamil/catkin_ws/devel/lib/geomagic_control/device_node
/usr/bin/ld: warning: libncurses.so.5, needed by /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libHD.so, may conflict with libncurses.so.6
[100%] Built target device_node

from ros_geomagic.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.