Use Ned’s TCP server¶
Ned is permanently running a TCP Server to acquire requests. This server is built on top of the Ned Python ROS Wrapper.
It offers a simple way for developers to create programs for robot and to control them via remote communication on a computer, on a mobile or any device with network facilities.
Programs can communicate through network TCP with the robots in any language available.
Connection¶
To access the server, you will have to use to robot’s IP adress and communicate via the port 40001.
Communication¶
Only one client can communicate with the server (reconnection effective but no multi clients).
The server answers only after the command is done, so it can’t deal with multiple commands at the same time.
Packet convention¶
General format¶
For easier usage and easier debugging, the communication is based on JSON format.
Every package have this following shape: <json_packet_size>{<json_content>}<payload>
.
The JSON packet size is an unsigned short coded on 2 bytes.
The JSON contains command’s name & params.
Payload contains heavy data like an image.
Request¶
Format - Request¶
As no function requests a payload in input, requests have the following.
Format: <json_packet_size>{'param_list': [<param_1>, <param_2>, ....], 'command': <command_str>}
Examples - Request¶
Calibrate auto: {'param_list': ['AUTO'], 'command': 'CALIBRATE'}
Move joints: {'param_list': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'command': 'MOVE_JOINTS'}
Answer¶
Format - Answer¶
Firstly, answers indicate to the user if its command has been well executed. This is indicated in the JSON by the parameter “status”.
A successful answer will have the format:
{'status': 'OK', 'list_ret_param': [<param_1>, <param_2>, ....], 'payload_size': <payload_size_int>, 'command': <command_str>}<payload_str>
An unsuccessful answer will have the format:
{'status': 'KO', 'message': <message_str>}
Examples - Answer¶
Calibrate Auto:
{'status': 'OK', 'list_ret_param': [], 'payload_size': 0, 'command': 'CALIBRATE'}
Get Pose:
{'status': 'OK', 'list_ret_param': [0.2, 0.15, 0.35, 0.5, -0.6, 0.1], 'payload_size': 0, 'command': 'GET_POSE'}
Commands enum for TCP server¶
-
class
CommandEnum
[source]¶ Enumeration of all commands used
-
CALIBRATE
= 0¶
-
SET_LEARNING_MODE
= 1¶
-
GET_LEARNING_MODE
= 2¶
-
SET_ARM_MAX_VELOCITY
= 3¶
-
SET_JOG_CONTROL
= 4¶
-
GET_JOINTS
= 10¶
-
GET_POSE
= 11¶
-
GET_POSE_QUAT
= 12¶
-
MOVE_JOINTS
= 20¶
-
MOVE_POSE
= 21¶
-
SHIFT_POSE
= 22¶
-
MOVE_LINEAR_POSE
= 23¶
-
SHIFT_LINEAR_POSE
= 24¶
-
JOG_JOINTS
= 25¶
-
JOG_POSE
= 26¶
-
FORWARD_KINEMATICS
= 27¶
-
INVERSE_KINEMATICS
= 28¶
-
GET_POSE_SAVED
= 50¶
-
SAVE_POSE
= 51¶
-
DELETE_POSE
= 52¶
-
GET_SAVED_POSE_LIST
= 53¶
-
PICK_FROM_POSE
= 60¶
-
PLACE_FROM_POSE
= 61¶
-
PICK_AND_PLACE
= 62¶
-
GET_TRAJECTORY_SAVED
= 80¶
-
GET_SAVED_TRAJECTORY_LIST
= 81¶
-
EXECUTE_REGISTERED_TRAJECTORY
= 82¶
-
EXECUTE_TRAJECTORY_FROM_POSES
= 83¶
-
EXECUTE_TRAJECTORY_FROM_POSES_AND_JOINTS
= 84¶
-
SAVE_TRAJECTORY
= 85¶
-
SAVE_LAST_LEARNED_TRAJECTORY
= 86¶
-
UPDATE_TRAJECTORY_INFOS
= 87¶
-
DELETE_TRAJECTORY
= 88¶
-
CLEAN_TRAJECTORY_MEMORY
= 89¶
-
GET_SAVED_DYNAMIC_FRAME_LIST
= 95¶
-
GET_SAVED_DYNAMIC_FRAME
= 96¶
-
SAVE_DYNAMIC_FRAME_FROM_POSES
= 97¶
-
SAVE_DYNAMIC_FRAME_FROM_POINTS
= 98¶
-
EDIT_DYNAMIC_FRAME
= 99¶
-
DELETE_DYNAMIC_FRAME
= 100¶
-
MOVE_RELATIVE
= 101¶
-
MOVE_LINEAR_RELATIVE
= 102¶
-
UPDATE_TOOL
= 120¶
-
OPEN_GRIPPER
= 121¶
-
CLOSE_GRIPPER
= 122¶
-
PULL_AIR_VACUUM_PUMP
= 123¶
-
PUSH_AIR_VACUUM_PUMP
= 124¶
-
SETUP_ELECTROMAGNET
= 125¶
-
ACTIVATE_ELECTROMAGNET
= 126¶
-
DEACTIVATE_ELECTROMAGNET
= 127¶
-
GET_CURRENT_TOOL_ID
= 128¶
-
GRASP_WITH_TOOL
= 129¶
-
RELEASE_WITH_TOOL
= 130¶
-
ENABLE_TCP
= 140¶
-
SET_TCP
= 141¶
-
RESET_TCP
= 142¶
-
TOOL_REBOOT
= 145¶
-
SET_PIN_MODE
= 150¶
-
DIGITAL_WRITE
= 151¶
-
DIGITAL_READ
= 152¶
-
GET_DIGITAL_IO_STATE
= 153¶
-
GET_HARDWARE_STATUS
= 154¶
-
ANALOG_WRITE
= 155¶
-
ANALOG_READ
= 156¶
-
GET_ANALOG_IO_STATE
= 157¶
-
CUSTOM_BUTTON_STATE
= 158¶
-
SET_CONVEYOR
= 180¶
-
UNSET_CONVEYOR
= 181¶
-
CONTROL_CONVEYOR
= 182¶
-
GET_CONNECTED_CONVEYORS_ID
= 183¶
-
GET_IMAGE_COMPRESSED
= 200¶
-
GET_TARGET_POSE_FROM_REL
= 201¶
-
GET_TARGET_POSE_FROM_CAM
= 202¶
-
VISION_PICK
= 203¶
-
MOVE_TO_OBJECT
= 205¶
-
DETECT_OBJECT
= 204¶
-
GET_CAMERA_INTRINSICS
= 210¶
-
SAVE_WORKSPACE_FROM_POSES
= 220¶
-
SAVE_WORKSPACE_FROM_POINTS
= 221¶
-
DELETE_WORKSPACE
= 222¶
-
GET_WORKSPACE_RATIO
= 223¶
-
GET_WORKSPACE_LIST
= 224¶
-
SET_IMAGE_BRIGHTNESS
= 230¶
-
SET_IMAGE_CONTRAST
= 231¶
-
SET_IMAGE_SATURATION
= 232¶
-
GET_IMAGE_PARAMETERS
= 235¶
-
PLAY_SOUND
= 240¶
-
SET_VOLUME
= 241¶
-
STOP_SOUND
= 242¶
-
DELETE_SOUND
= 243¶
-
IMPORT_SOUND
= 244¶
-
GET_SOUNDS
= 245¶
-
GET_SOUND_DURATION
= 246¶
-
SAY
= 247¶
-
LED_RING_SOLID
= 250¶
-
LED_RING_TURN_OFF
= 251¶
-
LED_RING_FLASH
= 252¶
-
LED_RING_ALTERNATE
= 253¶
-
LED_RING_CHASE
= 254¶
-
LED_RING_WIPE
= 255¶
-
LED_RING_RAINBOW
= 256¶
-
LED_RING_RAINBOW_CYCLE
= 257¶
-
LED_RING_RAINBOW_CHASE
= 258¶
-
LED_RING_GO_UP
= 259¶
-
LED_RING_GO_UP_DOWN
= 260¶
-
LED_RING_BREATH
= 261¶
-
LED_RING_SNAKE
= 262¶
-
LED_RING_CUSTOM
= 263¶
-
LED_RING_SET_LED
= 264¶
-