Skip to content

Commit 6317d63

Browse files
committed
a bit more docs and examples
1 parent f9a60c4 commit 6317d63

File tree

16 files changed

+634
-1784
lines changed

16 files changed

+634
-1784
lines changed

docs/examples/grpc.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Once you have your python bindings you can run the examples from the `python_cli
9494

9595
Or you can write your own python scripts to interact with the poulpe boards connected to the network. For example
9696

97+
9798
```python
9899
from python_client import PyPoulpeRemoteClient
99100
import time
@@ -107,19 +108,28 @@ client = PyPoulpeRemoteClient("http://127.0.0.1:50098", [slave_id], 0.001)
107108
108109
time.sleep(1.0)
109110
110-
print("Connected slaves to master: {}".format(client.get_connected_devices()))
111-
111+
devices = client.get_all_slaves_in_network()
112+
print("Devices connected in the network: ")
113+
for i,name in zip(devices[0],devices[1]):
114+
print("Slave {}: {}".format(i,name))
115+
112116
print("Slave {} compliancy is: {}".format(slave_id, client.get_torque_state(slave_id)))
113117
print("Slave {} current position: {}".format(slave_id, client.get_position_actual_value(slave_id)))
114118
```
115119
which might output something like:
116120
```shell
117121
Connecting on slave: 0
118-
Connected slaves to master: ([0], ['NeckOrbita3d'])
122+
Devices connected in the network:
123+
Slave 1: RightWristOrbita3d
124+
Slave 0: RightShoulderOrbita2d
119125
Slave 0 compliancy is: True
120126
Slave 0 current position: [-0.0011222249595448375, 3.743586057680659e-05, 6.8065196501265746e-06]
121127
```
122128

129+
NOTE:
130+
- <i class="fa fa-book fa-lg"></i> You can find the complete list of functions in the `python_client` crate in the [python_client docs](../../api/python_client).
131+
- You can find mure examples of useing the python client in the `python_client/notebooks` directory. [See the notebooks](https://github.com/pollen-robotics/poulpe_ethercat_controller/tree/develop/python_client/notebooks)
132+
123133
### Orbita2d and Orbita3d control clients
124134

125135
- Once you have your GRPC server running you can connect to it using the

docs/installation/python_client.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,25 @@ client = PyPoulpeRemoteClient("http://127.0.0.1:50098", [slave_id], 0.001)
5959

6060
time.sleep(1.0)
6161

62-
print("Connected slaves to master: {}".format(client.get_connected_devices()))
63-
62+
devices = client.get_all_slaves_in_network()
63+
print("Devices connected in the network: ")
64+
for i,name in zip(devices[0],devices[1]):
65+
print("Slave {}: {}".format(i,name))
66+
6467
print("Slave {} compliancy is: {}".format(slave_id, client.get_torque_state(slave_id)))
6568
print("Slave {} current position: {}".format(slave_id, client.get_position_actual_value(slave_id)))
6669
```
6770
which might output something like:
6871
```shell
6972
Connecting on slave: 0
70-
Connected slaves to master: ([0], ['NeckOrbita3d'])
73+
Devices connected in the network:
74+
Slave 1: RightWristOrbita3d
75+
Slave 0: RightShoulderOrbita2d
7176
Slave 0 compliancy is: True
7277
Slave 0 current position: [-0.0011222249595448375, 3.743586057680659e-05, 6.8065196501265746e-06]
7378
```
79+
80+
81+
NOTE:
82+
- <i class="fa fa-book fa-lg"></i> You can find the complete list of functions in the `python_client` crate in the [python_client docs](../../api/python_client).
83+
- You can find mure examples of useing the python client in the `python_client/notebooks` directory. [See the notebooks](https://github.com/pollen-robotics/poulpe_ethercat_controller/tree/develop/python_client/notebooks)

docs/software/poulpe_ethercat_grpc.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ See the and configure the features in the [Cargo.toml](https://github.com/pollen
4646
The server communicates with the ethercat master reading and writing the data to the poulpe boards.
4747

4848
The client sends the `PoulpeCommand` message to the server and receives the `PoulpeState` message from the server. `PoulpeCommand` message contains
49+
4950
- `id` : id of the poulpe board
5051
- `emergency_stop` : emergency stop flag (true for emergency stop)
5152
- `compliancy` : activate the board (true for active)
@@ -58,6 +59,7 @@ The client sends the `PoulpeCommand` message to the server and receives the `Pou
5859
- `published_timestamp` : timestamp of the message (timestamp when the message was sent)
5960

6061
`PoulpeState` message contains:
62+
6163
- `id` : id of the poulpe board
6264
- `mode_of_operation` : mode of operation
6365
- `actual_position` : actual position
@@ -77,4 +79,4 @@ The client sends the `PoulpeCommand` message to the server and receives the `Pou
7779

7880

7981
NOTE:
80-
<i class="fa fa-book fa-lg"></i> The full software API can be found [here](../../api/pouple_ethercat_grpc)
82+
<i class="fa fa-book fa-lg"></i> The full software API can be found [here](../../api/poulpe_ethercat_grpc)

poulpe_ethercat_controller/src/state_machine.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ impl ControlWord {
4545
}
4646
}
4747

48+
// The mode of operation for the motor
49+
// - 1: ProfilePositionMode - the motor will move to a specific position
50+
// - 2: VelocityMode - the motor will move at a specific velocity
51+
// - 4: ProfileTorqueMode - the motor will move with a specific torque
52+
#[derive(FromPrimitive, PartialEq, Clone, Copy, Debug)]
4853
pub enum CiA402ModeOfOperation {
4954
ProfilePositionMode = 1,
5055
VelocityMode = 2,
@@ -58,6 +63,12 @@ pub enum CiA402ModeOfOperation {
5863
Reserved = 15,
5964
}
6065

66+
impl CiA402ModeOfOperation {
67+
pub fn from_u8(value: u8) -> Option<CiA402ModeOfOperation> {
68+
num::FromPrimitive::from_u8(value)
69+
}
70+
}
71+
6172
// Error codes for the motors, we will have one error code per motor
6273
// - None - no error
6374
// - ConfigFail - error during the configuration of the motor

0 commit comments

Comments
 (0)