How to use the Function of mjv_applyPerturbForce()? #2358
Replies: 1 comment
-
Read the simulate code to understand how perturbations work. Forces in xfrc_applied can be visualized with mjVIS_PERTFORCE |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Intro
Hi!
I am a undergraduate at RWTH Aachen University, I use MuJoCo for my research on manipulator and external force.
My setup
Mujoco 3.2.5, C++, Ubuntu
My question
I am confused that how to use the API "void mjv_applyPerturbForce(const mjModel* m, mjData* d, const mjvPerturb* pert);
";
As the document says "Set perturb force,torque in d->xfrc_applied, if selected body is dynamic.";
When I check the struct of mjvPerturb, it doesn't contain the information of force or torque? How can I apply the external force?
I have tried another API "mj_applyFT()", it works well. But I have no idea to visualize the external force which it produce, can you tell me the way to visualize the external force?
Minimal model and/or code that explain my question
struct mjvPerturb_ { // object selection and perturbation
int select; // selected body id; non-positive: none
int flexselect; // selected flex id; negative: none
int skinselect; // selected skin id; negative: none
int active; // perturbation bitmask (mjtPertBit)
int active2; // secondary perturbation bitmask (mjtPertBit)
mjtNum refpos[3]; // reference position for selected object
mjtNum refquat[4]; // reference orientation for selected object
mjtNum refselpos[3]; // reference position for selection point
mjtNum localpos[3]; // selection point in object coordinates
mjtNum localmass; // spatial inertia at selection point
mjtNum scale; // relative mouse motion-to-space scaling (set by initPerturb)
};
typedef struct mjvPerturb_ mjvPerturb;
Confirmations
Beta Was this translation helpful? Give feedback.
All reactions