Programming a robot for a contest

AI Thread Summary
The discussion focuses on programming a virtual robot, referred to as R, for a contest where it competes against other robots, including those built by university students. The user seeks to calculate the absolute coordinates of an enemy robot (R2) based on R's known position and orientation. They have successfully derived R2's position when R is stationary but struggle to adjust for R's rotation when aiming the gun at R2. The user is attempting to calculate the angle for aiming but is facing issues with the angle adjustments in different quadrants. They are looking for guidance on accurately determining the aiming angle for R's gun based on R2's coordinates.
eax
Messages
61
Reaction score
0
I am programming a robots movements(virtual robot not a physical, like a game) its a contest, I asked last year students that did this contest and there robot got to 4th place by a fluke, their robot did random stuff :smile:. I'm in high school grade 11. University students are also partisipating in this event, last year their robot shot ahead of other robots. Thats what I want to do.

I know the obsolute position of my own robot(lets call my robot R for Robo) and its rotation, also its rotation of stuff like gun, and radar for detecting other robots. If the R detects another robot, R only knows the distance between R and the robot, and the degrees it would have to turn to face the robot. So I need to convert this to obsolute coordinates so when R moves around it can look where it last scene the robot.

If I can get the obsolute coordinates of the enemy robot, its all I need for my plan to shoot ahead of its path. I already tested this plan out and it works good if R is just standing still and not moving. How may I get obsolute coordinates of the enemy robot?

I tryed doing this my self but R is rotated so I can't just add obsolute coordinates of R to enemy robots. I'm lost I don't know how to do this.

Thanks in advance!
 
Last edited:
Physics news on Phys.org
R's position is (x,y) (known) and he is facing in direction A (known) relative to the reference, which I will assume is the +x axis. The second robot R2 is a distance D2 (R2D2; cute heh :rolleyes: ) from R in a direction B from the direction R is facing.

Let R turn B to face R2. R will know the direction (A+B) he is facing relative to the +x axis after this turn. The position of R2 is then (x+D2cos(A+B), y+D2sin(A+B))
 
Thanks!

I have one problem, I tryed my self using sign, I even made if statements for different quadrants on the plane for this.

I have after movement converted R2 to be relative to R now I need to get the angle to move the gun on it. 0 degrees is up, I can't seem to get it to aim properly. I have worked with something similar before but 0 degrees was right.

Knowing 0 degrees is up, let's say after converting R2 relative to R the R2(x,y) lay in the bottom left quadrant where x & y are negative. How may I calculate the angle there,

Iam doing this
angle = acos(-R2(x)/R2(distance from R))
since R2(x) is negative I make the whole thing be positive.
angle = angle + 90
I added by 90 for bottom quadrant
angle = angle * -1
I inverse it for other quadrant

It doesn't work properly. Whats wrong?

Thanks in advance!
 
I multiplied the values first without the error limit. Got 19.38. rounded it off to 2 significant figures since the given data has 2 significant figures. So = 19. For error I used the above formula. It comes out about 1.48. Now my question is. Should I write the answer as 19±1.5 (rounding 1.48 to 2 significant figures) OR should I write it as 19±1. So in short, should the error have same number of significant figures as the mean value or should it have the same number of decimal places as...
Thread 'Collision of a bullet on a rod-string system: query'
In this question, I have a question. I am NOT trying to solve it, but it is just a conceptual question. Consider the point on the rod, which connects the string and the rod. My question: just before and after the collision, is ANGULAR momentum CONSERVED about this point? Lets call the point which connects the string and rod as P. Why am I asking this? : it is clear from the scenario that the point of concern, which connects the string and the rod, moves in a circular path due to the string...
Thread 'A cylinder connected to a hanging mass'
Let's declare that for the cylinder, mass = M = 10 kg Radius = R = 4 m For the wall and the floor, Friction coeff = ##\mu## = 0.5 For the hanging mass, mass = m = 11 kg First, we divide the force according to their respective plane (x and y thing, correct me if I'm wrong) and according to which, cylinder or the hanging mass, they're working on. Force on the hanging mass $$mg - T = ma$$ Force(Cylinder) on y $$N_f + f_w - Mg = 0$$ Force(Cylinder) on x $$T + f_f - N_w = Ma$$ There's also...
Back
Top