{"id":18985129,"url":"https://github.com/o3de/roscondemo","last_synced_at":"2025-04-07T09:18:41.331Z","repository":{"id":62627843,"uuid":"519063100","full_name":"o3de/ROSConDemo","owner":"o3de","description":"A robotic fruit picking demo project for O3DE with ROS 2 Gem","archived":false,"fork":false,"pushed_at":"2025-03-18T11:09:45.000Z","size":26829,"stargazers_count":82,"open_issues_count":0,"forks_count":23,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-03-29T12:51:23.406Z","etag":null,"topics":["agriculture","o3de","robotics-simulation","ros2","ros2-humble"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/o3de.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-CC-BY-4.0.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-29T03:09:00.000Z","updated_at":"2025-03-24T03:01:03.000Z","dependencies_parsed_at":"2024-02-12T18:50:46.736Z","dependency_job_id":null,"html_url":"https://github.com/o3de/ROSConDemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o3de%2FROSConDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o3de%2FROSConDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o3de%2FROSConDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o3de%2FROSConDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/o3de","download_url":"https://codeload.github.com/o3de/ROSConDemo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247622984,"owners_count":20968575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agriculture","o3de","robotics-simulation","ros2","ros2-humble"],"created_at":"2024-11-08T16:24:46.951Z","updated_at":"2025-04-07T09:18:41.308Z","avatar_url":"https://github.com/o3de.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# O3DE Apple Kraken Demo Project\n\n### Video demo\n\nhttps://user-images.githubusercontent.com/82551958/229636734-2f67abeb-fe78-432c-8139-e4fc82f008ed.mp4\n\n\nThis project demonstrates an example application of [O3DE](https://www.o3de.org/) working with ROS 2.\nThe integration is realized through [ROS 2 Gem](https://github.com/o3de/o3de-extras/blob/development/Gems/ROS2).\n\n## How does it look like\n\n\u003cimg src=\"static/screenshots/apple_orchard.png\" width=\"640\"\u003e\n\u003cimg src=\"static/screenshots/apple_kraken.png\" width=\"640\"\u003e\n\n## The project includes\n\n- **Apple Orchard**, a simulation scene with many rows of apple trees.\n- **Apple Kraken**, a robot tasked with apple picking. It is ready to use and also included as an URDF.\n    - Multiple Apple Krakens are supported\n    - .. and you can spawn them using ROS 2 messages!\n- **Custom components** for picking apples, which benefit from direct integration with ROS 2.\n    - Yes, you can write ROS 2 code in O3DE!\n- **Autonomous operation** which is based on ROS 2 navigation stack and ground truth.\n    - Ground truth can be replaced with detectors based on sensor data. Give it a try!\n- **Apples**\n    - Thousands of apples!\n\n## Simulation scenes (levels)\n\n### Main Level\n\nThe main scene of the demo is set in an apple orchard surrounded by countryside. The orchard is managed by the Apple Kraken.\n\nThe main level is rather performance-intensive.\n\nThe Apple Kraken is a four-wheeled robot assigned the task of navigating around the orchard, collecting apples and storing them in its basket.\n\n### Playground Level\n\nThe playground scene is much lighter and can be used to quickly prototype with Kraken. There are only a couple of apple trees and the robot itself.\n\n# Requirements\n\n## Platforms\n\nThe project runs on Ubuntu 22.04 with ROS 2 Humble or ROS 2 Iron. If you wish to run this demo in _Docker environment_, please use the [instructions](docker/README.md) in the `Docker` folder.\n\n💡 ***Note:*** This demo is **not supported on Windows!**\n\n## O3DE\n\nRefer to the [O3DE System Requirements](https://www.o3de.org/docs/welcome-guide/requirements/) documentation to make sure that the system/hardware requirements are met.\n\nThe following commands should prepare O3DE (assuming `${WORKDIR}` is your working directory):\n```bash\ncd ${WORKDIR}\ngit clone --branch main --single-branch https://github.com/o3de/o3de.git\ncd o3de\ngit lfs install\ngit lfs pull\npython/get_python.sh\nscripts/o3de.sh register --this-engine\n```\n\nIn case of any problems, please refer to the instructions to [set up O3DE from GitHub](https://o3de.org/docs/welcome-guide/setup/setup-from-github/).\n\n## ROS 2 Gem\n\nThis project uses the [ROS 2 Gem](https://github.com/o3de/o3de-extras/blob/development/Gems/ROS2), which is included in the [O3DE extras bundle](https://github.com/o3de/o3de-extras). Please [install ROS 2](https://docs.ros.org/en/dashing/Installation/Ubuntu-Install-Binary.html) first. \n\nThe following commands should prepare `o3de-extras` into your `${WORKDIR}`:\n```bash\ncd ${WORKDIR}\ngit clone --branch main --single-branch https://github.com/o3de/o3de-extras\ncd o3de-extras\ngit lfs install\ngit lfs pull\n```\nAnd register required Gem:\n```bash\ncd ${WORKDIR}\n./o3de/scripts/o3de.sh register --gem-path o3de-extras/Gems/ROS2\n```\n\nPlease make sure to use the same version of `o3de` and `o3de-extras`. This demo was successfully tested with the `2310.1` release.\n\nMore information about installing ROS 2 Gem can be found in the installation guide in [ROS 2 Project Configuration](https://www.o3de.org/docs/user-guide/interactivity/robotics/project-configuration/). Note that the Gem instructions include the installation of ROS 2 with some additional packages.\n\nTo learn more about how the Gem works check out the [Robotics in O3DE](https://www.o3de.org/docs/user-guide/interactivity/robotics/). The Gem is open to your contributions!\n\n### Additional ROS 2 packages\n\nThe additional packages need to be installed. Use the following command:\n\n```\nsudo apt install ros-${ROS_DISTRO}-vision-msgs ros-${ROS_DISTRO}-nav-msgs ros-${ROS_DISTRO}-rmw-cyclonedds-cpp ros-${ROS_DISTRO}-cyclonedds\n```\n\n💡 ***Note:*** This is a dependency besides all the packages already required by the ROS 2 Gem.\n\n### Required environment settings\n\nSome commands and environmental variables are necessary for ROS 2 systems, including this demo, to function properly. It is best to add these commands and settings to either `~/.bashrc` or equivalent file. \n\nROS 2 distribution should always be sourced when building and running the demo and its command line interfaces. For a typical ROS 2 Iron installation, this would mean running the following for each console:\n\n```\nsource /opt/ros/iron/setup.bash\n```\n💡 ***Note:*** ROS 2 Humble is also supported. In that case, the provided command would be `source /opt/ros/humble/setup.bash`\n\nCurrently, we are observing issues when running navigation with FastDDS (the default middleware for ROS 2 Humble and ROS 2 Iron). While the exact cause is yet to be investigated, there are no such issues when running with CycloneDDS. Thus, please set the following:\n\n```\nexport RMW_IMPLEMENTATION=rmw_cyclonedds_cpp\n```\n\n# Building this project\n\n## Build steps\n\n1. Clone this project:\n\n```bash\ncd ${WORKDIR}\ngit clone https://github.com/o3de/ROSConDemo.git\n```\n\n2. Register this project in the O3DE engine. In O3DE directory:\n```bash\ncd ${WORKDIR}/o3de\nscripts/o3de.sh register -pp ${WORKDIR}/ROSConDemo/Project\n```\n\n3. Ensure your [ROS 2 is sourced](https://docs.ros.org/en/rolling/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html):\n\n```bash\necho $ROS_DISTRO\n\u003e iron\n```\n💡 ***Note:*** In the case ROS 2 Humble is sourced, the output is `humble`.\n\n4. Configure build:\n\n```bash\ncd ${WORKDIR}/ROSConDemo/Project\ncmake -B build/linux -G\"Ninja Multi-Config\" -DLY_DISABLE_TEST_MODULES=ON -DLY_STRIP_DEBUG_SYMBOLS=ON\n```\n\n5. Execute build (this will take a while the first time):\n\n```bash\ncd ${WORKDIR}/ROSConDemo/Project\ncmake --build build/linux --config profile --target ROSConDemo Editor AssetProcessor ROSConDemo.Assets\n```\n\n## Building the Navigation package\n\nTo build the ROS 2 navigation stack configured for this Project, please follow this [detailed document](kraken_nav/README.md). Do not run it yet if you wish to follow the demo scenario.\n\n## Launching the Editor\n\nLaunch the O3DE Editor:\n\n```bash\ncd ${WORKDIR}/ROSConDemo/Project\nbuild/linux/bin/profile/Editor\n```\n\n# Running the demo scenario\n\nYou can try out the demo scenario as presented during ROSCon 2022. Take the following steps:\n\n1. Launch the Editor and select the Main level. Allow it to load.\n2. Start the simulation with `Ctrl-G` or by pressing the Play button in the Editor. \n3. When it loads, spawn your first Apple Kraken using the following command: `ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_rusty', xml: 'line1'}'`.\n   1. You can learn more about spawning in [this section](#spawning-krakens)\n3. Once the simulation is running, start the [navigation stack](kraken_nav/README.md). If you followed all the instructions for setting it up, do the following:\n   1. launch the stack for the first robot with `ros2 launch o3de_kraken_nav navigation_multi.launch.py namespace:=apple_kraken_rusty_1 rviz:=True`. \n   1. You should see a new Rviz2 window.\n   1. Note that the number index `_1` has been added to the namespace when it was automatically generated by the Spawner.\n4. Using RViz2, set the navigation goal using a widget in the toolbar (`2D Goal Pose`). You need to click and drag to indicate the direction the robot will be facing. Make sure to set the goal next to an apple tree, to have the tree on the right side. Not too close, not too far. You can set subsequent goals for the robot to move around.\n   1. As configured in our package, RViz2 has additional `2D Goal Pose` buttons which are hard-set to work with specific robot namespaces.\n   1. Use the button first to the left.\n5. Once the robot arrives and stops next to the tree, you can [trigger apple gathering](#triggering-apple-gathering).\n6. Either wait for the robot to complete its job (gather all reachable apples) or cancel the gathering through the `/apple_kraken_rusty_1/cancel_apple_gathering` service.\n7. Select another navigation goal for the robot.\n8. Spawn three other Krakens:\n   1. `ros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_shiny', xml: 'line2'}' \u0026\u0026\nros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_rusty', xml: 'line3'}' \u0026\u0026\nros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken_shiny', xml: 'line4'}'`\n   1. You can also navigate with them using the remaining `2D Goal Pose` buttons and trigger gathering events. Follow the instructions in [this section](kraken_nav/README.md#running-nav-stack-for-multiple-vehicles) to launch the navigation stack for each Kraken.\n\n💡 ***Note:*** If you would like to start the scenario over, **remember to close all navigation stacks**. You can do this by pressing Ctrl-C in each console you started the `ros2 launch o3de_kraken_nav (..)` command.\n\n## Controlling the Apple Kraken\n\n### Navigation\n\nPlease refer to [Kraken navigation](kraken_nav/README.md) for instructions.\n\n### Triggering Apple Gathering\n\nCheck available services in a terminal using this command:\n\n- `ros2 service list`\n\nIf your simulation is running, you should be able to see the apple gathering service(s) listed there.\n\n- It should be named `/apple_kraken_rusty_1/trigger_apple_gathering`. It might have another namespace.\n\nIf Apple Kraken is in position, next to a tree, you can trigger apple gathering with this command:\n\n- `ros2 service call /apple_kraken_rusty_1/trigger_apple_gathering std_srvs/srv/Trigger`\n\nYou can also cancel a gathering operation in progress by calling another service:\n\n- `ros2 service call /apple_kraken_rusty_1/cancel_apple_gathering std_srvs/srv/Trigger`\n\n### Spawning Krakens\n\nPlease read the following section on [Robot Spawner](https://github.com/RobotecAI/o3de-ros2-gem/blob/development/docs/guides/ros2-gem.md#spawner).\n\nTo spawn a new Apple Kraken, you can use named points (provided by a Spawner Component) or custom poses. \n\n#### Available spawn aliases\n\nYou can use the spawn service with the following robot names:\n- apple_kraken_rusty\n- apple_kraken_shiny\n- apple_kraken (defaults to shiny).\nThese two robots are functionally the same.\n\n#### Available named spawn poses\n\nThere are several named poses (`line1` through `line4`) conveniently placed at entrances to apple orchard rows.\n\n#### Example calls:\n\nNamed point:\n\n```\nros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken', xml: 'line1'}'\n```\n\nFree pose:\n\n```\nros2 service call /spawn_entity gazebo_msgs/srv/SpawnEntity '{name: 'apple_kraken', initial_pose: {position:{ x: 4, y: 4, z: 0.2}, orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}}}'\n```\n# Troubleshooting\n\n## Check-list\n\n- Is O3DE running ok with an empty or default project?\n- Is ROS 2 installation ok? (check with `ros2 topic pub` etc.)\n- Is ROS 2 workspace sourced? (check `ROS_DISTRO`, `AMENT_PREFIX_PATH`)\n  - Note this needs to be true before `cmake` is run. Re-run configuration and build when in doubt. \n- Do you have compatible settings for crucial ENV variables when running the navigation / orchestration stack in the console and when running the simulator?\n    - check `RMW_IMPLEMENTATION`, `ROS_DOMAIN_ID` etc.\n- Check the console for errors as well as logs. From the Project folder, check `user/log/Editor.log`.\n- Are simulation topics up when you play the simulation?\n    - `ros2 node list` should include `/o3de_ros2_node`\n    - `ros2 topic list` should include `/clock`, `/tf` and `/tf_static` regardless of robot presence.\n    - topic list should also include `/pc`, `/ackermann_vel` and `/ground_truth_3D_detection` if there is a robot in the scene and the simulation is running.\n        - note that these topics will be namespaced.\n    - `ros2 service list` should also show several simulation and robot services such as spawning and apple gathering.\n\n# License\n\nFor terms please see the LICENSE*.TXT files at the root of this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo3de%2Froscondemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fo3de%2Froscondemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo3de%2Froscondemo/lists"}