编译ROS包
cd catkin_ws/src
git clone https://github.com/ros-drivers/urg_node.git
sudo apt-get install ros-melodic-urg-c
sudo apt-get install ros-melodic-laser-proc
cd ..
catkin_make
设置静态IP
查询自己网口MAC
ifconfig
第一行就是
我的是enp8s0
设置静态IP
sudo gedit /etc/network/interfaces
添加以下内容,设置本机IP为 192.168.0.1
auto enp8s0
allow-hotplug enp8s0
iface enp8s0 inet static
address 192.168.0.1
netmask 255.255.255.0
测试连通信
然后重启电脑,连接Hokuyo,测试连通性
ping 192.168.0.10
192.168.0.10是Hokuyo的默认IP
启动Hokuyo
启动 roscore
roscore
启动 Hokuyo
cd catkin_ws
source devel/setup.bash
rosrun urg_node urg_node _ip_address:=192.168.0.10
启动 rviz
rviz
添加LaserScan话题
将Global Options/Fixed Frame 修改为 laser