# Servoj confusion

**URL:** https://forum.universal-robots.com/t/servoj-confusion/42150
**Category:** URScript
**Created:** [January 30, 2026, 2:05am UTC](https://forum.universal-robots.com/t/servoj-confusion/42150 "2026-01-30T02:05:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mat.elwarth](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@mat.elwarth](https://forum.universal-robots.com/u/mat.elwarth)
#### Post date: [January 30, 2026, 2:05am UTC](https://forum.universal-robots.com/t/servoj-confusion/42150/1 "2026-01-30T02:05:08Z")

</div>

Hi All,

I’m trying to traverse a path of known points using servoj, but am having trouble making the trajectory smooth and consistent.

When I execute my run sequence the robot shudders when changing direction and also starts moving through points not in the path. The reason I use servoj and not a different move command is it should be able to smoothen out my trajectory and follow it precisely.

Currently I have this implementation:

```java
writer.write("servoj(" + (String) pairs.get(i)[1] + ", t=0.006,
              lookahead_time=0.1, gain=200)\n");
chunkLineCounter++;
// 1ms step_t
int steps = (int) Math.max(1, Math.floor(deltaT_ms));
for (int step = 1; step <= steps; step++) {
    int posInChunk = chunkLineCounter % 300;
    double fraction = (double) step / steps;
    double[] qInterp = new double[6];
    // linear joint interpolation
    for (int j = 0; j < 6; j++) {
        qInterp[j] = qStart[j] + (fraction * (qEnd[j] - qStart[j]));
    }
    // lookahead_time and gain help smooth the motion between your points
    double timeMultiplier = applyTrapezoidalRamp(fraction, posInChunk, 300);
    double adjustedT = 0.006 / timeMultiplier;
    double roundedT = Math.round(adjustedT * 500.0) / 500.0; // round to nearest 500Hz tick
// writer.write("servoj(" + formatJoints(qInterp) + ", t=" + String.format("%.3f", roundedT) + ", lookahead_time=0.1, gain=200)\n");
    writer.write("servoj(" + formatJoints(qInterp) + ", t=0.006,
                  lookahead_time=0.1, gain=200)\n");
    chunkLineCounter++;
}

```

The commented out command was my attempt to control the velocity, but it didn’t seem to work.

If anyone has advice on how to reliably improve trajectory following and/or control the velocity, please let me know!

Thanks.
