ADVRHumanoids / CartesianInterface

Package for generic cartesian control of floating base robots. It includes a ROS-based front end, as well as a programmatic API that can be used inside a real-time loop.
GNU General Public License v3.0
20 stars 1 forks source link

Problems on C++ API Examples on the Tutorial #49

Closed DavideAntonucci closed 4 years ago

DavideAntonucci commented 4 years ago

Hi @alaurenzi ,

I'm working on CartesIO 2.0.0 and following the tutorial for the C++ API:

https://advrhumanoids.github.io/CartesianInterface/progr_cpp.html#

The CartesianInterface branch that I'm using is 2.0-master.

I built the examples that you've proposed [A minimal example (ROS client)=test1.cpp,A minimal example (Solver)=cartesio_solver] getting these errors:

image

Moreover, I've correct partially the code:


 if(task_cartesian)
    {
        Eigen::Affine3d Ttgt;
        double time = 5.0;

        // fill Ttgt...

        // command reaching motion
        task_cartesian->setPoseTarget(Ttgt, time);//task->setPoseTarget(Ttgt, time);

        // wait until motion completed
       // THIS doesn't work
        //task_cartesian->setPoseTarget(Ttgt, time);//task->waitReachCompleted();
    }
alaurenzi commented 4 years ago

Hi Davide, are you linking against the cartesian_interface target? One way is to add cartesian_interface to the catkin COMPONENTS in cmake, and then link with ${catkin_LIBRARIES}

For the other issue, you're right because waitReachCompleted is a ROS-specific API, so a different cast is needed. I'll update the documentation ASAP

DavideAntonucci commented 4 years ago

Sorry, I didn't include the CMakeLists.txt file:


add_executable(test1 src/test1.cpp)
target_link_libraries(test1 ${catkin_LIBRARIES} ${cartesian_interface_LIBRARIES})

add_executable(cartesio_solver src/cartesio_solver.cpp)
target_compile_definitions(cartesio_solver PRIVATE
    -DURDF_PATH="/home/user/MultiDoF-superbuild/configs/CogimonConfig/urdf/cogimon.urdf"
    -DSRDF_PATH="/home/user/MultiDoF-superbuild/configs/CogimonConfig/srdf/cogimon.srdf"
    -DIK_PB_PATH="/home/user/MultiDoF-superbuild/configs/CogimonConfig/cogimon_stack.yaml")
target_link_libraries(cartesio_solver ${catkin_LIBRARIES} ${cartesian_interface_LIBRARIES})
alaurenzi commented 4 years ago

This is fine! Thanks because I spotted a missing dependency in the cartesian_interface cmakelists. Try to pull the last 2.0-devel, re-install, and try again to compile.

DavideAntonucci commented 4 years ago

Done!

I got this error:

image

alaurenzi commented 4 years ago

Mmm on my system this does not happen, I'll investigate. Meanwhile, add yaml-cpp to the target_link_libraries command (should not be needed though)

alaurenzi commented 4 years ago

Ok, I tried to fix it. However, I could not test it on my machine (it was already working fine..). Try please to pull and install again!

alaurenzi commented 4 years ago

I also pushed a modified RosClient example to the docs that compiles and runs fine.. should be published to the web in a short time

Edit: here it is

DavideAntonucci commented 4 years ago

Thanks @alaurenzi done, it works!

alaurenzi commented 4 years ago

Thanks to you. I am closing this issue (until you find other problems!)