0
$\begingroup$

Rosanswers logo

I have a robot with 2 identical cameras that I need to distinguish between at runtime. The only thing that tells me which is which is the serial number and which of the two ports they appear on is random.

Not a problem. I have a script that will check that for me and will return 0 or 1 depending on which camera it detects on which port. I have also tried it with 'true' and 'false'

I'm trying to use this in my launch file so that when the robot starts up it auto detect and configure the ports.

<param if = "$bash (find uvc_camera) serial_loc.sh" name = "left/device" type = "string" value = "/dev/video1"/>

When I run this I get:

Invalid <node> tag: $bash (find uvc_camera) serial_loc.sh is not a 'bool' type. 

The http://www.ros.org/wiki/roslaunch/XML page says:

"All tags support if and unless attributes, which include or exclude a tag based on the evaluation of a value. "1" and "true" are considered true values. "0" and "false" are considered false values. Other values will error. "

Has anyone tried to do something similar and if so how do you get ROS to recognize the bool?

Ros Electric, Ubuntu 11.10


Originally posted by DocSmiley on ROS Answers with karma: 127 on 2012-08-31

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

So, while all nodes can have guard attributes ("if" and "unless"), you can't execute arbitrary code inside of roslaunch xml attributes. That's why what you're trying isn't working. Also, this is a feature, not a bug. If people could execute arbitrary stuff in launchfiles, the roslaunch semantics would go out the window. Then light turns to dark, life to death, forever.

deleted terrible idea that should never influence anyone

Do you think you could incorporate the magic in "serial_loc.sh" into uvc_camera and post a patch that gets the camera via UID defined in a ros parameter?


You could do this:

<param name="device" command="$(find uvc_camera)/serial_loc.sh"/>

And make "serial_loc.sh" output the full device path.


Originally posted by jbohren with karma: 5809 on 2012-08-31

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by DocSmiley on 2012-08-31:
Honestly, the whole setup is sufficiently hacky that I'm not sure I could do that.

Comment by jbohren on 2012-08-31:
Yeah, I don't know what I was thinking.

Comment by DocSmiley on 2012-09-03:
I tried what you've suggested but the command= just gives me errors in the xmlloader.py ending with OSError: [Errno 13] Permission denied. I tried using value but that just gives me the filepath for serial_loc.sh

Comment by jbohren on 2012-09-04:
What's the contents of serial_loc.sh, and what are the file permissions? I tried this with my own bash script, and it worked for me.

Comment by Hippomormor on 2016-11-22:
Have you done chmod +x serial_loc.sh?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.