{"id":605,"date":"2021-05-25T08:14:40","date_gmt":"2021-05-25T12:14:40","guid":{"rendered":"https:\/\/blogs.sw.siemens.com\/plm-components\/?p=605"},"modified":"2026-03-26T08:03:18","modified_gmt":"2026-03-26T12:03:18","slug":"kineoworks-step-by-step-path-planning","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/plm-components\/kineoworks-step-by-step-path-planning\/","title":{"rendered":"KineoWorks\u202fstep-by-step #1: path planning"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.plm.automation.siemens.com\/global\/en\/products\/plm-components\/kineo.html\" target=\"_blank\" rel=\"noreferrer noopener\">KineoWorks<\/a><a href=\"https:\/\/www.plm.automation.siemens.com\/global\/fr\/products\/plm-components\/kineo.html\" target=\"_blank\" rel=\"noreferrer noopener\"> <\/a>is a software component that automatically computes collision-free motion, solving complex path-planning problems in applications such as robotic collision-free trajectory optimization. In this series of articles, Etienne Ferr\u00e9, Development Director of Kineo components, describes some of the key steps that are easily implemented to develop a sophisticated robotics simulation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Part 1: Path planning<\/h2>\n\n\n\n<p>This article explains how to solve the simplest and most common path planning scenario: finding a collision-free path that goes from point A to point B.&nbsp;<\/p>\n\n\n\n<p>Solving this point-to-point scenario involves two steps which we will explore in further detail:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Preparing&nbsp;the input&nbsp;<\/li><li>Running the&nbsp;path&nbsp;planner&nbsp;<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Preparing the Input<\/h2>\n\n\n\n<p>In this step you will obtain the inputs for the path planner which are:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>the&nbsp;device&nbsp;<\/li><li>the&nbsp;start configuration&nbsp;<\/li><li>the&nbsp;goal configuration&nbsp;<\/li><\/ul>\n\n\n\n<p>The first required input is a device which can be any moving system. For example, a free-flyer such as a building-inspection drone, or an articulated system, such as an industrial robot. The device defines the kinematic system and all its constraints: collision avoidance, joint limits and any other user-defined constraint. You can use our <a href=\"https:\/\/youtu.be\/YRBw9wr4IR8\" target=\"_blank\" rel=\"noreferrer noopener\">Kwik application<\/a> to graphically construct your devices quickly and easily. This example will discuss path planning for a robotic system.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/10\/2021\/05\/simplerobot.png\" alt=\"path planning for a simple robot system\" class=\"wp-image-713\" width=\"498\" height=\"417\" srcset=\"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/10\/2021\/05\/simplerobot.png 664w, https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/10\/2021\/05\/simplerobot-600x502.png 600w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><figcaption>Path planning for a robotic system<\/figcaption><\/figure><\/div>\n\n\n\n<p>Next, you need to supply a start configuration and a goal configuration, which will be used to create a direct path. In the example code below, the start and goal configurations for the robot system are created, together with a path that goes directly from the start to the goal.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Build start configuration&nbsp;\n\/\/ Start DOF values: &#91;0, 0, 1.57, 0, 0, 0] (positioned at home position)&nbsp;\nm_startCfg&nbsp;=&nbsp;CkwsConfig::create(m_device);\nm_startCfg-&gt;dofValue(2, 1.57);&nbsp;\n\/\/ Build goal configuration&nbsp;\nm_goalCfg&nbsp;=&nbsp;CkwsConfig::create(m_device);&nbsp;\n\/\/ Goal DOF values: &#91;3.14, 0, 1.57, 0, 0, 0] (positioned at J1=pi)&nbsp;\nm_goalCfg-&gt;dofValue(0, 3.14);\nm_goalCfg-&gt;dofValue(2, 1.57);\n\/\/ Build direct path&nbsp;\nm_path&nbsp;=&nbsp;CkwsPath::createWithDirectPath(*m_startCfg, *m_goalCfg);&nbsp;\n&nbsp;&nbsp;<\/code><\/pre>\n\n\n\n<p>Most path planners don\u2019t cope very well with colliding start\/goal configurations. Therefore, it\u2019s good practice is to check configuration validity. Here is an example:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Check configuration validity \nif(m_startCfg-&gt;validate()) \n{ \n  \/\/ m_startCfg is valid \n} <\/code><\/pre>\n\n\n\n<p>You can also check that the direct input path is colliding to confirm that the path planner will have some work to do:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Check path validity \nif(m_path-&gt;validate()) \n{ \n  \/\/ m_path is valid \n} <\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Running the Path Planner<\/strong>&nbsp;<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Creating the Path Planner&nbsp;<\/h3>\n\n\n\n<p>In order to find a collision-free path, you will need to create a path planner object. Here, an all-purpose path planner called a\u202f<strong>smart planner<\/strong> is used. Set <em>dynamic penetration<\/em> to zero in order to compute a path that will be completely collision-free.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Create the Smart Planner for solving the path planning problem:\nCkwsSmartPlannerShPtr smartPlanner = CkwsSmartPlanner::create(); \nsmartPlanner-&gt;penetration(0); <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Blocking Path Planning<\/h3>\n\n\n\n<p>This is the easiest method for finding a path. However, the call is blocking, so if there is no solution, the call will never return. It is not recommended for production code; however, it is useful in the prototyping stage:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Find the path\nsmartPlanner-&gt;plan(*m_startCfg, *m_goalCfg, m_path);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Non-Blocking Path Planning<\/h3>\n\n\n\n<p>The atomic API allows you to run the path planning loop in your own code, thus keeping control. First, call&nbsp;<strong>startPlan()<\/strong>&nbsp;in order to initialize the path planner. Then, each call to&nbsp;<strong>continuePlan()<\/strong>&nbsp;performs an incremental computation. Finally, call&nbsp;<strong>finishPlan()<\/strong>&nbsp;to end path planning. This is the recommended API when integrating path planning into an application in order to keep the application responsive.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bool mustContinue = true;\nktStatus status = KD_ERROR;\n\/\/ Start planner (STABLE_ENDS means modifying start or goal is not allowed)\nstatus = smartPlanner-&gt;startPlan(m_path, CkwsPathPlanner::STABLE_ENDS);\nif (KD_OK == status)\n{\n  \/\/ Run the loop\n  do\n  {\n    status = smartPlanner-&gt;continuePlan(m_path, mustContinue);\n  }\n  while (mustContinue);\n}\n\/\/ Finish path planning\nsmartPlanner-&gt;finishPlan(status, m_path);<\/code><\/pre>\n\n\n\n<p>Instead of implementing this using a loop construct, you can call <strong>continuePlan()<\/strong> from the main event loop of your UI toolkit using a timer or idle events. This allows you to keep the UI responsive without using threads. For implementing a Cancel button or a timeout, you can interrupt path planning just by calling <strong>finishPlan()<\/strong> instead of <strong>continuePlan()<\/strong>. During path planning, you can also retrieve information like completion (for displaying a progress bar) or current estimated difficulty.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Retrieving the Result<\/h2>\n\n\n\n<p>In both examples above, <strong>m_path<\/strong> initially contains the problem to solve and finally contains the computed path in cases of success. During path planning, when using the atomic API, calls to <strong>continuePlan()<\/strong> can also modify <strong>m_path<\/strong> in order to give intermediary results which will be colliding.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/10\/2021\/05\/simplerobot.mp4\"><\/video><\/figure>\n\n\n\n<p>In <a href=\"https:\/\/blogs.sw.siemens.com\/plm-components\/kineoworks-step-by-step-building-your-robot-with-kwik\/\" target=\"_blank\" rel=\"noreferrer noopener\">part 2 of our series<\/a>, we take a closer look at how you can build robots quickly and easily using our graphical <em>Kwik <\/em>application.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article explains how to solve the simplest and most common path planning scenario: finding a collision-free path that goes from point A to point B.<\/p>\n","protected":false},"author":36655,"featured_media":768,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[89,94],"tags":[2],"industry":[83],"product":[],"coauthors":[410],"class_list":["post-605","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-featured","category-tips-tricks","tag-kineo","industry-software-development"],"featured_image_url":"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/10\/2021\/05\/kineoworks-step-by-step-path-planning-main.png","_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/posts\/605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/users\/36655"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/comments?post=605"}],"version-history":[{"count":4,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/posts\/605\/revisions"}],"predecessor-version":[{"id":755,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/posts\/605\/revisions\/755"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/media\/768"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/media?parent=605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/categories?post=605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/tags?post=605"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/industry?post=605"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/product?post=605"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/plm-components\/wp-json\/wp\/v2\/coauthors?post=605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}