mithi / hexapod Goto Github PK
View Code? Open in Web Editor NEWBlazing fast hexapod robot simulator for the web.
Home Page: https://hexapod.netlify.app
License: Apache License 2.0
Blazing fast hexapod robot simulator for the web.
Home Page: https://hexapod.netlify.app
License: Apache License 2.0
When you look at the app state, on load, latestCameraView
is undefined even though we explicitly define it . Why?
Also when we move from one page to another it does not remember this default state, if we don't change the camera view on page load, (ie we intend to use the default camera view). What happens is it moves to a camera view that we don't intend (probably plotly's default camera view)
however, when we do change it (ie we explicitly play with the camera view), the app state does remember this camera view.
Line 53 in 7e1b9bd
This is not the behavior we intend. We need to fix it.
hexapod/src/hexapod/solvers/ik/hexapodSolver.js
Lines 13 to 20 in dbd772c
Add check.
that tx, ty, tz are between -1 and 1,
rx, ry, rz, hipStance and legStance are within what is specified in
https://github.com/mithi/hexapod/blob/master/src/components/vars.js
We can return null (early exit) or throw and error
The best practice i've discovered is to compute the transformation matrix outside and pass it
to the hexagon. This is because usually we use the same transformation matrix not only to the hexagon but other things like legs or coordinate frames (axes). So we'll just compute the transformation matrix only once for all the objects that need it. This is why we don't need these kinds of abstractions anymore.
hexapod/src/hexapod/Hexagon.js
Line 104 in 8fa9cbc
Rename from legsWithoutGravity
to legsNoGravity
hexapod/src/hexapod/VirtualHexapod.js
Line 133 in a55a0e8
Rename from legsOnGroundWithoutGravity
to groundLegsNoGravity
hexapod/src/hexapod/VirtualHexapod.js
Line 145 in a55a0e8
Destructure this ie
{xAxis, yAxis, zAxis } = this.localFrame
hexapod/src/hexapod/VirtualHexapod.js
Line 215 in a55a0e8
const bodyContactPoints = hexapod.body
.cloneShift(tVec.x, tVec.y, tVec.z)
.cloneTrot(rotMatrix).verticesList
const bodyContactPoints = hexapod.body
.cloneTrot(rotMatrix)
.cloneShift(tVec.x, tVec.y, tVec.z)
.verticesList
Add the following:
You can do
const localFrame = hexapod.localFrame,
So you dont have to type it all the time
hexapod/src/hexapod/plotter.js
Line 64 in c5d8406
cloneTrotShift(frame, tx = 0, ty = 0, tz = 0) {
let clone = new Hexagon(this.dimensions, {hasNoPoints: false } )
clone.cog = this.cog.cloneTrotShift(frame, tx, ty, tz)
clone.head = this.head.cloneTrotShift(frame, tx, ty, tz)
clone.verticesList = this.verticesList.map(point =>
point.cloneTrotShift(frame, tx, ty, tz)
)
return clone
}
constructor(dimensions, flags = { hasNoPoints: false } ) {
this.dimensions = dimensions
if (hasNoPoints) { return }
const { front, middle, side } = this.dimensions
const vertexX = [middle, front, -front, -middle, -front, front]
const vertexY = [0, side, side, 0, -side, -side]
this.verticesList = POSITION_LIST.map(
(position, i) =>
new Vector(vertexX[i], vertexY[i], 0, `${position}Vertex`, i)
)
this.head = new Vector(0, side, 0, "headPoint", 7)
this.cog = new Vector(0, 0, 0, "centerOfGravityPoint", 6)
}
leg.CloneTrotShift(leg, frame, tx, ty, tz)
pointCloneTrotShift(leg, frame, tx, ty, tz)
pointNewTrotShift(point, frame, tx, ty, tz)
hexagonCloneTrotShift(hexagon, frame, tx, ty, tz)
pointCloneShift(point, tx, ty, tz)
Your app will work regardless of network state, even if offline. This means your users will be able to use your app at 10,000 feet and on the subway.
so we must pass something unique in the htmlFor
of each input widget, which is the id for the inputField, each inputfield must have an id which is unique to whole page
related to #73
and how it's called
To have an idea on what kinds of tests to make.
Thanks!
Google Analytics, Ultimate Beginner’s Guide
https://www.youtube.com/watch?v=gBeMELnxdIg
Google Analytics Tutorial 2019: Beginner To Expert
https://www.youtube.com/watch?v=1T83gm6GBt0
When we used identity
from mathjs
in the Linkage
module, all sorts of bugs came up on mobile.
It might be better if we don't use this library at all.
Related to #27
Readings:
https://github.com/mithi/hexapod/blob/master/src/hexapod/solvers/LinkageIKSolver.js
From:
class LinkageIKSolver {
legXaxis = new Vector(1, 0, 0, "legXaxis")
bodyContactPoint = new Vector(0, 0, 0, "localBodyContact")
coxia
femur
tibia
summa
rho
p1
targetFootTipPoint
parsVector
pars
beta
gamma
obtainedSolution
reachedTarget
message```
To:
class LinkageIKSolver {
legXaxis = new Vector(1, 0, 0, "legXaxis")
dimensions = { coxia: null, femur: null, tibia: null, summa: null, pars: null }
points = {
bodyContactPoint: zeroVec("bodyContactPoint"),
coxiaPoint: zeroVec("coxiaPoint"),
femurPoint: zeroVec("femurPoint"),
footTipPoint: zeroVec("actualFootTipPoint"),
targetFootTipPoint: zeroVec("targetFootTipPoint"),
}
angles = { alpha: null, beta: null, gamma: null, rho: null }
vectors = {
legXaxis: new Vector(1, 0, 0, "legXaxis"),
parsVector: null
}
additionalInfo = {
obtainedSolution: false,
reachedTarget: false,
message: "",
}
hexapod/src/hexapod/VirtualHexapod.js
Line 117 in c09993f
hexapod/src/hexapod/VirtualHexapod.js
Line 156 in c09993f
hexapod/src/hexapod/Hexagon.js
Line 65 in 5cee12e
Make sure that this does not introduce breaking changes
Deploy and setup continuous integration
hexapod/src/hexapod/Hexagon.js
Line 67 in 8cdc22d
I don't think anyone uses this function, I should probably just delete it.
I should be able to do the following:
leg.coxiaPoint
leg.femurPoint
leg.footTipPoint
leg.bodyContactPoint
https://github.com/mithi/hexapod/blob/master/src/hexapod/Linkage.js
This function has a high cognitive complexity, rewrite this
hexapod/src/hexapod/VirtualHexapod.js
Line 29 in a55a0e8
Put the block of _computeMaybeGroundContact()
this this line directly since its the only one using it
hexapod/src/hexapod/Linkage.js
Line 120 in a55a0e8
Rename _computePointsWrtHexapodsCog
to _computePointsWrtHexapodCog
hexapod/src/hexapod/Linkage.js
Line 225 in a55a0e8
Find all the hard-coded strings in the code base. List them all here.
Please take a look at the link texts.py
below to get a better idea of what I'm trying to do.
Related to: #37
Something like this:
Examples (but not limited to)
Headers:
LandingPage Message
Hyperlinks texts and paths
Using only a partial bundle of Plotly reduced the bundle size by 50%.
Right now, Plotly still occupies 75% of the bundle.
#54
Other things that we can try:
MathJS
as dependency and just write all the matrix multiplications from scratchReactMarkdown
and just write them in htmlreact-icons
is taking up more space than it shouldpreact
and eject
Eject
Preact
Codesplitting
Importing only one icon from react-icon
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.