Skip to content

Troubleshooting

AUBO SDK provides error codes, logs, and exception handling, which are important tools for analyzing, judging, and resolving issues or errors of the SDK. They can help developers better debug and manage codes, improving the maintainability, reliability, and stability of codes. Logs record detailed information about the application in running process, including error codes and descriptions when an error occurs during running of the program. Exception handling can be used to diagnose and handle abnormal situations that arise during running of the program, such as program termination or crashes. Developers can choose appropriate methods to perform debugging based on specific scenarios and needs.

Error Codes

Error codes fall into three types: system error code, hardware abstraction layer error code, and runtime error code, defined in the header files system_error.h, hal_error.h, and rtm_error.h respectively. To view error codes and their corresponding descriptions, please refer to the document Error Codes.

Log

AUBO SDK provides logs to record detailed information about events, errors, etc. during program running. Logs perform recording in text format, including timestamps, log levels, event descriptions, error information, etc. They also provide a history that can help developers or technical support personnel quickly locate issues when problems arise and provide detailed information about program running.

Log Level

Log level indicates the severity of the log, ranging from 0 to 5.

LogLevelValueDescription
FATAL0Severe
ERROR1Error
WARNING2Warning
INFO3Notification
DEBUG4Debug
BACKTRACE5Backtrace

View Logs

Users can view logs in the following two ways:

  1. Log Files: On the AUBO Sim virtual machine or teach pendant, users can find the aubo_control and aubo_scope log files. The aubo_control log file represents the server and the aubo_scope log file represents the teach pendant. The file path is /root/arcs_ws/log, as shown in the figure below:

    log
  2. Terminal Real-time Log Printing: Open the terminal on the AUBO Sim virtual machine or teach pendant, switch to the folder path /root/arcs_ws/log where the logs are located, and enter tail -f aubo_control.log or tail -f aubo_scope.log. While running the program, users can see the log printing information of the server or teach pendant in real time on the terminal, monitor the program's running status, reproduce error issues, or find the causes of errors.

Exception

AUBO SDK supports exception handling, and the AuboException class is defined in its header file type_def.h. Errors may occur during program running, leading to abnormal situations such as program termination or crashes. Developers can add codes to the program to catch exceptions to avoid issues like crashes or unresponsiveness, and to locate the position or cause of the error.

AuboException Class

In C++, the AuboException class includes three member functions: type(), code(), and what().

type() is used to return the exception type, that is, an enumerated value of error_type that identifies the specific type of exception, such as pars_error, invalid_request and method_not_found.

Enumerated values of error_type are defined as follows:

enum error_type
{
    parse_error = -32700,      ///< Parsing error
    invalid_request = -32600,  ///< Invalid request
    method_not_found = -32601, ///< Method not found
    invalid_params = -32602,   ///< Invalid parameters
    internal_error = -32603,   ///< Internal error
    server_error,              ///< Server error
                               ///< This type is returned when -32099<= code_<=-32000
    invalid                    ///< Invalid 
                               /// This type is returned when code_ is not within the above range
    
};

code() is used to return the error code of the exception, that is, an enumerated value of ExceptionCode that represents the specific error situation of the exception.

Enumerated values of ExceptionCode are defined as follows:

enum ExceptionCode
{
    EC_DISCONNECTED = -1,      ///< Disconnected
    EC_NOT_LOGINED = -2,       ///< Not logged in
    EC_INVAL_SOCKET = -3,      ///< Invalid socket
    EC_REQUEST_BUSY = -4,      ///< Request busy
    EC_SEND_FAILED = -5,       ///< Sending failed
    EC_RECV_TIMEOUT = -6,      ///< Receiving timeout
    EC_RECV_ERROR = -7,        ///< Receiving error
    EC_PARSE_ERROR = -8,       ///< Parsing error
    EC_INVALID_REQUEST = -9,   ///< Invalid request
    EC_METHOD_NOT_FOUND = -10, ///< Method not found
    EC_INVALID_PARAMS = -11,   ///< Invalid parameters
    EC_INTERNAL_ERROR = -12,   ///< Internal error
    EC_SERVER_ERROR = -13,     ///< Server error
    EC_INVALID = -14           ///< Invalid
};

what() is used to return a detailed error message of the exception object.

Example of C++ Exception Catch

When writing a program in C++, use try/catch to catch and handle potential exceptions. The codes are as follows:

try{
	...// Code that causes an exception
}
catch(const arcs::aubo_sdk::AuboException& e) {
	// Print exception information
	std::cout << "An exception occurs: " << e.what() << std::endl;
	// Print the error code
	std::cout << "Exception code: " << e.code() << std::endl;
	// Print the exception type
	std::cout << "Exception type: " << e.type() << std::endl;
}

Example of Python Exception Catch

When developing with Python, use try/except for exception handling. The codes are as follows:

try:
	...# Code that causes an exception
except pyaubo_sdk.AuboException as ex:
	print("An exception occurs: ", ex)