Skip to content
This repository was archived by the owner on Jul 6, 2020. It is now read-only.

Final preparation for asyncio merge #631

Merged
merged 13 commits into from
Oct 13, 2018

Conversation

baby-bell
Copy link
Contributor

Replace hibike_process with hibike_process_async, virtual devices with async virtual devices, remove unused files and functions.

Remove old hibike_process and replace it with async version. API
compatibility is maintained, so Runtime will not be changed.
hibike_tester would hang after terminating hibike_process,
because one of its threads was still running.
We tell the thread to shut down after the process is done
instead of running forever.
This function is identical to send, so it doesn't make sense
to keep it around.
The asynchronous version uses less CPU and has saner defaults.
Some parts of the virtual device perform similar functions
to parts of hibike_process, but it is better that the two
implementations be allowed to evolve independently.
Async tests need to deal with the event loop. In addition,
we test that hibike is actually reading and writing to devices
using virtual devices.
As it turns out, we were not sending error messages when a
nonexistent device was accessed; a test should ensure this behavior
stays in.
@SilentCtrl SilentCtrl merged commit a330963 into hibike/asyncio Oct 13, 2018
@SilentCtrl SilentCtrl deleted the hibike/asyncio-final-prep branch October 13, 2018 21:53
SilentCtrl pushed a commit that referenced this pull request Oct 13, 2018
* Do not crash on invalid COBS data

* Rename hibike_process_async to hibike_process

Remove old hibike_process and replace it with async version. API
compatibility is maintained, so Runtime will not be changed.

* Prevent hibike_tester hang after termination

hibike_tester would hang after terminating hibike_process,
because one of its threads was still running.
We tell the thread to shut down after the process is done
instead of running forever.

* Remove stub file

* Remove send_transport

This function is identical to send, so it doesn't make sense
to keep it around.

* Replace virtual device with async version

The asynchronous version uses less CPU and has saner defaults.

* Remove virtual device dependency on hibike_process

Some parts of the virtual device perform similar functions
to parts of hibike_process, but it is better that the two
implementations be allowed to evolve independently.

* Update tests for async; add read/write tests

Async tests need to deal with the event loop. In addition,
we test that hibike is actually reading and writing to devices
using virtual devices.

* Remove outdated portions of README, update others

* Add explanation for read/write retries

* Add test for nonexistent device errors

As it turns out, we were not sending error messages when a
nonexistent device was accessed; a test should ensure this behavior
stays in.

* Update developer documentation

* Fix lint errors
baby-bell pushed a commit that referenced this pull request Oct 14, 2018
* Use profiling and event loop libs

* [HIBIKE] C extension (#622)

* Add hibike_packet as submodule

* Enable use of hibike_packet

Detects whether the extension is installed by trying to import it.

* Update hibike_packet

* Remove process_buffer

* [HIBIKE] fixing Disconnect and register_sensor syntax errors

* Final preparation for asyncio merge (#631)

* Do not crash on invalid COBS data

* Rename hibike_process_async to hibike_process

Remove old hibike_process and replace it with async version. API
compatibility is maintained, so Runtime will not be changed.

* Prevent hibike_tester hang after termination

hibike_tester would hang after terminating hibike_process,
because one of its threads was still running.
We tell the thread to shut down after the process is done
instead of running forever.

* Remove stub file

* Remove send_transport

This function is identical to send, so it doesn't make sense
to keep it around.

* Replace virtual device with async version

The asynchronous version uses less CPU and has saner defaults.

* Remove virtual device dependency on hibike_process

Some parts of the virtual device perform similar functions
to parts of hibike_process, but it is better that the two
implementations be allowed to evolve independently.

* Update tests for async; add read/write tests

Async tests need to deal with the event loop. In addition,
we test that hibike is actually reading and writing to devices
using virtual devices.

* Remove outdated portions of README, update others

* Add explanation for read/write retries

* Add test for nonexistent device errors

As it turns out, we were not sending error messages when a
nonexistent device was accessed; a test should ensure this behavior
stays in.

* Update developer documentation

* Fix lint errors

* [RUNTIME] changed kill process timeout from one second to three seconds

* Start async hibike rewrite

* [HIBIKE] Full implementation of async smart sensor protocol (#523)

Now, SmartSensorProtocol automagically registers itself with
Hibike when it connects.

* Fix bugs related to virtual devices

Essentially, we exclude existing serial ports from our
scan for new ones, but this didn't extend to virtual
devices, leading them to be added multiple times.

The other bug was that "connection_lost()" could
get called before a device was identified, triggering
a key error when we tried to take it out of the
devices map. This is now checked for.

Add function to create heartbeat requests

* Add async virtual devices

In addition, async virtual devices send heartbeat requests too, although
they don't do anything with the responses.

* Don't block event loop

* Don't block event loop on state queue
* Port process tests to async

* Use aiofiles for nonblocking IO

* Allow profiling measurements

* Use an external cobs library

* Memoize a few hot functions

* [HIBIKE] Pause reading of hibike messages when max size exceeded

* [HIBIKE] implemented backpressure on device side

* Exclude new name of hibike_packet from linting

* Unify runtime and hibike pipfiles

* Bump required python version to 3.7

* Bump runtime version
jonathan-j-lee pushed a commit that referenced this pull request Feb 28, 2019
* Use profiling and event loop libs

* [HIBIKE] C extension (#622)

* Add hibike_packet as submodule

* Enable use of hibike_packet

Detects whether the extension is installed by trying to import it.

* Update hibike_packet

* Remove process_buffer

* [HIBIKE] fixing Disconnect and register_sensor syntax errors

* Final preparation for asyncio merge (#631)

* Do not crash on invalid COBS data

* Rename hibike_process_async to hibike_process

Remove old hibike_process and replace it with async version. API
compatibility is maintained, so Runtime will not be changed.

* Prevent hibike_tester hang after termination

hibike_tester would hang after terminating hibike_process,
because one of its threads was still running.
We tell the thread to shut down after the process is done
instead of running forever.

* Remove stub file

* Remove send_transport

This function is identical to send, so it doesn't make sense
to keep it around.

* Replace virtual device with async version

The asynchronous version uses less CPU and has saner defaults.

* Remove virtual device dependency on hibike_process

Some parts of the virtual device perform similar functions
to parts of hibike_process, but it is better that the two
implementations be allowed to evolve independently.

* Update tests for async; add read/write tests

Async tests need to deal with the event loop. In addition,
we test that hibike is actually reading and writing to devices
using virtual devices.

* Remove outdated portions of README, update others

* Add explanation for read/write retries

* Add test for nonexistent device errors

As it turns out, we were not sending error messages when a
nonexistent device was accessed; a test should ensure this behavior
stays in.

* Update developer documentation

* Fix lint errors

* [RUNTIME] changed kill process timeout from one second to three seconds

* Start async hibike rewrite

* [HIBIKE] Full implementation of async smart sensor protocol (#523)

Now, SmartSensorProtocol automagically registers itself with
Hibike when it connects.

* Fix bugs related to virtual devices

Essentially, we exclude existing serial ports from our
scan for new ones, but this didn't extend to virtual
devices, leading them to be added multiple times.

The other bug was that "connection_lost()" could
get called before a device was identified, triggering
a key error when we tried to take it out of the
devices map. This is now checked for.

Add function to create heartbeat requests

* Add async virtual devices

In addition, async virtual devices send heartbeat requests too, although
they don't do anything with the responses.

* Don't block event loop

* Don't block event loop on state queue
* Port process tests to async

* Use aiofiles for nonblocking IO

* Allow profiling measurements

* Use an external cobs library

* Memoize a few hot functions

* [HIBIKE] Pause reading of hibike messages when max size exceeded

* [HIBIKE] implemented backpressure on device side

* Update hibike_packet submodule url

* Use http submodule url

* Fix trivial test failures

* Move hibike_packet so that import fails

* Exclude new name of hibike_packet from linting

* Unify runtime and hibike pipfiles

* Bump required python version to 3.7

* Fix linter errors

* Increase write attempts

* Fix syntax error

* Update comment

* Bump runtime version

* Switch to bash

* Reduce flakiness of tests

* Asyncio/writefix (#648)

* [RUNTIME] new branch with new hibibke_write_value function

* [RUNTIME] fixed hibike_write function

* [RUNTIME] fixed hibike_write_value

* changed an error name in runtime.py and cleand up runtime_Util.py a bit

* changed terminate_process to use process.join() instead of busy-waiting

* [HIBIKE] new pindefs for polarbear

* [HIBIKE] Add warning to clearFault()

* [HIBIKE] Most polarbear functionality done, still need to figure out what exact percentage the feedback pin gives

* [HIBIKE] Modified readCurrent() in motor.cpp to output the correct amount of current

* [HIBIKE] renaming new polarbear files appropriately

* [HIBIKE] added polar bear to enumerations in hibikeDevices.json and hibike/devices.h

* [HIBIKE] [RUNTIME] changed PolarBear dev ID, added PolarBear to statemanager device list

* [RUNTIME] fixed a bug in studentapi where we returned a device's peripherals instead of it's name

* [RUNTIME] uncommented process.terminate() in terminate_process()

* [HIBIKE] Attempt at fixing one direction hiccups on motor controller

* [HIBIKE] polarbear changed to use analog writes from the range of 0 to 1023 instead of pwm signals, also changed current limiting to 5 amps

* [HIBIKE] Changed analog write range from 0 to 255 instead of 0 to 1023

* [HIBIKE] formatting cleaned, trying new method of updating pwm

* MANUAL to MANUALDRIVE in current_limit

* flashable new PolarBear package

* [HIBIKE] Polarbears work now

* Fixed lint issues
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants