ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org
Ask Your Question
0

Add ps3joy_node.py to upstart

asked 2012-04-15 05:12:36 -0500

Hansg91 gravatar image

Hey,

I was trying to get the ps3joy_node.py node to automatically run when my pandaboard boots, but I'm having some problems. I made a launch script that launches ps3joy_node.py and joy_node, but this needs to be run in sudo for the ps3 controller connection. I would normally run this by doing sudo bash and then roslaunch it.

The upstart script does not recognize roslaunch though, I assume it's for the same reason why "sudo roslaunch xxx" won't work.

I noticed Turtlebot also uses upstart scripts, actually it's where I got the idea from, but they avoid this issue by directly running the (old) ps3joy.py script outside ROS.

I plan to use the extra set_feedback and diagnostics features of ps3joy_node.py, so I prefer using that one. That requires ROS though, and I can't get ROS + root rights + upstart to work together.

Any help is appreciated, thanks.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2012-04-15 05:27:51 -0500

Ryan gravatar image

TurtleBot also runs roslaunch from an upstart script using setuidgid. Check out turtlebot-start here. The one caveat with setuidgid is that it doesn't pass in the user's groups, so any devices which the user should be able to use need to either be owned by that user or have the appropriate global permissions.

edit flag offensive delete link more

Comments

Yes I noticed the setuidgid, but that removes root rights from the command, making it run under the turtlebot user, in the turtlebot case. Are you saying it would be best to alter the ps3joy script so it is allowed to be run in non-root, and modify permissions for the bluetooth device?

Hansg91 gravatar imageHansg91 ( 2012-04-15 05:33:20 -0500 )edit

If you want to use roslaunch, that's probably the best way to do it. We do it that way with most of our robots.

Ryan gravatar imageRyan ( 2012-04-15 06:36:49 -0500 )edit

I tried doing that, but I ran into another problem. The ps3joy_node.py script tries to open a bluetooth socket (port 17 and 19) and according to various websites, root privileges are a must for socket binding with ports < 1024, so that can't be done either I guess. Ideas ?

Hansg91 gravatar imageHansg91 ( 2012-04-15 06:42:15 -0500 )edit

Not sure, but that might be the reason why the setuidgid method wasn't used on ps3joy as well. @mwise_wg would know better.

Ryan gravatar imageRyan ( 2012-04-15 07:01:03 -0500 )edit
0

answered 2012-04-15 12:01:30 -0500

Thomas gravatar image

An alternative solution used here https://github.com/laas/ros_comm_upstart (upstart script for roscore only available as a .deb package) is to create a separate ROS user. The ROS user creation is automatically handled by my upstart Debian package. It is available here: https://github.com/downloads/laas/ros_comm_upstart/ros-electric-ros-comm-upstart_0.1_all.deb

Running ROS as root (with sudo for instance) is a huge security risk and I strongly discourage it.

Of course, you do not have to use my packaging but using a separate user for ROS services is crucial and will avoid all the trouble of dealing with setuidgid flags. Just give to the ROS user the access to the devices it needs and nothing more.

edit flag offensive delete link more
0

answered 2012-04-16 07:30:13 -0500

Hansg91 gravatar image

I managed to get it working, by simply using "setuidgid root ..." for ps3joy, sometimes the answer is right in front of you :)

edit flag offensive delete link more

Comments

Could you explain from where you run that command so that there is no sudo needed?

felix k gravatar imagefelix k ( 2012-10-22 05:47:30 -0500 )edit

If I remember correctly, from an executable in /usr/sbin

Hansg91 gravatar imageHansg91 ( 2013-01-31 04:10:10 -0500 )edit

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: 2012-04-15 05:12:36 -0500

Seen: 617 times

Last updated: Apr 16 '12