Giter Club home page Giter Club logo

poppy-robot-core's People

Contributors

nbarikipoulos avatar

Stargazers

 avatar

Watchers

 avatar

poppy-robot-core's Issues

Allows to 'reset' goal position when switching the compliant state to 'false'

If the 'present_position' register value is not equal to the 'goal_position' one, switching the 'compliant' state of a motor to 'false' will imply movement to the goal position.

Then, add a new boolean argument named 'safe' to the setCompliant function of the ExtMotorRequest in order to reset or not the goal position to the present position when switching the compliant state to 'false'.

Set it default value to 'true' i.e. it will reset the goal position value to the present position one when compliant state is set to 'false'

To resume, add the following argument: @param {boolean=} [safe=true]

Use live discovering to fill Poppy descriptor as default method

Poppy motors and set of motors (aka alias) are nowadays provided through:

  • An internal json file for common configuration (Poppy Ergo Jr),
  • An external json file provided by users.
    Note such file is named robot descriptor.

Furthermore The default configuration is set to internal Poppy Ergo Jr descriptor.

In order to avoid extra settings for users to extend to any motor configuration driven by pypot (or other robot of the Poppy family), Change it to:

  • Use the live discovering feature as default method to set up the robot structure,
  • Allow users to provide their own robot descriptor , if needed.

Inconsistent default values

In ExtMotorRequest the optional wait value is set to:

  • true for the function rotate,
  • false in setPosition.

Set it to false for both.

Update post request to the rest api

Post request are not correctly performed and could implies dysfunctionnement of the robot (corrupting the registers of the motors.)

  • Do not send all kind of values as string => use JSON.stringify,
  • Set up request headers to { ‘content-type’: ‘application/json’ },
  • In post request:
    • For the compliant register: Replace the boolean value by 0/1,
    • For posted numerical values: use integer instead of float.

Use async functions in facing user module

Do not "hide" anymore the asynchronous js/node "behavior."

This is mainly motivated by removing the limitation due to the sync-like suggered coding nowadays used.

Indeed, all async operations execution are "deported" in the last stage i.e. the script execution ( which is asynchronous). All others, such as Poppy instantiation, script definition, etc... could be considered as pre-execution stages only dedicated to define and describe operations for script execution.

That:

  • harms maintainability/evolutivity of this module conflicting with js/node paragdims,
  • may misleading users: at last "real" operations to the robot are executed asynchrinously.

In particular, #2 which need to query robot as initial step, could not be fixed.

"High frequency" of requests implies (huge) lags or timeout.

It seems to be connected with the use of (many?) custom instance in Axios.
As:

  • Custom instances imply recurrent bugs/issues (see the axios project),
  • Calling directly the axios API solves this issue.

Replace custom instance with direct call of axios with specific config settings for each kind of request.

Remove the descriptor locator property in config.

Way to provide robot descriptor through an input file is useless and it should be only done via live disovering of the target robot.

Then notion of descriptor locator in config should be removed as well as corresponding code.

Update Badges

  • Remove david badges (almost always down),
  • Add lgtm/codeclimate badges.

Update resolving of hostname/connection object

In settings, add a function in order to:

  • First set up properties of the connection object with defaut values if not provided,
  • On a second hand, resolve hostname.

In connection object:

  • Rename the 'ip' property to 'hostname',
  • Add a property in order to store resolved adress,

Chain requests to robot

In order to avoid "overload" of the robot server, chain requests of "complex" commands (aka that are based on many requests) such as discovering the structure of the robot/ querying many registers/motors.

Aim is to avoid to "overload" the robot REST api with to many requests in the same time, especially when many clients are connected on (cli or ui as example).

Add request to reset Poppy

Sometimes (often enough) next to some (unfortunately unidentified) actions, register value seems to be frozen or http server does not respond well.

Next to perfoming a reset request, everything seems to back to normal.
Then add it.

Speed setup: Use 'moving_speed' instead of 'goal_speed'

When motors are already stiff, changing the target speed with 'goal_speed' could imply "invonluntary" movement depending of the goal/present position values.
Too boring/complicate to use/set in script compared to the 'moving_speed' register

Update fail behavior on get register value.

On getRegister function of PoppyRequestHandler, in order to avoid globally throwing an error when a request failed for a register:

  • Catch the error,
  • Set returned value for return data with value set to 'undefined'.
    As example, querying motor m1 for 'present_position' and 'compliant' register values:
req.getRegister('m1', 'present_position', 'compliant')

will return

{ present_position: 90.0, compliant: undefined }

instead of throwing error is request on register 'compliant' failed.

Misc. code improvement

  • In poppy object rename property allMotorIds to motorNames,
  • In PoppyrequestHandler, remove useless getter settings,
  • Misc. update/renaming/code cleaning.

Simplify settings object

In object factories, simplify arg from
createXXX({ connect })
to
js createXXX(connect)
aka change the poppy configuration object structure from
{ connect: { hostname: .., port: ..., ... } }
to
{ hostname: .., port: ..., ... }

Reorganize internal folders/files

  • Remove the utils folder and dispatch it to new ones: poppy and request,
  • Rename:
    • default-settings.js to settings.js,
    • descriptor-factory.js to descriptor.js,
    • poppy-utils.js to factories.js.
  • Split factory and discoverDescriptor in descriptor.js.

Remove any use of the snap rest api

Next to #12, it is not mandatory to use the snap rest api to set led values (it was a side effect).

Then remove any use of the rest api exposed by snap.

Then simplify the connection settings object: rename httpPort to port.

Allow live discovering of the robot motors

Robot descriptor (aka motors list and settings) are nowadays:

  • hard-coded for a set of common configuation (Ergo Jr),
  • provided via a json file by user.

Add a live discovering feature.

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.