Forum: PogamutUT2004

Credible rotation (Rotate and TurnTo command)

Hi,

I'm trying to rotate my bot in a credible way changing pitch and roll at same time, like a player can do. I'm trying to choose rotation values with a fuzzy engine to simulate human behavior

I've proved use AdvancedLocomotion that use Rotate command in that way:
move.turnHorizontal(5000);
move.turnVertical(10000);
With that method my bot only do vertical turn (I think because it is in the same iteration)

I've proved too use:
Rotation rotation = new Rotation(10000,20000,0);
getAct().act(new TurnTo().setRotation(rotation));
I'm not sure if I can use it for both axis turn ¿is it posible?
Anyway using it (and others values) my bot always turn to same rotation position: (257.0, 26449.0, 0.0), I think maybe it is a bug ¿?

I don't want use TurnTo().setTarget() or setLocation() because I want my fuzzy engine calcule degree values. Any idea for execute both movement at same time?

Thanks

Frank
Hi!

Ad TurnTo command - the behavior you described is not a bug. TurnTo command can turn the bot TO some location or TO some rotation. So the command you want to use is Rotate command. However, with Rotate command it is possible to change only one rotation axis at a time - yaw or pitch. And the bad thing is that new rotate command stops the old rotate command (they do not stack with each other).

The solution to your problem is as follows: get the output from your fuzzy engine - how much and where you want your bot to rotate and then add this value to your current bot rotation. Then use TurnTo command to set rotation you obtained this way.

Hope this helps,
Michal
Hi Michal,

I haven't problem with Rotate command (advancedLocomotion use it too and work perfect) except the behavior that you described (I don't think bug is here)

My problem is with TurnTo command because it always turn to same rotation.
For example:
1) new TurnTo().setRotation(new Rotation(3000,yaw,roll));
and it result is (257.0, 26449.0, 0.0)

2) new TurnTo().setRotation(new Rotation(7000,yaw,roll));
and it result is the same again (257.0, 26449.0, 0.0)

It's for that I think there is a bug with TurnTo.setRotation()

Frank
Hi!

I've checked TurnTo command in Pogamut3 and you were right - there is a bug. :-( Rotation is sent to GameBots in wrong format for TurnTo command. I've fixed that in svn already.

Either you can fix it in TurnTo class, or checkout TurnTo.java from our svn.

The correct code of TurnTo is as follows (bug is in public String toMessage() function ):

public String toMessage() {
              		StringBuffer buf = new StringBuffer();
              		buf.append("TURNTO");
              		
		    					if (Target != null) {
		    						buf.append(" {Target " + Target.getStringId() + "}");
		    					}
		    				
                                if (Rotation != null) {
                                    buf.append(" {Rotation " + 
                                        Rotation.getPitch() + "," + 
                                        Rotation.getYaw() + "," + 
                                        Rotation.getRoll() + "}");
                                }
                            
                                if (Location != null) {
                                    buf.append(" {Location " + 
                                        Location.getX() + "," + 
                                        Location.getY() + "," + 
                                        Location.getZ() + "}");
                                }
                                        
            		return buf.toString();
            }


We will however probably make 3.0.12 in summer fixing these bugs (this bug, weaponry class bug, pathExecutor bugs...)

Best,
Michal
Ok, the easist solution for you is as follows:

To send TURNTO command do not use TurnTo class, but do it manually:

int pitch = 5000; //up,down
int yaw = 0; //left, right
int roll = 0;

getAct().act(new CommandMessage() { public String toString() { return "TURNTO {Rotation " + pitch + "," + yaw + "," + roll +  "}"; } });


This way TurnTo command works as intended.

Best,
Michal
Hi Michael,

that works and I can perform both axis movement using only TurnTo command (now I don't need mix TurnTo and Rotate commands)

I have another question, is it possible move a bot without changing it rotation? My question is because I want to move my bot like a human player can do, only thinking "I want go to left" and not "I want go to left so I turn to left and I go ahead". I simulated that using Move command and setFocusLocation() but this way I must calculate the Location and fix a far point in axis that I want to see.

In brief, is it not possible move like a human player do with keyboard and mouse? I think Rotate command do that like using mouse (but only one axis) but Move command are linked to a absolut location (and a human player are not thinking that)

I was reading a little bit of Javadoc and GameBots documentation and I saw that all movements and rotations are always based in location, rotation or target. Maybe it is interesting too can move bots with a relative aproach like human brain do. What do you think? (Maybe that must be in another Topic)

Thanks one more time :-)

Frank