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

Revision history [back]

click to hide/show revision 1
initial version

I solved the problem...

I checked the crontab -e script service and found that rosnode list appear the node from C++ side, but not from Python side on boot. The systemd doesn't work at all, giving permission errors and only execute the first line of EtherCAT. I tried both methods (crontab and systemd) combined with robot_upstart without success, but in stackoverflow I found the solution.

I believed that PyQt5 was the problem, so I tried to find a solution to startup a python script with a GUI made in PyQt5.

So, I combined the hardware permissions from robot_startup tutorial (explained on above comment) and added another script in /home/<user>/.config/autostart, named my_package.desktop that contains:

[Desktop Entry]
Version=1.0
Name=User
Comment=My Robot Startup
Exec=/home/<user>/my_package_ros.sh -nograb
Path=/home/<user>/
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;

Works like a charm.

PS.: the final my_package_ros.sh used have this:

#!/bin/bash
source /home/t800/.bashrc
sleep 5;
sudo /etc/init.d/ethercat start &
sleep 2;
roscore &
sleep 4;
/home/<user>/catkin_ws/devel/lib/my_package/ethercat_driver &
sleep 4;
python /home/<user>/catkin_ws/src/my_package/src/controller_ros.py &

Notice that I removed rosrun or roslaunch from the script and tried to directly load the exec files. Maybe works normal with roslaunch or rosrun, but I test later.

Thanks.

I solved the problem...

I checked the crontab -e script service and found that rosnode list appear the node from C++ side, but not from Python side on boot. The systemd doesn't work at all, giving permission errors and only execute the first line of EtherCAT. I tried both methods (crontab and systemd) combined with robot_upstart without success, but in stackoverflow I found the solution.

I believed that PyQt5 was the problem, so I tried to find a solution to startup a python script with a GUI made in PyQt5.

So, I combined the hardware permissions from robot_startup tutorial (explained on above comment) and added another script in /home/<user>/.config/autostart, named my_package.desktop that contains:

[Desktop Entry]
Version=1.0
Name=User
Comment=My Robot Startup
Exec=/home/<user>/my_package_ros.sh -nograb
Path=/home/<user>/
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;

Works like a charm.

PS.: the final my_package_ros.sh used have this:

#!/bin/bash
source /home/t800/.bashrc
/home/<user>/.bashrc
sleep 5;
sudo /etc/init.d/ethercat start &
sleep 2;
roscore &
sleep 4;
/home/<user>/catkin_ws/devel/lib/my_package/ethercat_driver &
sleep 4;
python /home/<user>/catkin_ws/src/my_package/src/controller_ros.py &

Notice that I removed rosrun or roslaunch from the script and tried to directly load the exec files. Maybe works normal with roslaunch or rosrun, but I test later.

Thanks.