ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to auto deploy a robot?

asked 2018-03-06 02:34:23 -0600

updated 2018-03-07 00:13:58 -0600

Hey , I want to know how the robot can be configured to start on bootup .

There are a handful of scripts which i want running in a proper order

  1. roscore
  2. node that accepts cmd_vel and publishes tf
  3. freenect node
  4. node that launches the description of the robot (ie URDF)
  5. node that launches the navigation related modules
  6. nodes that pertain to IMU data

How do i run all of the above nodes at startup , how do i make sure that if any of them fails ,then it will be rerun ?

UPDATE image description

I have added respawn param and set it to true for the rosserial_python node , it still doesn't recover when crashing .

edit retag flag offensive close merge delete

Comments

1

Please don't use screenshots for text. Images are not searchable, you can't copy and paste them, and you can't search them. Please update your question with a copy and paste of the error instead using the preformatted text (101010) button.

jayess gravatar image jayess  ( 2018-03-07 00:50:06 -0600 )edit
1

I think the rosserial_python/respawn problem should be handled in a separate question. It also needs more information, your image doesn't really show a crashing node, just a communication problem

Humpelstilzchen gravatar image Humpelstilzchen  ( 2018-03-07 02:21:34 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted
2

answered 2018-03-06 03:28:03 -0600

Delb gravatar image

updated 2018-03-06 03:28:48 -0600

You can do a roslaunch to run all of these nodes and start the launch file with a script for exemple.

Moreover, if a node fail you can launch it again by setting the attribute respawn of the tag <node> to true like that :

<node name="listener1" pkg="rospy_tutorials" type="listener.py" args="--test" respawn="true" />

That will restart your node until it runs properly.

Check here to see all the attributes of the tag, some might help you !

edit flag offensive delete link more

Comments

How do i add respawn for freenect?

<include file="$(find freenect_launch)/launch/freenect.launch" />

we cant add a respawn parameter when we include other launch files .

chrissunny94 gravatar image chrissunny94  ( 2018-03-07 00:09:07 -0600 )edit

Copy the content of the freenect.launch into your own launch file and add the respawn attribute to the desired nodes (don't modify the freenect.launch it's not recommended at all to modify from source)

Delb gravatar image Delb  ( 2018-03-07 01:04:48 -0600 )edit
2

answered 2018-03-06 06:06:30 -0600

In my case, I have a robot which automatically launches everything it needs for a basic behavior. Like Delb said in his answer, I have a launch file that will run all the nodes I need. Then, I launch that file from my .bashrc in one of the tty terminals.

In the launch file you can either define your nodes, or include other launch files that would start the nodes.

For the startup running of the launch file, here's the code I have on my .bashrc file:

TERMINAL = `tty`
case $TERMINAL in
       "/dev/tty2") roslaunch your_master_file.launch;
       sleep 2;;
esac

I chose tty2 but you can launch wherever you want. That would launch your file everytime you boot up your robot computer.

edit flag offensive delete link more
1

answered 2018-03-07 02:18:06 -0600

Humpelstilzchen gravatar image

I use a way more simpler approach:

I just launch a screen with my commands on startup. For that I put my launch commands in a screen configuration file, e.g. ~/.screen-startup:

screen 0 zsh -is eval 'roscore'
screen 1 zsh -is eval 'roslaunch --wait wild_thumper wild_thumper.launch'
screen 2 zsh -is eval 'roslaunch (...)

and run that on start with cron:

@reboot screen -d -m -c ~/.screen-startup

Its easy to setup, and that way I keep full control of each launch file since each is running in its own screen window.

edit flag offensive delete link more
1

answered 2018-03-06 06:10:15 -0600

130s gravatar image

robot_upstart is a popular ROS package dedicated for registering and de-registering Ubuntu upstart job.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-03-06 02:34:23 -0600

Seen: 714 times

Last updated: Mar 07 '18