Commit Graph
84 Commits
Author SHA1 Message Date
Laurens Valk bfe80edff6 ev3/snippets/bluetooth_pc: run client as python3
Even though our main example will have the PC as the server, make it possible to use it as client as well.

Now, it works just like the EV3s. The only difference is that
you must enter the full address instead of the name if the EV3 is the server you are connecting to.
2020-05-07 11:56:36 +02:00
Laurens Valk db10b75808 ev3/snippets/bluetooth_pc: run server as python3
This removes the MicroPython struct and socket specifics and replaces them with Python3 counterparts.

Also a few changes are made to deal with strings, which on MicroPython are just bytes.

Now, the server works on Python3 and client EV3s can connect to it.
2020-05-07 11:56:36 +02:00
Laurens Valk 9b3908090d ev3/snippets/bluetooth_pc: run MicroPython Unix
This is a copy of the EV3 server example with minimal changes
to make it run on a PC, using the unmodified MicroPython Unix port.

This is done by skipping the name resolver. The downside is that you
must specify the EV3 server address instead of its name.  However,
since in this example the PC will be the server, this is not really a
problem. The EV3 clients will just connect to the PC by its name.
2020-05-07 11:56:36 +02:00
Laurens Valk 5d943a609d ev3/snippets/bluetooth_pc: copy pybricks bluetooth
This copies the Pybricks MicroPython bluetooth implementation. As-is, it only runs in Pybricks MicroPython.

The next commits will adapt it to work with MicroPython and then Python3. We only need the Python3 end result, but this staged approach makes it easy to keep track of what will be changed.
2020-05-07 11:56:36 +02:00
Laurens Valk 21eac3abda ev3/snippets/bluetooth_pc: hello world launch
This creates an empty hello world style Python3 example
2020-05-07 11:56:36 +02:00
David Lechner 4da888ec52 official_models/ev3: add header to all programs
Add a header with links to the LEGO Education website for building
instructions and SD card image download. This way if someone gets a
copy of the program, they don't have to go searching for documentation.
2020-05-06 16:53:19 -05:00
David Lechner a7a57ee27e official_models/ev3/color_sorter: fix stalled duty cycle limit
30% is near the static friction limit of the medium motor itself. In the latest tests, the motor was stalling without moving, so bump up the minimum duty cycle to fix it with a reasonable safety margin.
2020-05-06 12:35:56 -05:00
Laurens Valk 51871031b8 README: Add link to support page 2020-04-28 15:27:51 +02:00
Laurens Valk 8f0e674b58 workspaces: generate 2020-04-28 15:18:40 +02:00
Laurens Valk c8bf8f4bbc workspaces: update script to sort alphabetically 2020-04-28 15:18:31 +02:00
Laurens Valk df83ea583e official/ev3/educator: fix docstring typo 2020-04-28 15:17:48 +02:00
Laurens Valk 15380261c9 official_models/ev3/educator/basic: flake8 2020-04-24 14:09:12 +02:00
Laurens Valk 6ef77a28da ev3: update workspaces 2020-04-24 14:04:53 +02:00
Laurens Valk d6e4470061 official_models/ev3/educator: rename main sample
As there are now multiple examples,  we rename this one to ultrasonic to better reflect what it does and which robot educator extension is required.
2020-04-24 13:12:27 +02:00
Laurens Valk 8b9d249e2e official_models/ev3/educator: add basic movement 2020-04-24 13:07:02 +02:00
Laurens Valk 2392e1bc66 official_models/ev3/educator: add line follower 2020-04-24 13:01:06 +02:00
Peter Iannone 3d7a1c6b0a Fix gyro_bot failing to leave stand.
Remove extra gyro_offset factor that causes gyro_bot to not leave the stand.
My gyro sensor has an offset of -17 which causes gyro_offset to become very large with this calculation.
Since the code is using the `*=` operator, the current calculation is `(1 - GYRO_OFFSET_FACTOR) * gyro_offset * gyro_offset`, but I believe the desired calculation is `(1 - GYRO_OFFSET_FACTOR) * gyro_offset` to make this moving average correct.
2020-04-23 10:20:16 -05:00
Laurens Valk 50c96cadb3 ev3: update workspaces 2020-04-16 15:07:42 +02:00
Laurens Valk 52ee3b772b snippets/ev3: split datalog into separate projects
Use the standard style instead of having them as launch configurations.
2020-04-16 15:07:22 +02:00
Laurens Valk 79e1064ae9 snippets/ev3/datalog: fix extension kwarg
Make the example match the doc.
2020-04-10 13:07:47 +02:00
Laurens Valk 18185b4d87 official_models/ev3/robot_educator: update example
This adds the updated example
2020-04-01 15:58:43 +02:00
Laurens Valk 039fec242b official_models/ev3/stair_climber: fix imports
also make looped waits consistent
2020-04-01 13:31:26 +02:00
Laurens Valk ab8b560ef4 official_models/ev3/snap: fix imports, head reset 2020-04-01 13:31:26 +02:00
Laurens Valk 9d96435675 official_models/ev3/elephant: fix brake, imports
The original example used brake, so let's keep using it.

Also fix media imports
2020-04-01 13:31:26 +02:00
Laurens Valk 0ef1a9f956 snippets/ev3: update workspaces
run ./update_workspaces.py
2020-04-01 13:31:26 +02:00
Laurens Valk 3744ad1918 official_models/ev3: update workspaces
run ./update_workspaces.py
2020-04-01 13:31:26 +02:00
Laurens Valk cabe91a044 official_models/ev3/tank_bot: fix driving
This example computed time from length, to then drive for that time. Since there is now simply a function to drive straight for a given distance, use that instead.

Also add wait after drive(0, 0) to give it some time to reach that speed (a standstill).

Also fix ImageFile import
2020-04-01 13:31:26 +02:00
David Lechner 63cf2ec4b5 official_models/ev3: expansion programs v2.0
Start updating these examples to 2.0 API
2020-04-01 13:31:26 +02:00
David Lechner 32b57a8cdd official_models/ev3: expansion programs v1.0 2020-04-01 13:31:26 +02:00
David Lechner 28e3bc8f0c Fix typo too/to 2020-03-26 16:22:19 -05:00
Laurens Valk 8cf77b8576 official/ev3/puppy: flake8
Stop is no longer used since d4d48efdbb
2020-03-26 13:54:16 +01:00
David Lechner d59bf03daf snippets/ev3: Split screen into separate projects
These will be included as examples in the API docs
2020-03-26 13:44:22 +01:00
Laurens Valk 51c91aebd7 official_models/ev3: update control API
Although set_run_settings remains implemented, we update the examples to use the updated API
2020-03-26 13:43:10 +01:00
David Lechner d4d48efdbb official_models/ev3: Update for motor API changes
Breaking changes were made in the motor API.

The stop(Stop.*) methods was split into explicit methods and the stop
argument in run_* methods was renamed and the default value changed in
some cases.
2020-03-26 13:43:10 +01:00
Laurens Valk 6a57abbff6 snippets/ev3/bluetooth: update mailbox name
In examples, it is helpful to give unrelated things different names.
2020-03-25 12:59:16 +01:00
Laurens Valk af926c5f19 snippets/ev3/buttons_quickstart: initial project
This is a demo of:
- multi-file project
- using images
- creating a "menu"

This program can be started away from the competition table.
Then a mission can be quickly activated by pressing one of the buttons.
2020-03-20 13:58:09 +01:00
David Lechner 90f2522068 CONTRIBUTING: new contributing guidelines
This file just links to pybricks-api since this repository
is not a stand-alone project.
2020-03-13 10:09:23 -05:00
David Lechner 789353ff3e AUTHORS: new authors file
This file explains code ownership.
2020-03-13 10:05:26 -05:00
Laurens Valk 5756a9caa0 ev3/puppy: flake8 2020-03-05 16:52:53 +01:00
Laurens Valk 221a7df0a5 official_models/ev3: add missing launch files
And update workspace
2020-03-05 16:46:26 +01:00
David Lechner 3b222fb2b4 ev3/puppy: fixes
- fix eyes blinking too long
- fix using 100% cpu when adjusting head
2020-03-05 16:44:49 +01:00
David Lechner 19f70a0bdb ev3/puppy: Mostly completed program 2020-03-05 16:44:41 +01:00
David Lechner 36522ad7ce ev3/puppy: new program (incomplete) 2020-03-05 16:44:24 +01:00
David Lechner fa0ef54fee ev3/color_sorter: set duty limit
This way, we don't torque so hard on parts that can't move
2020-03-05 16:44:20 +01:00
David Lechner 7772e76de4 ev3/color_sorter: add example 2020-03-05 16:43:50 +01:00
David Lechner 7fea4e5912 ev3/gyro_boy: remove unused type 2020-03-05 16:43:44 +01:00
David Lechner 53cf86265f ev3/gyro_boy: don't hog CPU
This uses wait() instead of busy waiting so we don't hog the CPU.
The busy wait was previously used because of motor control timing bugs.
2020-03-05 16:43:38 +01:00
David Lechner d399974119 ev3/gyro_boy: improvements
- more explanations
- explicit actions
- more consistent with EV3-G/scratch programs
2020-03-05 16:43:25 +01:00
David Lechner e07d3d05e8 ev3/gyro_boy: Add sensor input task
Functionality is still not quite the same as EV3-G/Scratch.
action_update() should remember the old speed during ultrasonic
reaction and then restore it.

Also, tuning is a bit off since loop time is ~26ms compared to ~18
in EV3-G/Scratch.
2020-03-05 16:42:51 +01:00
David Lechner 355c526412 ev3/gyro_boy: example (incomplete) 2020-03-05 16:41:48 +01:00