zoukankan      html  css  js  c++  java
  • [转]ROS Q&A | How to read LaserScan data

    http://www.theconstructsim.com/read-laserscan-data/

    Step 1. Open a project on ROS Development Studio(RDS)

    We can reproduce the question easily using RDS. If you haven’t had an account yet, you can register one for free here. After registration, you can log in and open the project from Public(click on my projects to switch to public simulations) -> Kobuki. In the project, click simulations -> Turtlebot 2 to launch the simulation.

    Step 2. Read LaserScan data

    The simulation is up and running now. You can check all the topic available with the command

    The LaserScan topic is called /kobuki/laser/scan. You can type the following command into the terminal to check the topic.

    The -n1 flag prints the topic exactly once. You’ll get something like this.

    The following command will give you the information for the topic

    You’ll see that the topic is using the message type called sensor_msgs/LaserScan. You can further check it with the command

    Related content:  [ROS Q&A] 069 - RQT Custom Plugin: undefined symbol

    The command gives you the message’s structure.

    The angle_min and angle_max indicate the angle range(from -90 to 90 degree in this case) that the LaserScan is measuring and the ranges is an array which gives you the distance measured for each angle bin.

    To explore the range value, let’s create a package.

    Add a python script under src with the following code

    Normally, you’ll need to give the script permission to execute with

    Then we create a launch file under lunch directory to launch the script

    Now you can type

    Related content:  [ROS Q&A] 081 - Making Aibo robot walk with ROS - #Part 1

    to launch the script. You should also see that the length of the ranges array is 720 in the 180-degree range. So if we want to read the LaserScan data on the left, in front and on the right of the robot, we can change our script a bit.

    That’s all now you get the value. You can play with it to navigate the robot. If you want to learn more about this topic, you can go to Robot Ignite Academy. We have tons of courses which teach you how to navigate the robot in a more advanced way.

  • 相关阅读:
    [考试反思]1008csp-s模拟测试65:突袭
    [考试反思]1008csp-s模拟测试64:契机
    [考试反思]1007csp-s模拟测试63:朦胧
    [考试反思]1006csp-s模拟测试62:隔断
    [考试反思]1005csp-s模拟测试61:休止
    [毒瘤题]玛里苟斯:线性基,表达式分析,测试点分治
    albus就是要第一个出场:线性基
    [考试反思]1005csp-s模拟测试60:招魂
    [考试反思]1004csp-s模拟测试59:惊醒
    [考试反思]1003csp-s模拟测试58:沉淀
  • 原文地址:https://www.cnblogs.com/qiuheng/p/9254707.html
Copyright © 2011-2022 走看看