How to decrease error value of Servoj

Hi. I’m Onur

I’m trying to control robot joint from URCap after my inverse kinematics solutions and trajectory planning. I’m keeping calculations results in the robot position, speed, acceleration limits. Even so trajectory tracking is not so good. error is around 3 mm in the tool space. I’m working on UR5 CB real robot.

The following jointposition is result of calculation code.
I’m sending this script code every 8 millisecond by 3003 port.
“servoj(”+ jointposition +",0,0,0.008,0.03,2000)"

lookahead_time=0.03
gain=2000
How do I adjust these parameter values?
Can I reduce the error by 0.5 mm?

Hi Onur,

Many things can influence to the error. The robot will always be chasing the last given target. If the target i moving fast and the robot is limited be strict safety configuration, the error will be bigger.
In theory you can increase the gain and reduce the look ahead time to reduce the error. But it will also result in much bigger joint torques/acceleration.

Thanks.

Sometime there is excessive vibration , some time there is no vibration for the same trajectory planning. i think its because sometime controller finishes servoj() over 8 millisecond.

can i get “servoj() done” feedback from controller to URCap quickly

How do you handle the timing. The Java is far from real time, so you should make sure to feed the controller with a new target each time slot.
If you make a script run the loop of servoj() i would not expect this behavior, if the target is moving continuously and not too fast.

I’m handling the timing this way in java

	long start_time=System.currentTimeMillis();
	for (int i = 0; i <transformation_matrix_list.size(); i++) {
		long elapsed_time=System.currentTimeMillis()-start_time ;
        int delay_millisecond=(int) (i*8-elapsed_time);      //delay_millisecond is arround 6-7 millisecond

        if(delay_millisecond>0) {
	        try {
	        	Thread.sleep(delay_millisecond);
        	}catch (InterruptedException e) {
        			e.printStackTrace();
        	}
        }

        float[][] transformation_matrix=transformation_matrix_list.get(i);
        float[] joint_positions=robot.getInverseKinematics(transformation_matrix,robot.getLastRobotJointPositions());
        sendServoj(joint_positions);
	}

Isn’t it real time?
Can i do it real time in java in URCap