Go Down

### Topic: Two Servos gimbaling in a circle (X and Y Servo) (Read 369 times)previous topic - next topic

#### Deva_Rishi

#15
##### Jan 12, 2021, 11:49 pm
Perhaps
Code: [Select]
`for (int i = 0 ; i <= 360 ; i++){  int posx = 90 + 20 * cos (i*M_PI/180) ;  int posy = 90 + 20 * sin (i*M_PI/180) ;  ....}`
Sort of what i was thinking, though i would consider  calculation the pulse length rather than the Angle for the sake of accuracy (servo.write() uses map() which is an integer calculation). Mind you the servos' probably aren't that accurate. I understand you don't have to much space for the servo connected to the inner ring, but somehow using less than 25% of the range of the servo is not ideal.
Quote
but the duct assembly has a third dimension,
it does ? I don't know if you put a laser pen in the center pointing upwards, and you do the 2D circle it will make a circle on the ceiling or whatever surface it is aimed at i'd say.
To 'Correct' you have to be Correct. (and not be condescending..)

#### lastchancename

#16
##### Jan 13, 2021, 12:03 am
... agreed, but what is the geometry of that circle ?
Dependent on the distance from the origin.
Experienced responders have a nose for laziness, (they were beginners once)... Sure, there are trolls, chest-beaters, and pretenders - but the help you'll get here is about as good as it gets - if you try to help youself!.

#### Robin2

#17
##### Jan 13, 2021, 10:08 am
I don't know if you put a laser pen in the center pointing upwards, and you do the 2D circle it will make a circle on the ceiling or whatever surface it is aimed at i'd say.
Until the OP explains clearly what he is trying to do all the is just speculation (IMHO).

What would be the point of moving a ducted fan so that a hypothetical laser pointer could draw a circle on a ceiling?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

#### MarkT

#18
##### Jan 13, 2021, 12:21 pm
What would be the point of moving a ducted fan so that a hypothetical laser pointer could draw a circle on a ceiling?

...R
Control surface pre-flight check - shows smooth and independent operation of both gimbal axes.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

#### amanbasra

#19
##### Jan 13, 2021, 12:27 pm
Until the OP explains clearly what he is trying to do all the is just speculation (IMHO).
Sorry if It's not been clear. Not sure how better illustrate it. I'll capture a video a video of the motion I wish to achieve  by moving the motor by hand once the structure has been re printed.

Are there any suggestions as to a more accurate system that isn't excessively expensive or larger. Steppers simply wouldn't fit the project.

That won't be until a few days so heres a little capture of the motion in cad (different to the initial image). This should show how the EDF will be moved. The fuselage will restrict the movement to 20 degrees. out of centre. The idea is that it can pivot 20 degrees in any direction between the two servo controlled axis... which would create a theoretical circle of which the motor is able to be moved within (refer to the horrifically drawn out diagram) The outer circle represents the limit of how far from the centre position the motor can move. I want to be able to move the motor along that line essentially to circularly gimbal the motor.

Perhaps "circular" is the wrong term, as there is in-fact a 3rd dimension that the motor will move in which I hadn't paid much attention to but I can see how that changes things and adds a layer of complexity.

#### Robin2

#20
##### Jan 13, 2021, 02:36 pm
Sorry if It's not been clear. Not sure how better illustrate it. I'll capture a video a video of the motion I wish to achieve  by moving the motor by hand once the structure has been re printed.
It would be a big help (to me, at least) if you explain the purpose of this gimballing and circling.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

#### amanbasra

#21
##### Jan 13, 2021, 03:14 pm
Control surface pre-flight check - shows smooth and independent operation of both gimbal axes.
Exactly right. Also to ensure that the servo arms are in the right position so that when the servo is set to 0 the servo arm is in fact in the 0 position.
It would be a big help (to me, at least) if you explain the purpose of this gimballing and circling.

...R
Like Mark said the main purpose of the circular motion is pre flight check and calibration to confirm the thrust vectoring system is working. If you mean the purpose of it in relation to the project, the gimbaling is the "steering' and stabilisation system. This will prevent the whole things from flying lopsided or be taken by a gust of wind and resulting in a RUD. I'll use a PID loop to keep the orientation straight up when in flight, the actuator for which will be those two servos responding to accelerometer data.

#### Deva_Rishi

#22
##### Jan 13, 2021, 04:00 pm
Quote
Perhaps "circular" is the wrong term, as there is in-fact a 3rd dimension that the motor will move in which I hadn't paid much attention to but I can see how that changes things and adds a layer of complexity.
Maybe you can explain why the 'circular' movement created by the sinus and cosinus is or isn't doing what you want ? I think it should do what you want, taking the motor 20 degrees out of the center in every direction. Since we are only focused on the direction the 3rd dimension seems irrelevant.
As for accuracy i was thinking along the lines of using the servo's full 180 degrees to make the motor shift only 40 degrees using a rod or a chain function, but the play on that would probably negate the increase in accuracy. That leaves the calculation that is done software wise which can be improved upon by calculating the pulse length to the servo in float (rather than in 16-bit integer)
To 'Correct' you have to be Correct. (and not be condescending..)

#### Robin2

#23
##### Jan 13, 2021, 04:25 pm
Exactly right. Also to ensure that the servo arms are in the right position so that when the servo is set to 0 the servo arm is in fact in the 0 position.Like Mark said the main purpose of the circular motion is pre flight check and calibration to confirm the thrust vectoring system is working. If you mean the purpose of it in relation to the project, the gimbaling is the "steering' and stabilisation system.
That gives me a much better understanding.

But I still don't see the role of the circling. Surely all that is needed is to ensure that each servo can smoothly move the thrust direction along its axis and that could be done with the servo-sweep example that comes with the Arduino IDE.

I don't know how much thrust your ducted fan can produce but the gimballing system in your picture in Reply #10 looks very flimsy to my unprofessional eye.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

#### amanbasra

#24
##### Jan 13, 2021, 04:51 pm

calculating the pulse length to the servo in float (rather than in 16-bit integer)
I'll give this a go. I have yet to try the sine cosine so hopefully it'll do the trick.
But I still don't see the role of the circling. Surely all that is needed is to ensure that each servo can smoothly move the thrust direction along its axis and that could be done with the servo-sweep example that comes with the Arduino IDE.
A sweep would work, but I'd like to circle the circumference of its motion zone to ensure it theres nothing restricting movement. The final prototype will be fairly congested and with lower tolerances. The gimbaling structure will be 50mm smaller it will be less forgiving. The idea is if it can perform the circular movement successfully that will let me know the control system is fully functional on that end, as opposed to just in one direction on the x or y axis. A sweep probably would suffice but for some reason I have a knack for pursuing the difficult option and being more thorough. Plus I'd much rather things work than have to spend days reprinting parts each time it fails miserably.
I don't know how much thrust your ducted fan can produce but the gimballing system in your picture in Reply #10 looks very flimsy to my unprofessional eye.
Quite right, it is very flimsy at the moment. The little structure is simply a test structure for testing some different nozzles types and exit diameters to find the combination that offers the most thrust. Just thin low infill parts because they're prone to breaking (as they have) while testing. Would've liked to try some computational fluid dynamics to try determine the nozzle side of things but that seemed too much of a rabbit whole to jump down for someone with extremely limited knowledge on fluid dynamics. I have a design for the final design that will be 3/4s more compact than it is at the moment. There is of course a fine line to walk between structural integrity and keeping things minimal to reduce weight.

#### Robin2

#25
##### Jan 13, 2021, 05:50 pmLast Edit: Jan 13, 2021, 07:06 pm by Robin2
I'll give this a go. I have yet to try the sine cosine so hopefully it'll do the trick. A sweep would work, but I'd like to circle the circumference of its motion zone to ensure it theres nothing restricting movement.
Gee -- it took an awfully long time to get that explanation

Now that I understand it I can make sense of what you said in your Original Post.

Would this general idea work?

Leave one servo at its mid point (90) and move the other servo fully "south" (180) (Using the compass points for simplicity).

Then sweep both servos in small steps with the one that is "south" moving up to the mid point and the other one moving from the mid point to (say) full West. In very simple terms, with code like this
Code: [Select]
`for (byte n = 0; n <= 90 ; n++) {  servoNorthSouth.write(180 - n);  servEastWest.write(90 + n);  delay(100);}`
Or is that just too simple?

EDIT to add - yes it is too simple. It would just move in a diagonal.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

#### amanbasra

#26
##### Jan 13, 2021, 08:27 pm
Perhaps
Code: [Select]
`for (int i = 0 ; i <= 360 ; i++){  int posx = 90 + 20 * cos (i*M_PI/180) ;  int posy = 90 + 20 * sin (i*M_PI/180) ;  ....}`
This has worked a treat, thanks again Mark! Thanks to everyone else for your input too!

#### Deva_Rishi

#27
##### Jan 13, 2021, 08:36 pm
Quote
A sweep would work, but I'd like to circle the circumference of its motion zone to ensure it theres nothing restricting movement.
In that case you should probably go for a square, not a circle. Unless your circle will be your boundary. You could just take the angle and direction as inputs i suppose, and always calculate x & y positions from that.
To 'Correct' you have to be Correct. (and not be condescending..)

#### Robin2

#28
##### Jan 13, 2021, 09:24 pm
One thing you probably need to be careful of is the possibility that the servos go beyond the positions calculated by the sin / cos code.

It may be wise to design the mechanics so no damage can be done at the extremes of both servos - in other words maybe there needs to be a clear square space rather than a circular space.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up