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

how can I use an SSH-Client for SSH Connections for Nav2?

asked 2022-07-28 16:32:34 -0500

Uik gravatar image

updated 2022-07-29 04:22:16 -0500

Good morning, my plan is to implement an agent system on the Turtlebots. Unfortunately, I had to accommodate the navigation externally via Nav2, because I couldn’t get Nav2 to run on the bot.

Now I need an SSH connection from my PC to the bot. But this has to be created by the navigation program (with Python). I created an SSH client with paramiko first and established the connection via bash scripts (once via subprocess and via os.system) as second attempt.

The connection was established and the bringup could be started successfully.

The problem is that ROS programs like Teleop and Cartographer could not connect to the bot, even though there was an SSH connection and the bringup was successful.

both ROS systems run on TURTLEBOT3_MODEL=burger and the same ID in the same network.

a connection “by hand” i.e. via “ssh ubuntu@IP” and then

“export TURTLEBOT3_MODEL=burger”

“ros2 launch turtlebot3_bringup” is working.

Does anyone know how Nav2, or ROS in general, detects the SSH connection, or how I can get the navigation to run using my own SSH client?

Do I have a typical Ubuntu rights problem here that nav2 has no rights for the SSH client?

Edit: i notice today, that the "by Hand" connection is a ubuntu@ubuntu-Terminal, but the terminal with the python code, or bash file is still a uik@uik-Terminal (see picture) the different terminals

description: ROS works only if i run the bringup "by hand" at the upper Terminal (ubuntu@ubuntu) the bottom Terminal has a running SSH (sshpass) and a running bringup, but ROS (teleop, cartographer) diddnt work

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2022-07-29 06:05:01 -0500

Uik gravatar image

updated 2022-07-29 11:01:37 -0500


export ROS_DOMAIN_ID = 30


if u start a SSH-Connection "by Hand" (typing ssh ubuntu@IP) then you "open" a terminal from the Turtlebot, that means you load the bashrc

the bashrc did 2 important operations

  1. source the ROS setup.bash

  2. export the ROS_DOMAIN_ID

u need to export a ROS_DOMAIN_ID bec. ROS components communicate with DDS Server and the ROS_DOMAIN_ID is the Network ID for your Server to connect to the Network (or something like that)

if u connect SSH via shell commands "automated" then u dont "open" a terminal and so u dont load the bashrc

for a ssh via sshpass (Unix lib):

sshpass -p 'turtlebot' ssh -tt ubuntu@ 'source /opt/ros/foxy/setup.bash && export ROS_DOMAIN_ID=30 && export TURTLEBOT3_MODEL=burger && ros2 launch turtlebot3_bringup'

sshpass -p is for the password (string) ssh -tt open a tty - controlling terminal, that means the bringup is "locked" to the ssh, if u close the ssh, then u shutdown the bringup too

URL for tty- control terminal

i will send updates if i was able to setup a client with paramiko!

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2022-07-28 16:32:34 -0500

Seen: 655 times

Last updated: Jul 29 '22