Manage several coordinate systems for simulation in BLENDER software

Hi guys,
Is anybody knows how to manage several coordinate systems to be used in robotic simulation by using BLENDER?
So, we should be able to decide which place is (0,0,0) and the coordinate of the other parts/designs that we place inside the area can automatically be known. Please, I really need the answer.
Thanks a lot! http://www.societyofrobots.com/robotforum/Smileys/default/cheesy.gif

I do not understand your problem.

In Blender you have

  • world coordinates (worldPosition/worldOrientation/worldScale) relative to the scene (0,0,0) and
  • local coordinates (localPosition/localOrientation/localScale) relative to the objects parent.

Just parent the parts.

Thanks for your reply.

I mean, when I am able to decide which point is the original point (0,0,0) and on which coordinate is another subject, that is inserted into the system, located. So, I will know the coordinate position of each objects that I located in the system. So, it just like manage a system, with known coordinate. How to do this and display each coordinates position?

I hope you understand my problem…^^

Thanks!

No, I do not.

and I do not see how it fits into the Game Engine. Every object within the Game Engine is known. You can get the coordinates of each object from the object itself.

Do you want to visualize the motion of a robot?

Maybe you should make a sketch.

Thanks for your quick reply!

Yes, I want to make a robotic simulation for preparation planning. I have to decide which point is 0,0,0, and the robot is at what coordinate, the other objects are at what coordinates. By this system, I will know when the end joint of the robot (joint6), will be moved (by game engine) to a certain coordinate location, the joint 1 will move …degree, joint2 will move…degree, and so on, so all MOVEMENTS and COORDINATE LOCATION of the joints are detected. Just like inverse kinematic.

I get counfused because when I play the simulation §, which means that I can already control the joint of the robot part by part, I can’t know (there is no ‘like MENU display’ which shows the movements and rotational degree of the joints) the position of each joints. So, when the robot is played, I need to know the POSITION and the ROTATIONAL DEGREE.

Well, I hope that you can understand my problem. And I do really appreciate your help! :)))

Alternatives are:

  • The easiest way is to print that information to the console

  • with a print statement.

  • Use debug overlay.

  • switch on show debug information,

  • write the information into a property,

  • enable debug on the property.

  • In 3D view.

  • set up some planes with text faces,

  • write the information into the property “Text” to be displayed.

In all cases you need a python script extracting the information from the objects.

You need

  • object.localPosition (or worldPosition)
  • object.localOrientation (or worldOrientation)
  • I do not think you need scale
    Please refer to the GameLogic API for details.
    While you can use the location directly, you might want transform the orientation matrix into some angles. You should find functions for that in this forum or in the above API.

(Please keep in mind, the module Blender is not available at runtime, but some submodules like Mathutils)

See this one

Attachments

ShowingPosition.blend (220 KB)

Additionally, you could output positions to properties, and toggle the “d” button on those properties, and turn on “show debug properties” in the Game menu, which enables displaying them in an overlay.

If you want to see an object’s position in global coordinates, but centered around a certain object (IE a local coordinate system that’s not rotated to match the object at the origin) just get the worldPosition of the object that you want to be at the origin, and subtract that from the position of your other objects. The resulting number is your second object’s position in coordinates zeroed around your first object.

what do you mean by outputting position of “d” button?

“just get the worldPosition of the object that you want to be at the origin, and subtract that from the position of your other objects.” how to do this?

Thanks a lot for you help! :slight_smile:

outputting position of “d” button?

I’m not sure where you read that- what I said about the “d” button means, on every property there is a small button to the right labeled “d”. Press that to have the property display on the screen while the game is running.

to subtract one vector from another, just subtract each element. So your new vector would be [x2-x1, y2-y1,z2-z1]

In python that looks like


g = GameLogic
cont = g.getCurrentController()
own = cont.owner

ob = g.getCurrentScene().objects['OByourobjectname'] #this is the object that you want to center the coordinate system around. Replace yourobjectname with the actual name of the object- but leave OB and the quotes.

cent = ob.position # this is the actual point you want to center your coordinate system around
pos = own.position # this is the location of the current object, in global coordinates

localPos = [ pos[0] - cent[0], pos[1] - cent[1], pos[2] - cent[2] ] #and here's your position in reference to the other object's position. Note that this doesn't account for rotation.