Code: Select all

```
for i in range(self.eeId - 1):
p.setJointMotorControl2(self.robotId, i + 1, p.POSITION_CONTROL,
target_p[i], target_v[i], positionGain=1, velocityGain=0.5)
```

This code sort of works but has unsatisfactory trajectory tracking error (maximum of 0.01 for some joint). I calculate this error by comparing the logged joint angles and target_p. It is like (the subplot below)

I found that:

1. increase positionGain does not improve tracking accuracy once it reaches a value like 1.

My question is:

1. How on earth is position control implemented?

2. Is there anyway to improve this tracking accuracy since this is quite essential to my application?