-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to get the velocity from a position sensor #5377
Conversation
projects/samples/devices/controllers/position_sensor/position_sensor.c
Outdated
Show resolved
Hide resolved
…sensor.c Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com>
Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com>
Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com>
Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com>
you pinpointed the fact that I was using the issue with this naming is that a variable and a function get the same name, I know it work, but I personnaly don't like it. Is it an issue for you ? |
I want to pinpoint a fact : |
I've tried to implement a test case, and wished to update the already existing controller in tests/api/controllers/position_sensor/position_sensor.c |
And I will need help to to the ROS part, i've tried to look into that, but no idea how to update it ! |
It's better to have position and velocity variable names even if they are the same as the function name (more readable).
I don't know. That's probably the way ODE compute the velocity as well...
What do you mean? It is tested here. |
If that's true, I don't see the benefit of adding a get velocity capability to the position sensor... |
@ShuffleWire: shall we close this PR or do you see any good reason to continue with it? |
I do like the option to be able to get "natively" the speed, that is very convenient in term of user usage of the API. Getting it from controller side is weird for me : we need to derivate a value that have been integrated before, but we actually have the raw value we want from the start. Moreover if the integration method (to get a position) is changed, the derivated speed will be impacted, even if the true speed didn't have changed. Given that, I understand the wish to keep the API small, so it's your decision to add it or not :) |
I agree it would be convenient from a controller program to get the speed directly from the position sensor. However, a real position sensor will not provide this information out-of-the-box, instead, this information is derived from the position. To me it would be more logical and way simpler to implement it only on the libController side (in the DLL that is linked with the controllers) rather than in Webots. It is not a big computation and I see this more like a utility function (saving users from having to do it in their controller code) rather than a physical device feature. |
Okay, I don't want to be that guy but : A dynamo is a way to get directly the speed by reading the output voltage, without the need to know the position. But tbf, it's not a "Position Sensor", so maybe it should be different stuff... Moreover I don't know application of this sort of sensor in real life project, so... Adding that in the controller could be nice, but from my own need, I don't see it being so much of a change : I was first interested to get the "raw" value of the speed. Doing the derivation manually is not that much of a big deal. I think that i could depend on the usage Webots user could have of this sort of helper. I do think that many of the sensor used by Webots user are simple position sensor, and so they actually need the derivation in their code on their actual robot. Hence, the "Position Sensor" simulation is limited to the position output, and they are not interested by the speed anyway. That my 2cents ! |
OK, in that case, it is maybe better to implement a Dynamo sensor for this particular need. |
I think if going that route, we could implement it in the way that it could recharge a "Battery", using a nominal power/current and something linear with the output voltage (ie the speed) or a more complex model based on the physical stuff. That could be sweet ! Use case : a Rover powered by a wind turbine on the top ! |
Closed in #5419 |
Discussed in #3891
Add a way to get the rotational speed of a hinge join.
There is still a lot of work to be done.
Feedback appreciated :)
In webots_ros repository:
If not, create a service or message description file /resources/webots_ros/srv/<function_name>.srv or /resources/webots_ros/msg/<function_name>.msg.
In /projects/default/controller/ros/ controller:
In webots_ros repository: