Commit graph

96 commits

Author SHA1 Message Date
Kevin Andersen
ecbbacd4c0 It seems like there's a tradeoff between how we choose to set the max power of the motors. Previously, I had set the motors' max power (torque) to follow their target speed, meaning they accelerated smoothly, but also lost their torque. Then in the following commit I changed the max power to 100 which means maximum torque to achieve the target speed, which resulted in very abrupt accelerations and erratic motor movement when changing speeds:
873b56c985

In the following commit I changed the functionality so that we add a fixed amount (10) more power than the target speed, e.g. for speed 50 it would provide power 60. This is fine for high speeds, but for low speeds it provides poor torque:

e3cdbffa2a

I assume it would be possible to design some sort of calculation that enabled high torque for low speeds, and vice versa. I will discuss with the team.
2019-04-08 17:56:54 -04:00
Christopher Willis-Ford
e6dd3f1175 Fix TaskQueue constructor when no options passed 2019-02-15 15:20:38 -08:00
Christopher Willis-Ford
be040f4c9b TaskQueue: Add option for max total cost 2019-02-12 18:57:58 -08:00
Christopher Willis-Ford
2a9a3b11b9 TaskQueue: support canceling a single task 2019-02-12 18:11:13 -08:00
Christopher Willis-Ford
d27dc5d54a TaskQueue: reduce number of async steps before task runs 2019-02-11 12:46:48 -08:00
Christopher Willis-Ford
5a17bb1451 Add clearTimeout to Timer and MockTimer 2019-02-11 12:14:44 -08:00
Christopher Willis-Ford
46a1ae83a0 Use MockTimer for TaskQueue tests 2019-02-07 16:35:33 -08:00
Christopher Willis-Ford
7f80fe17b3 Build a mock Timer class and add tests for it 2019-02-07 16:35:32 -08:00
Karishma Chadha
c761a9c82e Fix issue where non-strings were getting passed in to escape functions for handling special characters that can appear in xml. Add tests. 2019-02-07 11:58:10 -05:00
Paul Kaplan
765f2b2549
Merge pull request #1983 from picklesrus/broadcast-msg-chars
Broadcast msg chars
2019-02-07 08:32:55 -05:00
Paul Kaplan
6deab79903
Merge pull request #1979 from paulkaplan/share-blocks-new-ids
Add a utility for giving blocks new IDs, use it for sharing blocks.
2019-02-07 08:31:25 -05:00
picklesrus
b904f19c1d Fix loading broadcast messages with special characters for projects that were converted from 2.0. 2019-02-06 16:58:46 -05:00
Paul Kaplan
31fbcfa4d7 Add a utility for giving blocks new IDs, use it for sharing blocks. 2019-02-06 10:16:22 -05:00
Karishma Chadha
af0bebb773
Fix typo in comment 2019-02-04 23:33:18 -05:00
Karishma Chadha
d91c19434f Rename util function to be more descriptive. Refactor parameters to remove unused code. 2019-02-04 19:05:28 -05:00
Karishma Chadha
7faddb6c8f Replace xml-unsafe chars in sb3 variables. 2019-02-04 15:32:01 -05:00
Karishma Chadha
57f112cbfd Remove unsafe chars from variable ids when importing from 2.0. 2019-02-04 10:29:24 -05:00
Paul Kaplan
4fe06153d6
Merge pull request #1809 from paulkaplan/serialize-infinity
Serialize Infinity and NaN to 0
2018-12-05 08:28:50 -05:00
Paul Kaplan
7e96ef2985 Serialize Infinity and NaN to 0 2018-12-04 10:52:49 -05:00
Katie Broida
967cab8f20
Make the wait block's logic and behavior more consistent with Scratch 2 (#1759) 2018-12-04 10:35:42 -05:00
DD Liu
122443a75f
Merge pull request #1754 from bocoup/handle-infinity
Make Scratch 3 comparisons with +/-Infinity match Scratch 2
2018-11-29 14:31:10 -05:00
Valerie R Young
8c2da6b56a Satisfy linter 2018-11-29 14:07:27 -05:00
Valerie R Young
70f00e30c4 Revert changes to toNumber, fix comparison of infinity in cast.compare 2018-11-27 17:53:20 -05:00
Evelyn Eastmond
9c3518ba6d Adding check for open request before calling reject/resolve. Resolves #1764. 2018-11-27 09:43:53 -05:00
Valerie R Young
3fe1d3bf6d Minor typo 2018-11-13 14:58:28 -05:00
Valerie R Young
43c5d5c053 Correct infinity comparisons and toNumber 2018-11-13 13:51:12 -05:00
Karishma Chadha
87244b4110 Normalize capitalization of sensing_current block fields during sb2 import and during monitor id generation. Update monitors integration test to include sensing_current block monitors. 2018-11-08 14:11:30 -05:00
Karishma Chadha
5db3db3a92 monitor id getter should use block fields instead of a list of strings 2018-11-08 01:33:26 -05:00
Karishma Chadha
0e7eae98d5 Separate out monitors for blocks reporter blocks that have parameters. 2018-11-08 00:37:28 -05:00
Michael "Z" Goddard
ec414fffc6
use Number.isNaN in Cast.toNumber
Number.isNaN does not coerce and may help performance since we either
do not need to coerce the value or already have with Number.
2018-10-31 14:40:19 -04:00
Michael "Z" Goddard
5b10d41ba3
check if toNumber is given a number and shortcut if so
If toNumber is called on a number avoiding passing the number to Number
can provide a small performance improvement.
2018-10-30 11:28:22 -04:00
Andrew Sliwinski
853de9fa7d
Merge pull request #1593 from joker314/fix/compare-strings
Fix locale-dependant string comparison operators to match 2.0
2018-10-04 14:38:40 -04:00
jokebookservice1
ab8d4dc560
style(util): Address linting issues 2018-09-17 22:07:26 +01:00
jokebookservice1
dab78c4f62
fix(util): Make string comparisons match Flash's, everywhere 2018-09-17 21:25:14 +01:00
Christopher Willis-Ford
69ba2045fe Rename TokenBucket to TaskQueue 2018-09-14 22:34:34 -04:00
Christopher Willis-Ford
70c6ad4ef1 Add cancelAll method to clear the task queue 2018-09-14 22:10:17 -04:00
Christopher Willis-Ford
33e0197ad5 Add tests for TokenBucket 2018-09-13 17:05:00 -04:00
Christopher Willis-Ford
28621c9860 Protect against NaN task cost 2018-09-13 17:05:00 -04:00
Christopher Willis-Ford
c8dc8fb5b9 Add TokenBucket utility class 2018-09-13 17:05:00 -04:00
Eric Rosenbaum
39be6d873c
Rate-limiting with a token bucket for the WeDo extension (#1540)
* Initial version of token bucket

* Add rateLimiter util

* Remove check for motor.isOn in stopAllMotors

* Fix unit test

* Fix unit test with stubbed timer, and cleanup

* Add comment

* Reduce WeDo rate limit to 20 sends/sec

* Move rate limit into a constant

* Stop button stops motors and tone even if rate limit exceeded
2018-08-29 17:37:59 -04:00
Paul Kaplan
138d7136af Fix various jsdoc issues preventing the docs from building 2018-07-31 11:22:42 -04:00
Karishma Chadha
812e7a3772 Preserve sprite layer order information across saving and loading an sb3. 2018-07-24 11:00:48 -04:00
Eric Rosenbaum
e02dd35dbf remove logging 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
190f4b5796 Fixing linting errors. 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
d79efbece8 Some logging cleanup. 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
613a9f96c3 Adding initial test polling for EV3 distance sensor data. 2018-07-09 13:49:41 -04:00
Evelyn Eastmond
2d8ad05a78 Adding Ev3 extension with three test blocks to latest device-connection work, auto-connecting to device for now. 2018-07-09 13:49:40 -04:00
Evelyn Eastmond
73cc149783 Adding promises to return on BLE write. Some refactoring. 2018-07-09 13:41:57 -04:00
Evelyn Eastmond
d09c3f0418 MicroBit extension, Scratch Link first draft. (#1230)
* First microbit gui tests

* Fixed JSONRPC inheritance.  Renamed ScratchBLE/ScratchBT files.  Removed ScratchBT test code from Microbit extension.  Renamed addLine to log.

* Fixed log comments.  Removed addLine from Microbit.

* Adding auto-connect to Microbit at extension loading.  Adding hack for displayText block to Scratch-Link.

* Resolved merge conflicts and brought in latest microbit extension example code.

* Updated microbit write tests for displayText and displaySymbol blocks.  Some linting.

* Some linting and adding of BLE Characteristic consts.

* Linting fixes.

* Moving micro:bit device connection code all to the MicroBit class, decoupling Scratch3MicroBitBlocks from connection code.

* Removing old disconenct handlers from MicroBit class.  Moved service into new BLEUUID data structure.

* Renamed _write to _send.  Moved all BLE encoding concerns to the _send method.

* Using the util log.  Some linting.

* Added _read method to MicroBit class.  Renamed _send to _write.

* Some linting and formatting comments.

* First pass at peripheral chooser pattern for ScratchBLE.

* Testing characteristicDidChange events, and some changes to ScratchBLE on ready events.

* Refactoring work on PeripheralChooser and ScratchBLE.

* Some variable renaming and method signature stubs.

* Peripheral chooser method signatures.

* Moved base64 encoding/decoding to util.  Some method signature formatting.

* Adding test stubs for new util and io classes.

* Adding test stub for MicroBit extension.

* Clean up for PR.

* Clean up for PR.

* Final cleanup for PR.

* Removed logging to console.

* Adding 'btoa' and 'atob' node modules and using them in Base64Util.
2018-06-18 14:56:51 -04:00
Christopher Willis-Ford
53b5ba93f5 Add tests for converting extension metadata
These tests convert some extension metadata into scratch-blocks JSON and
XML, then verify that the JSON and XML are as expected.
2018-04-09 15:37:08 -07:00