Skip to content

Commit ee96147

Browse files
Convenience and maintenance changes. (#723)
* robotika/Dockerfile: - don't redownload dnn files every time (with comment RUN vs ADD) - set ENV to configure logging (rospy + roscpp) - add convenience top level Makefile soft link - add convenience top level run_solution.bash soft link * run_solution: - remove OMP_NUM_THREADS (moved to base/Dockerfile) - remove ROSCONSOLE_CONFIG_FILE (moved to robotika/Dockerfile) * sim.bash: add missing $ * x4.launch: - enable ros_proxy_node output to screen - remove unused remap for front_rgb * subt/script/sim.bash: improve output on exit * rosconsole.config: limit DEBUG to roscpp only
1 parent 44ace83 commit ee96147

File tree

6 files changed

+65
-18
lines changed

6 files changed

+65
-18
lines changed

subt/docker/robotika/Dockerfile

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
FROM robotika/subt-base:2020-09-22
22

3-
ADD http://osgar.robotika.cz/subt/virtual/model/mdnet3.64.64.13.4.relu.pth .
4-
ADD http://osgar.robotika.cz/subt/virtual/model/ssd_inception_v2_201009/frozen_inference_graph.pb .
5-
ADD http://osgar.robotika.cz/subt/virtual/model/ssd_inception_v2_201009/cv_graph.pbtxt .
3+
# ADD always downloads the file to calculate checksum, RUN checksum only the cmdline
4+
RUN curl -O# http://osgar.robotika.cz/subt/virtual/model/mdnet3.64.64.13.4.relu.pth
5+
RUN curl -O# http://osgar.robotika.cz/subt/virtual/model/ssd_inception_v2_201009/frozen_inference_graph.pb
6+
RUN curl -O# http://osgar.robotika.cz/subt/virtual/model/ssd_inception_v2_201009/cv_graph.pbtxt
67

78
RUN sudo apt-get update && sudo apt install -y ros-melodic-teleop-twist-keyboard
89

@@ -19,3 +20,12 @@ COPY . ./src/osgar/
1920
RUN /osgar-ws/env/bin/pip install -e src/osgar/
2021

2122
RUN source /opt/subt/setup.bash && catkin_make -DCMAKE_BUILD_TYPE=Release
23+
24+
ENV ROSCONSOLE_CONFIG_FILE=/osgar-ws/src/osgar/subt/docker/robotika/rosconsole.config
25+
ENV ROS_PYTHON_LOG_CONFIG_FILE=/osgar-ws/src/osgar/subt/docker/robotika/python_logging.conf
26+
27+
# adjust so that local logs look similar to cloudsim logs
28+
ENV ROSCONSOLE_FORMAT='${time} ${severity} ${node} ${logger}: ${message}'
29+
30+
RUN ln -s /osgar-ws/src/osgar/subt/docker/robotika/Makefile .
31+
RUN ln -s /osgar-ws/src/osgar/subt/docker/robotika/run_solution.bash .
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[loggers]
2+
keys=root, rosout
3+
4+
[handlers]
5+
keys=fileHandler,streamHandler
6+
7+
[formatters]
8+
keys=defaultFormatter
9+
10+
[logger_root]
11+
level=DEBUG
12+
handlers=fileHandler
13+
14+
[logger_rosout]
15+
level=DEBUG
16+
handlers=streamHandler
17+
propagate=1
18+
qualname=rosout
19+
20+
[handler_fileHandler]
21+
class=handlers.RotatingFileHandler
22+
level=DEBUG
23+
formatter=defaultFormatter
24+
# log filename, mode, maxBytes, backupCount
25+
args=(os.environ['ROS_LOG_FILENAME'],'a', 50000000, 4)
26+
27+
[handler_streamHandler]
28+
class=rosgraph.roslogging.RosStreamHandler
29+
level=DEBUG
30+
formatter=defaultFormatter
31+
# colorize output flag
32+
args=(True,)
33+
34+
[formatter_defaultFormatter]
35+
format=[%(name)s][%(levelname)s] %(asctime)s: %(message)s

subt/docker/robotika/rosconsole.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# You can define your own by e.g. copying this file and setting
55
# ROSCONSOLE_CONFIG_FILE (in your environment) to point to the new file
66
#
7-
log4j.logger.ros=DEBUG
7+
log4j.logger.ros.roscpp=DEBUG
88
log4j.logger.ros.roscpp.superdebug=WARN
99

1010
# hide messages about recursive call

subt/docker/robotika/run_solution.bash

-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
#!/usr/bin/env bash
22

3-
# disable crazy threading behavior inside openblas
4-
# https://github.com/xianyi/OpenBLAS#setting-the-number-of-threads-using-environment-variables
5-
export OMP_NUM_THREADS=1
6-
73
# adjust so that local logs look similar to cloudsim logs
84
export ROSCONSOLE_FORMAT='${time} ${severity} ${node} ${logger}: ${message}'
95

10-
# get directory where this bash script lives
11-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
12-
13-
# enable ROS DEBUG output to see if messages are being dropped
14-
export ROSCONSOLE_CONFIG_FILE="${DIR}/rosconsole.config"
15-
166
# when signal received just exit
177
trap "exit;" HUP INT TERM
188

subt/ros/robot/launch/x4.launch

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0"?>
22
<launch>
3-
<node name="$(arg robot_name)_proxy" pkg="proxy" type="ros_proxy" args="$(arg robot_name)">
4-
<remap from="$(arg robot_name)/front_rgbd/image_raw/compressed" to="$(arg robot_name)/front/image_raw/compressed"/>
3+
<node name="$(arg robot_name)_proxy" pkg="proxy" type="ros_proxy" args="$(arg robot_name)" output="screen">
54
<remap from="$(arg robot_name)/odom" to="$(arg robot_name)/nonexistent_input_odom"/>
65
</node>
76

subt/script/sim.bash

+15-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,23 @@ LOG_DIR="$(pwd)/ign-logs/$(date +%Y-%m-%dT%H.%M.%S)"
2727
echo $CIRCUIT
2828
echo $LOG_DIR
2929
echo $ROBOT
30-
echo WORLD
30+
echo $WORLD
3131
mkdir -p $LOG_DIR
3232

33-
trap 'echo; echo $CIRCUIT; echo $LOG_DIR; echo $ROBOT; echo $WORLD; echo;' EXIT
33+
function on_exit {
34+
echo
35+
echo " log dir: $LOG_DIR"
36+
echo " circuit: $CIRCUIT"
37+
echo " robot name: $ROBOT"
38+
echo "robot config: $CONFIG"
39+
echo " world: $WORLD"
40+
echo
41+
echo -n "score: "
42+
cat $LOG_DIR/score.yml
43+
cat $LOG_DIR/summary.yml
44+
}
45+
46+
trap on_exit EXIT
3447

3548
DOCKER_OPTS="--volume ${LOG_DIR}:/tmp/ign/logs --name sim"
3649
export DOCKER_OPTS

0 commit comments

Comments
 (0)