Wiki

Clone wiki

scl-manips-v2 / bugs / merge_chai3

Updating to Chai3D version 3

This will help you resolve application errors that occur after an update to master version fe35077f60fb5f3de34d9d275afcaf6060fde3b2 or later.

  • First install libglew
    • Ubuntu 12.04 and later: $ sudo apt-get install libglew1.6-dev
    • Ubuntu 10.04 etc: $ sudo apt-get install libglew1.5-dev
  • After installing libglew, you will have to add a -lGLEW to your makefile, or GLEW library dependency in your cmake file. Eg. Replace target_link_libraries(fmri_forces gomp GL GLU glut ncurses usb-1.0 pthread rt pci z) with target_link_libraries(fmri_forces gomp GL GLU **GLEW** glut ncurses usb-1.0 pthread rt pci z)
  • After doing that, go to applications_linux/scl_lib and $ sh make_everything.sh
    • If that doesn't work, please go to the appropriate directory and delete the older build files. Sometimes stale cmake files etc. introduce weird errors. $ rm -rf build_*
  • Next, chai 3.0 uses namespace chai3d.
    • Recommended: Add a chai3d:: namespace scope operator to all the chai objects you are using
    • Hacky: Add a using namespace chai3d; at the top of your .cpp file. Do not add it to a .h file, which forces this "fix" on others.
  • Finally, chai 3.0 has stopped using Eigen. So you will have to fix functions that pass Eigen vectors to chai.
    • In a nutshell, create a temp vector.
    • Copy the Eigen vector to the temp vector
    • Pass the temp vector to chai's function.
    • Yeah it's a bit inefficient.. ;-)
    • Eg.
tmp_eigen_vector3 = state_x_des_curr_task-box_xyz_translate_center; //Do your eigen computations earlier
tmp_plain_vector[0] = tmp_eigen_vector3(0);
tmp_plain_vector[1] = tmp_eigen_vector3(1);
tmp_plain_vector[2] = tmp_eigen_vector3(2);
//Explicit call
chai_haptic_box_des_yellow->setLocalPos(tmp_plain_vector[0],tmp_plain_vector[1],tmp_plain_vector[2]);

Updated