Can somebody try this piece of code and tell me whats wrong with it? Just make
a Robot and put this at your run() method.
public void run()
With this i always get a 25deg (45 (radar) - 20 (gun)) scan arc. But it should
45 radar because i put the radar apart from the gun turn, i guess. I tryed
this with (220.127.116.11 and 18.104.22.168) clients and got the same results. I'm sure i
did something wrong, but i simply don't get it.
There are nothing wrong with it. The setAdjustXX() did not detach the radar
from gun; it just simply compensate radar turn automatically e.g. if you have
setAdjustRadarForGunTurn(true) and setTurnGunRight(20), the system will
automatically call setTurnRadarLeft(20) for you.
So you only get 25 degrees of radar coverage.
I agree with Nat. :-)
1) The radar is mounted on the gun. When turning the radar, this is always
done relative to the gun. It can move up to 45 degrees in one direction
compared to the gun heading.
2) The gun is mounted on the body. When turning the gun, this is always
relative to the body. It can move up to 20 degrees in one direction compared
to the body heading.
3) The body can turn up to 10 degrees in one direction.
If you set all setAdjustXXX() to false, and turn the body, gun, and radar at
max. speed, the radar with effectively turn 10+20+45 = 75 degrees, i.e. the
radar heading will change with 75 degrees. If you turn the body and gun at max
speed to the right, but the radar in the opposite direction with max speed,
the radar heading will change with -10-20+45 = 15 degrees.
When you call setAdjustXXX() to true, you are not getting the "compensated
angles" for free. So Nat is right.
When you turn your gun to the left with 20 degrees, Robocode will
automatically turn the radar the same amount of degrees in the opposite
direction. That is, the gun turn is compensated by also turning the radar, so
that radar "stands still" compared to the gun. But the radar will have spend
20 degrees, and is only able to turn 45-20 = 25 of additional degrees
I hope this makes sense to you? :-)
Actually, turning the radar with 75 degrees using "piggybacking" with the gun
+ body is an effective way to move the radar really fast, if you need to turn
it fast. This can be handy in some situations where another robot just passed
beside your robot, and your robot lost it on the scanner.
Uhhh ... thanks to both of you.
This gives me a big headache. I'm not sure if i get it now, but i see how it
is supposed to be working. It's the first time i thought about a better radar
and i have to find a way around this additive angles. So thanks again.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.