A Python SDK for communicating with the Cora robotic arms over TCP sockets.
The package provides:
CoraClientRunning onn the client pc for straightforward controlCoraServerRunning on a cora robot which interfaces with ROS- Utility functions for encoding commands and decoding robot state messages
This SDK is designed to be simple, modular, and suitable for integration into larger robotics applications.
- TCP communication for commands, state feedback, and video
- Threaded background receivers
- Command encoding and state decoding utilities
src/
codi/
client.py
utils.py
exceptions.py
README.md
pyproject.toml
Make sure you have installed git otherwise the following commands will not work
Create a venv and source it:
python3 -m venv .venv\
source .venv/bin/activateInstall from github
pip install git+https://github.com/C-O-R-A/CoDI.git@mainOr install a specific release:
pip install git+https://github.com/C-O-R-A/CoDI.git@v0.1.0Local installation (development)
git clone https://github.com/C-O-R-A/CoDI.git
cd codi
pip install -e .install globally from github
pip install git+https://github.com/C-O-R-A/CoDI.git@v0.1.0Before the client pc can connect to the robot, static ethernet ip's must be configured.
sudo nano /etc/netplan/02-ethernet-static.yamlPaste this exactly:
network:
version: 2
renderer: NetworkManager
ethernets:
enx503eaa8b7587:
dhcp4: no
addresses:
- 192.168.10.2/24sudo netplan applyVerify it worked
ip a showYou should now see:
inet 192.168.10.2/24 scope global <ethernet interface name>Navigate to your network settings, then ethernet, then to the ethernet adapter connected to the robot.
Windows 10 often requires a gateway and DNS in the Settings app, even for a direct Ethernet link.
- IP address:
192.168.10.2 - Subnet prefix length:
24 - Default gateway:
192.168.10.1 - Preferred DNS:
1.1.1.1(or8.8.8.8)
The gateway/DNS are only to satisfy Windows, the PCs will still talk directly.
- Press
Win - Go to Settings
- Click Network & Internet
- Then Ethernet
- Select the adapter corresponding to the robot
- Scroll down to IP settings and click Edit
- Set IPv4 to On
- Enter:
- IP address:
192.168.10.2 - Subnet prefix length:
24 - Gateway:
192.168.10.1 - Preferred DNS:
1.1.1.1
- IP address:
- Click Save
Open Command Prompt and type:
ping 192.168.10.1or
ping cora.localThis sdk supports both .json and .yaml config files.
For most applications, the provided example config files under ./config/ can be copied and used.
json
{
"host": "cora.local",
"video_port": <video port>,
"command_port": <command port>,
"states_port": <states port>,
"config_port": <config port>,
"vision_port": <vision port>
}yaml
host: "cora.local"
video_port: <video port>
command_port: <command port>
states_port: <states port>
config_port: <config port>
vision_port: <vision port>numpyopencv-pythonmsgpackpyaml
These are installed automatically when installing via pip.
Client
import codi.api as cora
# Start the client using a config file
rt.start_client('client.json')
client = cora.get_client()
# Send joint position
cora.send_joint_position(
rt=False,
space="TS",
interface_type="position",
target="gripper",
gripper_command=1.0,
command=np.array([[1, 1, 1, 1], [2, 2, 2, 2]]),
predef_pose="standby"
)Server
from codi import CoraServer
# Start the server
cora_srv = CoraServer(str(CONFIG))
cora_srv.start()
# Send state feedback
cora_srv.send_state('moving', 'joint',
end_effector_state=np.array([[1, 1, 1], [3, 3, 3]]),
camera_frame_state=np.array([[2, 2, 2], [4, 4, 4]]),
gripper_frame_state=np.array([[4, 4, 4], [5, 5, 5]]))- Ensure correct IP address and port configuration.
- GUI functions require a Python installation that includes Tkinter.
- Video display requires Pillow for image conversion.
This project is released under the MIT License.
