Example #1
0
        private void VerifyLastMessage(byte servoId, DynamixelProtocol protocol)
        {
            int commResult = dynamixel.getLastTxRxResult(_portNumber, (int)protocol);

            if (commResult != CommSuccess)
            {
                throw new IOException(DynamixelErrorHelper.GetTxRxResultDescription(commResult) + $" on servo: {servoId}");
            }
            byte dxlError = dynamixel.getLastRxPacketError(_portNumber, (int)protocol);

            if (dxlError != 0)
            {
                throw new IOException(DynamixelErrorHelper.GetRxPackErrorDescription(dxlError) + $" on servo: {servoId}");
            }
        }
Example #2
0
        public bool Ping(byte servoId, DynamixelProtocol protocol = DynamixelProtocol.Version1)
        {
            dynamixel.ping(_portNumber, (int)protocol, servoId);
            if (dynamixel.getLastTxRxResult(_portNumber, (int)protocol) != CommSuccess)
            {
                return(false);
            }
            byte dxlError = dynamixel.getLastRxPacketError(_portNumber, (int)protocol);

            if (dxlError != 0)
            {
                throw new IOException(DynamixelErrorHelper.GetRxPackErrorDescription(dxlError));
            }
            return(true);
        }