Hi Martin
Thanks for this. I'll try and test it out later today and let you know how I get on.
Regards
Servo MoveToAngle
-
chipfryer27
- Valued Contributor
- Posts: 2122
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 474 times
- Been thanked: 705 times
-
chipfryer27
- Valued Contributor
- Posts: 2122
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 474 times
- Been thanked: 705 times
Re: Servo MoveToAngle
Hi Martin
Using a PIC18877 @ 32MHz and a MG90S servo which should give 180 degrees of rotation for widths between 1mS - 2mS, on my virtual scope I get for MoveToAngle (byte 0 - 180) pulse widths of
0 = 1mS
45 = 1.25mS
90 = 1.49mS
135 = 1.73mS
180 = 1.99mS
My proper scopes may show something more accurate but any difference would be trivial and the above is more than accurate enough for me.
However that only moves by 50% of expected. 90 moves by 45 degrees and 180 moves by 90 degrees. This is more to do with the cheapo servo I am using than anything Flowcode related.
Using MoveToPosition with byte values of 0 - 255 I got widths of
0 = 1mS
64 = 1.25mS
128 = 1.50mS
196 = 1.76mS
255 = 1.99mS
Again this moved 50% of expected and again is due to the servo.
Thanks for fixing.
Regards
Using a PIC18877 @ 32MHz and a MG90S servo which should give 180 degrees of rotation for widths between 1mS - 2mS, on my virtual scope I get for MoveToAngle (byte 0 - 180) pulse widths of
0 = 1mS
45 = 1.25mS
90 = 1.49mS
135 = 1.73mS
180 = 1.99mS
My proper scopes may show something more accurate but any difference would be trivial and the above is more than accurate enough for me.
However that only moves by 50% of expected. 90 moves by 45 degrees and 180 moves by 90 degrees. This is more to do with the cheapo servo I am using than anything Flowcode related.
Using MoveToPosition with byte values of 0 - 255 I got widths of
0 = 1mS
64 = 1.25mS
128 = 1.50mS
196 = 1.76mS
255 = 1.99mS
Again this moved 50% of expected and again is due to the servo.
Thanks for fixing.
Regards
-
BenR
- Matrix Staff
- Posts: 2307
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 639 times
- Been thanked: 848 times
Re: Servo MoveToAngle
Thanks Martin, I've been through and merged in your changes as well as added a new SetCalibrationAngle function to allow the angles to be calibrated to a specific motor. Once calibrated it means if you ask for a movement of 10 degrees then you should get 10 degrees.
Iain - If you're range of motion is a bit low you can increase the max us pulse width timing to around 2500. You can also maybe bring the min down a bit to say 750 or 500.
Iain - If you're range of motion is a bit low you can increase the max us pulse width timing to around 2500. You can also maybe bring the min down a bit to say 750 or 500.
-
medelec35
- Valued Contributor
- Posts: 2436
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 783 times
- Been thanked: 844 times
Re: Servo MoveToAngle
Your welcome.
Thanks Ben
Wow sounds like a great component has got even better!
Thanks Ben
Martin
-
chipfryer27
- Valued Contributor
- Posts: 2122
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 474 times
- Been thanked: 705 times
Re: Servo MoveToAngle
Hi
I then saw Ben's post above and thought that I might now have extra steps to make it move, such as adding in the Set Calibration value. This I did but I still don't get any output.
Am I missing something? If I roll back the component it provides an output.
Regards
FC informed of a new update (for the component) just after I posted my findings above, so I downloaded it and got no output...Thanks Martin, I've been through and merged in your changes as well as added a new SetCalibrationAngle function to allow the angles to be calibrated to a specific motor. Once calibrated it means if you ask for a movement of 10 degrees then you should get 10 degrees.
Iain - If you're range of motion is a bit low you can increase the max us pulse width timing to around 2500. You can also maybe bring the min down a bit to say 750 or 500.
I then saw Ben's post above and thought that I might now have extra steps to make it move, such as adding in the Set Calibration value. This I did but I still don't get any output.
Am I missing something? If I roll back the component it provides an output.
Regards
-
chipfryer27
- Valued Contributor
- Posts: 2122
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 474 times
- Been thanked: 705 times
Re: Servo MoveToAngle
Hi Martin
My post of 11:32am above used your component downloaded about fifteen minutes earlier and gave outputs similar to yourself.
Regards
My post of 11:32am above used your component downloaded about fifteen minutes earlier and gave outputs similar to yourself.
Regards
-
chipfryer27
- Valued Contributor
- Posts: 2122
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 474 times
- Been thanked: 705 times
Re: Servo MoveToAngle
Hi
I'm not a 100% certain I checked default Pin output after updating to latest component. I downloaded and did a reload as I had my chart open. I think I did but not 100%.
If the component went to a default then that would explain why I didn't get any output as the chances of the default being the port/pin I'm using is low
, but as it did come up showing two channels it clearly has picked up some of my settings.
I'll check when I get a chance.
Regards
EDIT.....
Opened up a previous chart on another laptop that uses the servo controller and was informed of the update. The update didn't change the pin I had allocated so it looks like there may be a problem with the update.
I'm not a 100% certain I checked default Pin output after updating to latest component. I downloaded and did a reload as I had my chart open. I think I did but not 100%.
If the component went to a default then that would explain why I didn't get any output as the chances of the default being the port/pin I'm using is low
I'll check when I get a chance.
Regards
EDIT.....
Opened up a previous chart on another laptop that uses the servo controller and was informed of the update. The update didn't change the pin I had allocated so it looks like there may be a problem with the update.
-
medelec35
- Valued Contributor
- Posts: 2436
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 783 times
- Been thanked: 844 times
Re: Servo MoveToAngle
Hi Iain.
Sorry I did not see your post, I have read it now.
I agree I could not get the servo to work either.
I have modified Bens version so it work and has his additional functions.
Can you give that a try instead?
Sorry I did not see your post, I have read it now.
I agree I could not get the servo to work either.
I have modified Bens version so it work and has his additional functions.
Can you give that a try instead?
- Attachments
-
- Servo_Controller.fcpx
- (18.15 KiB) Downloaded 1 time
Martin
-
chipfryer27
- Valued Contributor
- Posts: 2122
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 474 times
- Been thanked: 705 times
Re: Servo MoveToAngle
Hi Martin
I can try it tomorrow but if you have it working I'm sure it will be good.
Thanks
I can try it tomorrow but if you have it working I'm sure it will be good.
Thanks