射线投射(Ray Cast)生成虚拟激光数据

map_scan

Using ray-cast to generate virtual LaserScan data in given map, only work for 2D mobile robot. Refer to the source.

Instructions

map_scan is a ros package which implements ray-cast to generate virtual LaserScan data in given map. It’s very appriciated that the amcl had implemented the beam ray-cast wonderfully. And in this package, it will use the beam ray-cast provided by amcl and just modify it a little.

Usage

Note: To use this package, you could pull down the code to your computer. However, I should tell you that the package only has been tested in Ubuntu 16.04 and Ubuntu 18.04 corresponding to ROS distribution of kinetic and melodic.

step 1

New a folder as your workspace. Below is the example.

1
2
> mkdir -p ~/raycaster/src
> cd ~/raycaster/src

step 2

Pull down the code to your workspace.

1
> git clone https://github.com/hefvcjm/map_scan.git

Step 3

Compile the code.

1
2
> cd ~/raycaster
> catkin_make

Step 4

If you have sussecced to compile the code. Congratulations. And you can run the test code to feel how it works.

1
2
> source devel/setup.bash
> roslaunch map_scan test.launch

And you can see something like below.
screenshot
The arrow is the virtual-laser pose. And the green bound is the visualization of the LaserScan data.

API

Services Called

static_map (nav_msgs/GetMap)
map_scan calls this service to retrieve the map that is used for virtual-laser-based localization; startup blocks on getting the map from this service.

Services

map_scan(map_scan/GetMapScan)
Service to get the virtual-laser-scan in the map given the pose and the info of the virtual-laser.

0%