{"id":37064622,"url":"https://github.com/translearn/safemotions","last_synced_at":"2026-01-14T07:33:12.738Z","repository":{"id":57463559,"uuid":"343054228","full_name":"translearn/safeMotions","owner":"translearn","description":"[Humanoids 2022] Learning Collision-free and Torque-limited Robot Trajectories based on Alternative Safe Behaviors","archived":false,"fork":false,"pushed_at":"2025-12-18T08:30:20.000Z","size":20709,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-21T15:57:08.092Z","etag":null,"topics":["humanoids","python","robotics","safe-reinforcement-learning"],"latest_commit_sha":null,"homepage":"","language":"Python","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/translearn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-02-28T08:18:53.000Z","updated_at":"2025-12-18T08:30:24.000Z","dependencies_parsed_at":"2022-09-14T16:40:31.700Z","dependency_job_id":null,"html_url":"https://github.com/translearn/safeMotions","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/translearn/safeMotions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/translearn%2FsafeMotions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/translearn%2FsafeMotions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/translearn%2FsafeMotions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/translearn%2FsafeMotions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/translearn","download_url":"https://codeload.github.com/translearn/safeMotions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/translearn%2FsafeMotions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["humanoids","python","robotics","safe-reinforcement-learning"],"created_at":"2026-01-14T07:33:12.178Z","updated_at":"2026-01-14T07:33:12.730Z","avatar_url":"https://github.com/translearn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning Collision-free and Torque-limited Robot Trajectories based on Alternative Safe Behaviors \n[![IEEE Humanoids 2022](https://img.shields.io/badge/Humanoids-2022-%3C%3E)](https://www.humanoids2022.org/)\n[![arXiv](https://img.shields.io/badge/arXiv-2103.03793-B31B1B)](https://arxiv.org/abs/2103.03793)\n[![GitHub issues](https://img.shields.io/github/issues/translearn/safemotions)](https://github.com/translearn/safemotions/issues/)\u003cbr\u003e\nThis repository provides the code to learn torque-limited and collision-free robot trajectories without exceeding limits on the position, velocity, acceleration and jerk of each robot joint. \\\n**Note:** A follow-up work which considers moving obstacles can be found in the repository [safeMotionsRisk](https://github.com/translearn/safeMotionsRisk).\n\n![safemotions_picture](https://user-images.githubusercontent.com/51738372/116555683-f32d7680-a8fc-11eb-8cce-b01931c6ba58.png)\n\n## Installation\n\nTo use the code, clone the repository with:\n\n    git clone https://github.com/translearn/safeMotions.git\n\nThe required dependencies can be installed by running:\n\n    pip install -r requirements.txt\n\n## Trajectory generation \u0026nbsp; [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/translearn/notebooks/blob/main/safemotions_random_agent_demo.ipynb)\n\nTo generate a random trajectory with a single robot run\n\n    python safemotions/random_agent.py --use_gui --check_braking_trajectory_collisions --check_braking_trajectory_torque_limits --torque_limit_factor=0.6 --plot_trajectory\n\nFor a demonstration scenario with two robots run\n\n    python safemotions/random_agent.py --use_gui --check_braking_trajectory_collisions --robot_scene=1\n\nCollision-free trajectories for three robots can be generated by running\n\n    python safemotions/random_agent.py --use_gui --check_braking_trajectory_collisions --robot_scene=2\n\n\n## Pretrained networks \u0026nbsp; [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/translearn/notebooks/blob/main/safemotions_trained_networks_demo.ipynb)\n\nVarious pretrained networks for reaching randomly sampled target points are provided. \\\nMake sure you use ray==1.4.1 to open the pretrained networks.  \n\n### Industrial robots \nTo generate and plot trajectories for a reaching task with a single industrial robot run\n\n```bash\npython safemotions/evaluate.py --use_gui --plot_trajectory --plot_actual_torques --checkpoint=industrial/one_robot/collision \n```\nTrajectories for two and three industrial robots with alternating target points can be generated by running\n\n```bash\npython safemotions/evaluate.py --use_gui --checkpoint=industrial/two_robots/collision/alternating  \n```\nand\n```bash\npython safemotions/evaluate.py --use_gui --checkpoint=industrial/three_robots/collision/alternating  \n```\n\n### Humanoid robots \n\n\u003ctable width=\"100%\"\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth style=\"text-align:center; width: 36%\"\u003e\u003c/th\u003e\n            \u003cth style=\"text-align:center; width: 32%\"\u003eARMAR 6\u003c/th\u003e\n            \u003cth style=\"text-align:center; width: 32%\"\u003eARMAR 6x4\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd style=\"text-align:center;\"\u003e\u003c/td\u003e\n            \u003ctd style=\"text-align:center;\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/51738372/130495206-be360e87-2444-4481-86eb-44df5c949880.png\" width=\"300\"\u003e\u003c/td\u003e\n           \u003ctd style=\"text-align:center;\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/51738372/130494311-0c5e0265-30fc-4a54-962d-a853f16d7cbc.png\" width=\"300\"\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd style=\"text-align:left;\"\u003eAlternating target points \u003c/td\u003e\n            \u003ctd style=\"text-align:left\"\u003e --checkpoint=humanoid/armar6/collision/alternating\n            \u003c/td\u003e\n            \u003ctd style=\"text-align:left\"\u003e --checkpoint=humanoid/armar6_x4/collision/alternating\n            \u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd style=\"text-align:left;\"\u003eSimultaneous target points \u003c/td\u003e\n            \u003ctd style=\"text-align:left\"\u003e --checkpoint=humanoid/armar6/collision/simultaneous\n            \u003c/td\u003e\n            \u003ctd style=\"text-align:left\"\u003e --checkpoint=humanoid/armar6_x4/collision/simultaneous\n            \u003c/td\u003e\n        \u003c/tr\u003e\n         \u003ctr\u003e\n            \u003ctd style=\"text-align:left;\"\u003eSingle target point \u003c/td\u003e\n            \u003ctd style=\"text-align:left\"\u003e --checkpoint=humanoid/armar6/collision/single\n            \u003c/td\u003e\n            \u003ctd style=\"text-align:left\"\u003e --checkpoint=humanoid/armar6_x4/collision/single\n            \u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\n## Training\n\nNetworks can also be trained from scratch. For instance, a reaching task with a single robot can be learned by running \n```bash\npython safemotions/train.py --logdir=safemotions_training --name=industrial_one_robot_collision --robot_scene=0 --online_trajectory_time_step=0.1 --hidden_layer_activation=swish --online_trajectory_duration=8.0 --obstacle_scene=3 --use_target_points --target_point_sequence=0 --target_point_cartesian_range_scene=0 --target_link_offset=\"[0, 0, 0.126]\" --target_point_radius=0.065 --obs_add_target_point_pos --obs_add_target_point_relative_pos --check_braking_trajectory_collisions --closest_point_safety_distance=0.01 --acc_limit_factor_braking=1.0 --jerk_limit_factor_braking=1.0 --punish_action --action_punishment_min_threshold=0.95 --action_max_punishment=0.4  --target_point_reached_reward_bonus=5  --pos_limit_factor=1.0 --vel_limit_factor=1.0 --acc_limit_factor=1.0 --jerk_limit_factor=1.0 --torque_limit_factor=1.0 --punish_braking_trajectory_min_distance --braking_trajectory_min_distance_max_threshold=0.05 --braking_trajectory_max_punishment=0.5 --last_layer_activation=tanh --solver_iterations=50 --normalize_reward_to_initial_target_point_distance --collision_check_time=0.033 --iterations_per_checkpoint=50 --time=200\n```\n\n## Publication\nFurther details can be found in the following [publication](https://arxiv.org/abs/2103.03793):\n```\n  title={Learning Collision-free and Torque-limited Robot Trajectories based on Alternative Safe Behaviors}, \n  booktitle={2022 IEEE-RAS 21st International Conference on Humanoid Robots (Humanoids)},\n  author={Kiemel, Jonas and Kröger, Torsten},\n  year={2022},\n  pages={223-230},\n  doi={10.1109/Humanoids53995.2022.10000077}\n```\n\n[![Video](https://user-images.githubusercontent.com/51738372/196687365-0adb05c7-88ec-423f-86bd-f0600e62ea82.png)](https://youtu.be/U2OWsQrt-40)\n\n\n## Disclaimer\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftranslearn%2Fsafemotions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftranslearn%2Fsafemotions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftranslearn%2Fsafemotions/lists"}