I got everything working fine on this instruction https://docs.emlid.com/navio2/common/dev/ros/
I can connect from GCS and communicate with Ardupilot.
What is the best way to make all these commands automatically run on boot one after another?
Thanks for help!
You can try to use ROS Upstart. For install:
sudo apt-get install ros-indigo-robot-upstart
Robot_upstart allows you to quickly and easily generate background jobs to run roslaunch invocations on system startup, but you can also use roslaunch without robot_upstart. You need to modify fcu_url and gcs_url in
/opt/ros/kinetic/share/mavros/launch/apm.launch and run
roslaunch mavros apm.launch. Roslaunch will automatically start a roscore if there isn’t already one running and you’ll get your Navio connected to GCS.
To run this on boot you can create a simple systemd service. Create
mavros.service file in
/lib/systemd/system with the following contents:
ExecStart=/bin/bash -c "source /opt/ros/kinetic/setup.bash; /usr/bin/python /opt/ros/kinetic/bin/roslaunch mavros apm.launch"
sudo systemctl daemon-reload
And enable it on boot:
sudo systemctl enable mavros.service
Thank you guys, that was helpful! )
I think this info should be in your docs
Already added there. Thanks for pointing it out!