Skip to content
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

kit.continuous_servo[1].throttle = None doesn't work like kit.servo[1].angle = None #74

Open
cTurtle98 opened this issue Jun 2, 2023 · 2 comments

Comments

@cTurtle98
Copy link

cTurtle98 commented Jun 2, 2023

when I try to use
kit.continuous_servo[1].throttle = None
I get this error

TypeError: '>' not supported between instances of 'NoneType' and 'float'

@cTurtle98 cTurtle98 changed the title kit.continuous_servo[1].throttle = None doesn't work like kit.servo[1[.angle = None kit.continuous_servo[1].throttle = None doesn't work like kit.servo[1].angle = None Jun 2, 2023
@cTurtle98
Copy link
Author

cTurtle98 commented Jun 2, 2023

Servo handles None here:

@angle.setter
def angle(self, new_angle: Optional[int]) -> None:
if new_angle is None: # disable the servo by sending 0 signal
self.fraction = None
return

which passes to BaseServo_ here:

@fraction.setter
def fraction(self, value: Optional[float]) -> None:
if value is None:
self._pwm_out.duty_cycle = 0 # disable the motor
return

and here it is in continious servo

@throttle.setter
def throttle(self, value: float) -> None:
if value > 1.0 or value < -1.0:
raise ValueError("Throttle must be between -1.0 and 1.0")
if value is None:
raise ValueError("Continuous servos cannot spin freely")
self.fraction = (value + 1) / 2

but it doesnt work

@cTurtle98
Copy link
Author

some context:

I am using servokit continiousservo throttle to drive blue robotics basic esc's
https://bluerobotics.com/store/thrusters/speed-controllers/besc30-r3/
from a raspberry pi with the external servo driver board

I am trying to make the motors (connected to the esc) stop spinning and the esc to do its disarmed chime (which releases hold power on the motors)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant