Skip to content

Why my control function is called more than one time per step? #2383

Closed Answered by Hardwarize
Hardwarize asked this question in Asking for Help
Discussion options

You must be logged in to vote

Thanks for the point about RK @shogan50
Answering to myself from doc :
The control callback is called from within mj_forward and mj_step, just before the controls and applied forces are needed. When using the RK integrator, it will be called 4 times per step. The alternative way of specifying controls and applied forces is to set them before mj_step, or use mj_step1 and mj_step2. The latter approach allows setting the controls after the position and velocity computations have been performed by mj_step1, allowing these results to be utilized in computing the control (similar to using mjcb_control). However, the only way to change the controls between sub-steps of the RK integrator is to de…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@yuvaltassa
Comment options

@Hardwarize
Comment options

Answer selected by Hardwarize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants