.. _movesj_g: movesj_g (Auto Mode) ------------------------------------------ This function performs **joint-space spline motion** through multiple waypoints, executing smooth and continuous trajectories using **spline interpolation**. Each waypoint is automatically blended with the next for seamless movement. This API operates only in **Auto (Run) mode**. It is **not available in Manual (Teach) mode**. **Definition** |br| ``DRFLEx.h`` within class ``CDRFLEx``, public section .. code-block:: cpp bool movesj_g(float fTargetPos[MAX_SPLINE_POINT][NUM_JOINT], unsigned char nPosCount, float fTargetVel, float fTargetAcc, float fTargetTime = 0.f, MOVE_MODE eMoveMode = MOVE_MODE_ABSOLUTE) { return _movesj_g(_rbtCtrl, fTargetPos, nPosCount, fTargetVel, fTargetAcc, fTargetTime, eMoveMode); } **Parameter** .. list-table:: :widths: 25 20 20 35 :header-rows: 1 * - **Parameter Name** - **Data Type** - **Default Value** - **Description** * - fTargetPos - float[MAX_SPLINE_POINT][6] - - - List of waypoint poses in the BASE coordinate system [X, Y, Z in mm; Rx, Ry, Rz as fixed X-Y-Z angles in deg]. The function computes the joint position of each waypoint with inverse kinematics and writes it back into the array. * - nPosCount - unsigned char - - - Number of valid waypoints (max = MAX_SPLINE_POINT). * - fTargetVel - float - - - Target velocity for spline motion. * - fTargetAcc - float - - - Target acceleration for spline motion. * - fTargetTime - float - 0.0f - Motion duration [sec]. * - eMoveMode - :ref:`MOVE_MODE ` - ``MOVE_MODE_ABSOLUTE`` - Defines whether movement is absolute or relative. .. Caution:: The function overwrites all six elements of each of the first ``nPosCount`` waypoints in ``fTargetPos`` with the joint position [deg] from inverse kinematics. Pass a fresh copy of the waypoints on every call; reusing the same array sends the joint values as poses on the next call. Each joint position is the inverse-kinematics solution in solution space 2 (Lefty, Above, No Flip; see :ref:`movejx `) for the waypoint in the BASE coordinate system. For each waypoint, the call waits for this result from the controller and stores it in the data that the CDRFLEx object shares with ``get_current_posx``, ``get_desired_posx``, ``fkin``, ``ikin``, ``ikin_norm``, ``trans``, ``coord_transform``, ``calc_coord``, ``get_user_home``, ``get_user_cart_coord`` and ``flange_serial_read``, so a pointer returned earlier by one of them refers to overwritten data after movesj_g returns; copy the structure first. Do not call movesj_g inside a callback; see :ref:`Rules for callback functions `. **Return** .. list-table:: :widths: 15 85 :header-rows: 1 * - **Value** - **Description** * - 0 - Failed * - 1 - Success **Example** .. code-block:: cpp // Waypoint poses in BASE [X, Y, Z in mm; Rx, Ry, Rz in deg] const float waypoints[3][6] = { {400.f, 200.f, 300.f, 180.f, 0.f, 180.f}, {450.f, 150.f, 300.f, 180.f, 0.f, 180.f}, {500.f, 100.f, 300.f, 180.f, 0.f, 180.f} }; // movesj_g overwrites its first argument, so pass a fresh copy on every call float path[3][6]; for (int i = 0; i < 3; ++i) for (int j = 0; j < 6; ++j) path[i][j] = waypoints[i][j]; drfl.movesj_g(path, 3, 50.f, 100.f, 2.0f); .. Note:: - ``movesj_g`` provides **smooth, multi-point joint interpolation** using spline blending. - Automatically adjusts blending based on velocity and acceleration limits. - Ideal for **path teaching**, **motion streaming**, or **multi-point sequence execution**. - Not linked with ``force/stiffness control`` or ``change_operation_speed()``. - Ensure ``nPosCount`` ≤ MAX_SPLINE_POINT to avoid overflow.