Ask Your Question
0

Giving hokuyo persistent device names

asked 2014-06-04 09:56:32 -0500

GWall gravatar image

Hey,

I have multiple (3 to be precise) hokuyo cameras all going through usb. My problem is that I want each of them to have a specific name (i.e. the back camera is AMC0 and the side camera is AMC1 etc.). I have looked into writing a udev rule for that but I haven't been lucky in that department. I have the specific ID for each camera but I do not know how to link that to a name.

Any help is appreciated!

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2014-06-04 10:15:06 -0500

dornhege gravatar image

Use this udev rule:

# Hokuyos
SUBSYSTEMS=="usb", KERNEL=="ttyACM[0-9]*", ATTRS{manufacturer}=="Hokuyo Data Flex for USB", ATTRS{product}=="URG-Series USB Driver", MODE="0666", GROUP="dialout", PROGRAM=="/etc/ros/run.sh hokuyo_node getID %N q", SYMLINK+="sensors/hokuyo_%c"

It's gonna need /etc/ros/run.sh, which basically is:

#!/bin/sh
. /etc/ros/setup.sh 
rosrun $@

Where /etc/ros/setup.sh is a symlink to your ROS setup.sh file in /opt/ros/???/setup.sh.

edit flag offensive delete link more

Comments

Does this apply to each hokuyo? Or are there edits I need to make to that rule to make it specific to each camera? @dornhege

GWall gravatar imageGWall ( 2014-06-04 10:19:54 -0500 )edit

Works for every one that I've worked with, i.e. URG-04LX, Simple-URG, UTM 30-LX

dornhege gravatar imagedornhege ( 2014-06-04 11:20:37 -0500 )edit

maybe i'm just a total dingbat, but how do I decide what that particular device is going to be consistently called? @dornhege

GWall gravatar imageGWall ( 2014-06-04 12:03:03 -0500 )edit

The names are /dev/sensors/hokuyo_serial

dornhege gravatar imagedornhege ( 2014-06-04 13:00:44 -0500 )edit

so how does it give a unique and persistent name to each camera? @dornhege

GWall gravatar imageGWall ( 2014-06-04 13:07:27 -0500 )edit

The serial numbers are unique.

dornhege gravatar imagedornhege ( 2014-06-04 13:25:42 -0500 )edit

I followed your steps exactly and I don't see anything named hokuyo_serial or serial numbers in /dev/sensors/ @dornhege

GWall gravatar imageGWall ( 2014-06-04 13:39:26 -0500 )edit

You'll have to restart udev, unplug and replug your sensors before udev creates the new symlinks for them. You may also want to review the udev log to make sure that it isn't encountering any errors.

ahendrix gravatar imageahendrix ( 2014-06-04 14:06:28 -0500 )edit
1

answered 2017-05-12 09:28:10 -0500

kmhallen gravatar image

The following udev rule uses the latest installed ROS version. Make sure to restart or run sudo udevadm trigger to load and trigger the rule.

#### Install ###############################################################################
# sudo cp 90-HokuyoLidarRules.rules /etc/udev/rules.d/                                     #
# sudo udevadm control --reload-rules && sudo service udev restart && sudo udevadm trigger #
############################################################################################

# Hokuyo USB Lidars
KERNEL=="ttyACM[0-9]*", ACTION=="add", ATTRS{idVendor}=="15d1", MODE="0666", GROUP="dialout", PROGRAM="/bin/sh -c '$(find /opt/ros -name env.sh | sort -r | head -1) rosrun urg_node getID %N q'", SYMLINK+="sensors/hokuyo_%c"

Source: https://bitbucket.org/DataspeedInc/mo...

The mobility_base_bringup package also installs the udev rules when installed as a binary Debian package.

edit flag offensive delete link more

Comments

perfect!, I tried a couple of things. But, this is working very well. Thank you!

kivrakh gravatar imagekivrakh ( 2017-08-17 05:27:27 -0500 )edit

I get an error as follows :

ATTRS{idVendor}==15d1,: command not found

Do anyone knows anything about this error ?

MMH130 gravatar imageMMH130 ( 2018-03-01 05:08:04 -0500 )edit
0

answered 2017-05-12 04:58:45 -0500

Tones gravatar image

updated 2017-05-12 04:59:38 -0500

In kinetic, the following udev rule should do the job after you installed the package urg_node. Note that the paths in the udev rule below have to be changed for other ROS distributions.

SUBSYSTEMS=="usb", KERNEL=="ttyACM[0-9]*", ACTION=="add", ATTRS{idVendor}=="15d1", ATTRS{idProduct}=="0000", MODE="666", PROGRAM="/bin/bash -c 'source /opt/ros/kinetic/setup.bash; /opt/ros/kinetic/lib/urg_node/getID /dev/%k q'", SYMLINK+="sensors/hokuyo_%c", GROUP="dialout"

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-06-04 09:56:32 -0500

Seen: 984 times

Last updated: May 12 '17