From 790c7ee25293ed796fa8341a1728f2922591200c Mon Sep 17 00:00:00 2001 From: Jessica Herman Date: Wed, 21 Jun 2023 14:00:24 -0700 Subject: [PATCH 1/8] First commit, 2023 minimum working example --- mwes/2023/wamv_demo.py | 108 ++++++++++++++++++ mwes/README.md | 6 + team_config/example_team/dockerhub_image.txt | 2 +- .../example_team_2022/component_config.yaml | 64 +++++++++++ .../example_team_2022/dockerhub_image.txt | 1 + .../example_team_2022/thruster_config.yaml | 10 ++ 6 files changed, 190 insertions(+), 1 deletion(-) create mode 100644 mwes/2023/wamv_demo.py create mode 100644 team_config/example_team_2022/component_config.yaml create mode 100644 team_config/example_team_2022/dockerhub_image.txt create mode 100644 team_config/example_team_2022/thruster_config.yaml diff --git a/mwes/2023/wamv_demo.py b/mwes/2023/wamv_demo.py new file mode 100644 index 0000000..37ba4e6 --- /dev/null +++ b/mwes/2023/wamv_demo.py @@ -0,0 +1,108 @@ +import rclpy +from rclpy.node import Node +from ros_gz_interfaces.msg import ParamVec +from std_msgs.msg import Float64 +from rclpy.qos import QoSProfile, QoSDurabilityPolicy +from geometry_msgs.msg import PoseStamped + +class GhostShip(Node): + def __init__(self): + print('Starting node...') + super().__init__('ghost_ship') + self.task_type = "" + self.task_state = "" + self.task_sub = self.create_subscription(ParamVec, '/vrx/task/info', + self.taskCB, 10) + + pub_qos = QoSProfile(depth=1, + durability=QoSDurabilityPolicy.TRANSIENT_LOCAL) + self.right_thrust_pub = self.create_publisher(Float64, + '/wamv/thrusters/right/thrust', + qos_profile=pub_qos) + self.left_thrust_pub = self.create_publisher(Float64, + '/wamv/thrusters/left/thrust', + qos_profile=pub_qos) + self.thrust_msg = Float64() + self.thrust_msg.data = 30.0 + self.loopCount = 0 + + self.landmark_pub = self.create_publisher(PoseStamped, + '/vrx/perception/landmark', + qos_profile=pub_qos) + self.landmark_msg = PoseStamped() + self.landmark_msg.header.stamp = self.get_clock().now().to_msg() + self.landmark_msg.header.frame_id = 'mb_marker_buoy_red' + self.landmark_msg.pose.position.x = -33.7227024 + self.landmark_msg.pose.position.y = 150.67402097 + self.landmark_msg.pose.position.z = 0.0 + + self.create_timer(0.5, self.sendCmds) + + def taskCB(self, msg): + task_info = msg.params + for p in task_info: + if p.name == 'name': + self.task_type = p.value .string_value + if p.name == 'state': + self.task_state = p.value.string_value + + def moveForward(self): + self.right_thrust_pub.publish(self.thrust_msg) + self.left_thrust_pub.publish(self.thrust_msg) + self.loopCount += 1 + + def stop(self): + self.thrust_msg.data = 0.0 + self.right_thrust_pub.publish(self.thrust_msg) + self.left_thrust_pub.publish(self.thrust_msg) + + def publishBuoyLoc(self): + if self.loopCount > 10: + self.landmark_pub.publish(self.landmark_msg) + self.loopCount = 0 + self.loopCount += 1 + + + + def sendCmds(self): + if rclpy.ok(): + match self.task_type: + case "perception": + if self.task_state == ("initial" or "ready"): + print("Waiting for perception task to start...") + elif self.task_state == "running": + self.publishBuoyLoc() + elif self.task_state == "finished": + print("Task ended...") + rclpy.shutdown() + case "stationkeeping": + if self.task_state == ("initial" or "ready"): + print("Waiting for stationkeeping task to start...") + elif self.task_state == "running": + if self.loopCount < 10: + self.moveForward() + else: + self.stop() + elif self.task_state == "finished": + print("Task ended...") + rclpy.shutdown() + case _: + print(self.task_state) + if self.task_state == ("initial" or "ready"): + print("Waiting for default task to start...") + elif self.task_state == "running": + self.right_thrust_pub.publish(self.thrust_msg) + self.left_thrust_pub.publish(self.thrust_msg) + elif self.task_state == "finished": + print("Task ended...") + rclpy.shutdown() + +def main(args=None): + rclpy.init(args=args) + + ghost_ship = GhostShip() + rclpy.spin(ghost_ship) + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/mwes/README.md b/mwes/README.md index e826061..0f4c8a8 100644 --- a/mwes/README.md +++ b/mwes/README.md @@ -19,3 +19,9 @@ This directory contains Dockerfiles for building example competitor Docker image * Provides a starting point for competitors who expect to build a workspace using custom source code. * Because the Dockerfile expects to copy source code from the local file system, it is not self-contained. * Please see the `2022/vrx_2022_starter/README.md` for build instructions. + +## 2023 + +### `vrx_2023_simple` (in work) +* Dockerfile pending +* The python script corresponds to the behavior in `jessicaherman/vrx-competitor-example` \ No newline at end of file diff --git a/team_config/example_team/dockerhub_image.txt b/team_config/example_team/dockerhub_image.txt index b87880a..d294dfa 100644 --- a/team_config/example_team/dockerhub_image.txt +++ b/team_config/example_team/dockerhub_image.txt @@ -1 +1 @@ -crvogt/vrx_2022_simple +jessicaherman/vrx-competitor-example:2023.v2 \ No newline at end of file diff --git a/team_config/example_team_2022/component_config.yaml b/team_config/example_team_2022/component_config.yaml new file mode 100644 index 0000000..7a0ef5f --- /dev/null +++ b/team_config/example_team_2022/component_config.yaml @@ -0,0 +1,64 @@ +wamv_camera: + - name: front_left_camera + visualize: False + x: 0.75 + y: 0.1 + z: 1.5 + R: 0.0 + P: ${radians(15)} + Y: 0.0 + post_Y: 0.0 + - name: front_right_camera + visualize: False + x: 0.75 + y: -0.1 + z: 1.5 + R: 0.0 + P: ${radians(15)} + Y: 0.0 + post_Y: 0.0 + - name: far_left_camera + visualize: False + x: 0.75 + y: 0.3 + z: 1.5 + R: 0.0 + P: ${radians(15)} + Y: 0.0 + post_Y: 0.0 +wamv_gps: + - name: gps_wamv + x: -0.85 + y: 0.0 + z: 1.3 + R: 0.0 + P: 0.0 + Y: 0.0 +wamv_imu: + - name: imu_wamv + x: 0.3 + y: -0.2 + z: 1.3 + R: 0.0 + P: 0.0 + Y: 0.0 +lidar: + - name: lidar_wamv + type: 16_beam + x: 0.7 + y: 0.0 + z: 1.8 + R: 0.0 + P: ${radians(8)} + Y: 0.0 + post_Y: 0.0 +wamv_ball_shooter: + - name: ball_shooter + x: 0.55 + y: -0.3 + z: 1.3 + pitch: ${radians(-20)} + yaw: 0.0 +wamv_pinger: + - name: pinger + position: 1.0 0 -1.0 diff --git a/team_config/example_team_2022/dockerhub_image.txt b/team_config/example_team_2022/dockerhub_image.txt new file mode 100644 index 0000000..b87880a --- /dev/null +++ b/team_config/example_team_2022/dockerhub_image.txt @@ -0,0 +1 @@ +crvogt/vrx_2022_simple diff --git a/team_config/example_team_2022/thruster_config.yaml b/team_config/example_team_2022/thruster_config.yaml new file mode 100644 index 0000000..185cdb3 --- /dev/null +++ b/team_config/example_team_2022/thruster_config.yaml @@ -0,0 +1,10 @@ +engine: + - prefix: "left" + position: "-2.373776 1.027135 0.318237" + orientation: "0.0 0.0 0.0" + - prefix: "right" + position: "-2.373776 -1.027135 0.318237" + orientation: "0.0 0.0 0.0" + - prefix: "middle" + position: "0 0 0.318237" + orientation: "0.0 0.0 0.0" From a4709f24269753c7189d54377344be3bf154ec15 Mon Sep 17 00:00:00 2001 From: M1chaelM Date: Thu, 22 Jun 2023 16:11:19 -0400 Subject: [PATCH 2/8] working except gz fuel problems --- run_trial.bash | 15 ++++++++++----- vrx_server/build_image.bash | 2 +- vrx_server/vrx-server/gz_utils.sh | 4 ++-- vrx_server/vrx-server/run_vrx_trial.sh | 14 +++++++------- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/run_trial.bash b/run_trial.bash index 606a747..1ecdfaa 100755 --- a/run_trial.bash +++ b/run_trial.bash @@ -24,7 +24,8 @@ usage() } # Parse arguments -RUNTIME="runc" +# TODO: nvidia runtime by default; runtime may be obsolete +RUNTIME="nvidia" nvidia_arg="" image_nvidia="" @@ -65,7 +66,8 @@ fi # Constants for containers SERVER_CONTAINER_NAME=vrx-server-system -ROS_DISTRO=noetic +ROS_DISTRO=humble +SERVER_IMG="vrx-server-${ROS_DISTRO}${image_nvidia}:latest" LOG_DIR=/vrx/logs NETWORK=vrx-network NETWORK_SUBNET="172.16.0.10/16" # subnet mask allows communication between IP addresses with 172.16.xx.xx (xx = any) @@ -97,7 +99,7 @@ chmod 777 ${HOST_LOG_DIR} echo -e "${GREEN}Done.${NOCOLOR}\n" # Find wamv urdf and task world files -echo "Looking for generated files" +echo "Looking for WAM-V urdf file (generated)" TEAM_GENERATED_DIR=${DIR}/generated/team_generated/${TEAM_NAME} if [ -f "${TEAM_GENERATED_DIR}/${TEAM_NAME}.urdf" ]; then echo "Successfully found: ${TEAM_GENERATED_DIR}/${TEAM_NAME}.urdf" @@ -106,9 +108,11 @@ else echo -e "${RED}Err: ${TEAM_GENERATED_DIR}/${TEAM_NAME}.urdf not found."; exit 1; fi +echo "Looking for task sdf file (generated/copied)" COMP_GENERATED_DIR=${DIR}/generated/task_generated/${TASK_NAME} if [ -f "${COMP_GENERATED_DIR}/worlds/${TASK_NAME}${TRIAL_NUM}.sdf" ]; then echo "Successfully found: ${COMP_GENERATED_DIR}/worlds/${TASK_NAME}${TRIAL_NUM}.sdf" + echo -e "${GREEN}Done.${NOCOLOR}\n" else echo -e "${RED}Err: ${COMP_GENERATED_DIR}/worlds/${TASK_NAME}${TRIAL_NUM}.sdf not found."; exit 1; fi @@ -142,11 +146,11 @@ echo "---------------------------------" # simulation doesn't start too early, but may have issues if competitior # container waiting for ROS master and has error before server is created. # Run Gazebo simulation server container -SERVER_CMD="/run_vrx_trial.sh /team_generated/${TEAM_NAME}.urdf /task_generated/worlds/${TASK_NAME}${TRIAL_NUM}.world ${LOG_DIR}" -SERVER_IMG="vrx-server-${ROS_DISTRO}${image_nvidia}:latest" +SERVER_CMD="/run_vrx_trial.sh /team_generated/${TEAM_NAME}.urdf /task_generated/worlds/${TASK_NAME}${TRIAL_NUM} ${LOG_DIR}" ${DIR}/vrx_server/run_container.bash $nvidia_arg ${SERVER_CONTAINER_NAME} $SERVER_IMG \ "--net ${NETWORK} \ --ip ${SERVER_ROS_IP} \ + --gpus all \ -v ${TEAM_GENERATED_DIR}:/team_generated \ -v ${COMP_GENERATED_DIR}:/task_generated \ -v ${HOST_LOG_DIR}:${LOG_DIR} \ @@ -172,6 +176,7 @@ docker run \ --env ROS_MASTER_URI=${ROS_MASTER_URI} \ --env ROS_IP=${COMPETITOR_ROS_IP} \ --ip ${COMPETITOR_ROS_IP} \ + --gpus all \ --privileged \ --runtime=$RUNTIME \ ${DOCKERHUB_IMAGE} & diff --git a/vrx_server/build_image.bash b/vrx_server/build_image.bash index b88ef9b..c033aef 100755 --- a/vrx_server/build_image.bash +++ b/vrx_server/build_image.bash @@ -21,7 +21,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Parse arguments local_base_name="vrx-local-base" -image_name="vrx-server-jammy" +image_name="vrx-server-humble" DOCKER_ARGS="--build-arg BASEIMG=$local_base_name" # DOCKER_ARGS="$DOCKER_ARGS --no-cache" diff --git a/vrx_server/vrx-server/gz_utils.sh b/vrx_server/vrx-server/gz_utils.sh index 10330f8..83e94d9 100644 --- a/vrx_server/vrx-server/gz_utils.sh +++ b/vrx_server/vrx-server/gz_utils.sh @@ -4,7 +4,7 @@ function is_gzserver_running() { - if pgrep gzserver > /dev/null; then + if pgrep -f "gz sim server" > /dev/null; then true else false @@ -14,7 +14,7 @@ function is_gzserver_running() # Check if gzclient is running function is_gzclient_running() { - if pgrep gzclient > /dev/null; then + if pgrep "gz sim client" > /dev/null; then true else false diff --git a/vrx_server/vrx-server/run_vrx_trial.sh b/vrx_server/vrx-server/run_vrx_trial.sh index 54797d8..27dabce 100755 --- a/vrx_server/vrx-server/run_vrx_trial.sh +++ b/vrx_server/vrx-server/run_vrx_trial.sh @@ -40,7 +40,7 @@ echo "Starting vrx trial..." # Run the trial. # Note: Increase record period to have faster playback. Decrease record period for slower playback RECORD_PERIOD="0.01" -roslaunch vrx_gazebo vrx.launch gui:=false urdf:=$WAMV_URDF world:=$TRIAL_WORLD extra_gazebo_args:="-r --record_period ${RECORD_PERIOD} --record_path $HOME/.gazebo" verbose:=true non_competition_mode:=false > ~/verbose_output.txt 2>&1 & +ros2 launch vrx_gz competition.launch.py gui:=false urdf:=$WAMV_URDF world:=$TRIAL_WORLD extra_gazebo_args:="-r --record_period ${RECORD_PERIOD} --record_path $HOME/.gazebo" verbose:=true non_competition_mode:=false > ~/verbose_output.txt 2>&1 & roslaunch_pid=$! wait_until_gzserver_is_up echo -e "${GREEN}OK${NOCOLOR}\n" @@ -48,21 +48,21 @@ echo -e "${GREEN}OK${NOCOLOR}\n" # Store topics in rosbag # July 24, 2019 only record task info to save space echo "Starting rosbag recording..." -rosbag record -O ~/vrx_rostopics.bag /vrx/task/info & +ros2 bag record -o ~/vrx_rostopics.bag /vrx/task/info & echo -e "${GREEN}OK${NOCOLOR}\n" # Run simulation until shutdown echo "Run simulation until gzserver is shutdown by scoring plugin" wait_until_gzserver_is_down -echo "gzserver shut down" +echo "gz sim server shut down" echo -e "${GREEN}OK${NOCOLOR}\n" # Kill rosnodes -echo "Killing rosnodes" -rosnode kill --all -sleep 1s +#echo "Killing rosnodes" +#rosnode kill --all +#sleep 1s # Kill roslaunch -echo "Killing roslaunch pid: ${roslaunch_pid}" +echo "Killing ros2 launch pid: ${roslaunch_pid}" kill -INT ${roslaunch_pid} echo -e "${GREEN}OK${NOCOLOR}\n" From 841e1d7a18cd9a634246779b87faf3198cb4a923 Mon Sep 17 00:00:00 2001 From: M1chaelM Date: Thu, 22 Jun 2023 18:09:00 -0400 Subject: [PATCH 3/8] update get_trial_score for new /vrx/task/info message --- run_trial.bash | 9 +++++---- utils/get_trial_score.py | 43 +++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/run_trial.bash b/run_trial.bash index 1ecdfaa..e406218 100755 --- a/run_trial.bash +++ b/run_trial.bash @@ -66,6 +66,7 @@ fi # Constants for containers SERVER_CONTAINER_NAME=vrx-server-system +SERVER_USER=developer ROS_DISTRO=humble SERVER_IMG="vrx-server-${ROS_DISTRO}${image_nvidia}:latest" LOG_DIR=/vrx/logs @@ -188,10 +189,10 @@ echo "---------------------------------" # Copy the ROS log files from the server's container. echo "Copying ROS log files from server container..." -docker cp --follow-link ${SERVER_CONTAINER_NAME}:/home/$USER/.ros/log/latest $HOST_LOG_DIR/ros-server-latest -docker cp --follow-link ${SERVER_CONTAINER_NAME}:/home/$USER/.gazebo/ $HOST_LOG_DIR/gazebo-server -docker cp --follow-link ${SERVER_CONTAINER_NAME}:/home/$USER/vrx_rostopics.bag $HOST_LOG_DIR/ -docker cp --follow-link ${SERVER_CONTAINER_NAME}:/home/$USER/verbose_output.txt $HOST_LOG_DIR/ +#docker cp --follow-link ${SERVER_CONTAINER_NAME}:/home/$SERVER_USER/.ros/log/latest $HOST_LOG_DIR/ros-server-latest +docker cp --follow-link ${SERVER_CONTAINER_NAME}:/home/$SERVER_USER/.gz/ $HOST_LOG_DIR/gz-server +docker cp --follow-link ${SERVER_CONTAINER_NAME}:/home/$SERVER_USER/vrx_rostopics.bag $HOST_LOG_DIR/ +docker cp --follow-link ${SERVER_CONTAINER_NAME}:/home/$SERVER_USER/verbose_output.txt $HOST_LOG_DIR/ echo -e "${GREEN}OK${NOCOLOR}\n" diff --git a/utils/get_trial_score.py b/utils/get_trial_score.py index 5b9afee..a2782b4 100755 --- a/utils/get_trial_score.py +++ b/utils/get_trial_score.py @@ -1,11 +1,13 @@ -# get_trial_score.py: A Python script that gets the last message of a trial's rosbag file, +# get_trial_score.py: A Python script that gets the last message of a trial's ros2bag file, # then records the final trial score in a text file # # eg. python get_trial_score.py import os -import rosbag +import rosbag2_py import sys +from rclpy.serialization import deserialize_message +from rosidl_runtime_py.utilities import get_message # Get arguments team_name = sys.argv[1] @@ -17,25 +19,38 @@ trial_directory = dir_path + '/../generated/logs/' + team_name + '/' + task_name + '/' + trial_number # Open ros bag -bag_name = trial_directory + '/vrx_rostopics.bag' -bag = rosbag.Bag(bag_name) +bag_path = trial_directory + '/vrx_rostopics.bag/vrx_rostopics.bag_0.db3' +storage_options = rosbag2_py.StorageOptions(uri=bag_path, storage_id='sqlite3') +converter_options = rosbag2_py.ConverterOptions(input_serialization_format='cdr', + output_serialization_format='cdr') + +reader = rosbag2_py.SequentialReader() +reader.open(storage_options, converter_options) + +topic_types = reader.get_all_topics_and_types() + +type_map = {topic_types[i].name: topic_types[i].type for i in range(len(topic_types))} + +storage_filter = rosbag2_py.StorageFilter(topics=['/vrx/task/info']) +reader.set_filter(storage_filter) # Get last message last_topic = None -last_msg = None +last_msg_data = None last_t = None -for topic, msg, t in bag.read_messages(topics=['/vrx/task/info']): - last_topic = topic - last_msg = msg - last_t = t +while reader.has_next(): + (last_topic, last_msg_data, last_t) = reader.read_next() +msg_type = get_message(type_map[last_topic]) +last_msg = deserialize_message(last_msg_data, msg_type) +score = None +for field in last_msg.params: + if field.name == "score": + score = field.value.double_value # Write trial score to file trial_score_name = trial_directory + "/trial_score.txt" -f = open(trial_score_name, 'w+') -f.write("{}".format(last_msg.score)) +with open(trial_score_name, 'w+') as f: + f.write("{}".format(score)) print("Successfully recorded trial score in {}".format(trial_score_name)) -f.close() -bag.close() - From 7e211b2e5566fdab2784ab0c67b23dcfca633b74 Mon Sep 17 00:00:00 2001 From: M1chaelM Date: Thu, 22 Jun 2023 18:51:28 -0400 Subject: [PATCH 4/8] removing obsolete nvidia arguments / variables --- replay_trial.bash | 14 +++----------- run_trial.bash | 34 +++------------------------------- vrx_server/run_container.bash | 24 +----------------------- 3 files changed, 7 insertions(+), 65 deletions(-) diff --git a/replay_trial.bash b/replay_trial.bash index a3b9442..4ca3586 100755 --- a/replay_trial.bash +++ b/replay_trial.bash @@ -20,7 +20,7 @@ NOCOLOR='\033[0m' # Define usage function. usage() { - echo "Usage: $0 [-n --nvidia] [--keep-docker] [--manual-play] [--keep-gz] " + echo "Usage: $0 [--keep-docker] [--manual-play] [--keep-gz] " echo "--keep-docker: Keep Gazebo window open and Docker container running after playback ends." echo " By default, everything is terminated automatically." echo "--manual-play: Do not automatically start playback. Wait for user to click in GUI." @@ -31,8 +31,6 @@ usage() } # Parse arguments -nvidia_arg="" -image_nvidia="" keep_docker=1 # Args to pass to script internal to Docker container @@ -45,12 +43,6 @@ do key="$1" case $key in - -n|--nvidia) - nvidia_arg="-n" - image_nvidia="-nvidia" - shift - ;; - --keep-docker) keep_docker=1 shift @@ -166,8 +158,8 @@ y=$y" > ${HOST_GZ_GUI_CONFIG_DIR}/gui.ini # Run Gazebo simulation server container SERVER_CMD="/play_vrx_log.sh ${LOG_FILE} ${OUTPUT} ${manual_play} ${keep_gz}" -SERVER_IMG="vrx-server-${ROS_DISTRO}${image_nvidia}:latest" -${DIR}/vrx_server/run_container.bash $nvidia_arg ${SERVER_CONTAINER_NAME} $SERVER_IMG \ +SERVER_IMG="vrx-server-${ROS_DISTRO}:latest" +${DIR}/vrx_server/run_container.bash ${SERVER_CONTAINER_NAME} $SERVER_IMG \ "--net ${NETWORK} \ --ip ${SERVER_ROS_IP} \ -v ${HOST_LOG_DIR}:${LOG_DIR} \ diff --git a/run_trial.bash b/run_trial.bash index e406218..bb1cd9d 100755 --- a/run_trial.bash +++ b/run_trial.bash @@ -19,37 +19,10 @@ NOCOLOR='\033[0m' # Define usage function. usage() { - echo "Usage: $0 [-n --nvidia] " + echo "Usage: $0 " exit 1 } -# Parse arguments -# TODO: nvidia runtime by default; runtime may be obsolete -RUNTIME="nvidia" -nvidia_arg="" -image_nvidia="" - -POSITIONAL=() -while [[ $# -gt 0 ]] -do - key="$1" - - case $key in - -n|--nvidia) - RUNTIME="nvidia" - nvidia_arg="-n" - image_nvidia="-nvidia" - shift - ;; - *) # unknown option - POSITIONAL+=("$1") - shift - ;; - esac -done - -set -- "${POSITIONAL[@]}" - # Call usage() function if arguments not supplied. [[ $# -ne 3 ]] && usage @@ -68,7 +41,7 @@ fi SERVER_CONTAINER_NAME=vrx-server-system SERVER_USER=developer ROS_DISTRO=humble -SERVER_IMG="vrx-server-${ROS_DISTRO}${image_nvidia}:latest" +SERVER_IMG="vrx-server-${ROS_DISTRO}:latest" LOG_DIR=/vrx/logs NETWORK=vrx-network NETWORK_SUBNET="172.16.0.10/16" # subnet mask allows communication between IP addresses with 172.16.xx.xx (xx = any) @@ -148,7 +121,7 @@ echo "---------------------------------" # container waiting for ROS master and has error before server is created. # Run Gazebo simulation server container SERVER_CMD="/run_vrx_trial.sh /team_generated/${TEAM_NAME}.urdf /task_generated/worlds/${TASK_NAME}${TRIAL_NUM} ${LOG_DIR}" -${DIR}/vrx_server/run_container.bash $nvidia_arg ${SERVER_CONTAINER_NAME} $SERVER_IMG \ +${DIR}/vrx_server/run_container.bash ${SERVER_CONTAINER_NAME} $SERVER_IMG \ "--net ${NETWORK} \ --ip ${SERVER_ROS_IP} \ --gpus all \ @@ -179,7 +152,6 @@ docker run \ --ip ${COMPETITOR_ROS_IP} \ --gpus all \ --privileged \ - --runtime=$RUNTIME \ ${DOCKERHUB_IMAGE} & # Run competition until server is ended diff --git a/vrx_server/run_container.bash b/vrx_server/run_container.bash index 77b8a66..9a2b8da 100755 --- a/vrx_server/run_container.bash +++ b/vrx_server/run_container.bash @@ -22,32 +22,10 @@ set -x # Parse arguments -RUNTIME="runc" - -POSITIONAL=() -while [[ $# -gt 0 ]] -do - key="$1" - - case $key in - -n|--nvidia) - RUNTIME="nvidia" - shift - ;; - *) # unknown option - POSITIONAL+=("$1") -[ruby $(which gz) sim-1] qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. - shift - ;; - esac -done - -set -- "${POSITIONAL[@]}" - if [[ $# -lt 2 ]] then [ruby $(which gz) sim-1] qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. - echo "Usage: $0 [-n --nvidia] [ ]" + echo "Usage: $0 [ ]" exit 1 fi From 846017bb92260222b9a934bc16fe544d87143190 Mon Sep 17 00:00:00 2001 From: M1chaelM Date: Fri, 23 Jun 2023 15:20:08 -0400 Subject: [PATCH 5/8] remove redundant argument --- run_trial.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/run_trial.bash b/run_trial.bash index bb1cd9d..4456694 100755 --- a/run_trial.bash +++ b/run_trial.bash @@ -124,7 +124,6 @@ SERVER_CMD="/run_vrx_trial.sh /team_generated/${TEAM_NAME}.urdf /task_generated/ ${DIR}/vrx_server/run_container.bash ${SERVER_CONTAINER_NAME} $SERVER_IMG \ "--net ${NETWORK} \ --ip ${SERVER_ROS_IP} \ - --gpus all \ -v ${TEAM_GENERATED_DIR}:/team_generated \ -v ${COMP_GENERATED_DIR}:/task_generated \ -v ${HOST_LOG_DIR}:${LOG_DIR} \ From f5b964fbc8a797dd3eecf0945232922586b40b91 Mon Sep 17 00:00:00 2001 From: M1chaelM Date: Fri, 23 Jun 2023 15:33:40 -0400 Subject: [PATCH 6/8] workaround issue 680 in VRX --- run_trial.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_trial.bash b/run_trial.bash index 4456694..7595872 100755 --- a/run_trial.bash +++ b/run_trial.bash @@ -120,7 +120,7 @@ echo "---------------------------------" # simulation doesn't start too early, but may have issues if competitior # container waiting for ROS master and has error before server is created. # Run Gazebo simulation server container -SERVER_CMD="/run_vrx_trial.sh /team_generated/${TEAM_NAME}.urdf /task_generated/worlds/${TASK_NAME}${TRIAL_NUM} ${LOG_DIR}" +SERVER_CMD="/run_vrx_trial.sh /team_generated/${TEAM_NAME}.urdf practice_2023_${TASK_NAME}${TRIAL_NUM}_task ${LOG_DIR}" ${DIR}/vrx_server/run_container.bash ${SERVER_CONTAINER_NAME} $SERVER_IMG \ "--net ${NETWORK} \ --ip ${SERVER_ROS_IP} \ From 62e313fb760eb9ed572a877c93a840acd5f809e7 Mon Sep 17 00:00:00 2001 From: M1chaelM Date: Sun, 25 Jun 2023 13:23:29 -0400 Subject: [PATCH 7/8] remove workaround --- run_trial.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_trial.bash b/run_trial.bash index 7595872..4456694 100755 --- a/run_trial.bash +++ b/run_trial.bash @@ -120,7 +120,7 @@ echo "---------------------------------" # simulation doesn't start too early, but may have issues if competitior # container waiting for ROS master and has error before server is created. # Run Gazebo simulation server container -SERVER_CMD="/run_vrx_trial.sh /team_generated/${TEAM_NAME}.urdf practice_2023_${TASK_NAME}${TRIAL_NUM}_task ${LOG_DIR}" +SERVER_CMD="/run_vrx_trial.sh /team_generated/${TEAM_NAME}.urdf /task_generated/worlds/${TASK_NAME}${TRIAL_NUM} ${LOG_DIR}" ${DIR}/vrx_server/run_container.bash ${SERVER_CONTAINER_NAME} $SERVER_IMG \ "--net ${NETWORK} \ --ip ${SERVER_ROS_IP} \ From c29162ccfaf67b37ea7933999c0dcadcbcd7601f Mon Sep 17 00:00:00 2001 From: M1chaelM Date: Mon, 26 Jun 2023 09:09:51 -0400 Subject: [PATCH 8/8] downloading models during image build --- vrx_server/vrx-server/Dockerfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vrx_server/vrx-server/Dockerfile b/vrx_server/vrx-server/Dockerfile index d94b8c9..4ccce99 100644 --- a/vrx_server/vrx-server/Dockerfile +++ b/vrx_server/vrx-server/Dockerfile @@ -19,6 +19,22 @@ RUN /bin/sh -c 'echo ". /opt/ros/${ROSDIST}/setup.bash" >> ~/.bashrc' \ && /bin/sh -c 'echo ". ~/vrx_ws/install/setup.sh" >> ~/.bashrc' ## END OF SECTION BASED ON vrx/docker/Dockerfile +# Cache fuel resources +RUN /bin/bash -c 'gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/sydney_regatta \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/post \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/ground_station \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/antenna \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/mb_marker_buoy_red \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/mb_marker_buoy_black \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/mb_marker_buoy_green \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/mb_marker_buoy_white \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/mb_round_buoy_orange \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/mb_round_buoy_black \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/platypus \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/crocodile \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/turtle \ + && gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/wam-v' + # Expose port used to communiate with gzserver EXPOSE 11345