Cartographer连接激光-hokuyo UTM-30LX

news/2024/12/29 12:35:25/

系统环境:

    64位/ubuntu14 /ros-indogo

一、 在ros中安装hokuyo node:

                  1)连接激光到虚拟机,打开一个terminal ,下载激光的节点包  # sudo apt-get install ros-indigo-hokuyo-node

                   2)接下来配置激光节点,首先确保虚拟机菜单中 虚拟机-可移动设备 已经接上URG,然后可以开始配置:

                                               # cd /etc/udev/rules.d 

                                               #cd touch 50-laser.rules

                                               #sudo gedit 50-laserr.rules

                      在文件中添加以下内容: KERNEL="ttyACM[0-9]*" ,MODE="0777"

                      重启.rules使之生效:

                                               #sudo /etc/init.d/udev restart

                       检查权限#ls -al /dev/ttyACM0 如果显示 crw-rw 则输入 #sudo chmod a+rw /dev/tty/ACM0 权限应为 crw-rw-rw.....

          这样激光就在ros中可以使用啦!接下来下载slam的程序包

二、安装谷歌slam Cartographer_ros

        源码安装地址 : https://google-cartographer-ros.readthedocs.io/en/latest/

                 # Install wstool and rosdep.
                  sudo apt-get update
                  sudo apt-get install -y python-wstool python-rosdep ninja-build

                 # Create a new workspace in 'catkin_ws'.
                  mkdir catkin_ws

                 cd catkin_ws
                 wstool init src

                # Merge the cartographer_ros.rosinstall file and fetch code for dependencies.
                wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
                wstool update -t src

                # Install deb dependencies.
                rosdep init
                rosdep update   #(多试几遍,早晨容易成功)
                rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y

                # Build and install.
                catkin_make_isolated --install --use-ninja (#这边容易出错)
                source install_isolated/setup.bash

值得注意的是,cartographer的包一直在更新,很多人运行Catkin_make_isolated时很容易报错,说找不到ceres库,有人说用VPN或者改IP地址等等,在此贴上几个博客,以供参考 :

        http://www.cnblogs.com/wenhust/p/6112845.html

       安装成功后,就可以跑激光啦!

三、北洋激光连接谷歌slam

       在launch文件夹下新建一个文件demo_hokuyo.launch ,本人建议先拷贝一个其他的demo的launch(这样里面还是彩色的,不然是黑白的),然后再自己改个名字,再在文件中加入以下内容:

        <launch>
  <param name="/use_sim_time" value="true" />

  <node name="cartographer_node" pkg="cartographer_ros"
      type="cartographer_node" args="
          -configuration_directory $(find cartographer_ros)/configuration_files
          -configuration_basename demo_hokuyo.lua"
      output="screen">
    <remap from="scan" to="scan" />
  </node>

  <node name="rviz" pkg="rviz" type="rviz" required="true"
      args="-d $(find cartographer_ros)/configuration_files/demo_2d.rviz" />
 
</launch>

这其实就是改了 from scan to scan

然后再上一层文件夹中寻找配置文件夹,打开,新建一个demo_hokuyo.lua的文件,写入以下内容:

-- Copyright 2016 The Cartographer Authors
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.

include "map_builder.lua"

options = {
 map_builder = MAP_BUILDER,
 sensor_bridge={
horizontal_laser_min_range=0.,
horizontal_laser_max_range=30.,
horizontal_laser_missing_echo_ray_length=1.,
constant_odometry_translational_variance=0.,
constant_odometry_rotational_variance=0.,

},
  map_frame = "map",
  tracking_frame = "laser",
  published_frame = "laser",
  odom_frame = "odom",
  provide_odom_frame = true,
  use_odometry = false,
  use_laser_scan = true,
  use_multi_echo_laser_scan = false,
  num_point_clouds = 0,
  lookup_transform_timeout_sec = 0.2,
  submap_publish_period_sec = 0.3,
  pose_publish_period_sec = 5e-3,
}

MAP_BUILDER.use_trajectory_builder_2d = true

TRAJECTORY_BUILDER_2D.laser_min_range = 0.1
TRAJECTORY_BUILDER_2D.laser_max_range = 30.
TRAJECTORY_BUILDER_2D.laser_missing_echo_ray_length = 1.
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true

SPARSE_POSE_GRAPH.optimization_problem.huber_scale = 1e2

return options

(经过比对发现 .rviz文件不用改)

这样就完成啦!重新make 一下,再source一下 ,运行 roslaunch cartographer_ros demo_hokuyo.launch 就可以看到激光建地图啦!

如果要跑bag文件,请参考谷歌原地址。



                 



     



http://www.ppmy.cn/news/153271.html

相关文章

彩色增强

文章目录 1.真彩色增强2.伪彩色增强3.假彩色增强 彩色增强一般是指用多波段的黑白遥感图像&#xff0c;通过各种方法进行彩色合成或彩色显示&#xff0c;以突出不同物体之间的差别&#xff0c;提高解译效果的技术。彩色增强技术是利用人眼的视觉特性&#xff0c;将灰度图像变成…

激光雷达点云与单幅图像配准/映射变为彩色点云

激光雷达点云与单图像配准/映射变为彩色点云 如果没有对pcl库进行配置&#xff0c;则需要先配置pcl&#xff1a;可重复使用的VS-PCL1.10.1环境配置 本文提供激光雷达采集的点云与单幅二维图像之间的配准方法&#xff0c;目的是实现点云到图像之间的映射&#xff0c;同时也可以…

你不可错过的光模块中的激光器类型大盘点!

“ laser “ 由LASER (Light Amplification by Stimulated Emission of Radiation) 受激辐射光放大器缩写演变而来&#xff0c;激光是一种相干光&#xff0c;即具有频率相同、振动方向相同、相位相同&#xff08;或者说相位相差保持恒定&#xff09;的特性&#xff0c;光通信系…

【低光增强】Zero-DCE

文章目录 一、前言二、算法理解2.1 低光增强曲线2.2 整体框架2.3 网络结构2.4 损失函数2.4.1 空间一致性2.4.2 曝光控制2.4.3 色彩恒常2.4.4 光照平滑 2.5 Zero-DCE 三、效果测试 一、前言 Paper&#xff1a;Learning to Enhance Low-Light Image via Zero-Reference Deep Cur…

蓝天准系统P750的介绍与开箱

准系统笔记本&#xff1a;准系统笔记本是指使用由工厂&#xff08;即ODM厂商&#xff09;采购的标准化笔记本模具&#xff0c;再通过商家或懂技术的玩家安装相兼容的配件&#xff08;如CPU&#xff0c;显卡&#xff0c;内存&#xff0c;硬盘&#xff0c;光驱&#xff0c;无线网…

Nvidia Jetson AGX Orin 初体验

一、开箱 Nvidia Jetson AGX Orin是今年Nvidia推出的唯一的开发套件&#xff0c;相比Jetson Nano 472GFLOP算力、Jetson Xaiver 32TOPS(INT8)算力&#xff0c;它的算力达到了200 TOPS左右。也就是说&#xff0c;几乎相当于目前主流设备的8-10倍的算力。这就让张小白有点动心了…

NVIDIA GeForce RTX 2070显卡参数

以下是通过CUDA例程deviceQuery得到的结果&#xff1a; CUDA Device Query (Runtime API) version (CUDART static linking) Detected 1 CUDA Capable device(s) Device 0: "NVIDIA GeForce RTX 2070" CUDA Driver Version / Runtime Version 11.6 / 11…

DMA+PWM驱动彩色RGB灯

前言 现在带IC的彩灯虽然有 SK6812 、WS2812 等不同信号&#xff0c;但是其控制逻辑基本是完全兼容的&#xff0c;本文所描述相关控制参数来源于 SK6812 ,原于带 IC 芯片的 RGB 可以通过串联来实现数据的传输&#xff0c;使得其在PCB布线时变得更为简单。 SK6812 时序 驱动方…