You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-36Lines changed: 39 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -36,67 +36,70 @@ pip install --editable .\python-serial\ # OR Install for developement (change
36
36
37
37
# Launch and Use
38
38
39
-
Import the thermoflex library and use .discover() to find our product.
39
+
Import the thermoflex library and use .discover() to find your Node Controller.
40
40
41
-
```python
42
-
import thermoflex as tf
41
+
The `tf.discover()` method searches for USB devices with the Node Controller signature, creating a "NodeNet" object for each one found. A NodeNet represents a network of one or more Node Controllers, where additional devices can be connected via CAN bus to the primary USB-connected node. This allows you to control an entire network of nodes through a single USB connection.
43
42
44
-
netlist = tf.discover()
45
-
network1 = netlist[0]
46
-
```
43
+
For most users working with a single node, you can simply access the first node in the network:
47
44
48
-
This will return a list of [NodeNet](#nodenet-commands)-objects. Each [NodeNet](#nodenet-commands) contains a list of [Node](#node-commands)-objects connected at initialization as well as a broadcast [Node](#node-commands) and a self [Node](#node-commands) device. From here you will be able to assign nodes to variables using the .getDevice() command.
49
-
50
-
```Python
51
-
node0 =network1.node_list[0]
45
+
```python
46
+
import thermoflex as tf
47
+
network = tf.discover()[0] # Find all Node networks over USB and connects to the first one found (0th index)
48
+
node0 =network.node_list[0]# Access the first node in the network
52
49
```
53
50
54
-
You can also assign the broadcast node and self node by calling a [NodeNet](#nodenet-commands)'s .broadcast_node and .self_node.
55
-
56
-
```Python
57
-
node_b = network1.broadcast_node
58
-
node_s = network1.self_node
59
-
```
51
+
For advanced users working with multiple nodes, you have several options:
52
+
- Access specific nodes by their position in the network's node list
53
+
- Identify nodes by testing messages to determine which node responds
54
+
- Each node has a permanent unique ID number accessible using `node.id`. You can identify the Node that you want this way after seeing it respond.
60
55
61
-
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](#muscle-commands) objects
56
+
Additionally, each NodeNet provides two special Node objects:
57
+
-`network.self_node`: Direct access to the node connected via USB
58
+
-`network.broadcast_node`: Send commands to all nodes in the network simultaneously
62
59
60
+
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](#muscle-commands) objects.
63
61
64
62
65
-
To create [Muscle](#muscle-commands)-class objects, start by calling tf.muscle(). This is where you need input your *idnum*, *resistance*, *length*, and *diameter* values if you have them.
63
+
To create [Muscle](#muscle-commands)-class objects, start by calling tf.muscle(). This is where you need input your `portNum` that you want the muscle to connect to (0=M1 and 1=M2 when looking at the phyisical Node Controller port labels)
muscle2 = tf.Muscle(portNum=1) # You can make an orphaned muscle
71
69
```
72
70
73
-
Note that the *idnum* field is the only field that is neccesary for creating the [Muscle](#muscle-commands)-object.
74
-
75
-
Next, assign the muscle objects to a node object by calling the .setMuscle() command. This command takes the identification number and the muscle object as arguments
76
-
71
+
All Muscle objects need to be attached to a Node to operate correctly. This can be done at initialization (like muscle1 above) or by using one of the following methods:
77
72
```Python
78
-
node0.setMuscle(0, muscle1)
79
-
node0.setMuscle(1, muscle2)
73
+
node0.attachMuscle(muscle2, 1)
74
+
# OR
75
+
muscle2.attach(node0, 1)
80
76
```
81
77
82
-
Sessions are automatically created and create a filesystem that exports to a higher level folder. Sessions track the incoming and outgoing serial data and saves it to a .ses file and a .txt file. The .txt files are generated as plain messages, where as the .ses files have serialized messages.
78
+
From here, you can send the Node and Muscles commands.
79
+
80
+
**Command Formats:**
81
+
-[Node Commands](#node-commands)
82
+
-[Muscle Commands](#muscle-commands)
83
83
84
+
These commands should be in the format:
84
85
```Python
85
-
sessionl = tf.Session.sessionl
86
-
session1 = session[0]
86
+
muscle1.enable() # Muscle command
87
+
88
+
node0.enable(muscle1) # Node command version (does the same thing)
87
89
```
88
90
89
-
From here, you can add commands to your command buffer. [Node Commands](#node-commands)
91
+
Note that for all `Muscle` commands, there exists a similar method in the `Node` object
92
+
93
+
### Sessions (experimental)
90
94
91
-
These commands should be in the format,
95
+
Our built-in session logging system can create a filesystem that exports to a higher level folder. Sessions track the incoming and outgoing serial data and saves it to a `.ses`, storing Node network and send/received packet information. This data can be analyzed by the `SessionAnalyzer` class. **Note: This feature is experimental. Feel free to create your own logging logic in your scripts.**
92
96
93
97
```Python
94
-
node0.enable(muscle1)
98
+
sessionl = tf.Session.sessionl
99
+
session1 = session[0]
95
100
```
96
101
97
-
The muscle objects also have their own commands that are passed to their commanding node.[Muscle Commands](#muscle-commands)
98
-
99
-
Developer install instructions
102
+
### Developer install instructions
100
103
101
104
for testing purposes, use the command
102
105
```
@@ -141,7 +144,7 @@ with $SRC being the path to the [python-serial](python-serial/) folder. This wil
141
144
| setLogmode(mode) | Sets the logging mode of the node; mode:(0:'none', 1:'compact', 2:'dump', 3:'readable dump') |
142
145
| setMode(conmode, device) | Sets the input mode of the node; conmode : (percent, volts, amps, ohms, train); device : (all,node,m1,m2,...,m*n*) |
143
146
| 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*|
144
-
| setMuscle(idnum,muscle) | Assigns a muscle to the node; will have presets in the future |
147
+
| setMuscle(portNum,muscle) | Assigns a muscle to the node; will have presets in the future |
145
148
| enable(muscle) | Enables the selected muscle to act on the value set by setSetpoint(); enable : (*muscle object*) |
146
149
| enableAll | Enables all connected muscles of the node |
147
150
| disable(muscle) | Disables the selected muscle : (m1,m2,...,m*n*) |
Copy file name to clipboardExpand all lines: docs/Thermoflex Glossary.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@
46
46
| setLogmode(mode) | Sets the logging mode of the node; mode:(0:'none', 1:'compact', 2:'dump', 3:'readable dump') |
47
47
| setMode(conmode, device) | Sets the input mode of the node; conmode : (percent, volts, amps, ohms, train); device : (all,node,m1,m2,...,m*n*) |
48
48
| 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*|
49
-
|setMuscle(idnum,muscle) | Assigns a muscle to the node; will have presets in the future |
49
+
|attachMuscle(portNum,muscle) | Assigns a muscle to the node; will have presets in the future |
50
50
| enable(muscle) | Enables the selected muscle to act on the value set by setSetpoint(); enable : (*muscle object*) |
51
51
| enableAll() | Enables all connected muscles of the node |
52
52
| disable(muscle) | Disables the selected muscle : (m1,m2,...,m*n*) |
@@ -60,7 +60,7 @@
60
60
| .net | the connected network |
61
61
| .arduino | the serial port information and address |
62
62
| .logmode | integer logmode for internal use |
63
-
| .node_id| the id number of the connected node |
63
+
| .id | the id number of the connected node |
64
64
| .canid | the id specific to the Can bus of the connected node;seperate from the node id |
65
65
| .firmware | the firmware number of the connected node |
66
66
| .board_version | the board version of the connected node |
Copy file name to clipboardExpand all lines: python-serial/src/thermoflex.egg-info/PKG-INFO
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Install the thermoflex library. You can do this 3 different ways.
46
46
3. Download the latest release from [Github Releases](https://github.com/Delta-Robotics-Inc/ThermoFlex-Python-API/releases), cd into the folder and type this command
0 commit comments