ros学习记录

roscore启动报错:

cy@pc:~$ roscore
WARNING: unable to configure logging. No log files will be generated
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last):
  File "/usr/local/bin/rosversion", line 87, in <module>
    version = rosstack.get_stack_version(stack_name)
  File "/usr/local/lib/python2.7/dist-packages/rospkg/rospack.py", line 422, in get_stack_version
    return get_stack_version_by_dir(self.get_path(stack))
  File "/usr/local/lib/python2.7/dist-packages/rospkg/rospack.py", line 201, in get_path
    self._update_location_cache()
  File "/usr/local/lib/python2.7/dist-packages/rospkg/rospack.py", line 184, in _update_location_cache
    list_by_path(self._manifest_name, path, cache)
  File "/usr/local/lib/python2.7/dist-packages/rospkg/rospack.py", line 67, in list_by_path
    root = ElementTree(None, os.path.join(d, PACKAGE_FILE))
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 611, in __init__
    self.parse(file)
  File "<string>", line 38, in parse
cElementTree.ParseError: mismatched tag: line 62, column 33
Invalid <param> tag: Cannot load command parameter [rosversion]: command [rosversion roslaunch] returned with code [1]. 

Param xml is <param command="rosversion roslaunch" name="rosversion"/>
The traceback for the exception was written to the log file
No handlers could be found for logger "roslaunch"
cy@pc:~$ roscore
WARNING: unable to configure logging. No log files will be generated
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last):
  File "/usr/local/bin/rosversion", line 87, in <module>
    version = rosstack.get_stack_version(stack_name)
  File "/usr/local/lib/python2.7/dist-packages/rospkg/rospack.py", line 422, in get_stack_version
    return get_stack_version_by_dir(self.get_path(stack))
  File "/usr/local/lib/python2.7/dist-packages/rospkg/rospack.py", line 201, in get_path
    self._update_location_cache()
  File "/usr/local/lib/python2.7/dist-packages/rospkg/rospack.py", line 184, in _update_location_cache
    list_by_path(self._manifest_name, path, cache)
  File "/usr/local/lib/python2.7/dist-packages/rospkg/rospack.py", line 67, in list_by_path
    root = ElementTree(None, os.path.join(d, PACKAGE_FILE))
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 611, in __init__
    self.parse(file)
  File "<string>", line 38, in parse
cElementTree.ParseError: mismatched tag: line 62, column 33
Invalid <param> tag: Cannot load command parameter [rosversion]: command [rosversion roslaunch] returned with code [1]. 

Param xml is <param command="rosversion roslaunch" name="rosversion"/>
The traceback for the exception was written to the log file
No handlers could be found for logger "roslaunch"

参考github网址:https://github.com/Moonkisscy/courseRepo
解决:在.bashrc加入:source /opt/ros/hydro/setup.bash

1、creat a ROS Workspac

cd ~/
mkdir ROS_WORKSPACE   一开始把这忘了出错了
gedit .bashrc # open .bashrc under ~/

Then, paste the following behind source /opt/ros/indigo/setup.bash:

    ROS_WORKSPACE=$HOME/ROS_WORKSPACE

    export ROS_WORKSPACE

    ROS_PACKAGE_PATH=$ROS_WORKSPACE:$ROS_PACKAGE_PATH

    export ROS_PACKAGE_PATH

Open a new terminal, try:

roscd

~/ROS_WORKSPACE$

2.

git colne https://github.com/Moonkisscy/courseRepo.git
cy@pc:~$ cd courseRepo/
cy@pc:~/courseRepo$ ls
1_Introduction  3_class  CMake Practice.pdf  push.sh~   README.md~
2_class         9_class  push.sh             README.md
cy@pc:~/courseRepo$ cd 1_Introduction/
cy@pc:~/courseRepo/1_Introduction$ ls
Asus.yaml       CMakeLists.txt~  README.MD       RGBD_demo  src
build           manifest.xml     README.MD~      run.sh
CMakeLists.txt  manifest.xml~    referencePaper  run.sh~
cy@pc:~/courseRepo/1_Introduction$ 

下载数据集:https://github.com/EricLYang/courseRepo/tree/master/1_Introduction

Build the project

    cd build
    rm -r *
    cmake ..
    make -j4

Download the data from TUM

    cd ..

wget https://vision.in.tum.de/rgbd/dataset/freiburg1/rgbd_dataset_freiburg1_room.bag

新终端打开ros:roscore

cy@pc:~/courseRepo/1_Introduction$ rosbag play rgbd_dataset_freiburg1_room.bag

另一个终端输入:

rostopic list
/camera/depth/camera_info
/camera/depth/image
/camera/rgb/camera_info
/camera/rgb/image_color
/clock
/cortex_marker_array
/imu
/rosout
/rosout_agg
/tf
rosrun rviz rviz
//rviz可视化窗口打开

//需要运行rosbaglay

rostopic hz /camera/depth/image

average rate: 32.253
    min: 0.026s max: 0.040s std dev: 0.00444s window: 8
average rate: 30.441
    min: 0.020s max: 0.046s std dev: 0.00592s window: 38


cy@pc:~/courseRepo/1_Introduction$ rostopic info /camera/depth/image 
Type: sensor_msgs/Image

Publishers: 
 * /play_1534944243657566410 (http://localhost:39641/)

Subscribers: None
全部评论

相关推荐

HNU_fsq:建议直接出国,这简历太6了。自愧不如
点赞 评论 收藏
分享
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务