Page 1 of 1

Python Joint Control

Posted: Mon Nov 26, 2018 6:14 am
by barabasicsongor
Hey people!

I would have a quick question. I manage to retrieve the jointSet of the model through model.getJointSet().

Then I manage to find different joints, for example the shoulder-arm joint through: jointset.get(x) (x is the index of the joint). This returns me a Joint type object.

I would like to ask how could I modify this joints coordinates? For example it has an 'arm_add_r' coordinate which moves the arm upside. And then display this result on the screen?

At the moment I am displaying the result through:
model.getVisualizer().show(model.state)
manager.integrate(10)

P.S: Also during this manager.integrate my model is falling downwards, exiting the screen. Why is it happening?

THANK YOU!

Re: Python Joint Control

Posted: Mon Nov 26, 2018 10:59 am
by mitkof6
I would have a quick question.
A quick question, is no guarantee of a quick answer, nor short.
I would like to ask how could I modify this joints coordinates? And then display this result on the screen?

Code: Select all

model.setUseVisualizer(True)
state = model.initSystem()
model.updCoordinateSet().get('arm_add_r').setValue(state, new_value)
model.getVisualizer().show(state)
P.S: Also during this manager.integrate my model is falling downwards, exiting the screen. Why is it happening?
When you call manager.integrate(10) you are running a forward dynamics simulation from t0 =0s to tf=10s. As gravity is acting on the model the model falls downwards. If you are interested only in visualizing the model you can update the coordinates, realize to position stage and then call the show method.