.. _auto_amovesj: amovesj (Auto Mode) ------------------------------------------ As an asynchronous **movesj**, it operates the same as ``movesj()`` except that it returns as soon as the motion starts, **without waiting** for the motion to terminate, and then executes the next line. |br| A new motion command issued before the ``amovesj()`` motion terminates causes an error for safety reasons. Therefore, the **termination** of the ``amovesj()`` motion must be confirmed using ``mwait()`` between ``amovesj()`` and the following motion command before the new motion command is executed. **Definition (Uniform Velocity/Acceleration)** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section .. code-block:: cpp bool amovesj(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 _amovesj(_rbtCtrl, fTargetPos, nPosCount, fTargetVel, fTargetAcc, fTargetTime, eMoveMode); }; **Parameter** .. list-table:: :widths: 22 20 18 40 :header-rows: 1 * - **Parameter Name** - **Data Type** - **Default Value** - **Description** * - fTargetPos - float[MAX_SPLINE_POINT][6] - - - Maximum 100 waypoint list * - nPosCount - unsigned char - - - Number of valid waypoints. nPosCount must be 1 to 100. * - fTargetVel - float - - - Maximum velocity applied uniformly to all joints [deg/s] * - fTargetAcc - float - - - Maximum acceleration applied uniformly to all joints [deg/s\ :sup:`2`] * - fTargetTime - float - 0.0 - Reach Time [sec] * - eMoveMode - :ref:`MOVE_MODE ` - ``MOVE_MODE_ABSOLUTE`` - Refer to the Definition of Constant and Enumeration Type ---- **Definition (Per-Joint Velocity/Acceleration)** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section .. code-block:: cpp bool amovesj(float fTargetPos[MAX_SPLINE_POINT][NUM_JOINT], unsigned char nPosCount, float fTargetVel[NUMBER_OF_JOINT], float fTargetAcc[NUMBER_OF_JOINT], float fTargetTime = 0.f, MOVE_MODE eMoveMode = MOVE_MODE_ABSOLUTE) { return _amovesj_ex(_rbtCtrl, fTargetPos, nPosCount, fTargetVel, fTargetAcc, fTargetTime, eMoveMode); }; This overload allows specifying **independent velocity and acceleration limits for each joint axis**. It internally calls ``_amovesj_ex`` instead of ``_amovesj``. **Parameter** .. list-table:: :widths: 22 20 18 40 :header-rows: 1 * - **Parameter Name** - **Data Type** - **Default Value** - **Description** * - fTargetPos - float[MAX_SPLINE_POINT][6] - - - Maximum 100 waypoint list * - nPosCount - unsigned char - - - Number of valid waypoints. nPosCount must be 1 to 100. * - fTargetVel - float[6] - - - Maximum velocity limit for each joint axis [deg/s] * - fTargetAcc - float[6] - - - Maximum acceleration limit for each joint axis [deg/s\ :sup:`2`] * - fTargetTime - float - 0.0 - Reach Time [sec] * - eMoveMode - :ref:`MOVE_MODE ` - ``MOVE_MODE_ABSOLUTE`` - Refer to the Definition of Constant and Enumeration Type .. Note:: - When ``fTargetTime`` is specified, values are processed based on ``fTargetTime``, ignoring ``fTargetVel`` and ``fTargetAcc``. - When ``eMoveMode`` is ``MOVE_MODE_RELATIVE``, each pos in the position list is defined as a **relative coordinate** with respect to the preceding pos. (If position list = [q1, q2, …, q(n-1), q(n)], q1 is the relative angle from the start point, while q(n) is relative to q(n-1).) - This function does **not** support online blending of previous and subsequent motions. **Return** .. list-table:: :widths: 20 80 :header-rows: 1 * - **Value** - **Description** * - 0 - Error * - 1 - Success .. Note:: Returns false without a message when the robot is in STATE_EMERGENCY_STOP, STATE_SAFE_OFF, STATE_SAFE_OFF2, STATE_SAFE_STOP or STATE_SAFE_STOP2. **Example** .. code-block:: cpp #include #include // D-Out 3 seconds after the spline motion through all points of jpos begins float jpos[4][6]; float jvel = 10; float jacc = 10; unsigned char jposNum = 4; jpos[0][0]=0; jpos[0][1]=0; jpos[0][2]=-30; jpos[0][3]=0; jpos[0][4]=-30; jpos[0][5]=0; jpos[1][0]=90; jpos[1][1]=0; jpos[1][2]=0; jpos[1][3]=0; jpos[1][4]=0; jpos[1][5]=0; jpos[2][0]=0; jpos[2][1]=0; jpos[2][2]=-30; jpos[2][3]=0; jpos[2][4]=-30; jpos[2][5]=0; jpos[3][0]=0; jpos[3][1]=0; jpos[3][2]=0; jpos[3][3]=0; jpos[3][4]=0; jpos[3][5]=0; drfl.amovesj(jpos, jposNum, jvel, jacc); std::this_thread::sleep_for(std::chrono::milliseconds(3000)); drfl.set_digital_output(GPIO_CTRLBOX_DIGITAL_INDEX_1, true); This asynchronously executes a **joint spline** through four waypoints and toggles a digital output 3 seconds after start. Use ``mwait()`` before issuing the next motion to ensure the spline has finished.