As for the actuator, there are four type, namely: motor, position, velocity and cylinder. Therefore, how can I create an actuator which can control the "joint velocities" for a 6 DoF manipulator? I used the motor as the actuator and it works, but not suitable for my research task. Code: <body> <geom type="capsule" fromto="0.4 0 0.3 0.5 0 0.3"/> <geom type="cylinder" fromto="0.4 0.0 0.285 0.4 0.0 0.315" size="0.02" rgba=".3 .9 .3 .4"/> <joint axis="0 0 1" name='j0-4' pos="0.4 0 0.3"/> </body> Code: <actuator> <motor gear="1.0" joint="j0-4"/> </actuator> Code: sim.data.ctrl[0] = 0.1
When you define an actuator with type 'motor', the control signal has the meaning of torque. If you want a velocity servo, define an actuator with type 'velocity'. Then the control signal has the meaning of reference velocity. See these sections of the documentation: http://www.mujoco.org/book/computation.html#geActuation http://www.mujoco.org/book/modeling.html#CActuator
Thank you and I think your advice is right! Moreover, there is some useful information I have found: within the mujoco-py, we can control the "joint-velocity" using: Code: sim.data.qvel = 1.0 the "joint-angle" using: Code: sim.data.qpos = 1.0 even need not define the actuator within .xml Show my example: Code: if t<100: sim.data.qpos[0] = -0.5 else: sim.data.qpos[0] = 0.0
I'm trying to control joint with <velocity> actuators. One issue encountered was with controlling the joint to combat gravity. When I attempt to raise the arm in reverse direction of gravity, a small velocity control (qvel = 0.1) will fail to raise the arm. However, a large velocity control (qvel = 1) does raise the arm. I attempted to increase the gain kv of <velocity> actuator, but it only helps to an extent before the system became unstable. I'm not sending the position control. What's the recommended way to control joint with velocity?
You are asking general questions about control engineering - which is somewhat beyond the scope of this forum. There are two simple tricks you can try in this case: 1. Explicit gravity compensation 2. PID control In both cases, you end up with an open-loop term that compensates for bias forces (including gravity) and allows you to get a way with smaller feedback gains. In general, it is never a good idea to use feedback to compensate for systematic disturbances that are known in advance.
I see. I think in my case I do want to use PID control to compensate for disturbances. In the case of PID control, what's the easiest way to implement that in mujoco?
I think this is not correct. you can set the qpos in mujoco-py and the robot will move in simulation, but the correct way to control the robot is subtracting the desired qpos and feedback one and then apply a PD controller for example. Then you will have the control signal that can be applied to the motor by sim.data.ctrl.