{"id":19963303,"url":"https://github.com/advrhumanoids/proximitybaseddynamiccollisionavoidance","last_synced_at":"2025-07-20T13:34:37.901Z","repository":{"id":242341944,"uuid":"809308479","full_name":"ADVRHumanoids/ProximityBasedDynamicCollisionAvoidance","owner":"ADVRHumanoids","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-16T14:16:58.000Z","size":41,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-16T15:53:14.829Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ADVRHumanoids.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-02T10:25:32.000Z","updated_at":"2024-06-16T14:17:01.000Z","dependencies_parsed_at":"2024-06-02T11:42:48.967Z","dependency_job_id":"959a3a34-c84f-411c-9254-030b4445ffe7","html_url":"https://github.com/ADVRHumanoids/ProximityBasedDynamicCollisionAvoidance","commit_stats":null,"previous_names":["advrhumanoids/proximitybaseddynamiccollisionavoidance"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2FProximityBasedDynamicCollisionAvoidance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2FProximityBasedDynamicCollisionAvoidance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2FProximityBasedDynamicCollisionAvoidance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2FProximityBasedDynamicCollisionAvoidance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ADVRHumanoids","download_url":"https://codeload.github.com/ADVRHumanoids/ProximityBasedDynamicCollisionAvoidance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224374651,"owners_count":17300691,"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":[],"created_at":"2024-11-13T02:15:32.385Z","updated_at":"2025-05-03T22:32:05.484Z","avatar_url":"https://github.com/ADVRHumanoids.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ➤ ROS2 Package For Dynamic Collision Avoidance Based On OnBoard ProximitySensors For Human-Robot Close Interactions\n\n## Introduction\nIn human-robot shared environments, onboard proximity sensors have been recognized \nas a promising tool for monitoring the surrounding robot workspace.\nUnexpected collisions can then be spoiled and online evaded by continuously correcting \nthe robot's actual trajectory while maintaining a safe human-robot coexistence \nenabling in this way human-robot closed interactions. \nFor this purpose, the present ROS2 package for online dynamical collision avoidance and recovering\nbased on onboard sensors has been developed. \n\n![1729501512646](https://github.com/user-attachments/assets/76389938-3e66-4909-b1e5-69a82175f163)\n\n## Outline\n* [Introduction](#introduction)\n* [Outline](#outline)\n* [What It Does](#what-it-does)\n* [How to Use It](#how-to-use-it)\n* [How to Initialize It](#how-to-initialize-it)\n* [Installation](#installation)\n* [Execution](#execution)\n* [Ros2 Versions](#ros2-version)\n* [Dependences](#dependences)\n* [Maintaner](#maintaner)\n\n## What it does\n\nHere, a brief explanation of what the package does is given. \n\nAs mentioned in the introduction, this package allows you to avoid dinamic collisions. \nTo do that, the package computes *local changes* of a preplanned robot trajectory, in the Cartesian space. To compute such a local changes the package uses the measurements retrieved by the *onboard* sensors, in particular it \nrequires the measured distances. \nBased on that, the result of the package is a local replanning of the robot preplanned trajectory. \nThe avoidance of a dynamic collision performed thanks to the onboard sensors is triggered by a threshold value on the distances measurements. \nIn particular, if at least one distance measurement has a value less than the threshold value, then the algorithm to avoid the collision is activated computing the replanning of the preplanned robot \ntrajectory. Otherwise, no changes of the pre-planned robot trajectory will be computed and the package will provide the same trajectory as the preplanned one.\n\n## How to Use It\n\nKeeping in mind what the package does, then, the package requires some inputs and initial settings to do to properly work.\n\n*As inputs*, the package *online* requires the robot preplanned trajectory and distance measurements. \nThese quantities are supposed to be provided to the package by publishing messages on two different topics. The messages has to be in the form of 'MotionMsg.msg' \nas [here](https://github.com/ADVRHumanoids/ProximityBasedDynamicCollisionAvoidance/blob/master/msg/MotionMsg.msg) and 'SensorsMsg.msg' \nas [here](https://github.com/ADVRHumanoids/ProximityBasedDynamicCollisionAvoidance/blob/master/msg/SensorsMsg.msg). \n\n*As output*, at each instant of time, the package will provide a replanned robot trajectory to command to the robot by publishing the related message 'RobotMsg.msg' in the form as [here](https://github.com/ADVRHumanoids/ProximityBasedDynamicCollisionAvoidance/blob/master/msg/SensorsMsg.msg). \n\n\nThe replanning of the preplanned robot trajectory operated by the package is based on onboard sensors measurements, therefore, the package additionally requires to \nknow the location of the sensors on the robot body as well. For that, the package assumes a frame associated to each sensor present in the system. \nThen, the package requires these frames are present in the URDF of the robot model (you can do that by fakely adding fixed joints :)).\n\nAdditionally to the above, some initializations are required to be done. They are detailed in the next section.\n\nNote: if the preplanned robot trajectory is not provided, the package anyhow starts by knowing the initial configuration of the robot given as parameter. Based on that, if you send to the package \nmessages regarding the distances measurements, the package works! In particular, if a potential collision is detected, then the package will provide local changes of the current robot pose, which turns \nto move the robot to avoid the coming collision :)! On the other hand, if no messages are provided to the package, the package will anyway publish a message but its content its just the current pose of the \nrobot.\n\n## How to Initialize It\n\nAs we have seen, to use the package, it is necessary to\n\n1. Have a URDF file of the robot.\n2. Send a message to provide the robot preplanned trajectory.\n3. Send a message to provide the measured distances.\n4. Retrieve the result, replanned trajectory by listening to a topic.\n\nBut, to make everything effectively working, we need to properly initialize the package before using it. \n\nIn particular, it is required to set these quantities when you want to start the package:\n\n```yaml\n/robot/dyn_coll_avoid_settings:\n  ros__parameters:\n    robot_initial_config: [0.0,-1.56,0.9,0.2,-0.5,1.12]\n    robot_urdf_model_path: \"/home/liana/ros2_ws/src/ROS2UtilityNodes/urdf/inail2arm.urdf\"\n    robot_base_frame_name: \"base_link\"\n    robot_tip_frame_name: \"arm1_6\"\n    topic_motion_subscriber_name: \"/robot/motion_planning\"\n    topic_sensors_subscriber_name: \"/robot/sensors_data\"\n    topic_robot_publisher_name: \"replanning\"\n    sensors_frame_name: [\"teraflex_1_sensor1_link\",\"teraflex_1_sensor2_link\",\"teraflex_1_sensor3_link\",\"teraflex_1_sensor4_link\",\"teraflex_1_sensor5_link\",\"teraflex_1_sensor6_link\"]\n    distance_threshold: 0.20\n    correction_time: 0.4\n    n_sensors: 6\n    rate: 5\n    log_path: \"/tmp/replanner\"\n```\nin the file `dynamic_collision_avoidance_settings.yaml` related to the node inside the folder [config](https://github.com/ADVRHumanoids/ProximityBasedDynamicCollisionAvoidance/tree/master/config) of the package.\n\nExplaination:\n\n1. robot_initial_config : initial robot joint configuration. This is the initial robot configuration with which you start with the robot. It is used in the package in order to retrieve the initial pose of the tip frame.\n2. robot_urdf_model_path : absolute path of the URDf file.\n3. robot_base_frame_name : frame name of the base frame as named in the URDF file.\n4. robot_tip_frame_name : frame name of the tip frame as named in the URDF file.\n5. topic_motion_subscriber_name : topic name of where to subscribe the robot trajectory.\n6. topic_sensors_subscriber_name : topic name of where to subscribe the measured distances.\n7. topic_robot_publisher_name : topic name of publisher of the node.\n8. sensors_frame_name : frame names of the sensors as present and named in the URDF file.\n9. distance_threshold : threshold for the distance within which the avoidance is triggered (in meters).\n10. correction_time : time within with to evade the potential collision (in seconds).\n11. n_sensors : number of sensors.\n12. rate : node rate.\n13. log_path : absolute path of the folder where to log the data.\n\nThe values here are just an example. You have to insert the ones regarding your case. Please, do not touch any parameter name, just modify the fields :).\n\n## Installation\n**To Install** the dynamic collision avoidance package run\n```console\ngit clone https://github.com/ADVRHumanoids/ProximityBasedDynamicCollisionAvoidance.git\n```\ninside the _**src folder**_ of the workspace and then run\n```console\ncolcon build\n```\nin the main folder of the ros2 workspace\n\n## Execution\nTo execute the code, just run:\n```console\nros2 launch dyn_collision_avoid dynamic_collision_avoidance.launch.py\n```\n\nRemember to source `install/local_setup.sh`, by simply\n```console\nsource install/local_setup.sh\n```\n\nYou should get a similar output\n\n```console\n[INFO] [launch]: All log files can be found below /home/liana/.ros/log/2024-06-01-21-45-04-278346-liana-Inspiron-5593-1155608\n[INFO] [launch]: Default logging verbosity is set to INFO\n[INFO] [DynamicCollisionAvoidance-1]: process started with pid [1155611]\n[DynamicCollisionAvoidance-1] [INFO] [1717271104.387412824] [robot.dyn_coll_avoid_settings]: I am initializing the ROS node...\n[DynamicCollisionAvoidance-1] \n[DynamicCollisionAvoidance-1] [INFO] [1717271104.390868768] [robot.dyn_coll_avoid_settings]: I am loading the ROS node params...\n[DynamicCollisionAvoidance-1] \n[DynamicCollisionAvoidance-1] frame names : teraflex_1_sensor1_link\n[DynamicCollisionAvoidance-1] frame names : teraflex_1_sensor2_link\n[DynamicCollisionAvoidance-1] frame names : teraflex_1_sensor3_link\n[DynamicCollisionAvoidance-1] frame names : teraflex_1_sensor4_link\n[DynamicCollisionAvoidance-1] frame names : teraflex_1_sensor5_link\n[DynamicCollisionAvoidance-1] frame names : teraflex_1_sensor6_link\n[DynamicCollisionAvoidance-1] q0 :     0 -1.56   0.9   0.2  -0.5  1.12\n[DynamicCollisionAvoidance-1] p0 :   -0.579894 -0.00190494  -0.0216102     1.47078   -0.187644    -2.17913\n[DynamicCollisionAvoidance-1] Worked for 0.00 sec (0.0 MB flushed)....average load is -nan \n[DynamicCollisionAvoidance-1] Created variable 'TargetPoseReceived' (20 blocks, 500 elem each)\n[DynamicCollisionAvoidance-1] Created variable 'TargetPoseCorrectionTerm' (20 blocks, 500 elem each)\n[DynamicCollisionAvoidance-1] Created variable 'TargetPoseFinal' (20 blocks, 500 elem each)\n[DynamicCollisionAvoidance-1] Created variable 'JointsPositionReference' (20 blocks, 500 elem each)\n```\n\n## Ros2 Version\nThe package has been tested on\n\n- Humble Hawksbill (Debian packages [link](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html))\n- Jazzy Jalisco (source [link](https://docs.ros.org/en/jazzy/Installation/Alternatives/Ubuntu-Development-Setup.html))\n\nBoth on Ubuntu 22.04.\n\n## Dependences\nThe package requires the following dependencies:\n* [Eigen](https://eigen.tuxfamily.org/index.php?title=Main_Page): to handle with basic algebra;\n* [MatLogger2](https://github.com/ADVRHumanoids/MatLogger2): to log data;\n* [KDL](https://www.orocos.org/kdl.html): to handle robot quantities.\n\n## Maintaner\n\n|\u003cimg src=\"https://avatars0.githubusercontent.com/u/15608027?s=400\u0026u=aa95697b36504a10aeff4bf95d5d2f355ae94f07\u0026v=4\" width=\"180\"\u003e|\n|:-------------:|\n|Liana Bertoni|\n|liana.bertoni at iit.it|\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvrhumanoids%2Fproximitybaseddynamiccollisionavoidance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadvrhumanoids%2Fproximitybaseddynamiccollisionavoidance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvrhumanoids%2Fproximitybaseddynamiccollisionavoidance/lists"}