From 6769b560443a4cc25452da07c72eafdfd9074946 Mon Sep 17 00:00:00 2001 From: Andrew Zhao Date: Sun, 15 Oct 2023 15:47:13 +0000 Subject: [PATCH] upgrade to humble for docker container --- .devcontainer/devcontainer.json | 11 ++++++--- .gitignore | 1 + Dockerfile.jetson | 23 +++++++++++++++++++ ...rover_drivetrain_hw_actuator_interface.hpp | 4 ++-- ...rover_drivetrain_hw_actuator_interface.cpp | 4 ++-- 5 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 Dockerfile.jetson diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e9effb7e..bccf6c2d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,9 +6,9 @@ // Sets the run context to one level up instead of the .devcontainer folder. "context": "..", // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. - "dockerfile": "../Dockerfile.dev" + "dockerfile": "../Dockerfile.jetson" }, - "containerEnv": { "DISPLAY": "host.docker.internal:0.0" } + "containerEnv": { "DISPLAY": "host.docker.internal:0.0" }, // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, @@ -21,7 +21,12 @@ // Configure tool-specific properties. // "customizations": {}, - + // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "devcontainer" + + // Build arguments to pass to the CLI + + "runArgs":["--runtime=nvidia", "--rm" , "--network=host"] + } diff --git a/.gitignore b/.gitignore index 2f2d9223..33124fc7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ bin/ build/ install/ log/ +ros_dependencies/ msg_gen/ srv_gen/ msg/*Action.msg diff --git a/Dockerfile.jetson b/Dockerfile.jetson new file mode 100644 index 00000000..cc9f89e1 --- /dev/null +++ b/Dockerfile.jetson @@ -0,0 +1,23 @@ +# Start with the desktop ROS Humble 20.04 image +FROM dustynv/ros:humble-desktop-l4t-r35.1.0 +# FROM dustynv/ros:galactic-desktop-l4t-r35.1.0 + +# This dockerfile assumes you'll share your development folder from your computer over to the container, +# so we don't do `rosdep install` for you, or clone the repository. + +# update everything +RUN sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 42D5A192B819C5DA +RUN sudo apt purge '*opencv*' +RUN sudo apt install libopencv-dev +RUN sudo apt-get update -y && sudo apt-get install -y +# # Ensure rosinstall and rosdep are installed and up to date +RUN sudo apt-get install -y python3-rosdep + + +# build via docker build -f .\Dockerfile.dev -t uwrt_dev_image . +# run via docker run --name uwrt_dev_container -e DISPLAY=host.docker.internal:0.0 -it -v uwrt_dev_image +RUN rosdep install --from-paths . -y -r --ignore-src + + + + diff --git a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_hw/include/uwrt_mars_rover_drivetrain_hw/uwrt_mars_rover_drivetrain_hw_actuator_interface.hpp b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_hw/include/uwrt_mars_rover_drivetrain_hw/uwrt_mars_rover_drivetrain_hw_actuator_interface.hpp index b063f62e..fa52c867 100644 --- a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_hw/include/uwrt_mars_rover_drivetrain_hw/uwrt_mars_rover_drivetrain_hw_actuator_interface.hpp +++ b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_hw/include/uwrt_mars_rover_drivetrain_hw/uwrt_mars_rover_drivetrain_hw_actuator_interface.hpp @@ -47,10 +47,10 @@ class UWRTMarsRoverDrivetrainHWActuatorInterface : public hardware_interface::Ac LifecyleNodeCallbackReturn on_activate(const rclcpp_lifecycle::State& previous_state) override; UWRT_MARS_ROVER_DRIVETRAIN_HW_PUBLIC - hardware_interface::return_type read() override; + hardware_interface::return_type read(const rclcpp::Time & time, const rclcpp::Duration & period) override; UWRT_MARS_ROVER_DRIVETRAIN_HW_PUBLIC - hardware_interface::return_type write() override; + hardware_interface::return_type write(const rclcpp::Time & time, const rclcpp::Duration & period) override; UWRT_MARS_ROVER_DRIVETRAIN_HW_PUBLIC std::vector export_state_interfaces() override; diff --git a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_hw/src/uwrt_mars_rover_drivetrain_hw_actuator_interface.cpp b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_hw/src/uwrt_mars_rover_drivetrain_hw_actuator_interface.cpp index 2db5ebab..48d50389 100644 --- a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_hw/src/uwrt_mars_rover_drivetrain_hw_actuator_interface.cpp +++ b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_hw/src/uwrt_mars_rover_drivetrain_hw_actuator_interface.cpp @@ -157,7 +157,7 @@ LifecyleNodeCallbackReturn UWRTMarsRoverDrivetrainHWActuatorInterface::on_activa return LifecyleNodeCallbackReturn::SUCCESS; } -hardware_interface::return_type UWRTMarsRoverDrivetrainHWActuatorInterface::read() { +hardware_interface::return_type UWRTMarsRoverDrivetrainHWActuatorInterface::read(const rclcpp::Time & time, const rclcpp::Duration & period) { RCLCPP_DEBUG(logger_, "Drivetrain Actuator Reading..."); TwoFloats encoder_readings; @@ -182,7 +182,7 @@ hardware_interface::return_type UWRTMarsRoverDrivetrainHWActuatorInterface::read return hardware_interface::return_type::OK; } -hardware_interface::return_type UWRTMarsRoverDrivetrainHWActuatorInterface::write() { +hardware_interface::return_type UWRTMarsRoverDrivetrainHWActuatorInterface::write(const rclcpp::Time & time, const rclcpp::Duration & period) { RCLCPP_DEBUG(logger_, "Drivetrain Actuator Writing..."); // RCLCPP_INFO_STREAM(logger_, "Joint Velocity: " << motor_velocity_);