Giter Site home page Giter Site logo

clearpathrobotics / robot_upstart Goto Github PK

View Code? Open in Web Editor NEW
190.0 56.0 94.0 165 KB

ROS package of helper functions related to bringing up roslaunch on system startup.

License: BSD 3-Clause "New" or "Revised" License

CMake 0.76% Shell 9.76% Python 71.35% EmberScript 18.13%

robot_upstart's Introduction

robot_upstart Build Status

Clearpath Robotics presents a suite of scripts to assist with launching background ROS processes on Ubuntu Linux PCs. Please see the generated documentation and ROS Wiki.

robot_upstart's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robot_upstart's Issues

install script works but service dies after start

Hi,

I am trying to use robot_upstart to run mavros/launch/px4/launch after boot.

  • I did rosrun robot_upstart install --logdir /home/drone/upstart_log/ mavros/launch/px4.launch and the shows successful installation
  • I reboot but I don't see the service running. the content of the master.log file is below.

What could be the problem?

  • I am using ROS Kinetic

Thanks.

[rosmaster.threadpool][ERROR] 2018-06-08 11:21:14,847: Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/threadpool.py", line 218, in run
    result = cmd(*args)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/master_api.py", line 210, in publisher_update_task
    ret = xmlrpcapi(api).publisherUpdate('/master', topic, pub_uris)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1316, in single_request
    return self.parse_response(response)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1493, in parse_response
    return u.close()
  File "/usr/lib/python2.7/xmlrpclib.py", line 800, in close
    raise Fault(**self._stack[0])
Fault: <Fault -1: 'publisherUpdate: unknown method name'>

[rosmaster.master][INFO] 2018-06-08 11:21:14,848: publisherUpdate[/tf_static] -> http://odroid:57497/ []
[rosmaster.master][INFO] 2018-06-08 11:21:14,851: publisherUpdate[/tf_static] -> http://odroid:57497/ []: sec=0.00, exception=<Fault -1: 'publisherUpdate: unknown method $
[rosmaster.threadpool][ERROR] 2018-06-08 11:21:14,852: Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/threadpool.py", line 218, in run
    result = cmd(*args)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/master_api.py", line 210, in publisher_update_task
    ret = xmlrpcapi(api).publisherUpdate('/master', topic, pub_uris)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1316, in single_request
    return self.parse_response(response)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1493, in parse_response
    return u.close()
  File "/usr/lib/python2.7/xmlrpclib.py", line 800, in close
    raise Fault(**self._stack[0])
Fault: <Fault -1: 'publisherUpdate: unknown method name'>

[rosmaster.master][INFO] 2018-06-08 11:21:15,237: -PUB [/rosout_agg] /rosout http://odroid:38839/
[rosmaster.master][INFO] 2018-06-08 11:21:15,242: -SUB [/rosout] /rosout http://odroid:38839/
[rosmaster.master][INFO] 2018-06-08 11:21:15,246: -SERVICE [/rosout/get_loggers] /rosout rosrpc://odroid:36693
[rosmaster.master][INFO] 2018-06-08 11:21:15,250: -SERVICE [/rosout/set_logger_level] /rosout rosrpc://odroid:36693
[rosmaster.main][INFO] 2018-06-08 11:21:15,364: keyboard interrupt, will exit
[rosmaster.main][INFO] 2018-06-08 11:21:15,365: stopping master...
[rospy.core][INFO] 2018-06-08 11:21:15,365: signal_shutdown [atexit]

Feature request: run daemon in separate tty

Would it be a nice feature to be able to have the daemon output into a different tty?
This way it would be very easy to inspect running launch files by being able to simply switch to tty8.

Find a reasonable way to do some tests for this

The best end-to-end test would be to actually perform installations with different combinations of parameters, and then start and stop the resulting jobs. That would be pretty unfriendly to a developer, though—you'd want that to be a test which only runs on remote test VMs.

Service stop is killing all nodes not waiting to finish cleanly.

When I tried to stop myrobot service "sudo service myrobot stop", all nodes dies instantly rather than waiting to finish cleanly. But when I added this line "ExecStop=/usr/sbin/data-stop" to "/etc/systemd/system/multi-user.target.wants/data.service" the service stop works fine.

My linux is mint 18.
Could you please help me to understand why this is happening?

Update:
When ExecStop= is not exisit, the service sends the signKill by default which is kill instantly, and sigKill cant be captured by ros therefore nodes are dying not in proper way.
https://www.freedesktop.org/software/systemd/man/systemd.service.html
http://man7.org/linux/man-pages/man7/signal.7.html

Extra info are welcome.

Independent job for roscore

Would be nice when working remotely with a robot to be able to bounce the roslaunched stuff without getting a new roscore.

Selectable ROS_HOSTNAME?

ROS_HOSTNAME is set automatically when service starts. This can cause communication issue between clients when they can't resolve the robot's pc with the value in ROS_HOSTNAME.

Does it make sense to add an option to not explicitly set ROS_HOSTNAME (implying I might open a PR)?

Environment variables regarding ROS networking are tricky to me (IMO they are for many users...) so I might be wrong though.

Kinetic package?

I noticed there's no ros-kinetic-robot-upstart package in the Kinetic release. This is unfortunate, because I found this project quite useful in previous releases. Is this project now dead?

Service does not start

Hello,

I am trying to use robot_upstart with our Husky and I cannot get it to start the service, not even by running sudo service husky-core start. In this case, it does return a pid, but it does not load anything at all (it appears to die straight away).

The command I used to install is:
rosrun robot_upstart install my_package/launch/my_launch.launch --job husky-core --interface wlan0

The nodes loaded from within the launch file are from packages installed system-wide (that is, not in my workspace).

This works on another computer, both running 12.04 + Hydro. Having said that, even on the other computer, I can load system-wide nodes, but I cannot load nodes from within my workspace.

Lastly, when I run roslaunch my_package my_launch.launch, everything works as expected (i.e., all nodes are loaded).

I have tried specifying options for user and the path to setup.bash, but no luck.
Oh, just in case, yes, the wlan0 interface is up at boot time.

Any ideas/suggestions?
Thanks a lot!

No logs exist at /var/log/upstart

robot_upstart is not creating .conf file in /etc/init

at /tmp/xyz folder there are multiple .log files of topics started by robot_upstart but all are empty

Issue setting a launch file to run on upstart (need more than 1 value to unpack)

OLD ISSUE:

Hi,

I am trying to run my launch file on startup and have tried to follow the commands on this page : http://docs.ros.org/jade/api/robot_upstart/html/# , but when I run rosrun robot_upstart install r200_nodelet_rgbd_startup.launch (with the launch file placed in the /opt/ros/indigo/share/robot_upstart folder), I get the following error:


administrator@CPR-J100-0019:/opt/ros/indigo/share/robot_upstart$ rosrun robot_upstart install r200_nodelet_rgbd_startup.launch 
Traceback (most recent call last):
  File "/opt/ros/indigo/lib/robot_upstart/install", line 32, in <module>
    exit(main())
  File "/opt/ros/indigo/lib/python2.7/dist-packages/robot_upstart/install_script.py", line 66, in main
    pkg, pkgpath = args.pkgpath[0].split('/', 1)
ValueError: need more than 1 value to unpack

Please let me know if there is any solution to this issue, thank you very much for the help.

Best,

Gabriel

NEW ISSUE: Figured it out. The naming convention for the launch file path is package_name/path_to_file.

The issue I am having now is that, after having installed a .launch file for Jackal to launch when booting up, the jackal is very slow and it's command line through ssh is very slow. I am also not able to echo any of my desired topics, as they simply hang after I type "rostopic echo /my_topic". Let me know if there could be any solution to this, Thanks.

can't close file while use rosbag

When I use rosbag as system service in robot_upstart, the file can not be closed correctly if my computer is shutdown. How the service close the ros node?

Could anyone answer this problem?

Remote ROS Master Restart

I have a laptop running roscore and I have a RasPi which is connected to a few cameras and connects to roscore on the laptop.

If roscore is not started, the RasPi seems to error-out and retry connecting to the remote roscore when configured with the --master option (good!), but if the roscore is restarted, the RasPi seems to fail silently and I have to restart the service. Ideally it should go into the polling mode if the roscore is stopped right?

Option to override environment setup file

Necessary for situations where an environment wrapper is desired, to set additional environment vars (eg, platform variant information or other configuration).

Rather than needing to be one more thing passed in, this could also work from an env var itself, eg "ROS_SETUP". Then it's just a matter of the wrapper script setting that to itself.

Log becoming huge in /var/log/upstart

First of all a disclaimer

Not 100% sure it this is an issue, a feature request or me not completely understanding how robot_upstart works. Please forgive me if I am putting this message in the wrong place.

Issue description

We are using robot_upstart for our robot and are very happy with it. We face an issue with an ever-growing log file though. At some point the log becomes so big (94 Gb) that the systems if ' full ' and becomes unresponsive even to ssh logins.

Our configuration

The install statement that we use is:

rosrun robot_upstart install --job doorman --setup /etc/ros/setup.bash decos_doorman/launch/doorman.launch

It creates the following files:

/etc/init/doorman.conf
/etc/ros/indigo/doorman.d/.installed_files
/etc/ros/indigo/doorman.d/doorman.launch
/usr/sbin/doorman-start
/usr/sbin/doorman-stop

Possible solution: log to /tmp rather than to /var/log/upstart

Options that I found are :

  • setting the environment variable ROS_LOG_DIR to /tmp
  • passing --logdir /tmp to install statement
    This then assumes that Ubuntu takes care of clearing /tmp whenever it feels it is needed.
    I tried both of these options but still the logs were being created in /var/log/upstart only.

Possible solution: switch logging off completely

I did not yet find an option to not create log files at all.
As we use the logging for our 'production' robot and not on our R&D robots this would be a fine solution

Possible solution: auto cleanup old logs

Ok, now we are getting into the feature request area I think.
The idea could be to keep only today's log and discard of older logs automatically.

robot_upstart not finding install_script

I need to start ros launch file at machine startup .

We are using Ubilinux on Intel/Edison. We are using ROS:

/rosdistro: indigo
/rosversion: 1.11.13

I am trying to follow these instructions http://docs.ros.org/api/robot_upstart... I have downloaded code from https://github.com/clearpathrobotics/... branch indigo-devel
Here is how my folder looks

hemant@127:~/catkin_ws/src/robot_upstart/src/robot_upstart$ ls -ltr 
total 36
-rw-rw-r-- 1 hemant hemant 2408 Dec 26 16:06 uninstall_script.py
-rw-rw-r-- 1 hemant hemant 6667 Dec 26 16:06 providers.py
-rw-rw-r-- 1 hemant hemant 9173 Dec 26 16:06 job.py
-rw-rw-r-- 1 hemant hemant 4814 Dec 26 16:06 install_script.py
-rw-rw-r-- 1 hemant hemant 1663 Dec 26 16:06 **init**.py

Following shows command I ran.

hemant@127:~/catkin_ws$ catkin_make
hemant@127:~/catkin_ws$ catkin_make install
hemant@127:~/catkin_ws$ source ~/catkin_ws/devel/setup.bash

Now creating a job:

hemant@127:~/catkin_ws$ rosrun robot_upstart install myrobot mybotpackage/test.launch
Traceback (most recent call last):
  File "/home/hemant/catkin_ws/src/robot_upstart/scripts/install", line 29, in <module>
    from robot_upstart.install_script import main
ImportError: No module named robot_upstart.install_script

Question : Why it is not able to find robot_upstart.install_script

I have been told to inform here and it could be an issue
For more information see here

http://answers.ros.org/question/223129/robot_upstart-not-finding-install_script/
Thanks,

nmcli connect wifi not work with this

robot_upstart is great so far,it's good for auto start with reboot.
I want connect wifi Dynamicly,it works well by roslaunch.But installed service by robot_upstart this not work.the test is below,just nmcli command passed and not work,others work well.
If should add something to service for nmcli?

test.launch

<launch> <node pkg="hlf_robot" type="test.py" name="test_wifi"/> </launch>

test.py
2017-12-16 15-28-32

I have test subprocess and envoy to run this command line,they are the same as os.system().

Wrong initial value in /usr/sbin/foo-start not corrected in subsequent installation

Found in /usr/sbin/foo-start script, I had to manually change:

# Punch it.
-export ROS_HOME=$(echo ~wronguser)/.ros
+export ROS_HOME=$(echo ~rightuser)/.ros

When I first ran rosrun robot_upstart install foo/launch/upstart.launch, indeed something was wrong so I understand the upstart could use wronguser. But after running the same command multiple times on the right environment, the above wasn't fixed/overwritten.

Is it intended behavior?

(I did run rosrun robot_upstart uninstall %job_name% later but don't remember if it fixed this.)

Port permission issues.

Hi, I am seeing the following error when I use robot_upstart to launch my code.

Failed to open port: Permission denied

This error is in reference to the UART port that is used to communicate with the motor controllers. It appears that the service that robot_upstart spawns doesn't have the same permission level as the equivelent roslaunch service. How do I grant the robot_upstart service super user permisions?

Installation silently fails, log and services not created

I have an all.launch file that perfectly starts everything when I run:

. /usr/local/myproject/src/ros/shell
rosrun ros_mybot all.launch

Following the docs, I tried to make my launch file auto-run at boot using:

 rosrun robot_upstart install --setup /usr/local/myproject/src/ros/shell ros_mybot/launch/all.launch

This completed without error. However, these commands fail:

$ sudo service myrobot start
myrobot: unrecognized service
 $ sudo service myrobot stop
myrobot: unrecognized service

If I reboot, rqt_graph shows some of the nodes are started, but not all. Unfortunately, I have no way to debug this because the log file is not created. If I try to view the log file, I get the error:

$ sudo tail /var/log/upstart/myrobot.log -n 30
tail: cannot open '/var/log/upstart/myrobot.log' for reading: No such file or directory

What am I doing wrong?

using robot_upstart seems fail

I installed robot_upstart from github into my odroid successfully.The odroid connect to APM stack quad through FTDI cable. I am new to this ros package so I have some issue to use that.I follow the tutorial: Usage.
After i install and type the command rosrun robot_upstart install my_ros_package/launch/test.launch in the terminal,then reboot.
After that, I do rostopic list, it said ERROR: Unable to communicate with master
But When do roscor , it said roscore cannot run as another roscore/master is already running. It seems that something works but I can't see.
I want to uninstall that but I dont know the job name.
Could you tell me how to stop that? or any suggestions to see what going on here. Thanks so much.

stopping doesn't wait for nodes to exit

We're using robot_upstart to manage our ROS nodes and it's all working great except for the sudo service ros stop command. It finishes the command immediately, but the ROS nodes take an extra 10-20 seconds before they actually shut down. This causes big problems if we're trying to restart the software because nodes will be coming up and down at the same time, which makes everything confused.

Is it possible for the upstart script to track which pids and all children pids were created and wait until they're all terminated before finishing the command?

Multiple errors on Ubuntu 14.04

I tried to run robot_upstart on my Odroid board with Ubuntu 14.04, but it seems to fail:

odroid@odroid:~/catkin_ws$ rosrun robot_upstart install my_qbo_startup/launch/default.launch
grep: Invalid range end
grep: Invalid range end
grep: Invalid range end
/opt/ros/indigo/lib/robot_upstart/install: line 136: source: /bin/true: cannot execute binary file
Installing odroidindigo job using network interface eth0.
/opt/ros/indigo/lib/robot_upstart/install: line 153: rosrun: command not found
/opt/ros/indigo/lib/robot_upstart/install: line 154: rosrun: command not found
/opt/ros/indigo/lib/robot_upstart/install: line 155: rosrun: command not found
/opt/ros/indigo/lib/robot_upstart/install: line 162: rospd: command not found
Adding files to odroidindigo job: odroidindigo/home/odroid/catkin_ws/devel/setup.bashmy_qbo_startup/launch/default.launch/*
/opt/ros/indigo/lib/robot_upstart/install: line 168: pushd: home/odroid/catkin_ws/devel/setup.bashmy_qbo_startup/launch/default.launch: No such file or directory
cp: omitting directory 'etc'
cp: omitting directory 'include'
cp: omitting directory 'lib'
cp: omitting directory 'share'
/opt/ros/indigo/lib/robot_upstart/install: line 170: popd: directory stack empty
/opt/ros/indigo/lib/robot_upstart/install: line 172: popd: directory stack empty

"Unable to locate path ... in package ... . Installation aborted" on one system, works on another

Hi!

I have 3 computers with ROS running on them. The robot_upstart install works on two of those (Ubuntu) and doesn't work on the third one (Debian Wheezy).

On the first two I have the cob_bringup package inside the cob_robot package (part of the Care-O-Bot project by the Fraunhofer IPA). There is a robot.launch directly inside the cob_bringup package. When I run rosrun robot_upstart install cob_bringup/robot.launch the installation scripts detect the path properly. The full path of the launch file I have is basically /home/USER/catkin_ws/src/cob_robot/cob_bringup/robot.launch

On the third computer where the script fails I decide to do some testing and also added the robot_upstart package there (same procedure 1:1 as with the other 2 computers). The structure of this workspace is even simpler. The full path of the launch file is /home/USER/catkin_ws/src/listenerTalker/launch/talker.launch with the difference that I have the launch file in the launch folder (as per the file structure conventions in ROS - put the launch files in the launch directory, which is located in the root directory of the package). The found_path variable inside the install_script.py however returns empty (btw I added a return clause in this statement where the path is checked since before that the script just continues and right after that IF-statement crashes with an list index out of range (in found_path[0]) exception.

I have no idea what is causing all this. I even moved the launch file to the root of my listenerTalker package (to mimic the file structure on the other two systems) but all in vain. Note that this is a valid launch file and package (tested with roslaunch).

Any suggestions as to why this is happening?

roslaunch is not executed on startup because network adapter doesn't delay start

Hi,

I created a launch file that runs my ROS nodes automatically, including the Master.

Firstly I added the service with robot_upstart, including my master-ip and the wlan0 interface
Then I used daemon-reload and started the service. That was always working fine. However, on reboot it would never work.

service name-of-service status helped me finding the issue: The error displayed was
root: bebop: No IP address on wlan0, cannot roslaunch.

After more debugging, there were two things I needed to do before it worked correctly:
Firstly, I needed to alter the automatically created service file in /lib/systemd/system/name-of-service.service. I added following lines:
After=network.target
Wants=network.target
After=network-online.target
Wants=network-online.target

After adding these lines and reloading the daemon, the error persisted. As I found out, there was no service activated that delays my service. So I enabled both of these services with
sudo systemctl enable NetworkManager-wait-online.service
sudo systemctl enable systemd-networkd-wait-online.service

After reloading the deamon again, finally my service is delayed until I have a wifi connection and the lauch file is executed correctly.

Make sure every time you edit and reinstall the service, to edit the automatically created service file.

There's not much that can be done about the disabled network waiting service, but please automatically add the four lines to the service file.

[Question] Why execute with setuidgid

Hi, I'm using this fantastic node with my robot.
First of all, thanks, I like it too much.
Why do you use the command setuidgid to launch the roslaunch?

I use a user with groups added like video and dialout to have access the camara of my device (raspberry pi camera) and serial port.
I have to add dialout to main group and then I give privileges to dialout to access camera with:

$ echo 'SUBSYSTEM=="vchiq",GROUP="dialout",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules

But I think that doing this is very bad habit. How could it be done better?

Why don't you use just the command su?

Thanks for your time,
Pando

Upstart generates no logs

Is there any special setup needed to get logging to work with robot_upstart?

In the previous version of robot_upstart, it worked perfectly, and logs were generated to the standard ~/.ros/log directory. I recently upgraded to the most recent package in Ubuntu 16.04, installing my service with:

source /usr/local/myrobot/src/ros/setup.bash; rosrun robot_upstart install --setup /usr/local/myrobot/src/ros/setup.bash --job myrobot --user ubuntu myrobot/launch/all.launch

My all.launch looks like:

<launch>
    <include file="$(find myrobot)/launch/serial_head.launch" />
    <include file="$(find myrobot)/launch/serial_torso.launch" />
    <include file="$(find myrobot)/launch/sound.launch" />
    <include file="$(find myrobot)/launch/status.launch" />
    <include file="$(find myrobot)/launch/diagnostics_aggregator.launch" />
    <include file="$(find myrobot)/launch/robot_state_publisher.launch" />
</launch>

Running rostopic list or rosnode list shows several things running, yet my ~/.ros/log remains empty. This is especially frustrating since a few nodes aren't running, and I can't find any logs to shed light on the problem.

Is logging not supported via upstart, or does it require some special configuration?

If I run roslaunch myrobot all.launch from a regular terminal, everything starts correctly, and logs are created, so I'm assuming there's some issue with upstart using incorrectly permissions, even though it should be starting with my user, which is ubuntu.

The default /var/log/upstart log directory specified in your help docs is not created either.

Custom job start templates or ability to add pre-launch scripts

I needed to run startup checks on the system before executing roslaunch. Ultimately I ended up modifying templates/job-start.em to include various subsystem startup checks, such as network ping and platform identification before executing roslaunch.

I also made a change to providers.py which allows the user to pass custom template filenames. Alternatively a change could be made to specify pre-roslaunch scripts to be executed as part of the upstart job, I decided against this because it may be useful to set where the functions are called when the service is started.

The question is should the entire package need to be forked for minor changes in the template or is there some suitable way to allow for customization of the templates?

If this isn't useful, feel free to disregard. I have solved the issue for myself but thought it might be useful for others.

Log from service published to /var/log/syslog

I am experiencing a problem with robot upstart on ROS Kinetic. I install my bringup launch file and it automatically starts on system startup. I also set --logdir and the logs are written there.
But the log messages from ROS (ROS_INFO, ROS_ERROR) are also written to /var/log/syslog. This does not happen when directly calling roslaunch, only when the service runs.

Example of a syslog line:
Apr 17 16:10:41 robot robot-start[31465]: #33[31m[ERROR] [1523974241.950112782]: Sick300 not connected, will try connecting again in 500 msec...#33[0m

This is problematic because syslog is quickly growing too big.

I tried the solution from:
but without any luck.

Is there a solution for this? Thank you.

service suddenly not work,until reboot

Always start launch file with robot_upstart .but ,today,when my microphone lose,i stopped the service installed by robot_upstart,then restart the service,but microphone not work.I don't know what happened with this,because when i start the launch file with roslaunch command line,it work.Then restart service still not work.I just cannot start the launch file with the service.And the service stop not clean,roscore always running.
reboot machine,this problem disappeared.

ROS_HOME as an argument.

We have a use case where it would be useful to be able to specify ROS_HOME to robot_upstart. In particular, if you have a system where the data storage and system storage are separated physically. Would such a feature (and accompanying PR) be welcome here, or am I missing something some caveat?

Debian Jessie uses systemd to replace the init system

Debian Jessie uses systemd to replace the init system

After installing robot_upstart, add the following file: /usr/lib/systemd/system/<robot_upstart_service>.service


[Unit]
Description=robot upstart pibot

[Service]
Type=oneshot
ExecStart=/bin/sh -c "pibot-start"

[Install]
WantedBy=multi-user.target


Then run: $sudo systemctl enable <robot_upstart_service>.service

This is based on instructions from here:
http://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd

It was tested on a Raspberry Pi with Raspbian Jessie and ROS Indigo

service can be started up but rostopic cannot be echoed

Hi!

I followed the installation tips and got one executable file in /usr/sbin/ros. I tried to run it directly in foreground and it gave me everything the same as roslaunch which means all topics can be echoed. However, when I tried to do 'sudo service ros start', I can see rostopic list but rostopic echo returns nothing.

I am using ubuntu 16.04, ros kinetic. I have set up the /etc/ros/setup.bash to make sure my environment variables are correct. I also chmod all files to be used to 777.

Any help or suggestions are greatly appreciated! Thanks in advance.

ERROR: Unable to communicate with master!

I'm trying a very simple setup to launch a roscore when robot boots. I followed these steps:

  1. From a clean catkin workspace i cloned this repo: cd ~/catkin_ws/src && git clone https://github.com/clearpathrobotics/robot_upstart.git
  2. I compiled the workspace cd ~/catkin_ws && catkin_make
  3. I run the install script in the following way: rosrun robot_upstart install --job roscore --interface enp60s0 --user my_user --setup /home/my_user/catkin_ws/devel/setup.bash --logdir /tmp robot_upstart/test/launch/a.launch
  4. I got this output:
/lib/systemd/systemd
Preparing to install files to the following paths:
  /etc/ros/kinetic/roscore.d/.installed_files
  /etc/ros/kinetic/roscore.d/a.launch
  /etc/systemd/system/multi-user.target.wants/roscore.service
  /lib/systemd/system/roscore.service
  /usr/sbin/roscore-start
  /usr/sbin/roscore-stop
Now calling: /usr/bin/sudo /home/my_user/catkin_ws/src/robot_upstart/scripts/mutate_files
[sudo] password for my_user: 
Filesystem operation succeeded.
** To complete installation please run the following command:
 sudo systemctl daemon-reload && sudo systemctl start roscore
  1. I run: sudo systemctl daemon-reload && sudo systemctl start roscore
  2. I rebooted the robot.
  3. Once the robot is booted again, I opened a terminal and wrote: rostopic list and I got this error:
    ERROR: Unable to communicate with master!

So, why the roscore is not launched at startup?

Also, there are no logs in /tmp.

Device access with the `--user` option

I may be wrong but there is a limitation with the --user option because of a "limitation" of setuidgid.

Here is my scenario: I wanted to run the rosnode as user ros which belongs to group dialout and need access to some devices (e.g. /dev/ttyUSB0). My devices have ownership root:dialout and Read/Write permission for user and group. This setup allows me to run manually all nodes with device access.
However, when using robot_upstart, because of setuidgid, all groups other than ros are removed for the user launching the nodes (as stated in the man page). This means that sudo service myrobot start will not work because ros, not belonging to dialout when launched this way, does not have access to the devices.

Is there a way (other than setting --user root) to work around this problem?

The documentation should be updated to warn users about this fact.

Failed to load nodelet

Hi !

I'm using robot_upstart to load some nodelet at startup.

I'm getting a weird issue, it seems that it fails to load nodelet as I'm getting this kind of fatal error:

Node: /ueye_cam_nodelet_2
Time: 11:14:39.055841859 (2017-10-13)
Severity: Fatal
Published Topics: /rosout

Failed to load nodelet '/ueye_cam_nodelet_2` of type `ueye_cam/ueye_cam_nodelet` to manager `nodelet_manager'

Location:
/tmp/binarydeb/ros-kinetic-nodelet-1.9.10/src/nodelet.cpp:loadNodelet:228

----------------------------------------------------------------------------------------------------

Lauching sudo job-start on foreground is working fine (no permission issue).

Here is my launch file:

<launch>

  <node name="check_ueye_api" pkg="ueye_cam" type="check_ueye_api" required="true" />
  <arg name="nodelet_manager_name" value="nodelet_manager" />
  <arg name="camera_name" value="camera" />

  <node pkg="nodelet" type="nodelet" name="$(arg nodelet_manager_name)" args="manager"/>
  
  <node pkg="nodelet" type="nodelet" name="ueye_cam_nodelet_1" respawn="true"
        args="load ueye_cam/ueye_cam_nodelet $(arg nodelet_manager_name)">
    <param name="camera_name" type="str" value="$(arg camera_name)1" /> <!-- == namespace for topics and services -->
    <param name="camera_topic" type="str" value="image_raw" />
    <param name="camera_id" type="int" value="1" /> <!-- 0 = any camera; 1+: camera ID -->
    <param name="camera_intrinsics_file" type="string" value="" /> <!-- default: ~/.ros/camera_info/<camera_name>.yaml -->
    <param name="camera_parameters_file" type="string" value="" /> <!-- default: ~/.ros/camera_conf/<camera_name>.ini -->

    <param name="ext_trigger_mode" type="bool" value="False" /> 

    <param name="color_mode" type="str" value="rgb8" />
    <param name="image_width" type="int" value="800" />
    <param name="image_height" type="int" value="1200" />
    <param name="image_top" type="int" value="-1" /> <!-- -1: center -->
    <param name="image_left" type="int" value="-1" /> <!-- -1: center -->

    <param name="subsampling" type="int" value="1" /> <!-- supported by only some UEye cameras -->
    <param name="binning" type="int" value="1" /> <!-- supported by only some UEye cameras -->
    <param name="sensor_scaling" type="double" value="1.0" /> <!-- supported by only some UEye cameras -->

    <param name="auto_gain" type="bool" value="True" />
    <param name="master_gain" type="int" value="0" />
    <param name="red_gain" type="int" value="0" />
    <param name="green_gain" type="int" value="1" />
    <param name="blue_gain" type="int" value="16" />
    <param name="gain_boost" type="bool" value="False" />

    <param name="auto_exposure" type="bool" value="True" />
    <param name="exposure" type="int" value="33" /> <!-- in ms -->

    <param name="auto_white_balance" type="bool" value="True" />
    <param name="white_balance_red_offset" type="int" value="0" />
    <param name="white_balance_blue_offset" type="int" value="0" />
    
    <param name="flash_delay" type="int" value="0" /> <!-- in us -->
    <param name="flash_duration" type="int" value="1000" /> <!-- in us -->
    
    <param name="auto_frame_rate" type="bool" value="False" />
    <param name="frame_rate" type="double" value="10.0" />
    <param name="output_rate" type="double" value="0.0" /> <!-- >0: throttle rate for publishing frames -->
    <param name="pixel_clock" type="int" value="24" />

    <param name="flip_upd" type="bool" value="True" />
    <param name="flip_lr"  type="bool" value="False" />
  </node>

<node pkg="nodelet" type="nodelet" name="ueye_cam_nodelet_2"  respawn="true"
        args="load ueye_cam/ueye_cam_nodelet $(arg nodelet_manager_name)">
    <param name="camera_name" type="str" value="$(arg camera_name)2" /> <!-- == namespace for topics and services -->
    <param name="camera_topic" type="str" value="image_raw" />
    <param name="camera_id" type="int" value="2" /> <!-- 0 = any camera; 1+: camera ID -->
    <param name="camera_intrinsics_file" type="string" value="" /> <!-- default: ~/.ros/camera_info/<camera_name>.yaml -->
    <param name="camera_parameters_file" type="string" value="" /> <!-- default: ~/.ros/camera_conf/<camera_name>.ini -->

    <param name="ext_trigger_mode" type="bool" value="False" /> 

    <param name="color_mode" type="str" value="rgb8" />
    <param name="image_width" type="int" value="800" />
    <param name="image_height" type="int" value="1200" />
    <param name="image_top" type="int" value="-1" /> <!-- -1: center -->
    <param name="image_left" type="int" value="-1" /> <!-- -1: center -->

    <param name="subsampling" type="int" value="1" /> <!-- supported by only some UEye cameras -->
    <param name="binning" type="int" value="1" /> <!-- supported by only some UEye cameras -->
    <param name="sensor_scaling" type="double" value="1.0" /> <!-- supported by only some UEye cameras -->

    <param name="auto_gain" type="bool" value="True" />
    <param name="master_gain" type="int" value="0" />
    <param name="red_gain" type="int" value="0" />
    <param name="green_gain" type="int" value="1" />
    <param name="blue_gain" type="int" value="16" />
    <param name="gain_boost" type="bool" value="False" />

    <param name="auto_exposure" type="bool" value="True" />
    <param name="exposure" type="int" value="33" /> <!-- in ms -->

    <param name="auto_white_balance" type="bool" value="True" />
    <param name="white_balance_red_offset" type="int" value="0" />
    <param name="white_balance_blue_offset" type="int" value="0" />
    
    <param name="flash_delay" type="int" value="0" /> <!-- in us -->
    <param name="flash_duration" type="int" value="1000" /> <!-- in us -->
    
    <param name="auto_frame_rate" type="bool" value="False" />
    <param name="frame_rate" type="double" value="10.0" />
    <param name="output_rate" type="double" value="0.0" /> <!-- >0: throttle rate for publishing frames -->
    <param name="pixel_clock" type="int" value="24" />

    <param name="flip_upd" type="bool" value="True" />
    <param name="flip_lr"  type="bool" value="False" />
  </node>

<node name="web_video" type="web_video_server" pkg="web_video_server" respawn="true">
<param name="type" value="vp8"/>
<param name="address" value="10.42.0.1"/>
</node>
 <node pkg="img_saver" type="img_saver_node" name="img_saver"/>
</launch>

Support for Fedora

Right now, Fedora is disabled in the GBP tracks because there's no daemontools package on which it can depend. A few potential ways to eliminate the dependency:

I'm not super motivated to work on this as I'm not a Fedora user so the status quo is acceptable to me. But the ticket is here as a marker of work to be done if someone wants to take it up.

ERROR: could not contact master [http://127.0.0.1:11311], when service is launched.

Hi, I'm new to robot_upstart package.

First, my environment is below:

ubuntu mate 16.04
Raspberry Pi 3
ros kinetic

And I did that I installed robot upstart package from source at this repository (master branch).
Then I install my launch file to run when I RPI boot up.

rosrun robot_upstart install --job roscore foo/launch/bar.launch

But I caught the folloing error.

1月 15 15:50:34 mal root[409]: roscore: Using workspace setup file /home/mal/catkin_ws/devel/setup.bash                                                      [676/1929]
 1月 15 15:50:34 mal roscore-start[402]: <14>Jan 15 15:50:34 root: roscore: Using workspace setup file /home/mal/catkin_ws/devel/setup.bash
 1月 15 15:50:37 mal root[558]: roscore: Launching ROS_HOSTNAME=mal, ROS_IP=, ROS_MASTER_URI=http://127.0.0.1:11311, ROS_LOG_DIR=/tmp
 1月 15 15:50:37 mal roscore-start[402]: <14>Jan 15 15:50:37 root: roscore: Launching ROS_HOSTNAME=mal, ROS_IP=, ROS_MASTER_URI=http://127.0.0.1:11311, ROS_LOG_DIR=/tmp
 1月 15 15:50:40 mal roscore-start[402]: ls: cannot access '/etc/ros/kinetic/roscore.d/*.xacro': No such file or directory
 1月 15 15:50:41 mal root[639]: roscore: Generated launchfile: /tmp/roscore.launch
 1月 15 15:50:41 mal roscore-start[402]: <14>Jan 15 15:50:41 root: roscore: Generated launchfile: /tmp/roscore.launch
 1月 15 15:50:41 mal root[645]: roscore: Started roslaunch as background process, PID 644, ROS_LOG_DIR=/tmp
 1月 15 15:50:41 mal roscore-start[402]: <14>Jan 15 15:50:41 root: roscore: Started roslaunch as background process, PID 644, ROS_LOG_DIR=/tmp
 1月 15 15:50:44 mal roscore-start[402]: WARNING: cannot create log directory [/tmp/efe8ee0e-daee-11e6-a628-b827eb2a38c8]. Please set ROS_LOG_DIR to a writable location
.
 1月 15 15:50:44 mal roscore-start[402]: du: cannot read directory '/tmp/systemd-private-d841bace0f734c619ae55aa67b2e1288-systemd-hostnamed.service-FXeqHp': Permission 
d
 1月 15 15:50:55 mal roscore-start[402]: No handlers could be found for logger "roslaunch"
 1月 15 15:50:55 mal roscore-start[402]: ERROR: could not contact master [http://127.0.0.1:11311]
 1月 15 15:50:55 mal roscore-start[402]: The traceback for the exception was written to the log file
 1月 15 15:50:55 mal roscore-start[402]: Checking log directory for disk usage. This may take awhile.
 1月 15 15:50:55 mal roscore-start[402]: Press Ctrl-C to interrupt
 1月 15 15:50:55 mal roscore-start[402]: Done checking log file disk usage. Usage is <1GB.
 1月 15 15:50:55 mal roscore-start[402]: [24B blob data]
 1月 15 15:50:55 mal roscore-start[402]: started roslaunch server http://mal:40124/
 1月 15 15:50:55 mal roscore-start[402]: SUMMARY
 1月 15 15:50:55 mal roscore-start[402]: ========
 1月 15 15:50:55 mal roscore-start[402]: PARAMETERS
 1月 15 15:50:55 mal roscore-start[402]:  * /rosdistro: kinetic
 1月 15 15:50:55 mal roscore-start[402]:  * /rosversion: 1.12.6
 1月 15 15:50:55 mal roscore-start[402]: NODES
 1月 15 15:50:55 mal roscore-start[402]:   /mal_upstart/
 1月 15 15:50:55 mal roscore-start[402]:     integrator (mal_perception/integrator.py)
 1月 15 15:50:55 mal roscore-start[402]: auto-starting new master
 1月 15 15:50:55 mal roscore-start[402]: process[master]: started with pid [1015]
 1月 15 15:50:55 mal roscore-start[402]: Traceback (most recent call last):
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/bin/rosmaster", line 35, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     rosmaster.rosmaster_main()
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/main.py", line 80, in rosmaster_main
 1月 15 15:50:55 mal roscore-start[402]:     configure_logging()
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/main.py", line 58, in configure_logging
 1月 15 15:50:55 mal roscore-start[402]:     _log_filename = rosgraph.roslogging.configure_logging('rosmaster', logging.DEBUG, filename=filename)
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/roslogging.py", line 126, in configure_logging
 1月 15 15:50:55 mal roscore-start[402]:     logging.config.fileConfig(config_file, disable_existing_loggers=False)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/logging/config.py", line 85, in fileConfig
 1月 15 15:50:55 mal roscore-start[402]:     handlers = _install_handlers(cp, formatters)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/logging/config.py", line 163, in _install_handlers
 1月 15 15:50:55 mal roscore-start[402]:     h = klass(*args)
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/roslogging.py", line 167, in __init__
 1月 15 15:50:55 mal roscore-start[402]:     from rospy.rostime import get_time, is_wallclock
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/__init__.py", line 49, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     from .client import spin, myargv, init_node, \
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/client.py", line 47, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     import yaml
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 8, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     from loader import *
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/dist-packages/yaml/loader.py", line 4, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     from reader import *
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/dist-packages/yaml/reader.py", line 47, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     class Reader(object):
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/dist-packages/yaml/reader.py", line 140, in Reader
 1月 15 15:50:55 mal roscore-start[402]:     NON_PRINTABLE = re.compile(u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD\U00010000-\U0010ffff]')
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/re.py", line 194, in compile
 1月 15 15:50:55 mal roscore-start[402]:     return _compile(pattern, flags)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/re.py", line 249, in _compile
 1月 15 15:50:55 mal roscore-start[402]:     p = sre_compile.compile(pattern, flags)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/sre_compile.py", line 576, in compile
 1月 15 15:50:55 mal roscore-start[402]:     code = _code(p, flags)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/sre_compile.py", line 561, in _code```

When I caught such error, I suspected timing of launching service.
So I add following line to the service file in /lib/systemd/system/roscore.service (in this case "roscore").

[Timer]
OnBootSec=1min

And I reboot the PC, the service and launch file is launched correctly after a minute.
I'm not sure why this happens.

Sorry, this is only report. but if I have some time to see the code. I will.

Thanks.

Multiple bringup jobs cause multiple roscores leading to high CPU usage

I think this is multiple bugs (at least some of which are upstream of robot_upstart). Here's what happens:
I have two upstart jobs (install script for reference: https://github.com/OSUrobotics/wheelchair-automation/blob/cleanup/wheelchair_bringup/scripts/install). Both of them try to start roscores. I'm not sure why this happens, since roslaunch is only supposed to start roscore if it isn't already running. One of them can't start because port 11311 is already in use. That second roscore process sits there without exiting. Over time, this drives the CPU usage of the first roscore up to 100%, requiring a hard reboot of the i3 machine on the robot.

I found a workaround by editing the startup script at /usr/sbin/wheelchair-logging-start, and adding --wait to theroslaunch invocation. This fixes the problem. However, if the network interface goes down and comes back up (like wifi briefly goes down), another instance of roscore tries to start for the job without --wait.

tl;dr: Multiple jobs -> multiple roscores -> high CPU usage
This is hydro on Ubuntu 12.04.

templates/job-start.em has bad {user} tokens

templates/job-start.em has at least one instance of {user} being used where you really want @(user). When creating the ROS log directory if it doesn't exist (here):

if [[ ! -d $log_path ]]; then
  CREATED_LOGDIR=true
  trap 'CREATED_LOGDIR=false' ERR
    log warn "@(name): The log directory you specified \"$log_path\" does not exist. Attempting to create."
    mkdir -p $log_path 2>/dev/null
    chown {user}:{user} $log_path 2>/dev/null
    chmod ug+wr $log_path 2>/dev/null
  trap - ERR
  # if log_path could not be created, default to tmp
  if [[ $CREATED_LOGDIR == false ]]; then
    log warn "@(name): The log directory you specified \"$log_path\" cannot be created. Defaulting to \"/tmp\"!"
    log_path="/tmp"
  fi
fi

I only discovered this when trying to make a job with ROS_LOG_DIR set to /dev/shm/rosLogs.

Launch files in /etc becoming stale

I sometimes get bit by an inability to start my robot_upstart job or other failures when this sequence of events happens:

  1. I check out a package that contains a launch file I want to start at boot
  2. I run robot_upstart install, which copies the launch file to /etc
  3. I update the package (apt-get upgrade or git pull+recompile) and end up with an updated launch file in the package directory
  4. I try to launch again but use the out-of-date launch file in /etc, and my package doesn't function correctly.

The hack I used by hand to get around this was by putting a "stub" rosinstall in /etc/ros/<distro>/<jobname>.d, that contained an include statement pointing to the launch file I wanted to launch. That way there is no copy of the launch file that can become out of date.
(Note that I'm on hydro so I'm using version 0.0.7...to the best of my knowledge this behaviour hasn't changed in newer versions of the package, but I mention this just in case).

Would you consider in a future version using stub launchfiles instead of copying to avoid this issue?

Regards,

Jonathan

Request: Ability to use systemd User= directive

As noted in the docs [1], when using setuidgid, the groups and group permissions for that user are lost, which is pretty annoying for nodes that deal with hardware. Udev fixes do work, but are kind of painful to configure.

With systemd, you can run a service as a specific user, preserving the groups.
In the service section of the unit file you can add something like this:

[Service]
User={USER}

And then remove the setgiduid stuff from the /usr/sbin script, so that the service launches properly as the non-root user.
This would be pretty nice to have, and the sbin script could be kept compatible with upstart by checking if UID=0 before using setgiduid.

Adding a --wait flag to launch file to the install script

Hi!

This might be slightly tangential to #16. I noticed that the only clean way to add a --wait flag to the launch file is through the python API?

In a system with multiple machines and a single master it might be desired to wait for the master to start launchfiles (otherwise a launch will not be successful if it's execute before master comes up).

I'm more than happy to try to add this feature and make a PR if you think it's desired.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.