lagadic / vrep_ros_bridge

The main application of the plugin is to provide a communication interface between V-Rep and (ROS). The aim is to control the V-Rep simulation externally using ROS messages and ROS services.
Other
64 stars 45 forks source link

manipulator_handler build time error #45

Closed jingweiz closed 7 years ago

jingweiz commented 9 years ago

Hi, I tried to install this vrep_ros_bridge package, but cannot build the manipulator_handler successfully, the error message is as below:

~/catkin_ws/src/vrep_ros_bridge/manipulator_handler/src/ManipulatorHandler.cpp: In member function ‘virtual void ManipulatorHandler::_initialize()’: ~/catkin_ws/src/vrep_ros_bridge/manipulator_handler/src/ManipulatorHandler.cpp:318:63: error: ‘sim_jointmode_motion’ was not declared in this scope simSetJointMode(_handleOfJoints[jointID], sim_jointmode_motion, 0); ^ ~/catkin_ws/src/vrep_ros_bridge/manipulator_handler/src/ManipulatorHandler.cpp:319:44: error: ‘sim_boolparam_joint_motion_handling_enabled’ was not declared in this scope simSetBooleanParameter(sim_boolparam_joint_motion_handling_enabled,1); ^ make[2]: * [vrep_ros_bridge/manipulator_handler/CMakeFiles/manipulator_handler.dir/src/ManipulatorHandler.cpp.o] Error 1 make[1]: * [vrep_ros_bridge/manipulator_handler/CMakeFiles/manipulator_handler.dir/all] Error 2

Can anyone help me with it? Thanks in advance!

jingweiz commented 9 years ago

fyi I'm running ros indigo on Ubuntu 14.04

jokla commented 9 years ago

Hi,

Could you tell me the result of: echo $VREP_ROOT_DIR ?

Did you define VREP_ROOT_DIR in the bashrc?:

$ gedit ~/.bashrc

and in the end of the file add: export VREP_ROOT_DIR=/ChangeWithyourPathToVrep/

Thanks!

jingweiz commented 9 years ago

Wow, that was fast :) Yes, I did that, everything else built correctly, only this one package.

jingweiz commented 9 years ago

So the echo is: /home/$MYUSERNAME/graphics/V-REP_PRO_EDU_V3_2_2_64_Linux

Actually, when I build it at first time, it's reporting errors saying that it cannot find "/home/$MYUSERNAME/graphics/V-REP_PRO_EDU_V3_2_2_64_Linux/home/$MYUSERNAME/graphics/V-REP_PRO_EDU_V3_2_2_64_Linux/readme.txt", so it repeats the VREP_ROOT_DIR twice and I don't know why. I then modified the CMakeLists.txt in vrep_ros_plugin floder:

if(NOT VREP_ROOT_DIR)

set(VREP_ROOT_DIR $ENV{VREP_ROOT_DIR} CACHE PATH "Installation prefix for V-Rep." FORCE)

endif()

cos I found before I commenting off the "if endif", the VREP_ROOT_DIR is twice of the correct one, and after I did this, everything compiled except the manipulator_handler package

jingweiz commented 9 years ago

And now when I run the simulation, the qr target can move and everything else is correct but the robot cannot move. I echo the "/cmd_vel" and it is publishing values, it has a publisher "/demo_pioneer_visual_servo_pioneer_node", but no subscriber, which I guess is the job of the manipulator_handler?

jokla commented 9 years ago

Hi jingweiz, so it seems there is something wrong with the variable VREP_ROOT_DIR. But now the manipulator plugin is working? Can you write here how you defined it in the bashrc please?

About the demo with the pioneer, did you follow this tutorial?

jingweiz commented 9 years ago

Hi, so this is how I define it in the bashrc: export VREP_ROOT_DIR=/home/jingweiz/graphics/V-REP_PRO_EDU_V3_2_2_64_Linux

I reinstalled everything and this VREP_ROOT_DIR is now correct, but still the manipulator_handler is not building correctly, any idea how this could happen? I follow the tutorial, installed ros-indigo-visp, demo_pioneer, vision_visp, vrep_ros_bridge so now in my ~/catkin_ws/src/ folder, there are /demo_pioneer, /rosaria, /vrep_ros_bridge and the CMakeLists.txt. Did I miss anything?

jokla commented 9 years ago

I will check with your V-REP version and I will let you know. In the meantime can you check if using this version of V-REP is it working ? (it is the previous version)

V-REP_PRO_EDU_V3_2_1_64_Linux

(remember to change the VREP_ROOT_DIR with the new Vrep folder)

jingweiz commented 9 years ago

OK thanks a lot! I tried this version but still it doesn't work. My problem is that this manipulator_handler doesn't compile, so the version of vrep might not be the problem. Is it that the version of ros? I used indigo, but the tutorial is using hydro

jokla commented 9 years ago

I use indigo with Ubuntu 14.04 and V-REP_PRO_EDU_V3_2_1_64_Linux.

Did you checkout the Indigo version of the repository?

jingweiz commented 9 years ago

yes, I did

jokla commented 9 years ago

The problem is that with the version of V-REP V3_2_2_64 the motion mode is deprecated. So in the file programming/include/v_repConst.h is defined as sim_jointmode_motion_deprecated :

enum { /* Joint modes: */ sim_jointmode_passive=0, sim_jointmode_motion_deprecated, sim_jointmode_ik, sim_jointmode_reserved_previously_ikdependent, sim_jointmode_dependent, sim_jointmode_force };

So the first fast solution is to use an older version of V-REP like V3.2.0 (http://www.coppeliarobotics.com/previousVersionDownloads.html). I will see how to fix the problem, thank you for help!

jokla commented 9 years ago

So delete the build and devel of V-REP (or all the folder), set VREP_ROOT_DIR to the version V3.2.0, open a new terminal, make sure the variable VREP_ROOT_DIR is correct and rebuild V-REP.

It should work!

Reading from the manual of V-REP:

Motion mode: this mode is deprecated and should not be used anymore. A similar and more flexible behaviour can be obtained with the passive mode and a child script appropriately updating the joint.

I have to find a new way to control the joint in velocity.

I will keep you updated here,

Giovanni

jingweiz commented 9 years ago

Hey, thanks for the update! Now I try to reinstall everything, but when I try to do: catkin_make -DCMAKE_BUILD_TYPE=Release --pkg rosaria it shows: fatal error: Aria.h: No such file or directory

include "Aria.h"

But it builds successfully before... I didn't change anything... any idea why this would happen?

jingweiz commented 9 years ago

so in the rosaria repo I found that there are three new commits two days ago, I checkout the commit from two days ago: ea3be2b74e7f58cfe6241dd721f4c54945eb3e33, and use V3_2_0 version of vrep, now finally everything compiles, thanks a lot for your help!

fedeallocati commented 9 years ago

+1 To fix this functionality in the last v-rep version. From another INRIA team :)

jokla commented 9 years ago

Hi fedeallocati!

If you want to use the last version of V-REP and you don't need to control the joint in motion mode (in velocity without the dynamic simulation ) you can modify the file vrep_ros_bridge/manipulator_handler/src/ManipulatorHandler.cpp at lines 318 and 319:

} else if (_jointCtrlMode[jointID] == CustomDataHeaders::MOT_VELOCITY){ simSetJointMode(_handleOfJoints[jointID], sim_jointmode_motion, 0); simSetBooleanParameter(sim_boolparam_joint_motion_handling_enabled,1);

You have to substitute : 1) sim_jointmode_motion with sim_jointmode_motion_deprecated 2) sim_boolparam_joint_motion_handling_enabled with sim_boolparam_joint_motion_handling_enabled_deprecated

So you will have:

} else if (_jointCtrlMode[jointID] == CustomDataHeaders::MOT_VELOCITY){ simSetJointMode(_handleOfJoints[jointID], sim_jointmode_motion_deprecated, 0); simSetBooleanParameter(sim_boolparam_joint_motion_handling_enabled_deprecated,1);

But in this way the controller in velocity is not working. I am trying to understand why!

fedeallocati commented 9 years ago

Hi jokla! That's exactly what I did, but as a matter of fact what I need to do is controlling the joints of an arm that is are Torque/Force mode. Before looking at your plugin, what I did was a wrapper of the standard vrep ros api, using the handles of the objects, but this plugin looked promising. I don't know if I can be of any help, because I started using vrep just a few weeks ago, but I can definitely be a beta tester of any attempts you do to try to solve the issue.

jokla commented 9 years ago

I hope the plugin will be useful for you! what kind of robot are you controlling? If you will have any improvement don't hesitate to fork and to do a pull request.

Anyway if you want, let me know if the control in Torque/Force mode is working fine for you, thanks!

Cheers

ricsp commented 9 years ago

The manipulator plugin should compile now (thanks to 7831b380478210a0e9b95ca43c5dca8b36148463), however the deprecated mode should not be used. We are currently working on a long term solution.

jokla commented 9 years ago

If you want to control the robot in velocity (without dynamic simulation), instead of using the Motion_mode you should use the mode "Passive_mode_velocity":

In the child script on V-REP you can add: simExtSetFloatCustomDataFromHeader(handle, sim_ext_ros_bridge_manipulator_data_main, 0) simExtSetIntCustomDataFromHeader(handle, sim_ext_ros_bridge_manipulator_data_ctrl_mode, sim_ext_ros_bridge_manipulator_ctrl_mode_Passive_mode_velocity)

I will update the documentation.

Giovanni