diff --git a/systems/drone/Dockerfile b/systems/drone/Dockerfile index 42cd636..461740d 100644 --- a/systems/drone/Dockerfile +++ b/systems/drone/Dockerfile @@ -1,7 +1,7 @@ FROM 909785973729.dkr.ecr.us-east-1.amazonaws.com/drone-simulator:0de4571c4816b18d3f2d917a3be84d7d3b7fb182 -ARG VELOCITY_COST_OVERRIDE -ENV VELOCITY_COST_OVERRIDE=$VELOCITY_COST_OVERRIDE +# Install JQ: +RUN apt-get update && apt-get install -y jq COPY entrypoint.sh / diff --git a/systems/drone/entrypoint.sh b/systems/drone/entrypoint.sh index 72be958..509cfce 100755 --- a/systems/drone/entrypoint.sh +++ b/systems/drone/entrypoint.sh @@ -1,8 +1,19 @@ #!/bin/bash -if [[ -n $VELOCITY_COST_OVERRIDE ]]; then - VELOCITY_COST_OVERRIDE="--velocity_cost_override ${VELOCITY_COST_OVERRIDE}" +# Set the cost override for the velocity cost +# Check if the parameters.json file that exists in /tmp/resim/inputs contains the velocity cost override: +if [ -f /tmp/resim/inputs/parameters.json ]; then + VELOCITY_COST_OVERRIDE=$(jq -r '.velocity_cost_override' /tmp/resim/inputs/parameters.json) + # check it is not null: + if [ "$VELOCITY_COST_OVERRIDE" == "null" ]; then + VELOCITY_COST_OVERRIDE="" + echo "No velocity cost override found in parameters" + # otherwise: + else + echo "Found a velocity cost override in the parameters.json file: $VELOCITY_COST_OVERRIDE" + VELOCITY_COST_OVERRIDE="--velocity_cost_override ${VELOCITY_COST_OVERRIDE}" + fi fi - +echo "Running container with cost override: $VELOCITY_COST_OVERRIDE" /sim_container_entrypoint.sh $VELOCITY_COST_OVERRIDE