Commit Graph

52 Commits (d6ab57425bedfe8af515413902369a3b0d1b6ea6)

Author SHA1 Message Date
Rick Carlino d6ab57425b TODO: Fix FarmbotCeleryScript.SchedulerTest 2020-01-23 15:37:09 -06:00
Rick Carlino 9ba060c0f1 Fix set_servo_angle, get_sequence 2020-01-23 15:06:04 -06:00
Rick Carlino e1e8adfa00 Fix set_servo_angle, get_sequence 2020-01-23 15:02:15 -06:00
Rick Carlino f2790ff886 Fix read/write pin sys call tests 2020-01-23 14:46:23 -06:00
Rick Carlino e4af444ece TODO: Fix FarmbotCeleryScript.SysCallsTest. 50 tests, 11 failures 2020-01-22 21:03:46 -06:00
Rick Carlino 0c22021d66 TODO: Fix FarmbotCeleryScript.SysCallsTest. 49 tests, 13 failures 2020-01-22 20:51:48 -06:00
Rick Carlino ac7bf38be9 Fix SysCalls.point tests 2020-01-22 20:27:55 -06:00
Rick Carlino c9206ab484 TODO: Fix FarmbotCeleryScript.SysCallsTest. 47 tests, 16 failures 2020-01-22 19:56:29 -06:00
Rick Carlino 2c45bd3057 Fix FarmbotCeleryScript.CompilerGroupsTest 2020-01-22 19:23:23 -06:00
Rick Carlino 5a449af74f Minor cleanup 2020-01-19 10:32:00 -06:00
Rick Carlino a2647f7fe2 (51.1%, STABLE). "good enough" tests for Sequence.sequnce/2 2020-01-19 10:28:37 -06:00
Rick Carlino cc1a97d886 (50.8%, STABLE). Needs better assertions 2020-01-19 09:19:08 -06:00
Rick Carlino eba61d34f8 (49.2%, FAILING) Move groups stuff into its own test for now. 2020-01-19 09:01:30 -06:00
Rick Carlino 88ace0db19 Simulate :get_point_group, remove dead code 2020-01-18 14:06:39 -06:00
Rick Carlino 4ce80f0431 WIP: Still failing 2020-01-17 18:01:28 -06:00
Rick Carlino ee010874f0 TODO: Fix failing test 2020-01-17 16:59:04 -06:00
Rick Carlino a8c4887841 Run mix format 2020-01-17 16:02:00 -06:00
Rick Carlino 26d31012fb Test: get_point_group test success case 2020-01-17 15:40:25 -06:00
Rick Carlino 12c55fb60f Test: PointGroup test failure case 2020-01-17 15:28:13 -06:00
Rick Carlino 1c00c543e3 Rename some test helpers 2020-01-17 13:42:58 -06:00
Rick Carlino 5722bea421 Huge formatting update (sorry) 2020-01-17 09:58:53 -06:00
Rick Carlino 845e69ce7e
Re-enable set_servo_angle
* set_servo_angle works.
* Tests for set_servo_angle in  FarmbotCeleryScript.Syscalls
2019-12-27 11:45:26 -06:00
connor rigby 30d035fb88 Fix compiler tests 2019-10-22 14:19:32 -07:00
Connor Rigby a5022eed27 Factor out CeleryScript compiler into multiple modules
This should hopefully allow for easier to follow error messages as it
removes all elixir macro "magic"
2019-10-22 14:19:32 -07:00
Connor Rigby cf2877c76e
Ensure firmware/rpc logs always dispatch 2019-09-13 16:03:33 -07:00
connor rigby 3231651b5f
Add :set_pin_io_mode rpc back to known rpcs 2019-09-13 16:03:30 -07:00
Connor Rigby ed84cfeb2f
Add feature to subscribe to update to scheduled calendar 2019-09-13 16:03:27 -07:00
Connor Rigby 3d07c263ea
Fix scheduler not reindexing when an event is missed
* Add some breadcrumbs to see what the data that generated the scheduled
event looks like
* only monitor a process if it isn't monitored yet
2019-09-13 16:03:26 -07:00
connor rigby 55533675f5
Reenable sequence init and sequence complete logs
Sort of a hack, but store some metadata about a sequence in the AST
format, and if it exists, log it
2019-09-13 16:03:26 -07:00
connor rigby 5ca92090a1
Update more logs
* Any float is not formatted very specifically
   * if the remainder in the decimal is `0`, don't display decimal
   * if the remainder is not zero, truncate to only one decimal place

* Write/Read pin
   * yeah that got messy
2019-09-13 16:03:25 -07:00
connor rigby 059af23faf
Add parens to movement logs 2019-09-13 16:03:24 -07:00
connor rigby 28b43bebd3
Update more logs for clarity
* Add log for things that enumerate all axis
* change `homing` to `going home`..
2019-09-13 16:03:24 -07:00
connor rigby 0cbb4ba784
Fix named pins causing celeryscript errors
NamedPin values were encoded as tuples. This changes it to
pattern matchable structs, and implements a `to_string` behaviour
for those structs
2019-09-13 16:03:24 -07:00
Connor Rigby c92c79347f
Add back step logs 2019-09-13 16:03:24 -07:00
Connor Rigby e6b29ea559
Refactor CeleryScript execution
* FarmEvents now schedule all events up front
  * Executions are stored in the database
* Regimens now schedule all items up front
  * Executions are stored in the database
* fix Deleting a FarmEvent with a running RegimenInstance
* `execute`int and `schedule`ing a CeleryScript are not separate things
* Everywhere `scheduling` and `executing` CeleryScript updated to use
the new API
2019-09-13 16:03:23 -07:00
Connor Rigby 00d0897672
Dry up celery_script compilation
This adds much more type checking and error
handling in the compiled celery_script.
Also removes the hack/shortcut in the StubSysCalls
module.
2019-09-13 16:03:23 -07:00
Connor Rigby 697850b4b3
Implement process separation for celery scheduler
This should hopefuly prevent hanging forever and other weird
issues relating to executing celeryscript
2019-09-13 16:03:23 -07:00
Connor Rigby 5496efd390
Revert "Update scheduler to use ETS instead of storing data on a local state"
This reverts commit 4b2fa3f312.
2019-09-13 16:03:23 -07:00
Connor Rigby 14ff862176
Allow named_pin to return metadata
This will allow doing special thing contextually depending
on the type of pin being read.
2019-09-13 16:03:22 -07:00
connor rigby 3afed72bf5
Update scheduler_test to be less strict.
When the scheduler was split up into two different processes
for executing cellery_script, checking times doesn't really make
sense. Asserting that they do infact execute in a certain
amount of time is fine
2019-09-13 16:03:20 -07:00
Connor Rigby d7b43ffebe
Fix scheduler tests 2019-09-13 16:03:20 -07:00
Connor Rigby 80b6e53569
Update scheduler to use ETS instead of storing data on a local state 2019-09-13 16:03:20 -07:00
Connor Rigby 2a1db21546
Implement remaining celery nodes 2019-09-13 16:03:19 -07:00
Connor Rigby db54e2117d
Update find_home to not take a speed arg 2019-09-13 16:03:18 -07:00
Rick Carlino b4c05d13e0
Test case: passing default value in a sequence 2019-09-13 16:03:17 -07:00
connor rigby d842c3a123
🎉 Implement Variables in Regimen 2019-09-13 16:03:17 -07:00
Connor Rigby ef3225878d
Change FarmbotCeleryScript Namespace 2019-09-13 16:03:16 -07:00
Connor Rigby 4114e26804
Implement new CeleryScript Runtime environment.
This is obviously a rather large change warranting an essay describing
it.

A Brief overview
Basically the old implementation had quite a few down sides preventing
it from really working as intended, especially with the addition of the
variables feature. Here is the shortlist of things that needed
addressing:

* No scoping between sequences.
What this essentially means is that a sequence that executes another
sequence is unable to add data to the calle. This is important for using
Variables.

* Error recovery
certain nodes have a high likelyhood of failing such as anything that
interfaces the firmware. Much focus was spent ensuring that errors would
be recoverable when desired.

* Complexity of control flow asts versus action asts.
Nodes such as `if` will always work in the same way regardless of the
state of the rest of the system meaning there is no reason for it to
have a special implementation per environment. on the other hand
`move_absolute` is bound to a specific part of the system. Seperating
these concerns allows for better testing of each piece independently.

A More In Depth overview
The core of this change resolves around 1 really big change resulting in
many more small changes. This change is the CeleryScript `compiler`. The
TLDR of this system is that now CeleryScript ASTs are deterministicly
compiled to Elixir's AST and executed. Doing this has some big benifits
as described below.

1) CeleryScript "runtime" environment is now much simpiler in favor of a somewhat
complex "compile time" environment. Basically instead of EVERY single
CeleryScript AST having a custom runtime implementation, only a subset
of ASTs that require external services such as the Firmware, Database,
HTTP, etc require having a runtime implementation. This subset of ASTs
are called `SysCalls`. Also the runtime implementations are compiled to
a single function call that can be implemented instead of needing to
have a contextual environment and making decisions at runtime to
evaluate variables and the like.

2) Static analysis is now possible. This means an incorrectly crafted
sequence can be validated at compile time rather than getting half way
through a sequence before finding the error.

3) Having the "external services" separated leads to better plugability.
There is now a behaviour to be implemented for the subset of syscalls
that are system specific.
2019-09-13 16:03:15 -07:00
Connor Rigby f2b8abd692
Botstate refactor (#645)
* Refactor PinBindings

* Refactor logging to not require Farmbot.Registry

* Fix AMQP bot_state_transport and log_transport

* Update to use floats everywhere

* Refactor Farmbot.Firmware

* Write Firmware Tests

* dipping into FarmbotOS finally

* Cleanup peripheral_worker error message

* Implement remaining CeleryScript RPCs

* Refactor job progress

* Image Upload status notifications updates

* Fix compiler warnings and things

* Update Firmware submodule

* Fix FarmbotEXT tests
2019-09-13 16:03:14 -07:00
connor rigby 10a4379568
Work toward farmware/celeryscript stuff
* Fix logger erros
* Fix migrations
* Fix compile errors
* Fix tzdata child_spec
2019-09-13 16:03:13 -07:00