Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
Signed-off-by: Oguz Ozturk <[email protected]>
  • Loading branch information
oguzkaganozt committed Nov 25, 2024
1 parent 154cda5 commit 92f4a2a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 58 deletions.
53 changes: 53 additions & 0 deletions docker/etc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

# Source ROS2 and Autoware
source "/opt/ros/$ROS_DISTRO/setup.bash"
source /opt/autoware/setup.bash

# Check if VNC is enabled
if [ "$VNC_ENABLED" = "true" ]; then

# Start VNC server
echo "Starting VNC server..."
vncserver :1 -auth $HOME/.Xauthority -geometry 1024x768 -depth 16 -pixelformat rgb565 >/dev/null 2>&1
VNC_RESULT=$?

if [ $VNC_RESULT -ne 0 ]; then
echo "Failed to start VNC server (exit code: $VNC_RESULT)"
exit $VNC_RESULT
fi

sleep 2

# Start NoVNC
echo "Starting NoVNC..."
websockify --daemon --web=/usr/share/novnc/ --cert=/etc/ssl/certs/novnc.crt --key=/etc/ssl/private/novnc.key 6080 localhost:5901

# Get local IP address (works on Linux)
LOCAL_IP=$(hostname -I | awk '{print $1}')
NOVNC_URL="${LOCAL_IP}:6080"

# Configure ngrok if NGROK_AUTHTOKEN is set
if [ -n "$NGROK_AUTHTOKEN" ]; then
echo "Starting ngrok..."
ngrok config add-authtoken $NGROK_AUTHTOKEN

# Start ngrok tunnel for NoVNC
ngrok http --url=$NGROK_URL 6080 --log=stdout >ngrok.log &

NOVNC_URL=https://$NGROK_URL
fi

# Start Rviz
rviz2 -d /autoware/simulation/scenario_simulator.rviz

# Print message
echo -e "\033[32m-------------------------------------------------------------------------\033[0m"
echo -e "Note: In order to access VNC and NoVNC on localhost, you need to expose ports 5901 and 6080 to the outside world respectively."
echo -e "\033[32mVNC server is running and accessible at localhost:5901 via VNC viewer\033[0m"
echo -e "\033[32mNoVNC web interface available at $NOVNC_URL/vnc.html via web browser\033[0m"
echo -e "\033[32m-------------------------------------------------------------------------\033[0m"
fi

# Run command
exec "$@"
6 changes: 0 additions & 6 deletions docker/planning-control/entrypoint.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docker/planning-control/fail/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ FROM ghcr.io/autowarefoundation/autoware:universe AS planning-control-fail
COPY docker/planning-control/fail/fail_scenario.launch.xml /opt/autoware/share/autoware_launch/config/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/static_obstacle_avoidance.param.yaml

# Copy entrypoint script
COPY docker/planning-control/entrypoint.sh /entrypoint.sh
COPY docker/etc/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion docker/planning-control/pass/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ FROM ghcr.io/autowarefoundation/autoware:universe AS planning-control-pass
COPY docker/planning-control/pass/pass_scenario.launch.xml /opt/autoware/share/autoware_launch/config/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner/autoware_behavior_path_static_obstacle_avoidance_module/static_obstacle_avoidance.param.yaml

# Copy entrypoint script
COPY docker/planning-control/entrypoint.sh /entrypoint.sh
COPY docker/etc/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion docker/simulator-visualizer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ RUN curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \
EXPOSE 5900 6080

# Copy entrypoint script
COPY docker/simulator-visualizer/entrypoint.sh /entrypoint.sh
COPY docker/etc/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
49 changes: 0 additions & 49 deletions docker/simulator-visualizer/entrypoint.sh

This file was deleted.

0 comments on commit 92f4a2a

Please sign in to comment.