ros下启动omni手控器,订阅话题
- usb设为可执行
cd ~/omni/TouchDriver2019_2_15_Linux/TouchDriver2019_2_14
./ListUSBHapticDevices
# /dev/ttyACM0
./ListUSBHapticDevices /dev/ttyACM0
# /dev/ttyACM0
sudo chmod 777 /dev/ttyACM0
- 运行
omni_common omni_state.launch
cd ~/car_ws/src/Geomagic_Touch_ROS_Drivers-hydro-devel/omni_common/launch
roslaunch omni_common omni_state.launch
- 运行python,订阅话题
cd ~/car_ws/src/Geomagic_Touch_ROS_Drivers-hydro-devel/omni_common/src
python listener4.py
手控器相关话题
启动launch文件后的话题列表为:
$ rostopic list
/phantom/button
/phantom/force_feedback
/phantom/joint_states
/phantom/pose
/phantom/state
/rosout
/rosout_agg
- /phantom/button
guyue@guyue:~$ rostopic echo /phantom/button
grey_button: 1
white_button: 0
---
grey_button: 0
white_button: 0
---
- /phantom/joint_states
guyue@guyue:~$ rostopic echo /phantom/joint_states
---
header:
seq: 44057
stamp:
secs: 1627442790
nsecs: 151462066
frame_id: ''
name: [waist, shoulder, elbow, yaw, pitch, roll]
position: [-0.0, 0.26888954639434814, -0.6397024393081665, 3.1529915687912187, -3.13045995831292, -3.447229327755519]
velocity: []
effort: []
---
- /phantom/pose
guyue@guyue:~$ rostopic echo /phantom/pose
---
header:
seq: 516525
stamp:
secs: 1627390215
nsecs: 931911788
frame_id: "/map"
pose:
position:
x: 0.0
y: 0.0881141967773
z: -0.0655107116699
orientation:
x: -0.181168104759
y: -0.0779586342595
z: -0.385540513457
w: 0.901365121161
---
- /phantom/state
guyue@guyue:~$ rostopic echo /phantom/state
---
header:
seq: 581194
stamp:
secs: 1627390280
nsecs: 600925748
frame_id: ''
locked: True
close_gripper: True
pose:
position:
x: -24.5597171783
y: 15.7225236893
z: -9.16426181793
orientation:
x: -0.132378251324
y: -0.111142464598
z: -0.768582546722
w: 0.615957969357
current:
x: 0.0
y: 0.0
z: 0.0
velocity:
x: -0.210287976682
y: -1.33447144402
z: 0.610092210632
---
报错及解决
错误1 不能复制文件
ubuntu cp拷贝文件夹报错“文件系统不支持符号链接”
- 解决
说明待拷贝的文件夹内部有不支持拷贝的文件格式,可以将文件夹压缩为压缩包,再复制
参考:https://blog.csdn.net/Q893448322/article/details/116023201
错误2 missing: SDL_LIBRARY SDL_INCLUDE_DIR
将复制过来的文件解压,将工作空间中的devel和build文件夹删除,运行catkin_make
,报错:
Could NOT find SDL (missing: SDL_LIBRARY SDL_INCLUDE_DIR)
- 解决
sudo apt-get install libsdl-dev
参考:https://blog.csdn.net/weixin_30819163/article/details/97343928
错误3 missing: SDL_LIBRARY SDL_INCLUDE_DIR
解决完上面的问题,再次运行catkin_make
,报错:
Could NOT find SDL_image (missing: SDL_IMAGE_LIBRARIES SDL_IMAGE_INCLUDE_DIRS)
- 解决
sudo apt-get install libsdl-image1.2-dev
参考:https://blog.csdn.net/weixin_30563319/article/details/97343932
错误4 Could not find a package configuration file provided by “libuvc”
解决完上面的问题,再次运行catkin_make
,报错:
Could not find a package configuration file provided by "libuvc" with any
of the following names:
libuvcConfig.cmake
libuvc-config.cmake
- 解决
sudo apt-get install ros-melodic-libuvc
参考:https://blog.csdn.net/JimmyC18/article/details/108273954
问题5 Invoking “make -j16 -l16” failed
解决完上面的问题,再次运行catkin_make
,报错:
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j16 -l16" failed
- 解决
好多都说是在opencv中报错的,然后想到以前装opencv的时候,"make -j16 -l16"应该是多核编译,所以可能是卡住了或者什么
重新运行catkin_make
即可
问题6 找不到 -lncurses
重新运行catkin_meke
后报错
/usr/bin/ld: 找不到 -lncurses
collect2: error: ld returned 1 exit status
/usr/bin/ld: 找不到 -lncurses
collect2: error: ld returned 1 exit status
Geomagic_Touch_ROS_Drivers-hydro-devel/omni_common/CMakeFiles/omni.dir/build.make:118: recipe for target '/home/guyue/catkin_ws/devel/lib/omni_common/omni' failed
make[2]: *** [/home/guyue/catkin_ws/devel/lib/omni_common/omni] Error 1
CMakeFiles/Makefile2:11777: recipe for target 'Geomagic_Touch_ROS_Drivers-hydro-devel/omni_common/CMakeFiles/omni.dir/all' failed
make[1]: *** [Geomagic_Touch_ROS_Drivers-hydro-devel/omni_common/CMakeFiles/omni.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
Geomagic_Touch_ROS_Drivers-hydro-devel/omni_common/CMakeFiles/omni_state.dir/build.make:118: recipe for target '/home/guyue/catkin_ws/devel/lib/omni_common/omni_state' failed
make[2]: *** [/home/guyue/catkin_ws/devel/lib/omni_common/omni_state] Error 1
CMakeFiles/Makefile2:11738: recipe for target 'Geomagic_Touch_ROS_Drivers-hydro-devel/omni_common/CMakeFiles/omni_state.dir/all' failed
make[1]: *** [Geomagic_Touch_ROS_Drivers-hydro-devel/omni_common/CMakeFiles/omni_state.dir/all] Error 2
- 解决
sudo apt-get install ros-melodic-libuvc
参考:https://blog.csdn.net/weixin_43723326/article/details/103427351
问题7 [omni_state.launch] is neither a launch file in package [omni_common] nor is [omni_common] a launch file name
catkin_make
成功后,运行launch
文件,报错:
RLException: [omni_state.launch] is neither a launch file in package [omni_common] nor is [omni_common] a launch file name
The traceback for the exception was written to the log file
- 解决
这应该是因为新复制过来的工作空间没有添加路径
echo "source ~/car_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
添加完路径后,需要重新打开终端