Skip to content
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

Positional Sensor on Rotational Motor has a discontinuous value change at high speeds #6698

Open
austingreisman opened this issue Nov 13, 2024 · 1 comment

Comments

@austingreisman
Copy link

austingreisman commented Nov 13, 2024

Describe the Bug
When running a custom world (has some buildings and flat ground with grass) simulation of the Tesla Model 3 (proto downloaded from your webots cloud site), I am experiencing an issue when running at speeds over 15 m/s (this depends on the basicTimeStep parameter in the World settings).

I am running Webots R2023b.

Steps to Reproduce

  1. Open up a basic world that has a lot of space to drive.
  2. Set your basicTimeStep parameter to 33.
  3. Run the TeslaModel 3 proto in this world at a speed greater than 15 m/s.
  4. See error of Position Sensor (either wheel) spontaneously jumping up in it's cumulative increase/decrease in rads.
  • I did some investigating into this issue. It seems when the difference in current to previous position sensor readings becomes greater than ~1.42 rads, this issue appears. This was confirmed by increasing the basicTimeStep above 33 (ms) and seeing this issue appear at lower speeds, then decreasing the basicTimeStep and seeing this issue appear at higher speeds. The commonality seems to be when consecutive reads of the Position Sensor on the wheels are greater than 1.42 rads.

Expected behavior
There would be a linear increase in difference between the current Position Sensor value read and the previous past the 1.4 rad mark.

Screenshots
image

I'll explain some things in this image
_leftPositionSensorData = a private variable which holds the this->_leftPositionSensor->getValue() (rads) where _leftPositionSensor is a webots::PositionSensor pointer to the left wheel's position sensor.
_previousLeftPositionSensorValue is _leftPositionSensorData value from the previous timestep (0.03 s).
RobotSpeed is the speed we are calculating based on the current RPM knowing the wheel radius.
CMD is the velocity (m/s) and spin rate (curvature) we are attempting to command to the vehicle.

As you can see from the first mention of _leftPositionSensorData in the terminal from the screenshot, we have a difference between timesteps of approximately 1.41, then to approximately 1.42, then this large jump happens to 4.86 on the third mention of _leftPositionSensorData in the terminal. This is the behaviour I find weird that is messing up my code.

System

  • Operating System: Linux Ubuntu 20.04
  • Graphics Card: Mesa Intel® Xe Graphics (TGL GT2)

Additional context
The speed was going crazy at this point (RobotSpeed) because our math would break when this would happen. I have since figured out that you can get a continuous decrease in the angle difference if you take the _leftPositionSensorData and _previousLeftPositionSensorValue, take the absolute, then subtract that value from 2Pi. This is also fairly confusing, but works at the moment... Here is what the code would look like

this->_leftRPM = ((Constants::TwoPI - std::abs(this->_previousLeftPositionSensorValue - this->_leftPositionSensorData)) / leftRpmSamplingPeriod) * SimulatorRobotChassisConstants::RPMConversion;
@austingreisman
Copy link
Author

Bump - Is anyone able to look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant