From c2646122722b4119620f5b848a330d5b94bffa47 Mon Sep 17 00:00:00 2001 From: Alex Berg <56053786+BergerKing333@users.noreply.github.com> Date: Tue, 12 Nov 2024 11:11:10 -0600 Subject: [PATCH 1/3] Cool startup script changes (#319) * Cool startup script changes * Always run build_image.sh when not trying to use cached image * docker documentation * Moving new documentation to docker folder. --- docker/README.md | 37 ++++++++++++++++++++++++++++ scripts/build_image.sh | 9 +++++++ scripts/enter_isaac_ros_container.sh | 6 +++-- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 docker/README.md diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 00000000..6307fa40 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,37 @@ +**Updating Docker Image:** + +If you need to change or update the docker images for the Lunabotics project, start by making your changes to your local Dockerfiles. Make any changes you need here, and push these changes to GitHub. Make sure that the changes you are making are relevant to the docker file that you’re adding it to. If it isn’t, either pick a different file or make a new dockerfile (if you make a new one, make sure to add the new dockerfile name to the image_key in /scripts/enter_isaac_ros_container.sh and /scripts/build_image.sh). As of right now, we’re keeping all of our docker files in Lunabotics/docker and the Nvidia’s files in Lunabotics/src/isaac_ros_common. + +After making your changes locally, build them with `./scripts/enter_isaac_ros_container false` +This will run all of the local dockerfiles without defaulting to the cached image on dockerhub. +After building and opening this container, run tests to make sure that this image doesn’t break anything. +Find the highest level image of this build with docker image list. The highest level image will be the largest image shown by docker image list, and will likely be isaac_ros_dev-x86-64. +Tag this image as `umnrobotics/:_` +At time of writing, we were tagging images as 'umnrobotics/isaac_ros3.1:x86_64-ros2_humble-realsense-deepstream-user-zed-umn-gazebo_d000f8df5f3859fd56c7459b2ad3a718' + + +If you are logged in to docker, running docker image push will push this image to the cloud, and you are done. If you changed the name of/created a new dockerhub repo, update BASE_DOCKER_REGISTRY_NAMES in /scripts/build_image.sh to reflect the new name. + +After doing this, everything should be set up. Running ./scripts/enter_isaac_ros_container should default to the newly cached image, with all of the new changes. +When downloading the docker image on a separate device for the first time use “./scripts/enter_isaac_ros_container cached” to pull the new image. If it doesn’t do this, you may need to run docker image rm to ensure that it pulls the new image. + +**Basic Docker Commands:** + + +`docker login` – Prompts you to login to dockerhub. If maintaining team docker images, use the umnrobotics account. + +`docker image list` – Shows all docker images that are built on your device + +`docker ps – lists alls RUNNING` images + +`docker kill ` – Kills the specified image, stops it from running + +`docker image rm ` – deletes the specified image from your computer + +`docker image prune` – Deletes headless / unused images. These images show as ‘’ when running `docker image list + +`docker system prune -a --volumes` – Deletes and clears ALL built images from the container + +`docker image tag ` – Essentially just renames a docker image + +`docker image push ` – Pushes local image to the cloud where it can be downloaded and used by others. diff --git a/scripts/build_image.sh b/scripts/build_image.sh index dbf1bfce..204fe086 100755 --- a/scripts/build_image.sh +++ b/scripts/build_image.sh @@ -14,6 +14,15 @@ else ARCH=arm64 fi +USE_CACHED_IMAGE=${1:-true} +if [ "${USE_CACHED_IMAGE}" = "false" ]; then + echo "Building image locally" + printf 'CONFIG_DOCKER_SEARCH_DIRS="$HOME/Lunabotics/src/isaac_ros/isaac_ros_common/scripts/../../../../docker"\n BASE_DOCKER_REGISTRY_NAMES=""\n'> ~/.isaac_ros_common-config +else + echo "Using remote image" + printf 'CONFIG_DOCKER_SEARCH_DIRS="$HOME/Lunabotics/src/isaac_ros/isaac_ros_common/scripts/../../../../docker"\n BASE_DOCKER_REGISTRY_NAMES="umnrobotics/isaac_ros3.1"\n'> ~/.isaac_ros_common-config +fi + if [ ! -f ${HOME}/Lunabotics/docker/deepstream/deepstream*.deb ]; then ngc registry resource download-version nvidia/deepstream:7.0 --dest "${HOME}/Lunabotics/docker/deepstream" --file "*${ARCH}.deb" || echo You need to install ngc! fi diff --git a/scripts/enter_isaac_ros_container.sh b/scripts/enter_isaac_ros_container.sh index d62cd0d9..1119477c 100755 --- a/scripts/enter_isaac_ros_container.sh +++ b/scripts/enter_isaac_ros_container.sh @@ -3,11 +3,13 @@ printf 'CONFIG_DOCKER_SEARCH_DIRS="$HOME/Lunabotics/src/isaac_ros/isaac_ros_comm image_key="ros2_humble.realsense.deepstream.user.zed.umn.gazebo" docker_arg="-v /usr/local/zed/resources:/usr/local/zed/resources -v $HOME/rosbags:/rosbags -v /usr/local/zed/settings:/usr/local/zed/settings" -if docker images | grep -q "${image_key}"; then +USE_CACHED_IMAGE=${1:-true} + +if $USE_CACHED_IMAGE && docker images | grep -q "${image_key}"; then echo "Image ${image_key} already exists" else echo "Building image ${image_key}" - bash ~/Lunabotics/scripts/build_image.sh + bash ~/Lunabotics/scripts/build_image.sh $USE_CACHED_IMAGE fi bash ~/Lunabotics/src/isaac_ros/isaac_ros_common/scripts/run_dev.sh -d ~/Lunabotics -i "${image_key}" -a "${docker_arg}" -v -b From 90aa661b1f4b6516b1e362d710b2f9ffca770bc8 Mon Sep 17 00:00:00 2001 From: Anthony Brogni Date: Wed, 13 Nov 2024 01:52:35 +0000 Subject: [PATCH 2/3] Manual controls are all done now --- .../rovr_control/main_control_node.py | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/rovr_control/rovr_control/main_control_node.py b/src/rovr_control/rovr_control/main_control_node.py index afa02b40..90e8c524 100644 --- a/src/rovr_control/rovr_control/main_control_node.py +++ b/src/rovr_control/rovr_control/main_control_node.py @@ -70,6 +70,7 @@ def __init__(self) -> None: self.declare_parameter("digger_lift_manual_power", 0.075) # Measured in Duty Cycle (0.0-1.0) self.declare_parameter("lift_dumping_position", -1000) # Measured in encoder counts self.declare_parameter("lift_digging_start_position", -3050) # Measured in encoder counts + self.declare_parameter("dumper_power", 0.5) # The power the dumper needs to go # Assign the ROS Parameters to member variables below # self.autonomous_driving_power = self.get_parameter("autonomous_driving_power").value @@ -84,6 +85,7 @@ def __init__(self) -> None: self.lift_digging_start_position = ( self.get_parameter("lift_digging_start_position").value * 360 / 42 ) # Convert encoder counts to degrees + self.dumper_power = self.get_parameter("dumper_power").value # Print the ROS Parameters to the terminal below # self.get_logger().info("autonomous_driving_power has been set to: " + str(self.autonomous_driving_power)) @@ -94,6 +96,7 @@ def __init__(self) -> None: self.get_logger().info("autonomous_field_type has been set to: " + str(self.autonomous_field_type)) self.get_logger().info("lift_dumping_position has been set to: " + str(self.lift_dumping_position)) self.get_logger().info("lift_digging_start_position has been set to: " + str(self.lift_digging_start_position)) + self.get_logger().info("dumper_power has been set to: " + str(self.dumper_power)) # Define some initial states here self.state = states["Teleop"] @@ -117,6 +120,8 @@ def __init__(self) -> None: # Define service clients here self.cli_dumper_dump = self.create_client(Trigger, "dumper/dump") + self.cli_dumper_setPower = self.create_client(SetPower, "dumper/setPower") + self.cli_dumper_stop = self.create_client(SetPower, "dumper/stop") self.cli_digger_toggle = self.create_client(SetPower, "digger/toggle") self.cli_digger_stop = self.create_client(Trigger, "digger/stop") self.cli_digger_setPower = self.create_client(SetPower, "digger/setPower") @@ -228,9 +233,15 @@ async def joystick_callback(self, msg: Joy) -> None: if msg.buttons[bindings.B_BUTTON] == 1 and buttons[bindings.B_BUTTON] == 0: self.cli_dumper_dump.call_async(Trigger.Request()) - # Check if the lift digging position button is pressed # - if msg.buttons[bindings.A_BUTTON] == 1 and buttons[bindings.A_BUTTON] == 0: - self.cli_lift_setPosition.call_async(SetPosition.Request(position=self.lift_digging_start_position)) + # Manually adjust the dumper position with the left and right bumpers + if msg.buttons[bindings.RIGHT_BUMPER] == 1 and buttons[bindings.RIGHT_BUMPER] == 0: + self.self.cli_dumper_setPower.call_async(SetPower.Request(power=self.dumper_power)) + elif msg.buttons[bindings.RIGHT_BUMPER] == 0 and buttons[bindings.RIGHT_BUMPER] == 1: + self.cli_dumper_stop.call_async(Trigger.Request()) + elif msg.buttons[bindings.LEFT_BUMPER] == 1 and buttons[bindings.LEFT_BUMPER] == 0: + self.self.cli_dumper_setPower.call_async(SetPower.Request(power=-self.dumper_power)) + elif msg.buttons[bindings.LEFT_BUMPER] == 0 and buttons[bindings.LEFT_BUMPER] == 1: + self.cli_dumper_stop.call_async(Trigger.Request()) # Manually adjust the height of the digger with the left and right triggers if msg.buttons[bindings.RIGHT_TRIGGER] == 1 and buttons[bindings.RIGHT_TRIGGER] == 0: @@ -242,10 +253,6 @@ async def joystick_callback(self, msg: Joy) -> None: elif msg.buttons[bindings.LEFT_TRIGGER] == 0 and buttons[bindings.LEFT_TRIGGER] == 1: self.cli_lift_stop.call_async(Trigger.Request()) - # Check if the calibration button is pressed - if msg.buttons[bindings.RIGHT_BUMPER] == 1 and buttons[bindings.RIGHT_BUMPER] == 0: - self.cli_drivetrain_calibrate.call_async(Trigger.Request()) - # THE CONTROLS BELOW ALWAYS WORK # # Check if the Apriltag calibration button is pressed @@ -274,7 +281,7 @@ async def joystick_callback(self, msg: Joy) -> None: # Check if the autonomous digging button is pressed # TODO: This autonomous action needs to be tested extensively on the physical robot! - if msg.buttons[bindings.BACK_BUTTON] == 1 and buttons[bindings.BACK_BUTTON] == 0: + if msg.buttons[bindings.START_BUTTON] == 1 and buttons[bindings.START_BUTTON] == 0: # Check if the auto digging process is not running if self.auto_dig_handle.status != GoalStatus.STATUS_EXECUTING: if not self.act_auto_dig.wait_for_server(timeout_sec=1.0): @@ -298,7 +305,7 @@ async def joystick_callback(self, msg: Joy) -> None: # Check if the autonomous offload button is pressed # TODO: This autonomous action needs to be tested extensively on the physical robot! - if msg.buttons[bindings.LEFT_BUMPER] == 1 and buttons[bindings.LEFT_BUMPER] == 0: + if msg.buttons[bindings.BACK_BUTTON] == 1 and buttons[bindings.BACK_BUTTON] == 0: # Check if the auto offload process is not running if self.auto_offload_handle.status != GoalStatus.STATUS_EXECUTING: if not self.act_auto_offload.wait_for_server(timeout_sec=1.0): From 73cffe0030c650678852e5b8fe926a680ea98514 Mon Sep 17 00:00:00 2001 From: Anthony Brogni Date: Tue, 19 Nov 2024 10:05:08 -0600 Subject: [PATCH 3/3] Default our Simulation to the NASA field (#325) * Default our Simulation to NASA * Removed the berm zone Apriltags from both model.sdf files --- .../apriltag_location_nasa.urdf.xarco | 66 +---------------- .../apriltag_location_ucf_bot.urdf.xarco | 64 +---------------- .../apriltag_location_ucf_top.urdf.xarco | 64 +---------------- .../models/NASA_field/model.sdf | 37 +--------- .../models/UCF_field/model.sdf | 72 ++----------------- .../isaac_ros_launch/launch/isaac_launch.py | 2 +- 6 files changed, 14 insertions(+), 291 deletions(-) diff --git a/src/apriltag/apriltag/apriltag_location_nasa.urdf.xarco b/src/apriltag/apriltag/apriltag_location_nasa.urdf.xarco index b4021192..5675dd74 100644 --- a/src/apriltag/apriltag/apriltag_location_nasa.urdf.xarco +++ b/src/apriltag/apriltag/apriltag_location_nasa.urdf.xarco @@ -1,17 +1,14 @@ - - + + @@ -38,61 +35,4 @@ This assumes that we are placing 2 tags on the wall. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/apriltag/apriltag/apriltag_location_ucf_bot.urdf.xarco b/src/apriltag/apriltag/apriltag_location_ucf_bot.urdf.xarco index 056a5459..cd530ea2 100644 --- a/src/apriltag/apriltag/apriltag_location_ucf_bot.urdf.xarco +++ b/src/apriltag/apriltag/apriltag_location_ucf_bot.urdf.xarco @@ -5,12 +5,9 @@ (0,0) is the bottom right corner of the map, (4.57, 8.14) is the top left. --> - - + + @@ -37,61 +34,4 @@ This assumes that we are placing 2 tags on the wall. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/apriltag/apriltag/apriltag_location_ucf_top.urdf.xarco b/src/apriltag/apriltag/apriltag_location_ucf_top.urdf.xarco index 35ea5bf9..9c205e0b 100644 --- a/src/apriltag/apriltag/apriltag_location_ucf_top.urdf.xarco +++ b/src/apriltag/apriltag/apriltag_location_ucf_top.urdf.xarco @@ -5,12 +5,9 @@ (0,0) is the bottom right corner of the map, (4.57, 8.14) is the top left. --> - - + + @@ -37,61 +34,4 @@ This assumes that we are placing 2 tags on the wall. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/gazebo/ros_gz_description/models/NASA_field/model.sdf b/src/gazebo/ros_gz_description/models/NASA_field/model.sdf index b793af4a..02d0deca 100644 --- a/src/gazebo/ros_gz_description/models/NASA_field/model.sdf +++ b/src/gazebo/ros_gz_description/models/NASA_field/model.sdf @@ -22,57 +22,24 @@ - + 3.44 -2.5 0 0 0 0 - + /src/gazebo/ros_gz_description/models/Apriltag36_11_00001 -6.87 1 0.4 1.57 0 1.57 AprilTag_1 - /src/gazebo/ros_gz_description/models/Apriltag36_11_00002 -6.87 1.2159 0.4 1.57 0 1.57 AprilTag_2 - - - \ No newline at end of file diff --git a/src/gazebo/ros_gz_description/models/UCF_field/model.sdf b/src/gazebo/ros_gz_description/models/UCF_field/model.sdf index 77e98d6a..843b0047 100644 --- a/src/gazebo/ros_gz_description/models/UCF_field/model.sdf +++ b/src/gazebo/ros_gz_description/models/UCF_field/model.sdf @@ -20,16 +20,13 @@ - + 4.07 -4.57 0 0 0 0 - + /src/gazebo/ros_gz_description/models/Apriltag36_11_00001 0 3.57 0.4 1.57 0 -1.57 @@ -42,46 +39,13 @@ AprilTag_2_Bottom - - - - - + 4.07 0 0 0 0 0 - + /src/gazebo/ros_gz_description/models/Apriltag36_11_00001 0 1.2159 0.4 1.57 0 -1.57 @@ -94,33 +58,5 @@ AprilTag_2_Top - - \ No newline at end of file diff --git a/src/isaac_ros/isaac_ros_launch/launch/isaac_launch.py b/src/isaac_ros/isaac_ros_launch/launch/isaac_launch.py index 0d899987..fe9f81c3 100644 --- a/src/isaac_ros/isaac_ros_launch/launch/isaac_launch.py +++ b/src/isaac_ros/isaac_ros_launch/launch/isaac_launch.py @@ -62,7 +62,7 @@ def generate_launch_description(): # Gazebo gazebo_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( - [PathJoinSubstitution([FindPackageShare("ros_gz_launch"), "launch", "UCF_field.launch.py"])] + [PathJoinSubstitution([FindPackageShare("ros_gz_launch"), "launch", "NASA_field.launch.py"])] ), condition=IfCondition(LaunchConfiguration("setup_for_gazebo")), )