Skip to content

Fix DC motor Vmax voltage limiting in voltage input mode (#3489) - #3503

Open
Adityakk9031 wants to merge 2 commits into
google-deepmind:mainfrom
Adityakk9031:fix-dcmotor-vmax-voltage-mode
Open

Fix DC motor Vmax voltage limiting in voltage input mode (#3489)#3503
Adityakk9031 wants to merge 2 commits into
google-deepmind:mainfrom
Adityakk9031:fix-dcmotor-vmax-voltage-mode

Conversation

@Adityakk9031

Copy link
Copy Markdown
Contributor

Fixes #3489

Problem

When a <dcmotor> is configured with Vmax in voltage-commanded mode (input="voltage") without an inductance state:

  1. mjGAIN_DCMOTOR skipped dcmotorVoltage() due to checking ctrlspec != mjINPUT_VOLTAGE, leaving ctrl[uadr] unclamped.
  2. Inside dcmotorVoltage(), the raw terminal voltage input u4[3] was added after the Vmax clamp, bypassing the supply voltage limit.

Solution

  1. In dcmotorVoltage(), add raw terminal voltage u4[3] and apply the Vmax clamp to the resulting total terminal voltage.
  2. In mjGAIN_DCMOTOR, invoke dcmotorVoltage() whenever ctrlnum > 0 so that ctrl[uadr] is consistently clamped by Vmax.
  3. Added unit test TEST_F(DCMotorTest, VmaxVoltageInput) to verify Vmax enforcement for voltage-controlled DC motors.

@Adityakk9031

Copy link
Copy Markdown
Contributor Author

@yuvaltassa have a look

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vmax silently ignored for voltage-controlled dcmotors

1 participant