RoboWare Studio
是ROS
的一款IDE
,基于微软开源的VSCode
开发,功能比较强大,使得开发更加快速、简单。是目前最好用的ROS
开发工具了。
分类: ROS
Ubuntu 14.04.5系统上OpenPTrack V1版本安装配置(Kinect V2)
目前在研究视觉跟踪人的事情,找到的比较好的参考项目就是OpenPTrack
了,截至目前(2017.8.14
)OpenPTrack
的V2
版本还没有释放出代码,因此我们只能依旧在V1
版本上进行测试,这个版本目前只能在Ubuntu 14.04.5
系统上运行,其他系统上(比如Ubuntu 16.04
)问题比较多,还是建议在Ubuntu 14.04.5
系统上进行安装。
1.从GitHub上获取项目代码
1 2 3 |
$ sudo apt-get install git -y $ cd ~ $ git clone https://github.com/OpenPTrack/open_ptrack.git |
2.安装ROS
1 2 3 4 5 6 |
$ cd open_ptrack/scripts $ chmod +x *.sh $ ./ros_install.sh $ source /opt/ros/indigo/setup.bash $ ./ros_configure.sh |
3.安装OpenPTrack
1 |
$ ./openptrack_install.sh |
4.链接OpenPTrack
目录
1 |
$ ln -s ~/workspace/ros/catkin/src/open_ptrack ~/open_ptrack |
5.Kinect V2
驱动程序安装
1 2 3 4 5 6 7 8 |
$ sudo apt-get install nvidia-375-dev $ sudo apt-get install ocl-icd-opencl-dev $ cd ~/workspace/ros/catkin/src $ source ~/.profile $ roscd open_ptrack/../scripts $ chmod +x kinect2_install.sh $ ./kinect2_install.sh |
重启系统,然后执行如下命令:
1 2 |
$ cd ~/workspace/ros/catkin/devel/lib/kinect2_bridge $ sudo ./kinect2_bridge |
6.完整的自动化安装脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import subprocess def execBashShellCommand(cmd): print cmd p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,executable="/bin/bash") while True: buff = p.stdout.readline() if buff == '' and p.poll() != None: break print buff p.wait() def main(): execBashShellCommand("rm -rf ~/workspace") execBashShellCommand("rm -rf ~/.ros") execBashShellCommand("rm -rf ~/.rviz") execBashShellCommand("rm -rf ~/open_ptrack") execBashShellCommand("sudo apt-get install git -y") execBashShellCommand("cd ~ && git clone https://github.com/OpenPTrack/open_ptrack.git") execBashShellCommand("sed -i '/source ~\/workspace\/ros\/rosbuild\/setup.bash/d' ~/.bashrc") execBashShellCommand("sed -i '/export KINECT_DRIVER=openni/d' ~/.bashrc") execBashShellCommand("sed -i '/export LC_ALL=C/d' ~/.bashrc") execBashShellCommand("cd ~/open_ptrack/scripts && chmod +x *.sh && ./ros_install.sh") execBashShellCommand("cd ~/open_ptrack/scripts && source /opt/ros/indigo/setup.bash ; ./ros_configure.sh") execBashShellCommand("cd ~/open_ptrack/scripts && ./openptrack_install.sh") execBashShellCommand("ln -s ~/workspace/ros/catkin/src/open_ptrack ~/open_ptrack") execBashShellCommand("source ~/workspace/ros/rosbuild/setup.bash ; source ~/.profile ; export KINECT_DRIVER=openni && export LC_ALL=C && cd ~/workspace/ros/catkin && catkin_make --pkg calibration_msgs && catkin_make --pkg opt_msgs && catkin_make --force-cmake") execBashShellCommand("sudo apt-get -y install nvidia-375-dev") execBashShellCommand("sudo apt-get -y install ocl-icd-opencl-dev") execBashShellCommand("source ~/workspace/ros/rosbuild/setup.bash ; source ~/.profile ; export KINECT_DRIVER=openni && export LC_ALL=C && cd ~/workspace/ros/catkin/src && roscd open_ptrack/../scripts && chmod +x kinect2_install.sh && ./kinect2_install.sh") execBashShellCommand("cd ~/workspace/ros/catkin/devel/lib/kinect2_bridge && sudo ./kinect2_bridge") if __name__ == "__main__": main() |
7.测试系统
可能需要重新插拔一下Kinect
的USB
数据线,然后执行如下命令
1 |
$ roslaunch kinect2_bridge kinect2_bridge.launch |
执行之后,等待十几秒,然后Ctrl+C
中断执行。
执行完成后,执行
1 |
$ roslaunch tracking detection_and_tracking_kinect2.launch |
之后,会弹出三个界面出来。
参考链接
ROS下使用roslaunch命令时使用gdb/pdb调试
最近在使用OpenPTrack
来进行人的跟踪测试,可是运行程序的时候总是崩溃。
OpenPTrack
是通过roslaunch
命令来运行程序的。
网上搜索了一下,可以找到对应的launch
文件,在其中的node
节点中增加如下语句即可
1 |
launch-prefix="xterm -e gdb -ex run --args " |
我们以
1 |
$ roslaunch tracking detection_and_tracking_kinect2.launch |
这条命令为例,detection_and_tracking_kinect2.launch
文件的原始内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<launch> <arg name="camera_name" default="kinect2_head" /> <!-- Start the Kinect --> <include file="$(find kinect2_bridge)/launch/kinect2_bridge_ir.launch"/> <!-- Launch ground based people detection node --> <node pkg="detection" type="ground_based_people_detector" name="ground_based_people_detector" output="screen" required="true"> <rosparam command="load" file="$(find detection)/conf/ground_based_people_detector_kinect2.yaml" /> <param name="classifier_file" value="$(find detection)/data/HogSvmPCL.yaml"/> <!--param name="camera_info_topic" value="/$(arg camera_name)/depth_lowres/camera_info"/--> <param name="camera_info_topic" value="/$(arg camera_name)/ir_rect/camera_info"/> <param name="output_topic" value="/detector/detections"/> <!--param name="pointcloud_topic" value="/$(arg camera_name)/depth_lowres/points"/--> <param name="pointcloud_topic" value="/$(arg camera_name)/depth_ir/points"/> <param name="rate" value="60.0"/> </node> </launch> |
增加调试命令之后的样子如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<launch> <arg name="camera_name" default="kinect2_head" /> <!-- Start the Kinect --> <include file="$(find kinect2_bridge)/launch/kinect2_bridge_ir.launch"/> <!-- Launch ground based people detection node --> <node pkg="detection" type="ground_based_people_detector" name="ground_based_people_detector" output="screen" required="true" launch-prefix="xterm -e gdb -ex run --args "> <rosparam command="load" file="$(find detection)/conf/ground_based_people_detector_kinect2.yaml" /> <param name="classifier_file" value="$(find detection)/data/HogSvmPCL.yaml"/> <!--param name="camera_info_topic" value="/$(arg camera_name)/depth_lowres/camera_info"/--> <param name="camera_info_topic" value="/$(arg camera_name)/ir_rect/camera_info"/> <param name="output_topic" value="/detector/detections"/> <!--param name="pointcloud_topic" value="/$(arg camera_name)/depth_lowres/points"/--> <param name="pointcloud_topic" value="/$(arg camera_name)/depth_ir/points"/> <param name="rate" value="60.0"/> </node> </launch> |
(注意代码添加位置)这样在执行原来例子的时候,就会先打开一个新的Shell
界面,被调试的程序就在这个Shell
中被执行了。
如果被调式的是Python
脚本,则需要修改调试器为pdb
,如下:
1 |
launch-prefix="xterm -e python -m pdb " |