Skip to main content

Setting up the Environment

You will likely need multiple terminals running to see everything you are wanting to monitor. To do this you can either run tmux outside of the docker with multiple sessions, or multiple terminal windows that are executing the rosbag_container bash. Whichever method you use, you will need to ensure the rosbag_container container is already running. After some consideration, it's recommended to always use tmux so that you can continue working and maintain your command list if you get disconnected or want to work from a different workstation.

Start a ROSCORE Instance

You will need roscore running to perform any playback of data stored in bags. The best approach that I've found so far is to start roscore in a tmux session so that it is persistent without needing to always have a roscore terminal running. 

Check to see if the roscore tmux session already exists

rkitect@gibsonhh:~$ tmux list-sessions

You should get a list of current tmux sessions.

rkitect@gibsonhh:~$ tmux list-sessions
invokewebai: 1 windows (created Wed Oct 16 09:56:34 2024)
rkitect@gibsonhh:~$

If roscore isn't listed, then continue. If it is listed, then roscore should be running already. You should hop into that tmux session to verify.

Start a new tmux session title roscore

tmux new -t roscore

Bash into the rosbag_container docker instance

rkitect@gibsonhh:~$ docker exec -it rosbag_container bash
root@03efcb8f4879:/#

Source the ROS environment

root@03efcb8f4879:/# source /opt/ros/noetic/setup.bash

Run ROSCORE

root@03efcb8f4879:/# roscore
... logging to /root/.ros/log/179ffe12-8f26-11ef-988c-0242ac1c0002/roslaunch-03efcb8f4879-255.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://03efcb8f4879:44425/
ros_comm version 1.17.0


SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.17.0

NODES

auto-starting new master
process[master]: started with pid [263]
ROS_MASTER_URI=http://03efcb8f4879:11311/

setting /run_id to 179ffe12-8f26-11ef-988c-0242ac1c0002
process[rosout-1]: started with pid [273]
started core service [/rosout]

You can leave this up if you want to observe, or you can exit it by typing Ctrl+B. The tmux session will remain running. You can verify this by using tmux list-sessions

rkitect@gibsonhh:~$ tmux list-sessions
invokewebai: 1 windows (created Wed Oct 16 09:56:34 2024)
roscore-5: 1 windows (created Sun Oct 20 15:57:43 2024) (group roscore)
rkitect@gibsonhh:~$

If you want to reattach the roscore session you can use

rkitect@gibsonhh:~$ tmux a -t roscore

Existing Sessions

You can check for any existing tmux sessions for roscore using the list-sessions option for tmux

rkitect@gibsonhh:~$ tmux list-sessions
invokewebai: 1 windows (created Wed Oct 16 09:56:34 2024)
rosbag: 1 windows (created Tue Oct 22 22:24:00 2024)
roscore-5: 1 windows (created Sun Oct 20 15:57:43 2024) (group roscore)
rkitect@gibsonhh:~$

If you see the session you want to use go ahead and load into it.

New Sessions

If you don't see the session you want to continue using, or just want to start a new session, continue here. To start new sessions for running ROS commands or viewing output, use one of the following methods. 

TMUX

rkitect@gibsonhh:~$ tmux new -t rosdocker1 #add a new number as needed or name appropriately

Once you are in the tmux session you can skip down to Bashing into the rosbag_container docker

Multi-Terminal

In each new terminal window, execute bash for the rosbag_container contrainer

Bashing into the ROSBAG_CONTAINER docker

rkitect@gibsonhh:~$ docker exec -it rosbag_container bash
root@03efcb8f4879:/#

You can now continue on to Setting up the ROS Environment