0 votes
by
retagged by
Hi,

Is it possible to have motor rpm, not throttle, as an input value to a vehicle?

I am using ROS to calculate desired motor rpm, and want to send this data to the vehicle model. Then read the values of torque on the wheels and send them back to ROS. Is it possible and how can I do that.

Thanks!

1 Answer

0 votes
by

As you're using ROS, then you're surely referring to controlling robotic motors where the RPM value is specified directly. Best solution in VPP is implementing a custom vehicle with SynchronousDrive blocks connected to each wheel. 

The SynchronousDrive block implements a direct drive motor that enforces a RPM value using up to a maximum torque amount:

https://vehiclephysics.com/blocks/other-blocks/#synchronousdrive

Here is a custom vehicle example where the rear wheels are linked to a differential, and to a single DirectDrive motor. It could be modified easily to connect a SynchronousDrive motor to each drive wheel and control them independently:

https://vehiclephysics.com/advanced/custom-vehicles/

Torques on the wheels may be read from the wheel states. Here's an example of accessing the wheel states:

https://vehiclephysics.com/advanced/custom-addons/#example-source-code

And here's the reference for the WheelState class:

https://vehiclephysics.com/advanced/vehiclebase-reference/#nested-classes

WheelState.tireForce is a Vector2 with the longitudinal force in the "y" component and the.lateral force in the "x" component.

This solution requires the Professional or Enterprise versions of VPP. The Community Edition doesn't support custom vehicles, nor includes the SynchronousDrive block.

...