{"action":"created","issue":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/9917","repository_url":"https://api.github.com/repos/MarlinFirmware/Marlin","labels_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/9917/labels{/name}","comments_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/9917/comments","events_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/9917/events","html_url":"https://github.com/MarlinFirmware/Marlin/issues/9917","id":302024282,"node_id":"MDU6SXNzdWUzMDIwMjQyODI=","number":9917,"title":"[Discussion] Handling of junction speeds and jerk","user":{"login":"Sebastianv650","id":10776877,"node_id":"MDQ6VXNlcjEwNzc2ODc3","avatar_url":"https://avatars3.githubusercontent.com/u/10776877?v=4","gravatar_id":"","url":"https://api.github.com/users/Sebastianv650","html_url":"https://github.com/Sebastianv650","followers_url":"https://api.github.com/users/Sebastianv650/followers","following_url":"https://api.github.com/users/Sebastianv650/following{/other_user}","gists_url":"https://api.github.com/users/Sebastianv650/gists{/gist_id}","starred_url":"https://api.github.com/users/Sebastianv650/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sebastianv650/subscriptions","organizations_url":"https://api.github.com/users/Sebastianv650/orgs","repos_url":"https://api.github.com/users/Sebastianv650/repos","events_url":"https://api.github.com/users/Sebastianv650/events{/privacy}","received_events_url":"https://api.github.com/users/Sebastianv650/received_events","type":"User","site_admin":false},"labels":[{"id":229043822,"node_id":"MDU6TGFiZWwyMjkwNDM4MjI=","url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/T:%20Design%20Concept","name":"T: Design Concept","color":"1d76db","default":false},{"id":208489635,"node_id":"MDU6TGFiZWwyMDg0ODk2MzU=","url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/T:%20Development","name":"T: Development","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":73,"created_at":"2018-03-03T19:14:14Z","updated_at":"2018-06-22T19:22:36Z","closed_at":null,"author_association":"NONE","body":"This is a follow-up to a topic which already was here a long time ago, but I can't find it anymore. If someone remebers it and can find the issue, you might link it here.\r\n\r\nDuring the research for strange jerk behaviour today I stumbled around the suboptimal handling of junction speeds again. In one sentence: Marlins way of handling jerk and junction speeds leads to exceeded jerk in some daily situations.\r\nThe attached test gcode and the results in the table should clarify things a bit. The gcode does the following things:\r\n- set the jerk speeds to the selected values\r\n- First it does 4 G1 travel moves\r\n- followed by 4 G1 print moves\r\n- in the last round it does a prime move (extruder only), followed by two print moves, a retract - travel - prime combination and again a print move.\r\n\r\nI printed the following values over serial:\r\n- max junction speed as calculated by the jerk code inside the planner\r\n- initial and final step rate of each block as it gets executed\r\n- initial and final speed of each block (step rate / steps/mm), this one is calculated inside Excel by hand\r\n\r\nI did two runs, first with X and Y jerk set to 5 and E jerk set to 1mm/s, and a second one switching the values. As you can see, as soon as we are switching between extruder only moves and XY moves things start to get wired. Same should be true for Z only moves and XY moves.\r\nThe problem is that Marlin connects each segment by one single junction speed, which is not always what is needed. A simple example like the one from H13 in the table, lets assume a X Jerk of 1, an E jerk of 5. Let's do a print move along X followed by a prime move. What we want ist:\r\n- Start with a jerk speed of 1\r\n- Accelerate to cruising speed\r\n- Decelerate to jerk speed **1**. The extruder speed in this case is nearly 0 due to the low X jerk.\r\n- Now the prime move, start with a jerk speed of **5**\r\n- accelerate, cruise and decelerate to jerk speed of 5 again.\r\n\r\nThe two axis X and E are not linked, also their junction speeds shouldn't be linked. What Marlin does is in this case is:\r\n- Start with a jerk speed of 1\r\n- Accelerate to cruising speed\r\n- Decelerate to jerk speed **5** -> Ignoring the needed final speed of 1!\r\n- Now the prime move, start with a jerk speed of **5**\r\n- accelerate, cruise and decelerate to jerk speed of **1** -> Jerk value from next print move!\r\n\r\n![jerk](https://user-images.githubusercontent.com/10776877/36938099-ecf9eb4e-1f1c-11e8-98c9-90bdcee23900.JPG)\r\n\r\nIt becomes crucial when we replace the first print move by a Z move. Z axis often have 0.x jerk values, but the final speed would be also 5mm/s due to the following retract move.\r\n\r\nConclusion:\r\n- A junction speed in terms of final speed = next start speed is only needed to give a smooth movement along a 3D path. Retracts and prime movements does not fall into this, so their speeds should be decoupled.\r\n- Same is true for extruder speed changes due to variable width paths: the 3D movement XYZ has always a connected speed, but the extruder speed can jump at the junctions.\r\n- If we have to connect end and start speeds, we always have to check if all axis can follow the choosen final or start speed. We can't finish X at 5mm/s if it needs 1mm/s only because the next E move can start at 5mm/s.\r\n- That was the easy part. Any ideas how such a jerk implementation could look like? GRBL will not help, as this is a 3D printer specific problem.\r\n\r\nFiles:\r\n[Marlin Junction speeds.zip](https://github.com/MarlinFirmware/Marlin/files/1777767/Marlin.Junction.speeds.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/comments/399554721","html_url":"https://github.com/MarlinFirmware/Marlin/issues/9917#issuecomment-399554721","issue_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/9917","id":399554721,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTU1NDcyMQ==","user":{"login":"gloomyandy","id":5133126,"node_id":"MDQ6VXNlcjUxMzMxMjY=","avatar_url":"https://avatars2.githubusercontent.com/u/5133126?v=4","gravatar_id":"","url":"https://api.github.com/users/gloomyandy","html_url":"https://github.com/gloomyandy","followers_url":"https://api.github.com/users/gloomyandy/followers","following_url":"https://api.github.com/users/gloomyandy/following{/other_user}","gists_url":"https://api.github.com/users/gloomyandy/gists{/gist_id}","starred_url":"https://api.github.com/users/gloomyandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gloomyandy/subscriptions","organizations_url":"https://api.github.com/users/gloomyandy/orgs","repos_url":"https://api.github.com/users/gloomyandy/repos","events_url":"https://api.github.com/users/gloomyandy/events{/privacy}","received_events_url":"https://api.github.com/users/gloomyandy/received_events","type":"User","site_admin":false},"created_at":"2018-06-22T19:22:36Z","updated_at":"2018-06-22T19:22:36Z","author_association":"NONE","body":"So to clarify the current code looks like..\r\n`      #if ENABLED(JUNCTION_DEVIATION)\r\n        #define MAX_E_JERK (max_e_jerk_factor * max_acceleration_mm_per_s2[_EINDEX])\r\n      #else\r\n        #define MAX_E_JERK max_jerk[E_AXIS]\r\n      #endif\r\n`\r\ndoes it need to be changed to:\r\n``"}}
{"actor":{"display_login":"gloomyandy"}}