How to check if two objects are aligned

Hi,

I am trying to make a robotic simulator using panda3d. For this I would like to know when two objects (the end effector and the payload) are correctly aligned. At present I set both a collision solids and search for a collision between them, showing that they are in the same place. However, I am now looking to improve the accuracy of my robot and therefore want to detect when they aligned correctly.

I am unsure how to detect such behaviour, any help would be greatly appriciated.

Thanks!!

What defines alignment in your simulation? Do the parts have to have the same orientation? The same orientation in just on plane–or even just on just one axis? Do the parts have to be in the same location? And can the parts even be of different sizes, and if so, how does that affect alignment?

The parts will be the same size. Alignment should be on the same plane and of the same orientation. I am looking to couple to standard interfaces together.

Okay, fair enough!

Given this, could you perhaps compare both the orientation-quaternions of the pieces and their locations?

That is, could you define that, if the orientation-quaternions of the two pieces are within a given tolerance (perhaps see the “almostSameDirection” method of the quaternion class), and the difference between their locations has a length less than a given tolerance, then the pieces are aligned.

I’m not sure of what you mean by this–do you mean that you have some third-party interfaces that you’re required to use?

Given this, could you perhaps compare both the orientation-quaternions of the pieces and their locations?

This makes sense. I the point of alignment is at one corner of a cube, will I need to make a new node at this location just for the alignment check?

I’m not sure of what you mean by this–do you mean that you have some third-party interfaces that you’re required to use?

Yes kind of - it doesnt really matter though. So long as the points are in the correct place the interfaces’ will connect.

I wouldn’t like to swear to it, but I wouldn’t think so.

Fair enough, then!

so should I just use the node at the centre of the piece and work out the offset due to the geometry?

Hmm… Do the pieces not have the same origin-point? If they don’t, then indeed, an offset might be called for. Otherwise, I would think that you could just compare their base -locations and -orientations.

Brilliant - thanks for all your help!!

1 Like