ApplyExternalForce from the C++ API seems to have no effect #3650
ManosAgelidis
started this conversation in
General
Replies: 1 comment
-
Hi, |
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to apply some external force on a robot through the applyExternalForce function which is provided by the b3RobotSimulatorClientAPI . I have the equivalent code in python where I use the corresponding applyExternalForce function which seems to correctly apply a force on the robot (it moves as it is supposed to). But when I do the same from the C++ API on the same robot, the function seems to have no effect. An easy way to reproduce the behaviour is to add these lines in the RobotSimulatorMain.cpp just before the sim->stepSimulation() call
btVector3 force(100000, 100000, 100000); btVector3 pos = {0, 0, 0}; for (int i = 0; i< sim->getNumJoints(minitaurUid);++i){ bool success = sim->applyExternalForce(minitaurUid, i, force, pos, EF_LINK_FRAME); }
The value of the success bool is true, so the function seems to at least not throw an error, but nothing happens. Am I missing something here? According to the documentation this line
sim->setRealTimeSimulation(false);
should enable applying the force. I know that the recommendation is to use the pybullet python API, but I would like to couple my robot with a fluid simulator which is written in C++, and if everything works I would like to also provide the fluid simulator in bullet (it is already open source). Thanks in advance for the help!
Beta Was this translation helpful? Give feedback.
All reactions