hokuyo接头为网口。
附录一个我之前编译好的包吧。可以直接下载测试使用urg_node github.
1. apt 安装
驱动安装:
sudo apt install ros-kinetic-urg-node
安装依赖
sudo apt install ros-kinetic-urg-c
sudo apt install ros-kinetic-laser-proc
博主apt 安装的,运行激光节点的时候会报段错误,故将其卸载了,重新源码编译的
2. 源码编译
mkdir -p urg_ws/src && cd urg_ws/src
git clone https://github.com/ros-drivers/driver_common.git
git clone https://github.com/ros-perception/laser_proc.git
git clone https://github.com/ros-drivers/urg_c.git
cd ../
catkin_make
cd src
git clone https://github.com/ros-drivers/urg_node.git
cd ../ && catkin_make
网上很多博客都是进行到上面这一步,基本就编译过了,博主在编译urg_node的时候报错boost某个函数未定义,如下图
解决方法:urg_node.cpp中 报错的一个函数替换成了std的,当然这不是最好的方法。记得添加相应的thread头文件
// boost::this_thread::sleep(boost::posix_time::milliseconds(10));
std::this_thread::sleep_for(std::chrono:: milliseconds (10));
3. 网络配置
hokuyo激光雷达的默认ip地址为:192.168.0.10
本机静态ip为:192.168.0.20 (可以设定同网段的其他ip)
或者
sudo gedit /etc/network/interfaces
修改为以下内容(eth0为网桥ip地址,如果网桥名不为eth0,改为相应的即可)
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.20
netmask 255.255.255.0
4. 启动roscore
roscore
5. 启动激光
rosrun urg_node urg_node _ip_address:=192.168.0.10
6. rviz 查看激光数据