Last active
February 15, 2024 10:07
Revisions
-
Hypnotriod revised this gist
Feb 15, 2024 . 1 changed file with 2 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,3 @@ // -------------------------------- // vehicle is faced towards y axis // start angle @@ -35,5 +31,5 @@ const y = Math.sin(A)*x1 + Math.cos(A)*y1 + Y console.log('velocity', v) console.log('angle', (a + A) / Math.PI * 180) console.log('radius', r) console.log('x', x.toFixed(3)) console.log('y', y.toFixed(3)) -
Hypnotriod revised this gist
Oct 22, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const x1 = a != 0 ? Math.cos(a) * r - r : 0 const y1 = a != 0 ? Math.sin(a) * r : v // next x position const x = Math.cos(A)*x1 - Math.sin(A)*y1 + X // next y position const y = Math.sin(A)*x1 + Math.cos(A)*y1 + Y // -------------------------------- console.log('velocity', v) -
Hypnotriod revised this gist
Oct 22, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const y1 = a != 0 ? Math.sin(a) * r : v // next x position const x = Math.cos(A)*x1 - Math.sin(A)*y1 + X // nexty y position const y = Math.sin(A)*x1 + Math.cos(A)*y1 + Y // -------------------------------- console.log('velocity', v) console.log('angle', (a + A) / Math.PI * 180) -
Hypnotriod created this gist
Oct 22, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ function precisionRound(number, precision) { var factor = Math.pow(10, precision); return Math.round(number * factor) / factor; } // -------------------------------- // vehicle is faced towards y axis // start angle const A = -Math.PI*0.5 // start x position const X = 2 // start y position const Y = 0 // wheels distance const L = 1 // left wheel velocity const v1 = Math.PI * 0.99 // right wheel velocity const v2 = Math.PI * 1 // -------------------------------- // angular velocity of the wheels center const a = (v2 - v1) / L // velocity of the wheels center const v = (v1 + v2) / 2 // radius const r = a != 0 ? v / a : 0 // next relative x position const x1 = a != 0 ? Math.cos(a) * r - r : 0 // next relative y position const y1 = a != 0 ? Math.sin(a) * r : v // next x position const x = Math.cos(A)*x1 - Math.sin(A)*y1 + X // nexty y position const y = Math.sin(A)*x1 - Math.cos(A)*y1 + Y // -------------------------------- console.log('velocity', v) console.log('angle', (a + A) / Math.PI * 180) console.log('radius', r) console.log('x', precisionRound(x,3)) console.log('y', precisionRound(y,3))