movec

abstract fun movec(poseVia: Pose, poseTo: Pose, a: Double = 1.0, v: Double = 0.8, r: Double = 0.0, mode: Int = 0, cmdTimeout: Long? = null, onChange: (ArmState) -> Unit? = null, onFinished: (ArmState) -> Unit? = null): ArmState

Move circular to position (circular in tool-space). TCP moves on the circular arc segment from current pose, through poseVia to poseTo. Accelerates to and moves with constant toolspeed v. Use the mode parameter to define the orientation interpolation.

Return

ArmState representing the current URScript command execution state, which is continuously updated.

Parameters

poseVia

path point (note: only position is used. Rotations are not used so they can be left as zeros.)

poseTo

target pose (note: only position is used in Fixed orientation mode).

a

tool acceleration (m/s^2)

v

tool speed (m/s)

r

blend radius (m)

mode

defines the orientation interpolation mode:

  • 0: Unconstrained mode. Interpolate orientation from current pose to target pose (poseTo)

  • 1: Fixedmode. Keep orientation constant relative to the tangent of the circular arc (starting from current pose)

cmdTimeout

maximum time (in milliseconds) to wait for the command to complete. If this time is exceeded, the command is considered failed and the ArmState will no longer be updated.

onChange

⚠️ Experimental: optional callback that is invoked whenever the ArmState changes during execution. This API is experimental and may change or be removed in future versions.

onFinished

optional callback that is invoked once when the ArmState is final. The state is final when runningState assumes the following value: RunningState.END, RunningState.TIMEOUT, RunningState.CANCELED

Samples

import com.wolfscowl.ur_client.UR
import com.wolfscowl.ur_client.examples.Examples.ur
import com.wolfscowl.ur_client.interfaces.state.await
import com.wolfscowl.ur_client.interfaces.state.awaitBlocking
import com.wolfscowl.ur_client.interfaces.state.awaitBlockingUntil
import com.wolfscowl.ur_client.interfaces.state.awaitUntil
import com.wolfscowl.ur_client.model.element.JointPosition
import com.wolfscowl.ur_client.model.element.Pose
import com.wolfscowl.ur_client.model.element.RunningState
import com.wolfscowl.ur_client.model.element.Vec3
import com.wolfscowl.ur_client.model.robot_state.mode.RobotMode
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import kotlin.system.exitProcess

fun main() { 
   //sampleStart 
   val ur = UR("192.168.2.1")

runBlocking {
    ur.connect()
    ur.isConnectedFlow.first { it }

    val state = ur.arm.movec(
        poseVia = Pose(
            x = -0.133,
            y = -0.704,
            z = 0.430,
            rx = -1.80,
            ry = 2.57,
            rz = 0.000
        ),
        poseTo = Pose(
            x = -0.133,
            y = -0.698,
            z = 0.245,
            rx = 2.221,
            ry = -2.221,
            rz = 0.000
        ),
        a = 0.8,
        v = 0.2,
        cmdTimeout = 20000,
        onChange = null,
        onFinished = { state -> /* Do something */ }
    ).await() // await for the finale state
    println(state)
} 
   //sampleEnd
}

abstract fun movec(positionVia: JointPosition, positionTo: JointPosition, a: Double = 1.0, v: Double = 0.8, r: Double = 0.0, mode: Int = 0, cmdTimeout: Long? = null, onChange: (ArmState) -> Unit? = null, onFinished: (ArmState) -> Unit? = null): ArmState

Move circular to position (circular in tool-space). TCP moves on the circular arc segment from current joint position, through positionVia to positionTo. Accelerates to and moves with constant toolspeed v. Use the mode parameter to define the orientation interpolation.

Return

ArmState representing the current URScript command execution state, which is continuously updated.

Parameters

positionVia

path point as joint position. Then forward kinematics is used to calculate the corresponding pose.

positionTo

target joint position. Then forward kinematics is used to calculate the corresponding pose.

a

tool acceleration (m/s^2)

v

tool speed (m/s)

r

blend radius (m)

mode

defines the orientation interpolation mode:

  • 0: Unconstrained mode. Interpolate orientation from current joint position to target joint position (positionTo)

  • 1: Fixedmode. Keep orientation constant relative to the tangent of the circular arc (starting from current joint position)

cmdTimeout

maximum time (in milliseconds) to wait for the command to complete. If this time is exceeded, the command is considered failed and the ArmState will no longer be updated.

onChange

⚠️ Experimental: optional callback that is invoked whenever the ArmState changes during execution. This API is experimental and may change or be removed in future versions.

onFinished

optional callback that is invoked once when the ArmState is final. The state is final when runningState assumes the following value: RunningState.END, RunningState.TIMEOUT, RunningState.CANCELED

Samples

import com.wolfscowl.ur_client.UR
import com.wolfscowl.ur_client.examples.Examples.ur
import com.wolfscowl.ur_client.interfaces.state.await
import com.wolfscowl.ur_client.interfaces.state.awaitBlocking
import com.wolfscowl.ur_client.interfaces.state.awaitBlockingUntil
import com.wolfscowl.ur_client.interfaces.state.awaitUntil
import com.wolfscowl.ur_client.model.element.JointPosition
import com.wolfscowl.ur_client.model.element.Pose
import com.wolfscowl.ur_client.model.element.RunningState
import com.wolfscowl.ur_client.model.element.Vec3
import com.wolfscowl.ur_client.model.robot_state.mode.RobotMode
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import kotlin.system.exitProcess

fun main() { 
   //sampleStart 
   val ur = UR("192.168.2.1")

runBlocking {
    ur.connect()
    ur.isConnectedFlow.first { it }

    val state = ur.arm.movec(
        positionVia = JointPosition(
            base = Math.toRadians(-90.00),
            shoulder = Math.toRadians(-120.00),
            elbow = Math.toRadians(-60.00),
            wrist1 = Math.toRadians(-90.00),
            wrist2 = Math.toRadians(90.00),
            wrist3 = Math.toRadians(-70.00)
        ),
        positionTo = JointPosition(
            base = Math.toRadians(-90.00),
            shoulder = Math.toRadians(-125.00),
            elbow = Math.toRadians(-80.00),
            wrist1 = Math.toRadians(-65.00),
            wrist2 = Math.toRadians(90.00),
            wrist3 = Math.toRadians(-90.00)
        ),
        a = 0.8,
        v = 0.2,
        cmdTimeout = 20000,
        onChange = null,
        onFinished = { state -> /* Do something */ }
    ).await() // await for the finale state
    println(state)
} 
   //sampleEnd
}