Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mods
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
mods
Commits
dd300b37
You need to sign in or sign up before continuing.
Commit
dd300b37
authored
7 years ago
by
Jake Read
Browse files
Options
Downloads
Patches
Plain Diff
bugfix on wait blocks
parent
9afc75cc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/hardware/motors/stepper
+8
-8
8 additions, 8 deletions
modules/hardware/motors/stepper
with
8 additions
and
8 deletions
modules/hardware/motors/stepper
+
8
−
8
View file @
dd300b37
...
...
@@ -292,7 +292,7 @@
trap.accelLength = 0; // never accel
// we really want speed by multiple times, and total distance we know, for vAvg
var tSum = (trap.cruise - trap.exit) / trap.accel + trap.deccelLength / trap.cruise
trap.vAvg = trap.
delta
/ tSum
trap.vAvg = trap.
length
/ tSum
} else if (trap.cruise == trap.exit) {
// accel, cruise? unless entry also cruise?
//console.log('accel then cruise')
...
...
@@ -301,7 +301,7 @@
trap.deccelLength = trap.length + 1; // and never deccel
// wait
var tSum = (trap.cruise - trap.entry) / trap.accel + (trap.delta - trap.accellength) / trap.cruise
trap.vAvg = trap.
dela
/ tSum
trap.vAvg = trap.
length
/ tSum
} else {
// it's either a full trap, or a triangle
var accelDistance = (trap.cruise * trap.cruise - trap.entry * trap.entry) / (2 * trap.accel)
...
...
@@ -313,7 +313,7 @@
trap.deccelLength = trap.length - deccelDistance
// wait
var tSum = (trap.cruise - trap.entry) / trap.accel + (trap.deccelLength - trap.accellength) / trap.cruise + (trap.cruise - trap.exit) / trap.accel
trap.vAvg = trap.
delta
/ tSum
trap.vAvg = trap.
length
/ tSum
} else {
//console.log('triangle')
trap.ramptype = 'triangle'
...
...
@@ -323,8 +323,8 @@
var midPoint = (vPeak * vPeak - trap.entry * trap.entry) / (2 * trap.accel)
trap.accelLength = midPoint
trap.deccelLength = midPoint
var tSum = (
trap.
vPeak - trap.entry) / trap.accel + (
trap.
vPeak - trap.exit) / trap.accel
trap.vAvg = trap.
delta
/ tSum
var tSum = (vPeak - trap.entry) / trap.accel + (vPeak - trap.exit) / trap.accel
trap.vAvg = trap.
length
/ tSum
}
}
...
...
@@ -362,10 +362,10 @@
packet.push(132)
// now we pack these values into C-readable bytes
// int32_t steps, uint32_t entryspeed, accel, accellength, decellength
packet = packet.concat(pack32(
stepWait
.delta))
packet = packet.concat(pack32(
trap
.delta))
if(isNaN(stepWait.vAvg)){
console.log('maths failure on vAvg')
console.log('maths failure on vAvg'
, trap.ramptype
)
packet = packet.concat(pack32(1000))
console.log('wait block', stepWait.steps, 1000)
} else {
...
...
@@ -396,7 +396,7 @@
function trapezoidToStepWait(trap) {
var stepWait = {}
// planner units -> steps
stepWait.steps = Math.round(trap.
delta
* mod.convert)
stepWait.steps = Math.round(trap.
length
* mod.convert)
//
stepWait.vAvg = Math.round(trap.vAvg * mod.convert)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment