I wanted to use the gazebo_ros_bumpers and retrieve the force vector for each contact. However, when drawing the vectors, it appears to me they are not in a correct reference frame.
I think, according to the comments in the source file (gazebo_ros_bumper.cpp), that the contact data (force, normal, point) are all given in the "user requested" frame of reference. I am using diamondback but this seems not to have changed in trunk version of the file. see :
I can see some coordinate frame change for the data in the source code but I cannot understand why some are using RotateVector (example force and torque)
// rotate into user specified frame. frame_rot is identity if world is used. Vector3 force = frame_rot.RotateVector( Vector3(contact.forces[k]. body1Force.x,
and some others are converted by RotateVectorReverse (position and normal).
// rotate normal into user specified frame. frame_rot is identity if world is used. Vector3 normal = frame_rot.RotateVectorReverse( Vector3(contact.normals[k].x,
with frame_rot the rotation transformation from local to global frame. To what I could read, forces and position are given by ODE in global coordinate system, so forces would need the same reverse transformation that position and normal require, but I may have missed something.
Changing both transformation to reverse seemed to show better force orientation when displayed but I cannot be totally sure as contact points are "varying a lot" due to bouncy contacts.
If any one has comments on this, it sure could help confirm the issue (or not), and I could then file a bug if required.
Post score: 2
Comment by GuiHome on 2011-09-14:
As mentionned in the question, I am running diamondback. I cannot switch to electric because the Shadow Hand dos not support it yet. But I verified the trunk version at the time of the question, and the code was the same for this part. In electric the code is still the same. Will try it again soon.
Comment by hsu on 2011-09-02:
Hi, are you running on diamondback or electric?