Add a way to get the speed of a motor and/or joint #3891
Replies: 11 comments 1 reply
-
Since speed sensors in the real world for motors or joint are implemented as position sensors for which the speed is derived, I would propose to extend the PositionSensor to return also the speed. It is a matter of adding an API function like |
Beta Was this translation helpful? Give feedback.
-
Afaik, WbPositionSensor derivate from WbJointDevice from WbJoint |
Beta Was this translation helpful? Give feedback.
-
Both options are possible, but I would rather ask ODE for that since deriving the velocity from the position can be done on the controller side (no need for a new API function). Note: I believe a better name would be const dReal * dBodyGetLinearVel (dBodyID);
const dReal * dBodyGetAngularVel (dBodyID); depending on the type of joint (linear or rotational). |
Beta Was this translation helpful? Give feedback.
-
Note: because the velocities retrieved by ODE are absolute, they should be subtracted from the velocity of the parent body to get a relative velocity which is what we want in this case. |
Beta Was this translation helpful? Give feedback.
-
Well, that seems like a bit of work, but nice way to dive into ODE ! I will give it a try at home :) |
Beta Was this translation helpful? Give feedback.
-
You should simply find the parent ODE body of the ODE body you want to measure the velocity. Only a single subtraction of the velocities of two bodies should be sufficient. |
Beta Was this translation helpful? Give feedback.
-
Thank for the feeback :) Will do my best ! |
Beta Was this translation helpful? Give feedback.
-
If you want I can try to have a go at it next week ;) |
Beta Was this translation helpful? Give feedback.
-
Yes ! Go ahead ! I'll be in holiday this week, but I might find some time to follow. |
Beta Was this translation helpful? Give feedback.
-
I have tried to work again on that, and to understand how others sensors are developed. found out that in could it be a more direct way to get the rotational speed of the hinge ? That would avoid me to work on a new ode function like what do you think ? @omichel |
Beta Was this translation helpful? Give feedback.
-
MR in #5377 |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I'm working with rotating part, and I wish I could get the current rotational speed of a motor. This extend to linear motor, and actually to any joint.
Describe the solution you'd like
Add a "speed_feeback" in Motor llike the "force_feedback"
OR
Add a SpeedSensor like PositionSensor
OR
Extend PositionSensor to return speed
Describe alternatives you've considered
I'm using a GPS on interesting point of my part, and manually deduce the speed of the part using gps_get_speed(). But that force me to create a lot of these, and that not very efficient
Beta Was this translation helpful? Give feedback.
All reactions