Skip to content

Python package for the ThermoFlex Artificial Muscle System by Delta Robotics. This package is responsible for controlling and communicating with devices within the ThermoFlex ecosystem.

Notifications You must be signed in to change notification settings

Delta-Robotics-Inc/ThermoFlex-Python-API

Repository files navigation

Thermoflex Python API

System Requirements

Introduction

The Thermoflex muscle is a current activated artificial muscle that is designed to have a low profile and simple activation and deactivation sequence. The purpose of this library is provide a universal python API for communicating with and directing ThermoFlex Node devices over USB and pyserial.

Download and Installation

To install our software, the most common method is through pip:

pip install thermoflex

You can install manually by downloading the files from our Github release page and installing the package with pip.

Github Releases Page

For Developers

You can also install manually by cloning this repository and running the following commands. This is good if you want to contribute to the library or work with an older/prototype version.,

git clone https://github.com/Delta-Robotics-Inc/ThermoFlex-Python-API
cd ThermoFlex-Python-API
pip install .\python-serial\               # Use for normal installation (not for development)
pip install --editable .\python-serial\    # OR Install for developement (changes made to repository source code reflects in your `thermoflex` package

Launch and Use

Import the thermoflex library and use .discover() to find our product.

import thermoflex as tf

netlist = tf.discover()
network1 = netlist[0]

This will return a list of NodeNet-objects. Each NodeNet contains a list of Node-objects connected at initialization as well as a broadcast Node and a self Node device. From here you will be able to assign nodes to variables using the .getDevice() command.

node0 = network1.node_list[0]

You can also assign the broadcast node and self node by calling a NodeNet's .broadcast_node and .self_node.

node_b = network1.broadcast_node
node_s = network1.self_node

Once you have your connected node bound, you can call its status, reset and logging commands. To use the muscles, you need to create Muscle objects

To create Muscle-class objects, start by calling tf.muscle(). Input the "idnum" which is the port on the Node controller that the muscle is plugged into.

muscle1 = tf.muscle(idnum = 0)
muscle2 = tf.muscle(idnum = 1)

Next, assign the muscle objects to a node object by calling the .setMuscle() command. This command takes the port number and the muscle object as arguments

node0.setMuscle(0, muscle1)
node0.setMuscle(1, muscle2)

These commands should be in the following format, either referencing a Muscle object or a Node object:

node0.enable(muscle1)
# or
muscle1.enable()

Full list of Muscle Commands: Muscle Commands

Library Functions

Program Function Description
discover(prodid) finds connected nodes from the product id (prodid)
update() updates all of the networks
updatenet(network) updates the network
delay(time) continuously calls update on all of the networks until time is called
endsession(session) Ends and deletes the session
endAll() Ends and deletes all sessions, nodes, and networks

Program Glossary

NodeNet Commands

NodeNet Commands Function
refreshDevices() updates the status for all devices on a NodeNet
addNode(nodeid) creates a new Node with the given nodeid
removeNode(nodeid) removes a Node object with nodeid from the given NodeNet's internal node list
getDevice(nodeid) gets the Node object with nodeid and attaches it to the NodeNet
openPort() Opens the port associated with the network, Started upon initialization
closePort() Closes the port associated with the network
start_serial() starts the serial loop for sending and receiving commands. started upon initialization.

NodeNet Glossary

Node Commands

Node Commands Function
status() Checks the status of the node and returns its status
getStatus() Returns the latest node status received
reset() Resets at the node level, can be extrapolated to reset the entire network
setLogmode(mode) Sets the logging mode of the node; mode:(0:'none', 1:'compact', 2:'dump', 3:'readable dump')
setMode(conmode, device) Sets the input mode of the node; conmode : (percent, volts, amps, ohms, train); device : (all,node,m1,m2,...,mn)
setSetpoint(musc, conmode, setpoint) Sets the point at which the node actuates to; musc: muscle id number; conmode : (percent, volts, amps, ohms, train); setpoint : float
setMuscle(idnum,muscle) Assigns a muscle to the node; will have presets in the future
enable(muscle) Enables the selected muscle to act on the value set by setSetpoint(); enable : (muscle object)
enableAll Enables all connected muscles of the node
disable(muscle) Disables the selected muscle : (m1,m2,...,mn)
disableAll Disables all connected muscles of the node
update Sends and receives the packets to "update" the node state

Node Glossary

Muscle Commands

Muscle Command Function
changeMusclemos(mosfetnum:int) Manually changes the mosfet number of the selected muscle. The mosfet number is set automatically when the muscle is assigned to a node;
setMode(conmode) Sets the data type that a given muscle receives for its setSetpoint() command; conmode : (percent, volts, amps, ohms, train)
setSetpoint(setpoint:float) Sets the setpoint of the muscle at the node.
setEnable(bool) Sets the enable status of the muscle in the node.

Muscle

About

Python package for the ThermoFlex Artificial Muscle System by Delta Robotics. This package is responsible for controlling and communicating with devices within the ThermoFlex ecosystem.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages