-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Spike Essential projects #87
Comments
Sure! I can share code and LDraw file... from pybricks.hubs import EssentialHub
from pybricks.pupdevices import Motor, ColorSensor, ColorLightMatrix
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop, Axis
from pybricks.robotics import DriveBase
from pybricks.tools import wait, StopWatch
hub = EssentialHub()
# Motor order doesn't matter
hipsmotor1=Motor(Port.A)
hipsmotor2=Motor(Port.B,Direction.COUNTERCLOCKWISE)
# Set capabilities well above physical limits to maximize power/speed
maxspeed=1000
hipsmotor1.control.limits(maxspeed,8000)
hipsmotor2.control.limits(maxspeed,8000)
# This hips angle provides a good match with natural period of pendulum
hipsangle=55
wait(1000)
while True:
# Wait till we are on top of swing
while hub.imu.angular_velocity(Axis.X)>0:
continue
# Then rotate legs
hipsmotor1.run_target(maxspeed,hipsangle,wait=False)
hipsmotor2.run_target(maxspeed,hipsangle)
while hub.imu.angular_velocity(Axis.X)<0:
continue
hipsmotor1.run_target(maxspeed,-hipsangle,wait=False)
hipsmotor2.run_target(maxspeed,-hipsangle) |
Thank you @ZPhilo ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need to make instructions and publish code for:
Tic Tac Toe
Balancer
The text was updated successfully, but these errors were encountered: