Small Line Follower with Prime Hub and mixed Powered Up elements #149
Replies: 17 comments
-
Thanks for sharing. I think you are the first user in the world to dual boot the Inventor Hub! It's cool to see that these motors are already working as well - I don't have them. If you like, here are some ideas for further exploration:
Disconnecting USB used to work, I think. We'll have to try that again. We might even change the way USB works after we enable Bluetooth. At that point, it could work just the like other hubs, leaving the USB free for other things like fast file transfer. We're not sure yet, so feel free to share your wishes and feature requests :) |
Beta Was this translation helpful? Give feedback.
-
Well you already said BT - using the Chrome IDE would be good for beginners since using text editor and pybricksdev might scare them. For me BT would also have the advantage of using the Nordic UART (if supported on this firmware) to cooperate with other systems until full messaging is available. Can't remember any particular feature I might need... I am still trying to figure how to use most of the API like Grid and Speaker (I think still missing?). Generally speaking, having support for all internal devices of the PU family hubs would be great but it's already on the roadmap. Thanks for the tips, will try them. |
Beta Was this translation helpful? Give feedback.
-
Speaker is not implemented yet, but we're investigating to include (very basic) speech synthesis 🤓 . There is some experimental IMU functionality in there already, so have a look at the |
Beta Was this translation helpful? Give feedback.
-
I already found the experimental IMU, had been using it with Control+ hub for a wristband-based HID controller - sending the output of the IMU to a "master" device on a bakcpack where it calculates the orientation of the wrist. But my math is very rust and only implemented 2 DOF. |
Beta Was this translation helpful? Give feedback.
-
Have also tried to install the Pybricks firmware too, but regardless of not so smooth feedback progress at the console and the success message in the end, it always end booting with the LEGO firmware. |
Beta Was this translation helpful? Give feedback.
-
That's a good sign! It means the update was successful. This feature is not ready for average user yet, though. It's more like a proof of concept for now :) Please use the Technic Hub for real projects for now. Switching over will be easy later since motors and sensors work the same across all hubs. |
Beta Was this translation helpful? Give feedback.
-
Yeah! Not a real project, just wanted to give it a try! :) |
Beta Was this translation helpful? Give feedback.
-
It's great to have your feedback, we appreciate it. This gives us more confidence in the procedure. It works just like the official update procedure, but still :) There's already a version on the way which will show progress using the pixels on the screen. When you reach 100%, all lights will be on. As you have found, turning on the Pybricks firmware still need some work. The reason is this: by the time we check the button state, the power is not on yet, so it cannot read the button state. |
Beta Was this translation helpful? Give feedback.
-
Small update: thanks to a Laurens suggestion the robot no longer needs to be tethered so I can now let it run full speed on the floor. # with Laurens Valk tips
# for Proportional control and COUNTERCLOCKWISE option
from pybricks.hubs import PrimeHub
from pybricks.parameters import Port, Color, Direction, Button
from pybricks.pupdevices import Motor, ColorDistanceSensor
from pybricks.tools import wait
hub = PrimeHub()
mL = Motor(Port.E, Direction.COUNTERCLOCKWISE)
mR = Motor(Port.F)
s = ColorDistanceSensor(Port.A)
SPEED = 95
TIME = 1
THRESHOLD = 55
KP = 2.5
# wait for LEFT button to be pressed
while True:
if hub.buttons.pressed() == [Button.LEFT] :
break
wait(10)
while True:
wait(TIME)
v = s.reflection()
print(v)
steering = (v - THRESHOLD) * KP
mR.dc(SPEED + steering)
mL.dc(SPEED - steering) not sure about that "wait(TIME)" line... forgot to comment it but it probably works fine without it. |
Beta Was this translation helpful? Give feedback.
-
Nice and clean 😄 Do you want to share the video link as well? By the way, here's a another trick you can use to wait for any button: # wait for any button to be pressed
while not any(hub.buttons.pressed()):
wait(10) |
Beta Was this translation helpful? Give feedback.
-
Do you have new app script to flash the FW that supports unthetered
operation?
Best,
Fernando Correia
Sent without an iPhone... 😁
…On Mon, Oct 19, 2020, 10:40 Jorge Pereira ***@***.***> wrote:
I thought you would never ask :D
https://youtu.be/oHwqm5GqPTU
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/pybricks/support/issues/149#issuecomment-711934076>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQAYD3NVHHOT327U4JK4RYTSLQCPFANCNFSM4SPW6K3A>
.
|
Beta Was this translation helpful? Give feedback.
-
No, the firmware is the same. |
Beta Was this translation helpful? Give feedback.
-
Since you are already using REPL, you can also copy&paste the whole script into it. |
Beta Was this translation helpful? Give feedback.
-
I wonder, did USB still hang if you removed the |
Beta Was this translation helpful? Give feedback.
-
yes it did.
before the change, with our without the "print" command, i never saw that last line. |
Beta Was this translation helpful? Give feedback.
-
but before the change, I could re-run it again (as long as never removed the USB cable). |
Beta Was this translation helpful? Give feedback.
-
Description
Just what the title says: a very small line follower with very few pieces to demonstrate Pybricks' potential
I flashed my Prime Hub from the 51515 Robot Inventor set with v3.0.0a9 so it now does dual boot and I can use pybricksdev with it through the USB cable.
Since I didn't want to disassemble my current 'Blast' configuration, I used just the hub with a few other pieces I had available - particularly 2 large Technic motors (identical to the large motors from the SPIKE set) and 1 Color/Distance sensor from the BOOST set.
Source Code
Code is very simple and quick tuned for running over a common sheet of paper. At this early stage of pybricks support for the Prime Hub, I have to run the code in tethered mode so a small closed circuit is enough for demonstration with a short USB cable connected to my laptop.
Building instructions
I believe there is no need for instructions as anyone can build this toy in less than 5 minutes
Beta Was this translation helpful? Give feedback.
All reactions