Skip to content

HrishabhMittal/cobot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Addverb's Cobot Python Client Library

This project provides a Python-based client library designed to interface with Addverb's cobot. It allows for remote control of joint jogging, Cartesian movements, gripper operations, querying positions and velocity scaling over a network using a custom TCP protocol.

Overview

The system operates on a client-server architecture:

  • The Backend (C++): A control server runs directly on Addverb's cobot hardware or controller. It handles hardware safety states, and listens for incoming TCP instructions on port 5000. It utilizes a dedicated thread to process network packets while maintaining the real-time control loop.
  • The Client (Python): This library provides a high-level Cobot class that abstracts the TCP socket communication into simple method calls. Users can control the robot without needing to manage raw byte buffers or manual socket states.

Requirements

To use this library, the cobot must be running the backend control in the dockerfile on the cobot. Ensure your cobot and the client machine are on the same network. Support for different networks will be added later through hole punching if I have free time :)

Installation

  1. Clone the repository:
git clone git@github.com:HrishabhMittal/cobot.git
cd cobot
  1. Ensure Python is installed: This library is verified with Python 3.x.

  2. Install the package in development mode: You can install the library locally so it is accessible within your Python environment:

pip install -e .

Basic Usage

from cobot import Cobot, Dirn

# Using a context manager ensures the connection is closed automatically
# the ip to be used can be found by running ip addr, or ifconfig
# local IPs start from 10. 
# look for inet 10.x.y.z
with Cobot(host="10.x.y.z") as arm:
    # set speed multiplier
    arm.setVelocity(1.5)
    
    # jog the first joint in a positive direction
    arm.jogJoint(Dirn.POSITIVE, 0)

    # let it jog for a bit
    time.sleep(5)

    # stop all movement
    arm.stopJogging()

    # move to base ~ 10s
    arm.baseRigid()

    # +x dirn
    arm.jogCartesian(Dirn.NEGATIVE, 0)
    
    # let it jog for a bit
    time.sleep(10)
    
    # stop all movement
    arm.stopJogging()
    
    # Open gripper ~ 5s
    arm.gripperOpen()
    
    # Close the gripper ~ 5s
    arm.gripperClose()

Bluetooth Rerouter Usage

Make sure the serial port is open on rfcomm0

sudo sdptool add SP
sudo rfcomm listen 0 1

# make sure your user is added to groups uucp, which owns rfcomm serial ports
sudo usermod -aG uucp "$USER"
# you might need to logout and login for changes
# check using
groups
# see if uucp is listen
# if not
# quick fix
newgrp uucp

To use bluetooth rerouter

arm=BluetoothCobot("10.x.y.z","/dev/rfcomm0")
arm.reroute()

About

Python Client Library utilising TCP to send remote controls to COBOT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages