Author Topic: Bot-Making Help  (Read 898 times)

Schicko

  • Member
  • **
  • Posts: 21
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #15 on: March 29, 2016, 06:33:28 pm »
I figured that my bot design can't achieve the full degree of movement that Trook's TI can, so decided to make myself one of those and start from that design instead. Unfortunately, despite trying to duplicate the programming in the video as close as I can, my TI doesn't work like the one in the video and breaks.. Can someone help with this please?  ;D

Here is what I came up with: https://www.dropbox.com/s/qj6b51m1veptthe/bp_TI?dl=0

That one breaks after leaving it alone for a couple seconds, so here is an older version which has linear velocity controls disabled: https://www.dropbox.com/s/ian5tolhpxv8e6w/bp_TI4?dl=0

That one only breaks when you try and use angular velocity controls.

I tried my bot in both vanilla and modded clients, but it still breaks. I feel like I am probably doing the controls wrong, but I'm not sure where I went wrong with them.

MarvinMan

  • Automation Expert
  • Experienced Member
  • ***
  • Posts: 236
  • Likes: +4/-0
    • View Profile
Re: Bot-Making Help
« Reply #16 on: March 29, 2016, 10:43:11 pm »
The control system on the old one looks reasonable. The way it runs away rather than oscillating wildly suggests that you've got a positive kp/kd where it should be negative.

I'd recommend adding some fins for stable mechanical damping, and using MIN/MAX functions to limit the thrust values to something you can contain.

z26

  • Experienced Member
  • ***
  • Posts: 108
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #17 on: March 30, 2016, 04:33:01 am »
Sometimes i noticed than in highly critical code, the order you created the code hexes in can actually matter.  Sort off like 2 + (4 * 8 ) doesnt give the same result than (2 + 4) * 8

This can be slightly annoying since theres no way to notice that order by looking at the code.

Schicko

  • Member
  • **
  • Posts: 21
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #18 on: March 30, 2016, 01:08:20 pm »
Thanks all. Apparently all I needed was to rest a bit so I could better figure out what I was doing wrong. The angular velocity controls were all wrong as I had assumed that TrookLue made it so that [8] would make it pitch down and [5] would pitch up which wasn't the case. Also I muddled the roll controls, so that didn't help either. I've fixed it now though: https://www.dropbox.com/s/7qntthmbjamo9qp/bp_TI7?dl=0

Maybe I will implement better controls as per Marvin's suggestions and also add some weapons to it later.

Thanks again.

Edit: I think a bot that uses less parts than TI but can also move like it could be made. It would look something like https://www.dropbox.com/s/4s4kh3mqu2w0ehr/bp_1?dl=0 . The different degrees of movements would be attained by the 6 jets using thrust vectoring. I have no idea how that could be programmed in though  ;D. Any ideas?
« Last Edit: March 30, 2016, 03:33:10 pm by Schicko »

Schicko

  • Member
  • **
  • Posts: 21
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #19 on: March 31, 2016, 06:30:33 pm »
No takers :'( ? It would be really great if someone could tell me how I might program PID controlled thrust vectoring even for one motor-elbow-jet setup, then at least I could try and go on from there. https://www.dropbox.com/s/51z5dsi5c1h51h5/bp_2?dl=0

MarvinMan

  • Automation Expert
  • Experienced Member
  • ***
  • Posts: 236
  • Likes: +4/-0
    • View Profile
Re: Bot-Making Help
« Reply #20 on: March 31, 2016, 09:21:20 pm »
That flies surprisingly well. The kp or the attack/release on the translational controls are perhaps a bit too aggressive. I'd be inclined to remove the ki term and calculate the required lift force directly from the pitch/roll so that it doesn't keep ramping up the trust when it hits a solid obstacle.

When it comes to thrust vectoring, trigonometry is your friend (but watch out for NaN outputs). I think your best option would be to use two elbows at 90 degrees rather than a single elbow on a motor. In that case, the top and bottom jets provide the lift, one set of elbows controls pitch and the other set controls roll. (use trig to calculate how much thrust to feed into the non-lift jets.

FYI, edits don't seem to show up as new posts, so if you have something new to add that you want people to see, make a new post (or message someone specific).

Schicko

  • Member
  • **
  • Posts: 21
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #21 on: March 31, 2016, 10:11:53 pm »
Hey thanks MarvinMan! I will try out removing the ki, but I'm not sure how I'd make it calculate the forces required. I think the same would apply for the thrust vectoring issue. How would I make it calculate the required forces/angles actively if their states change quickly and frequently? Do I just use the math operand and make it calculate lift force by using trig/pythag on the pitch/roll jets' thrust values? Keep in mind I am still a noob at Rawbots and robotics in general and I basically just figured out how to make TrookLue's bot by watching his video and using some common sense.

Oh and next time, I promise to edit less and post more ;D . Thanks again.

Edit: Whoops. Sorry for the mixup. Also realised it might not just be pythag I need to resolve vectors.
« Last Edit: March 31, 2016, 11:48:24 pm by Schicko »

z26

  • Experienced Member
  • ***
  • Posts: 108
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #22 on: March 31, 2016, 10:22:49 pm »
That's not Pressureline :p

MarvinMan

  • Automation Expert
  • Experienced Member
  • ***
  • Posts: 236
  • Likes: +4/-0
    • View Profile
Re: Bot-Making Help
« Reply #23 on: April 01, 2016, 10:58:07 am »
If you have a jet on an elbow, and want to use it to provide thrust along some combination of two perpendicular directions (X and Y), you need to calculate the total thrust required and the angle of the elbow. Assuming you know what thrust you need it the X and Y directions, use those two values as the perpendicular sides of a right-angled triangle.

Use pythagoras to calculate the total thrust required (ie. the hypotenuse of the triangle)

Use trig to find the angle for the elbow. The function you need depends on the exact mechanical configuration, but ATAN should work for a jet placed directly on an elbow like in that blueprint you uploaded.

To calculate the total lift thrust required you need either the SIN or COS of the pitch and roll, then use pythagoras to combine those values. I have a bot that does something similar to enable jets that let it drive on walls or the ceiling. If you can't work it out yourself, I can upload the blueprint.

Schicko

  • Member
  • **
  • Posts: 21
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #24 on: April 01, 2016, 12:35:59 pm »
Thanks for the explanations MarvinMan, and sorry for the inconvenience. I think what you've said makes sense. I'll try working it out for myself, but feel free to upload your blueprint so I and others can use it for future reference.

Schicko

  • Member
  • **
  • Posts: 21
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #25 on: April 01, 2016, 03:56:17 pm »
MarvinMan, I tried to implement your suggestion for TI and here is what I came up with: https://www.dropbox.com/s/dw2a3hj2su2i7t1/bp_TI2?dl=0 . Was that what you meant?

MarvinMan

  • Automation Expert
  • Experienced Member
  • ***
  • Posts: 236
  • Likes: +4/-0
    • View Profile
Re: Bot-Making Help
« Reply #26 on: April 01, 2016, 10:24:41 pm »
I could'nt figure out exactly where the total lift thrust is set, but all the trig and square/root functions look right. Other than that, it just needs a bit of tuning.

Here's the blueprint for the wall driving bot. Just be careful not to drive off the edges of the map too fast.
https://www.dropbox.com/s/juttiq9uhei19xh/bp_downforcer?dl=0

Schicko

  • Member
  • **
  • Posts: 21
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #27 on: April 01, 2016, 11:39:05 pm »
Awesome, thanks! Yeah I wasn't really sure where I was supposed to plug the outputs of the pitch/roll vector calculations. They come out with really small values (around 1) so I wasn't sure if I did the calculations right. I thought it made sense to multiply it to the output of the pids so that's what I did. I will definitely make sure to check out your bot to see what I am actually supposed to do  ;D .

I've started work on the other hoverbot earlier as well, and I'll probably do some more tomorrow. I've replaced the motors with elbows like you suggested and finished linear velocity controls which are basically the same as TI's.

Working out the math for the angular velocity controls is still proving troublesome for me though, as maths isn't my strongest suit. I'm sure I'll get it soon enough though, just need to brush up on vectors and trig some. One thing that is really bugging me though is that I can't seem to get my head around how to make jets at the bottom/angled downwards have positive thrust value whilst those at the top/angled up have negative/0 as the jets' positions and roles are dynamic, what with them being vectored thrust jets after all.

Do I even need to ensure the bottom jets are positive and vice versa or am I approaching the issue with angular velocity controls all wrong? I feel like it's impossible to calculate the required thrust without knowing the correct angles, but also that it's impossible to know the required angles if the correct thrust isn't known. I think I am missing a variable or something.

Perhaps I'll sleep for now, try to clear my head and hopefully tomorrow I'll be able to better understand what I need to do  ;D.
« Last Edit: April 01, 2016, 11:50:55 pm by Schicko »

PressureLine

  • XFM Developer
  • Administrator
  • Experienced Member
  • *****
  • Posts: 192
  • Likes: +4/-0
    • View Profile
    • Rawbots Club Forums
Re: Bot-Making Help
« Reply #28 on: April 02, 2016, 11:12:55 am »
One thing that may not have been mentioned in this topic is that angular velocity (and acceleration) values are in radians/second (and radians/second/second for accel) and FWIW a radian is ~60 (its actually 360/2pi) which may help with your maths a little :)
"Never assume that anything you've never seen before is benign. Most particularly not something that says 'MARINES' on it."

Schicko

  • Member
  • **
  • Posts: 21
  • Likes: +0/-0
    • View Profile
Re: Bot-Making Help
« Reply #29 on: April 02, 2016, 01:13:01 pm »
Thanks for the heads up PressureLine. I have a question: Isn't the sign function supposed to output a 0 if the input is 0? Mine is outputting a 1 for some reason.