raisimTech / raisimLib

Visit www.raisim.com
http://www.raisim.com
Other
341 stars 91 forks source link

Is the contact normal expressed in the contact frame? #443

Closed ClaudioChiariello closed 1 year ago

ClaudioChiariello commented 1 year ago

This could be a trivial question, but I am confused because in the example here https://raisim.com/sections/Contact.html#contacts seems that the contact normal is expressed in the world frame:

std::cout<<"Contact Normal in the world frame: "<<contact.getNormal().e().transpose()<<std::endl;

jhwangbo commented 1 year ago

It is expressed in the world frame. The contact normal in the contact frame is always {0,0,1}

ClaudioChiariello commented 1 year ago

How can I transform this vector in the contact frame?

jhwangbo commented 1 year ago

transform from which frame to which frame? getNormal returns this vector in the world frame. In the contact frame it is 0,0,1

ClaudioChiariello commented 1 year ago

I wanted to transform it from the world frame to the contact frame. But this should be useless if in the contact frame is always 0,0,1. Have I understood correctly?

jhwangbo commented 1 year ago

yes. you got that right

ClaudioChiariello commented 1 year ago

I don't want generate a new issue because probably has already been discussed, but to get the contact force in the world frame should I implement this? contactForce = (contact.getContactFrame().e().transpose() * contact.getImpulse().e()) / world_->getTimeStep();

jhwangbo commented 1 year ago

yes, that is correct