Skip to content

robotstack-dev/ftservo-python-websockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ftservo-python-websockets

This is a fork of the official feetech repository that adds WebSocket support, enabling wireless control of FEETECH servos.

WebSocket Support

This fork adds support for using a WebSocket client as a port in place of a serial port. This makes it possible to wirelessly control your robot!

It requires the servos to be connected over half-duplex serial to a WiFi-enabled microcontroller (e.g. ESP32) that uses a WebSocket server to relay the comms to and from connected motors. The RobotStack Smart Servo Add-On Board is a ready-to-use solution that provides this functionality.

Structure

root directory
     |---scservo_sdk
     |---sms_sts
     |---scscl
     |---additional-examples

The source code of the library is located in the scservo_sdk directory.

The 'scscl' and 'sms_sts' directories contain examples of using the library.

The additional-examples directory contains examples demonstrating additional features:

  • send_text.py: Shows how to send text messages to the server
  • ping_and_poll.py: Demonstrates how to ping a servo and poll for incoming messages

Usage

Tested with:

Installation

$ cd /usr/src/
$ sudo git clone https://github.com/robotstack-dev/ftservo-python-websockets.git
$ sudo chown -R pi ftservo-python-websockets
$ cd ftservo-python-websockets/sms_sts
$ python3 ping.py
Succeeded to open the port
Succeeded to change the baudrate
[ID:001] ping Succeeded. SCServo model number : 1540

Basic Usage

To use WebSocket define your port as:
        portHandler = PortHandler("ws://yourServerURL:portnum")
e.g.:
        portHandler = PortHandler("ws://192.168.1.22:80")

You'll need to find the IP address of the server. If using the smart-servo-bridge firmware, you can print its IP address to the serial monitor when it starts up.

Send binary with:
        portHandler.writePort([byte1,byte2,...,byteN])

This feature is used by the FTServo SDK with calls such as:
        packetHandler.write1ByteTxRx(portHandler, id, ADDR_TORQUE_ENABLE, TORQUE_ENABLE)

You can also send text with:
        portHandler.writePort("my message here")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages