C#

This document introduces the data types and APIs defined in JAKA SDK (C#), mainly intended for software developers who create robot applications in C# to communicate with virtual or real controllers. It will also be helpful for users who need to understand JAKA robot controller applications.

Interface List

Basic Robot Operations

[Create Handler]

int create_handler(char[] ip, ref int handle, bool use_grpc = false);
int create_handler([MarshalAs(UnmanagedType.LPStr)] string ip, ref int handle, bool use_grpc = false);
int create_handler_with_auth([MarshalAs(UnmanagedType.LPStr)] string ip, ref int handle, bool use_grpc, [MarshalAs(UnmanagedType.LPStr)] string username, [MarshalAs(UnmanagedType.LPStr)] string password);

[Destroy Handler]

int destroy_handler(ref int handle)

Robot Arm Login

int power_on(ref int handle)

Power Off Robot Arm

int power_off(ref int handle)

Shut Down Robot Arm

int shut_down(ref int handle)

Enable Robot Arm

int enable_robot(ref int handle)

Disable Robot Arm

int disable_robot(ref int handle)

Get DH parameters of the currently connected robot arm

int get_dh_param(ref int handle, ref JKTYPE.DHParam offset)

Set Robot Arm Installation Angle

int set_installation_angle(ref int handle, double angleX, double angleZ)

Get Robot Arm Installation Angle

int get_installation_angle(ref int handle, ref JKTYPE.Quaternion quat, ref JKTYPE.Rpy appang)

Get Robot Arm Status

int get_robot_state(ref int handle, ref JKTYPE.RobotState state)

Get Robot Arm Status Monitoring Data - Only Thread-Safe Interface

int get_robot_status(ref int handle, ref JKTYPE.RobotStatus status)

Get Robot Arm Status Monitoring Data

int get_robot_status_simple(ref int handle, ref JKTYPE.get_robot_status_simple status)

Robot Moving Output

Robotic arm movement in manual mode

int jog(ref int handle, int aj_num, JKTYPE.MoveMode move_mode, JKTYPE.CoordType coord_type, double vel_cmd, double pos_cmd)

Robotic arm stop movement in manual mode

int jog_stop(ref int handle, int num)

Robotic arm joint movement

int joint_move(ref int handle, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed);
int joint_move_extend(ref int handle, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond)

Robotic arm linear movement at end effector

int linear_move(ref int handle, ref JKTYPE.CartesianPose end_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed);
int linear_move_extend(ref int handle, ref JKTYPE.CartesianPose cart_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond);
int linear_move_extend_ori(ref int handle, ref JKTYPE.CartesianPose cart_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond, double ori_vel, double ori_acc)

Robotic arm arc movement

int circular_move(ref int handle, ref JKTYPE.CartesianPose end_pos, ref JKTYPE.CartesianPose mid_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond);
int circular_move_extend(ref int handle, ref JKTYPE.CartesianPose end_pos, ref JKTYPE.CartesianPose mid_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond, double circle_cnt);
int circular_move_extend_mode(ref int handle, ref JKTYPE.CartesianPose end_pos, ref JKTYPE.CartesianPose mid_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond, double circle_cnt, int circle_mode)

Set robot arm speed multiplier

int set_rapidrate(ref int handle, double rapid_rate)

Get robot arm speed multiplier

int get_rapidrate(ref int handle, ref double rapid_rate)

Set tool information

int set_tool_data(ref int handle, int id, ref JKTYPE.CartesianPose tcp, char[] name);
int set_tool_data(ref int handle, int id, ref JKTYPE.CartesianPose tcp, [MarshalAs(UnmanagedType.LPStr)] string name)

Get tool information

int get_tool_data(ref int handle, int id, ref JKTYPE.CartesianPose tcp)

Set the tool ID currently in use

int set_tool_id(ref int handle, int id)

Query the tool ID currently in use

int get_tool_id(ref int handle, ref int id)

Set user coordinate system information

int set_user_frame_data(ref int handle, int id, ref JKTYPE.CartesianPose user_frame, char[] name);
int set_user_frame_data(ref int handle, int id, ref JKTYPE.CartesianPose user_frame, [MarshalAs(UnmanagedType.LPStr)] string name)

Get user coordinate system information

int get_user_frame_data(ref int handle, int id, ref JKTYPE.CartesianPose user_frame)

Set the user coordinate system ID currently in use

int set_user_frame_id(ref int handle, int id)

Query the user coordinate system ID currently in use

int get_user_frame_id(ref int handle, ref int id)

Control robot arm to enter or exit drag mode

int drag_mode_enable(ref int handle, bool enable)

Query whether the robot arm is in drag mode

int is_in_drag_mode(ref int handle, ref bool in_drag)

Set joint friction compensation coefficient (drag feel parameter)

int set_drag_friction_compensation_gain(ref int handle, int joint, int gain);

Get joint friction compensation coefficient (drag feel parameter)

int get_drag_friction_compensation_gain(ref int handle, ref JKTYPE.DragFrictionCompensationGainList gainList);

Get the pose of the tool endpoint under the current settings — servo feedback

int get_actual_tcp_position(ref int handle, ref JKTYPE.CartesianPose tcp_position)

Get the pose of the tool endpoint under the current settings

int get_tcp_position(ref int handle, ref JKTYPE.CartesianPose tcp_position)

Get current robot arm joint angles — servo feedback

int get_actual_joint_position(ref int handle, ref JKTYPE.JointValue joint_position)

Get the current robot arm joint angles

int get_joint_position(ref int handle, ref JKTYPE.JointValue joint_position)

Set manual or automatic mode

int set_auto_manual_mode(int mode, int robot_id)

Get the current robot arm operation mode

int get_auto_manual_mode(ref int mode, int robot_id)

Check if the robot arm exceeds the limit

int is_on_limit(ref int handle, ref bool on_limit)

Check if the robot arm movement has stopped

int is_in_pos(ref int handle, ref bool in_pos)

Check if the robot arm is in an emergency stop state

int is_in_estop(ref int handle, ref bool estop)

Set the robot arm motion planner type

int set_motion_planner(ref int handle, int type)

Terminate robot arm movement

int motion_abort()

Check the robot arm motion status

int get_motion_status(ref int handle, ref JKTYPE.MotionStatus status)

Set the robot arm load

int set_payload(ref int handle, ref JKTYPE.PayLoad payload)

Get robot arm load data

int get_payload(ref int handle, ref JKTYPE.PayLoad payload)

EDG

Robotic arm EDG enable

int edg_init(ref int handle, ref bool en, char[] edg_stat_ip)
int edg_init_extend(ref int handle, ref bool en, char[] edg_stat_ip, int edg_port, int edg_mode)

Robotic arm high-speed acquisition of EDG feedback data

int edg_get_stat(ref int handle, ref JKTYPE.EDGState edg_state, byte robot_index)

Robotic arm acquisition of EDG feedback data issuance timestamp

int edg_stat_details(ref int handle, ulong[] details)

Robotic arm EDG joint space servo mode motion

int edg_servo_j(ref int handle, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode, int step_num, byte robot_index)

Robotic arm EDG Cartesian space servo mode motion

int edg_servo_p(ref int handle, ref JKTYPE.CartesianPose cartesian_pose, JKTYPE.MoveMode move_mode, int step_num, byte robot_index)

FTP

Initialize FTP client

int init_ftp_client(ref int i)

Close FTP client

int close_ftp_client(ref int i)

FTP download

int download_file(ref int handle, char[] local, char[] remote, int opt);
int download_file(ref int handle, [MarshalAs(UnmanagedType.LPStr)] string local, [MarshalAs(UnmanagedType.LPStr)] string remote, int opt)

FTP upload

int upload_file(ref int handle, char[] local, char[] remote, int opt);
int upload_file(ref int handle, [MarshalAs(UnmanagedType.LPStr)] string local, [MarshalAs(UnmanagedType.LPStr)] string remote, int opt)

FTP delete

int delete_ftp_file(ref int handle, char[] remote, int opt);
int delete_ftp_file(ref int handle, [MarshalAs(UnmanagedType.LPStr)] string remote, int opt)

FTP rename

int rename_ftp_file(ref int handle, char[] remote, char[] destination, int opt);
int rename_ftp_file(ref int handle, [MarshalAs(UnmanagedType.LPStr)] string remote, [MarshalAs(UnmanagedType.LPStr)] string destination, int opt)

FTP directory query

int get_ftp_directory(ref int handle, char[] remote, int type, StringBuilder ret );
int get_ftp_directory(ref int handle, [MarshalAs(UnmanagedType.LPStr)] string remote, int type, StringBuilder ret )

Payload Identification

Start identifying sensor end load

int start_torq_sensor_payload_identify(ref int handle, ref JKTYPE.JointValue joint_pos)

Get sensor end load identification status

int get_torq_sensor_identify_status(ref int handle, ref int identify_status)

Get sensor end load identification result

int get_torq_sensor_payload_identify_result(ref int handle, ref JKTYPE.PayLoad payload)

Set sensor end load

int set_torq_sensor_tool_payload(ref int handle, ref JKTYPE.PayLoad payload)

Get sensor end load

int get_torq_sensor_tool_payload(ref int handle, ref JKTYPE.PayLoad payload)

Tool Drag

Get force compliance control parameters

int get_admit_ctrl_config(ref int handle, ref JKTYPE.RobotAdmitCtrl admit_ctrl_cfg)

[Set force compliance control parameters]

int set_admit_ctrl_config(ref int handle, int axis, int opt, double ftUser, double ftConstant, int ftNormalTrack, double ftReboundFK)

Enable or disable tool dragging

int enable_admittance_ctrl(ref int handle, int enable_flag)

Enable tool dragging

int enable_tool_drive(ref int handle, int enable_flag)

Get tool dragging enable status

int get_tool_drive_state(ref int handle, ref int enable_flag, ref int state)

Get tool dragging parameters

int get_tool_drive_config(ref int handle, ref JKTYPE.RobotToolDriveCtrl)

Set force control drag feel parameters

int set_tool_drive_config(ref int handle, JKTYPE.ToolDriveConfig)

Get tool drag coordinate system

int get_tool_drive_frame(ref int handle, ref JKTYPE.FTFrameType)

Set tool drag coordinate system

int set_tool_drive_frame(ref int handle, JKTYPE.FTFrameType)

Get fusion drag sensitivity

int get_fusion_drive_sensitivity_level(ref int handle, ref int level)

Set fusion drag sensitivity

int set_fusion_drive_sensitivity_level(ref int handle, int level)

Get motion limit - singularity and joint limit - warning range

int get_motion_limit_warning_range(ref int handle, ref int warning_range)

Set motion limit - singularity and joint limit - warning range

int set_motion_limit_warning_range(ref int handle, int warning_range)

Force control

Set constant-force compliance control coordinate system

int set_ft_ctrl_frame(ref int handle, int ftFrame)

Get constant-force compliance control coordinate system

int get_ft_ctrl_frame(ref int handle, ref int ftFrame)

Set force control type and zero calibration (initialization) options

int set_compliant_type(ref int handle, int sensor_compensation, int compliance_type)

Get force control type and reading display (initialization) status

int get_compliant_type(ref int handle, ref int sensor_compensation, ref int compliance_type)

Set speed compliance control force condition

int set_compliance_condition(ref int handle, ref JKTYPE.FTxyz ft)

Set approach speed limit

int set_approach_speed_limit(ref int handle, double vel, double angularVel)

Get approach speed limit

int get_approach_speed_limit(ref int handle, ref double vel, ref double angularVel)

Set constant-force control tolerance

int set_ft_tolerance(ref int handle, double force, double torque)

Get constant-force control tolerance

int get_ft_tolerance(ref int handle, ref double force, ref double torque)

Activate/Deactivate Constant Force Compliant Control

int set_ft_ctrl_mode(ref int handle, int mode)

Get constant-force compliance enable status

int get_ft_ctrl_mode(ref int handle, ref int mode)

Set constant-force compliance control parameters

int set_ft_ctrl_config(ref int handle, AdmitCtrlType cfg)

Get constant-force compliance control parameters

int get_ft_ctrl_config(ref int handle, ref RobotAdmitCtrl cfg)

Collision

Query whether the robot arm is in collision protection mode

int is_in_collision(ref int handle, ref bool in_collision)

Recover from collision protection mode after collision

int collision_recover(ref int handle)

Set robot arm collision level

int set_collision_level(ref int handle, int level)

Get collision level set by machine

int get_collision_level(ref int handle, ref int level)

Kinematics

Robotic arm inverse kinematics solution

int kine_inverse(ref int handle, ref JKTYPE.JointValue ref_pos, ref JKTYPE.CartesianPose cartesian_pose, ref JKTYPE.JointValue joint_pos)

Robotic arm forward kinematics solution

int kine_forward(ref int handle, ref JKTYPE.JointValue joint_pos, ref JKTYPE.CartesianPose cartesian_pose)

Robotic arm inverse solution extension

int kine_inverse_extend(ref int handle, ref JKTYPE.JointValue ref_pos, ref JKTYPE.CartesianPose cartesian_pose, ref JKTYPE.JointValue joint_pos, ref JKTYPE.CartesianPose tool, ref JKTYPE.CartesianPose userFrame)

Extended robot arm forward kinematics calculation

int kine_forward_extend(ref int handle, ref JKTYPE.JointValue joint_pos, ref JKTYPE.CartesianPose cartesian_pose, ref JKTYPE.CartesianPose tool, ref JKTYPE.CartesianPose userFrame)

Convert Euler angles to rotation matrix

int rpy_to_rot_matrix(ref int handle, ref JKTYPE.Rpy rpy, ref JKTYPE.RotMatrix rot_matrix)

Convert rotation matrix to Euler angles

int rot_matrix_to_rpy(ref int handle, ref JKTYPE.RotMatrix rot_matrix, ref JKTYPE.Rpy rpy)

Convert quaternion to rotation matrix

int quaternion_to_rot_matrix(ref int handle, ref JKTYPE.Quaternion quaternion, ref JKTYPE.RotMatrix rot_matrix)

Convert rotation matrix to quaternion

int rot_matrix_to_quaternion(ref int handle, ref JKTYPE.RotMatrix rot_matrix, ref JKTYPE.Quaternion quaternion)

Interface call return value list and troubleshooting

Error codes

Description

Handling suggestions

0

success

null

2

interface error or controller not supported

Check the controller and SDK version information, upgrade or use another interface

-1

invalid handler

Please check whether login is done before calling the interface

-2

invalid parameter

Please check whether the parameters are correct

-3

failed to connect

Please check the network connection status, or whether the robot IP is correct

-4

inverse kinematics error

Inverse kinematics failed, please check the current coordinate system, or whether the reference joint angles are reasonable

-5

emergency stop

Emergency stop state, status retained

-6

not powered on

Not powered on

-7

not enabled

Not enabled

-8

not in servo mode

Not in servo mode. When executing servoJP, you must first enter servo mode. Please check whether the corresponding interface is called

-9

must disable enable before powering off

Must disable enable before powering off

-10

cannot operate, program is running

Cannot operate, a program is currently running. Please close the program first

-11

cannot open file, or file does not exist

Cannot open file, or file does not exist

-12

motion abnormal

Abnormal movement, possibly near a singularity point or exceeding robot movement limits

-14

ftp error

ftp abnormal

-15

socket msg or value oversize

Exceeding limit abnormal

-16

kine_forward error

Forward kinematics failed

-17

not support empty folder

Empty folders are not supported

-20

protective stop

Safeguard (Protective) Stop

-21

emergency stop

Emergency stop

-22

on soft limit

In soft limit position, manual drag of the robot is not possible; use the teaching function in the APP to approach the soft limit

-30

fail to encode cmd string

Command encoding failed, usually due to an error while parsing the message returned by the controller

-31

fail to decode cmd string

Command decoding failed, usually due to an error while parsing the message returned by the controller

-32

fail to uncompress port 10004 string

Failed to decompress data from port 10004, possibly due to network fluctuations or excessive data size

-40

move linear error

Linear movement failed, please check if there are any singular regions in the path

-41

move joint error

Joint movement failed, please check the set joint angles

-42

move circular error

Arc motion failed, please check the set parameters

-50

block_wait timeout

Blocking wait timeout

-51

power on timeout

Power-on timeout

-52

power off timeout

Power-off timeout

-53

enable timeoff

Enable timeout

-54

disable timeout

Disable timeout

-55

set userframe timeout

Setting user coordinate system timeout

-56

set tool timeout

Setting tool coordinate system timeout

-57

edg init failed

EDG function initialization failed

-58

edg is running, cannot use servo_j or servo_p

EDG function is running, cannot use servo_j or servo_p interface

-59

Current EDG mode does not support using edg_servo_j or edg_servo_p.

EDG function is running, cannot use edg_servo_j or edg_servo_p interface

-60

set io timeout

Setting IO timeout

-61

operation timeout

Interface timeout

-62

servo queue is full

Servo queue is full

-63

servo is not running

Servo mode is not started

-9997

not implement

Interface not implemented

-9998

deprecated interface

Interface will be removed in the future (function still available)

-9999

obsolete interface

Interface will be removed in the future (function unavailable)

Issue feedback

If there are any inaccurate descriptions or mistakes in the document, we kindly ask readers for their understanding and corrections. If you find any problems or wish to provide suggestions while reading, you can send an email to support@jaka.com, and we will reply to you as soon as possible.