hello,
I'm trying to calculate the distance between two objects. Generally, I use the smallest distance function to measure two objects.
But in my project https://ibb.co/t2yTTJ1, when the person model goes along the path and when the cylinder is between the robot(UR10) and person model, I want to define a point on the surface of the cylinder and measure the distance between robot and cylinder(defined point) and the distance between the person and cylinder(point).
But I don't whether there is a way to define the point on the cylinder or other shape?
Best regards,
Jian
How to define a point on the surface of a cylinder?
Re: How to define a point on the surface of a cylinder?
The distance calculation module can compute distance between a cylinder and a dummy. Just make sure the measurable property is turned on.
To define a point on a cylinder of radius \(r\) and height \(h\) you can use the formula \(\hat x r cos \theta + \hat y r sin \theta + \hat z h \lambda\) where \(\lambda\) and \(\theta\) are two parameters, and \(\hat x\), \(\hat y\), \(\hat z\) are the normal vectors of its rotation matrix. You can simply place a dummy at coordinates \(\left( r cos \theta, r sin \theta, h \lambda \right)\) relative to the cylinder and that is your point.
To define a point on a cylinder of radius \(r\) and height \(h\) you can use the formula \(\hat x r cos \theta + \hat y r sin \theta + \hat z h \lambda\) where \(\lambda\) and \(\theta\) are two parameters, and \(\hat x\), \(\hat y\), \(\hat z\) are the normal vectors of its rotation matrix. You can simply place a dummy at coordinates \(\left( r cos \theta, r sin \theta, h \lambda \right)\) relative to the cylinder and that is your point.
Re: How to define a point on the surface of a cylinder?
Thanks for your reply.
I want to know, is there a method to define a point on the surface of an obejct with any shape, not only cylinder?
thanks,
Jian
I want to know, is there a method to define a point on the surface of an obejct with any shape, not only cylinder?
thanks,
Jian
Re: How to define a point on the surface of a cylinder?
Simply create a dummy (
Cheers
sim.createDummy
), and place it where you want (sim.setObjectPosition
), then attach it to the shape (sim.setObjectParent
). To find the coordinate on the surface of a shape where to place the dummy, you can use a proximity sensor for instance (e.g. a ray-type proximity sensor). Then use sim.checkProximitySensor
.Cheers