systemd roslaunch turtlebot3 with ROS_NAMESPACE, got error!

asked 2020-04-06 20:16:53 -0500

wdxpz gravatar image

Dear all,

I am a new student to ROS, I'd like to launch multiple turtlebot3 at startup by systemd service for navigation in next step.

I can launch the robot by manually run the command: ROS_NAMESPACE=tb3_0 roslaunch turtlebot3_bringup turtlebot3_robot.launch multi_robot_name:="tb3_0" set_lidar_frame_id:="tb3_0/base_scan"

I also made the launch scripts startrobot.sh and startrobot.service to auto start the robot at boot. I can start the service normally by manually run sudo systemctl start startrobot.service, but when I power off and then power on the robot, the service will always report [WARN] Get params fail, timeout error and [ERROR] Lost sync with device.

I've lost now, and hope to get your help!

Here are my service file and scipts file.

start_robot.service

[Unit]
Description=Auto-start Robot Service 
After=network.target

[Service]
Type=idle
User=waffle
Group=waffle
EnvironmentFile=/home/waffle/start_robot/env.conf
ExecStart=/home/waffle/start_robot/startrobot.sh

[Install] 
WantedBy=multi-user.target

startrobot.sh

#!/usr/bin/env bash
bash -c "source /opt/ros/kinetic/setup.bash && source /home/waffle/catkin_ws/devel/setup.sh && rosnode kill -a && ROS_NAMESPACE=tb3_0 roslaunch turtlebot3_bringup turtlebot3_robot.launch multi_robot_name:="tb3_0" set_lidar_frame_id:="tb3_0/base_scan""

My roscpp version is 1.12.13, firmware version is v1.2.2, turtlebot3 modle is waffle_pi

Thanks a lot! Hope to get your help!

edit retag flag offensive close merge delete