-
Notifications
You must be signed in to change notification settings - Fork 196
tutorials vrx_docker_examine
Carlos Agüero edited this page Sep 21, 2023
·
11 revisions
- In many cases, it is helpful to be able to open a shell into a running container, so you can use bash commands to understand more about its behavior.
- This most obvious case for this approach is a scenario in which the container is not exiting early but the WAMV is still not moving.
- In this tutorial we will walk through opening a bash session into a competitor image while it is in the middle of a trial.
As in the previous tutorial, open two terminals before you begin:
- In one terminal, we will run the trial you want to debug, using the testing instructions.
- In the the other terminal we will open a bash session into your competitor container.
- Begin running your trial as described in the testing tutorial, using the command:
./run_trial.bash $TEAM $TASK $TRIAL
- Wait for the competitor container to launch (you can use
docker container ls
to check). - Once the competitor container is running, run the following in your other terminal to open an interactive shell:
docker exec -it vrx-competitor-system bash
- This command will open a shell into the competitor container that will remain open until the container exits at the end of the trial.
- Source the
setup.bash
file, if necessary:source /opt/ros/humble/setup.bash
- Note that in many cases, competitor images may choose not to source
setup.bash
by default in their login shell, by adding a source command tobashrc
. - This is not an error since you will not be using a login shell during the competition.
- But, it means we have to do it manually when debugging.
- Note that in many cases, competitor images may choose not to source
- List rostopics:
Make sure you can see the
ros2 topic list
/vrx/task/info
topic and any topics related to the particular task you are running. - Check that you can read
/vrx/task/info
ros2 topic echo /vrx/task/info
- If your WAMV is not moving, try sending a thrust command to verify the setup:
RATE=1 CMD=2.0 ros2 topic pub /wamv/thrusters/right/thrust -r $RATE std_msgs/msg/Float64 data:\ $CMD
- Check that the command is publishing data as expected:
ros2 topic echo /wamv/thrusters/right/thrust
- You should receive
/wamv/thrusters/right/thrust
data (which is set to 2.0 in the script). - You should be able to see the effect of this command when playing back the trial.
- Check environment variables. For example:
env | grep ROS
- If the commands in the previous section produce their expected outcomes, this indicates that the competitor container is able to communicate with the server.
- In this case, it is likely that the container's software is not running or misconfigured.
- You can use
ps -ef
or thetop
command to get a quick sense of what is running on your system. - If a process that you expect to be running is not running, you can try to bring it up manually to see whether it executes correctly or produces a useful error message.
- A disadvantage of the above approach is that VRX trials have a time limit, and the bash session will close at the end of the trial.
- In addition, if the container is crashing or exiting early, there may not be time to log in and interact with it.
- The next tutorial provides one way of working around these limitations, by launching the competitor image manually.
Back: Basic Debugging | Up: VRX Docker Image Overview | Next: Run a Container Manually |
---|