How to use iCub velocity control with the simulator using IVelocityControl command #587
-
Hello, I am a master student working on the iCub vision more specifically on smooth pursuit and we are trying to control the icub simulator using the velocity commands, through the 'IVelocityControl' class. i am unable to control velocity in icub by using velocityMove in python further unable to understand where velocity change effect can be seen in icub object or its eye velocity that is being affected. headOptions = yarp.Property()
headOptions.put("device","remote_controlboard")
headOptions.put("local","/client/head")
headOptions.put("remote","/icubSim/head")
# create remote driver
headDriver = yarp.PolyDriver(headOptions)
# iMode = headDriver.viewIControlMode()
headPos = headDriver.viewIPositionControl()
iMode = headDriver.viewIControlMode()
headVel = headDriver.viewIVelocityControl()
headEncs = headDriver.viewIEncoders()
joints=headPos.getAxes()
ivelocity=headVel.velocityMove(joints,speed) further these setPosition Mode and setVelocityMode commands give attribute errors in trying to implement them for j in range(joints):
# iMode.setPositionMode(j)
# iMode.setPositionMode(j)
# iMode.setVelocityMode(j) Kindly provide me help on how to control it with an example of code in python ,i willl be very thankful to you in this regards. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @hamaduddin, welcome to the robotology community! Both icub and icubSim are starting in position control, for controlling in velocity you should switch the control mode first. for j in range(joints):
iMode.setControlMode(j, yarp.VOCAB_CM_VELOCITY) In any case here you can see a working example of controlling the robot using the python bindings. Then what @pattacini said about the timeout could be a possible problem, there should be a timeout of 100 ms, if after 100 ms no velocity command is received the motion is stopped. But I expect that this is what happens on the real robot, in the simulation you should be fine, not 100% sure. |
Beta Was this translation helpful? Give feedback.
Hi @hamaduddin,
welcome to the robotology community!
I don't know if the code you posted is complete but it seems that is missing some steps.
Both icub and icubSim are starting in position control, for controlling in velocity you should switch the control mode first.
Then before
ivelocity=headVel.velocityMove(joints,speed)
you shouldIn any case here you can see a working example of controlling the robot using the python bindings.
Then what @pattacini said about the timeout could be a possible problem, there should be a timeout of 100 ms, if after 100 ms no velocity command is received the motion is stopped. But I…