Code Monkey home page Code Monkey logo

hexapod's Introduction

hexapod's People

Contributors

2shar18 avatar dependabot[bot] avatar icyjoseph avatar mikong avatar mithi avatar nitesh-kumar-sharma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hexapod's Issues

Improve code coverage

Optimization: Remove unnecessary computation when cloning

Hexagon cloning function

    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
    }

New Hexagon constructor to remove computation

    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)
    }

Make offline first progressive web app

It should work on all modern web browsers (including mobile web browsers like iOS safari)

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.

Readings

Namespace properties of LinkageIKSolver

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: "",
    }

Optimize: Reduce Bundle Size Further

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:

  • Remove MathJS as dependency and just write all the matrix multiplications from scratch
  • Remove ReactMarkdown and just write them in html
  • Figure out if react-icons is taking up more space than it should
  • Check if it's a good idea to use preact and eject

Related Links

Eject

Preact

Codesplitting

Importing only one icon from react-icon

Remove cloneRotXYZ and replace accompanying tests with cloneTrot since this won't be used anymore

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.

cloneRotXYZshift(thetaX, thetaY, thetaZ, tx, ty, tz) {

Sanity checks of parameters?

const solveInverseKinematics = (
dimensions,
rawIKparams,
flags = { rotateThenShift: true }
) => {
const { tVec, rotMatrix, startPose } = convertIKparams(dimensions, rawIKparams)
const startHexapod = new VirtualHexapod(dimensions, startPose)

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

Add more tests for inverse kinematics edge cases

Add google analytics

Default camera view being overridden on page load

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.

latestCameraView: CAMERA_VIEW,

This is not the behavior we intend. We need to fix it.

Rename functions to use new conventions


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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.