From a8fa2d6a1046a2a994695cf3962d51cc3df8f6c7 Mon Sep 17 00:00:00 2001 From: franklinselva Date: Mon, 9 Sep 2024 11:14:28 +0200 Subject: [PATCH] Update build instructions and README.md for new integration Related to #49 --- curiosity_rover/README.md | 26 +++++++++++++++++++++----- curiosity_rover/build.sh | 2 +- curiosity_rover/run.sh | 27 ++++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/curiosity_rover/README.md b/curiosity_rover/README.md index 6a27032b..b4ad327a 100644 --- a/curiosity_rover/README.md +++ b/curiosity_rover/README.md @@ -8,8 +8,9 @@ To start the demo, there are few dependencies that need to be installed. The fol 1. You will need ROS Humble on your host system. If it is not already installed, you can follow the instructions [here](https://docs.ros.org/en/humble/Installation.html). 2. You will need Gazebo Sim installed on your system. If not, you can follow the instructions [here](https://gazebosim.org/docs/all/getstarted/). -3. You will need docker installed on your system. If not, you can follow the instructions [here](https://docs.docker.com/get-docker/). -4. Install xterm for running the demo. You can install it using the following command. +3. You will need Nvidia's Isaac Sim installed on your system. If not, you can follow the instructions [here](https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_workstation.html). +4. You will need docker installed on your system. If not, you can follow the instructions [here](https://docs.docker.com/get-docker/). +5. Install xterm for running the demo. You can install it using the following command. ```bash sudo apt-get install xterm ``` @@ -39,13 +40,28 @@ To start the demo, there are few dependencies that need to be installed. The fol ``` 5. To run the demo, you can use the following command. ```bash - # To run the demo + # To run the demo with gazebo ./run.sh + + # To run the demo with isaac sim + ./run.sh --isaacsim ``` -This will start the demo in one terminal and gazebo in another terminal. To control the rover, we provide ros2 services for the demo. You can control the rover using the following services. +This will start the demo in one terminal and gazebo in another terminal. To control the canadarm2, we provide ros2 services for the demo. You can control the rover using the following services. + +> NOTE: If you are using Isaac Sim, make sure to start the simulation in Isaac Sim before running the demo. You can find more information on how to start the simulation in Isaac Sim [here](https://github.com/space-ros/simulation/). + + +1. To move around, you can use teleop_twist_keyboard. To run the teleop_twist_keyboard, you can run the following command, + ```bash + # For gazebo + ros2 run teleop_twist_keyboard teleop_twist_keyboard + + # For isaacsim + ros2 run teleop_twist_keyboard teleop_twist_keyboard -r /cmd_vel:=/curiosity/cmd_vel + ``` -1. To move around, you can use the `move` service. The service takes two arguments, `linear` and `angular` velocities. You can call the service using the following command. + You can also use the following services to control the rover, ```bash # Move forward ros2 service call /move_forward std_srvs/srv/Empty diff --git a/curiosity_rover/build.sh b/curiosity_rover/build.sh index f70ea063..9b7e55a9 100755 --- a/curiosity_rover/build.sh +++ b/curiosity_rover/build.sh @@ -9,7 +9,7 @@ SHELL="/bin/bash" # Define packages SIM_PACKAGES="curiosity_description curiosity_gazebo" -CONTROL_PACKAGE="curiosity_rover_demo" +CONTROL_PACKAGE="curiosity_common curiosity_rover_demo" DEMO_PACKAGES="$CONTROL_PACKAGE $SIM_PACKAGES" #################################################################################################### diff --git a/curiosity_rover/run.sh b/curiosity_rover/run.sh index 6760015c..0c3b1884 100755 --- a/curiosity_rover/run.sh +++ b/curiosity_rover/run.sh @@ -5,6 +5,17 @@ XTERM_CONFIG="-bg black -fg white -fa 'Monospace' -fs 11" DOCKER_IMAGE="osrf/space-ros:curiosity_demo" LOCAL_WORKSPACE=$(pwd) +# Help function to describe each target +help() { + echo "Curiosity Rover Run Script" + echo "Usage: ./run.sh [--option]" + echo "Available options:" + echo " ./run.sh help - Show this help message" + echo " ./run.sh - Run the CanadArm2 control demo with Gazebo" + echo " ./run.sh --isaacsim - Run the CanadArm2 control demo with IsaacSim" + exit 0 +} + # Run the Curiosity Rover Gazebo simulation locally run-gazebo() { # shellcheck disable=SC2090 @@ -20,7 +31,7 @@ run-control-demo() { xterm $XTERM_CONFIG -T 'Curiosity Rover Demo' -e "docker run -it --rm \ -e RMW_IMPLEMENTATION=rmw_cyclonedds_cpp \ $DOCKER_IMAGE \ - bash -c 'source /home/spaceros-user/curiosity_ws/install/setup.bash && ros2 launch curiosity_rover_demo mars_rover.launch.py'" & + bash -c 'source /home/spaceros-user/curiosity_ws/install/setup.bash && $1'" & } check_docker() { @@ -51,8 +62,18 @@ run() { check_xterm check_ros2 + if [ "$1" == "--isaacsim" ]; then + LAUNCH_COMMAND="ros2 launch curiosity_rover_demo mars_rover.launch.py environment:=isaacsim" + else + LAUNCH_COMMAND="ros2 launch curiosity_rover_demo mars_rover.launch.py" + fi + run-control-demo "$LAUNCH_COMMAND" + + if [ "$1" == "--isaacsim" ]; then + exit 0 + fi + run-gazebo - run-control-demo } -run +run "$@"