I just updated my code to use pigpio instead of RPi.GPIO, the later is working but my robot is trembling like a chihuahua, so I gave pigpio a try.
In this piece of code I'm moving my servo, so to move it 90 degrees I was sending 7.07 , based on this calculation (my servo goes up to 270 degrees):
def AngleCalculation(angle):
return float(angle) / 27 + 2
and the result would be applied here:
def ExecuteRotationOnServo(angle):
p[currentMotor].ChangeDutyCycle(angle)
now after update to pigio the same angle doesn't move the servo at all, but I did notice that with big numbers like 100 or 150 it does move (not in the correct angle), with 200 or 10 it doesn't (I couldn't understand why, the documentation says that 0-255 should work):
def ExecuteRotationOnServo(angle):
pi.set_PWM_dutycycle(motorsPin[currentMotor],angle)
After reading the documentation I'm even more confused, I can't see any units or formula to get angles to work with it (I'm new to this so maybe it is just my ignorance), googling didn't help at all, just found this link with a formula but in it the answer assumes that I know the pulse width of an specific angle (and I have no clue, my previous code were happy with simple numbers)
How can I convert angles into something that pigpio can understand?
Why aren't angles the basic unit for this kind of things? (I'm assuming that angles is way less accurate or something like that?)