Robotics StackExchange | Archived questions

Is it possible to run the shell command about ros while booting?

Hi, before i start question, i hope you guys understand poor english i will try my best and if you can't get what i'm talking please let me know in comment

I'm trying to run the shell like below to make my robot work without any physical disturb while moving. (environment is ubuntu 22.04)

#!/bin/bash
cd ~/ros2_ws && colcon --symlink-install --cmake-args -DBUILD_SHARED_LIBS=ON && source ~/.bashrc
cd src/project/launch
ros2 launch ./myprojectname.py

this shell works well when i run shell myself using command 'sh myshell.sh' and is in directory '/etc/profile.d/myshell.sh'. ofcourse i did

chmod +x myshell.sh

after i reboot pc, monitor shows error message like this for a while

failed to start process error reports when automatic reporting is enabled

I think main point is that ros can be initialized or not while booting. if ros cannot be initialized while booting is there other way for remote control?

I tried

crontab -e
@reboot path/scripts.sh > scripts.sh.log 2>&1

and

cd /etc/init.d
sudo vi myshell.sh
sudo update-rc.d myshell.sh defaults

too but also didn't work.

Asked by chobo on 2023-07-20 19:36:02 UTC

Comments

Answers