Skip to content

Commit a8fb16a

Browse files
committed
docs update
1 parent f856b97 commit a8fb16a

File tree

12 files changed

+198
-61
lines changed

12 files changed

+198
-61
lines changed

docs/_config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ exclude:
3131

3232

3333
callouts:
34+
note:
35+
title: Note
36+
color: green
3437
info:
3538
title: Info
3639
color: blue

docs/ethercat/index.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,49 @@
11
---
2-
title: EtherCAT communication
2+
title: EtherCAT protocols
33
layout: default
44
has_children: true
5+
nav_order: 4
56
---
67

78

9+
# EtherCAT communication
10+
11+
This crate enable communicating over EtherCAT network in few different ways.
12+
13+
## Real-time communication
14+
15+
The real-time variables are exchanged over the network at a high frequency (typically 1kHz) using the PDO communication. There are two types of PDO communication supported by the crate
16+
17+
- Cyclic PDOs - buffered
18+
- Mailbox PDOs - (optional)
19+
20+
{: .info }
21+
> - **PDO** - Process Data Object
22+
23+
Cyclic PDOs are the most common way of exchanging the data over the network. The data is exchanged at a fixed frequency and the data is buffered, ensuring the continuitiy. If the data is not read in time, the data is overwritten with the new data.
24+
25+
Mailbox PDOs are used to ensure that the data is read and written properly. Mailbox enables a handshake between the master and the slave, ensuring that the data is read and written properly. If the data is not written in time, the master will not read the old data but will read zeros.
26+
27+
{: .note}
28+
In order to ensure the continuity, mailbox PDOs are buffered in software in the `ethercat_controller` crate, with a timeout of 1s. If the data is not written in time, the master will consider the slave not operational and will fail. This procedure is enabled by default and can be disabled using the feature `verify_mailbox_pdos` in its `Cargo.toml` file.
29+
30+
## Non real-time communication
31+
32+
The non real-time variables are exchanged over the network using the Mailbox protocol, based on CoE. There are two types of communication supported by the crate.
33+
34+
- SDO communication (Mailbox protocol with CoE)
35+
- FoE communication for file upload - (Mailbox protocol with CoE)
36+
37+
{: .info }
38+
> - **SDO** - Service Data Object
39+
> - **CoE** - Can Over Ethercat
40+
> - **FoE** - Fiile over Ethercat
41+
42+
43+
The SDO communication is used to read and write the data to the slave devices with a handshake. It is mostly used for configuring the slave devices and before starting the real-time communication. In poulpe firmware, it is supported by the `firmware_Poulpe` version 1.5.x and the boards only respond to the SDO communication if they are in the `PREOP` (pre-operational) state.
44+
45+
The FoE communication is used to upload the files to the slave devices, in particular to upload the firmware to the slave devices. In poulpe firmware, it is supported by the `firmware_Poulpe` version 1.5.x and only in `PREOP` (pre-operational) state.
46+
47+
## Communication configuration
48+
49+
The crate determins which kind of communication is available from the ESI XML file downloaded from the slave, and sets up the necessary infrastructure for the communication. See the [poulpe configuration docs](../installation/configure_poulpe) for more info on how to configure the poulpe boards for the EtherCAT network.

docs/examples/grpc.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ $ RUST_LOG=info cargo run --release -- config/my_network_config.yaml # or config
6666
6767
</details>
6868
69+
## Running the GRPC clients
70+
6971
### Rust GRPC client examples
7072
7173
- The simplest example is the `client_listener` example. This example connects to the server and listens for the states of the poulpe boards connected to the network.
@@ -96,10 +98,9 @@ RUST_LOG=info cargo run --release --example client_sinus # add the slave id (ex.
9698

9799
### Python GRPC client
98100

99-
- The `poulpe_ethercat_grpc` crate has a python client that can be used to connect to the GRPC server and read the states of the poulpe boards connected to the network. The python client is a wrapper around the GRPC client that is generated in the `python_client` crate. See the [python_client/README.md](python_client/README.md) for more info.
101+
- The `poulpe_ethercat_grpc` crate has a python client that can be used to connect to the GRPC server and read the states of the poulpe boards connected to the network. The python client is a wrapper around the GRPC client that is generated in the `python_client` crate.
100102
- The python client uses the `maturin` package to build the python wheel.
101-
- See the [python_client/README.md](python_client/README.md) for instructions on how to build the python client.
102-
103+
- See the [python_client docs](../../installation/python_client) for instructions on how to build the python client.
103104

104105
Once you have your python bindings you can run the examples from the `python_client/scripts` directory or notebooks from the `python_client/notebooks` directory.
105106

docs/examples/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ back_to_top: true
55
back_to_top_text: "Back to top"
66
has_children: true
77
has_toc: false
8+
nav_order: 3
89
---
910

1011
# Running the code
1112

1213
The code in the `poulpe_ethercat_controller` crate can be run in multiple ways. The main ways are:
1314

14-
- [Standalone examples](examples/standalone.md): The examples are standalone and do not require the GRPC server to be running.
15-
- [GRPC server and client](examples/grpc.md): The `poulp_ethercat_grpc` crate is a GRPC server that can be used to communicate with the poulpe boards connected to the network. The server can be accessed by multiple clients at the same time. The server is written in Rust and the clients can be written in Rust or Python.
15+
- [Standalone examples](standalone): The examples are standalone and do not require the GRPC server to be running.
16+
- [GRPC server and client](grpc): The `poulp_ethercat_grpc` crate is a GRPC server that can be used to communicate with the poulpe boards connected to the network. The server can be accessed by multiple clients at the same time. The server is written in Rust and the clients can be written in Rust or Python.

docs/index.md

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,19 @@ title: Home
33
layout: default
44
nav_order: 1
55
---
6-
# Poulpe ehtercat controller
6+
# Poulpe EhterCAT stack
77

8-
This is the code that manages the communication between the orbita2d and orbita3d actuators and the ethercat master. The code is written in rust. It is intended to communicate with poulpe boards running the [firmware_Poulpe](https://github.com/pollen-robotics/firmware_Poulpe).
8+
This is the full EtherCAT stack that manages the communication with the poulpe boards through EtherCAT network. The code is written in rust.
9+
It is intended to communicate with poulpe boards running the [firmware_Poulpe](https://github.com/pollen-robotics/firmware_Poulpe).
910

11+
## Crate structure
1012

13+
The code is based on the [EtherCAT IgH stack](https://gitlab.com/etherlab.org/ethercat). The EtherCAT master is implemented in the `ethercat_controller` crate. The `poulpe_ethercat_controller` crate is the main crate that manages the communication with the poulpe boards. The `poulpe_ethercat_grpc` crate is the crate that manages the communication with the GRPC server. Read more about the crate structure in [Crates docs](software)
1114

1215
## Safety features
1316

14-
Each layer of the code has its own safety features. The `ethercat_controller` deals with the EtherCAT communication safety features (see more in the [ethercat_controller/README.md](ethercat_controller/README.md#main-features)). The `poulpe_ethercat_controller` crate has its own safety features that are specific to the poulpe boards (see more in the [poulpe_ethercat_controller/README.md](poulpe_ethercat_controller/README.md#safety-features)). The `poulpe_ethercat_grpc` crate has its own safety features that are specific to the GRPC communication (see more in the [poulpe_ethercat_grpc/README.md](poulpe_ethercat_grpc/README.md#safety-features)).
15-
16-
`ethercat_controller` crate has the following safety features:
17-
- At the statup
18-
- Checks if the master and all the slaves are oprational
19-
- Checks if all the slaves are configured properly
20-
- During the operation
21-
- Checks if the master and all the slaves are oprational
22-
- Checks if all the slaves are connected to the master
23-
- Checks if new slaves are connected to the master
24-
25-
`poulpe_ethercat_controller` crate has the following safety features:
26-
- At the statup
27-
- Checks if ethercat network is operational and the topology is correct
28-
- Checks if all the boards are in the correct state
29-
- During the operation
30-
- Checks if the boards are in the correct state and only allows turning them on if they are in the correct state
31-
32-
`poulpe_ethercat_grpc` crate has the following safety features:
33-
- Real-time communication
34-
- All server and client messages are time stamped to ensure that the communication is real-time
35-
- The server discards all the client messages that are too old
36-
- The client that receives the messages that are too old will not process them and consider that the server is down
37-
- Safety features
38-
- The server checks if the boards are in the fault state and if any of them is it sends the emergency stop signal to all the boards
39-
- The server continues the operation, reading the baoards states but not sending any commands to the boards
17+
The code implements many safety features in order to ensure the safe operation of the boards. Read more about the safety features in the [Safety features](safety_features) docs.
18+
4019

4120
## Install and build the `poulpe_ethercat_controller` code
4221

@@ -47,12 +26,7 @@ Now that you have the ethercat master running and the poulpe board configured, y
4726
git clone [email protected]:pollen-robotics/poulpe_ethercat_controller.git
4827
```
4928

50-
- Build the code
51-
```shell
52-
cargo build --release
53-
```
54-
If the build passes that means that the code is working properly.
55-
29+
For more information on how to install and build the code read the [Installation and configuration](installation) docs.
5630

5731
## Support
5832

docs/installation/configure_poulpe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ SM2: PhysAddr 0x1300, DefaultSize 0, ControlRegister 0x20, Enable 1
139139
140140
</details>
141141
142-
<details markdown="1"><summary>Example for version v1.0.x</summary>
142+
<details markdown="1"><summary>Example for version v1.5.x</summary>
143143
144144
```shell
145145
$ ethercat pdos

docs/installation/index.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
11
---
22
title: Installation and configuration
33
layout: default
4-
position: 2
4+
nav_order: 2
55
has_children: true
66
---
77

88
# Installation and configuration
99

10-
The `poulpe_ethercat_controller` crate is intended to be used with the poulpe boards that are connected to the network. The crate can be used to communicate with the poulpe boards, read and write the SDO and PDO objects, and update the firmware over the EtherCAT network.
10+
The crate is written in Rust and is communicating difectly wit the **EtherCAT IgH** Master. It uses the rust wrapper crate `ethercat-rs` and builds on top of it to provide a more user friendly interface to the user.
1111

1212
## Downoload the code
1313

14-
Now that you have the ethercat master running and the poulpe board configured, you can run the code.
14+
You can obtain the code by cloning the repository.
1515

1616
- Clone the repo
1717
```shell
1818
git clone [email protected]:pollen-robotics/poulpe_ethercat_controller.git
1919
```
2020

21+
Check out the branches that you need, depending on the poulpe firmware version that you are using.
22+
23+
`firmware_poulpe` version | `poulpe_etehract_controller` version
24+
--- | ---
25+
v0.9.x | 0.9.x
26+
v1.0.x | 1.0.x or higher
27+
v1.5.x | 1.5.x
28+
29+
For example if you are using the v1.5.x firmware version you should check out the 1.5.x branch:
30+
```shell
31+
git checkout 1.5.x
32+
```
33+
34+
35+
2136
## Building the code
2237

23-
The crate is written in Rust and is communicating difectly wit the EtherCAT IgH Master. It uses the rust wrapper crate `ethercat-rs` and builds on top of it to provide a more user friendly interface to the user. The endpoint interface is a GRPC server and client interface that can be accessed by multiple clients at the same time, either in rust or python.
38+
The crate is written in Rust and uses the `cargo` build system. All the dependencies are managed by the `cargo` build system, except for the EtherCAT IgH Master.
2439

2540
So the main dependencies are:
2641
- Rust - [installation guide](https://www.rust-lang.org/tools/install)
@@ -37,3 +52,7 @@ Once when you have everything installed you and before you can run the code you
3752

3853
Here is the [guide to configure the poulpe boards](configure_poulpe) on the network.
3954

55+
56+
## Running the code
57+
58+
Once you have the ethercat master running and you connected your poulpe board to the network, you can run the code. See the [Running the code](../examples) docs for more info.

docs/installation/installation_ethercat.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ sudo apt-get install -y protobuf-compiler libprotobuf-dev
3030
- Install the [ethercat master](https://etherlab.org/en/ethercat/)
3131
- `git clone https://gitlab.com/etherlab.org/ethercat.git`
3232
- `cd ethercat`
33-
- use the `stable-1.6` branch `git checkout stable-1.6`
33+
- use the `stable-1.6` branch `git checkout stable-1.6`
34+
- if needed `stable-1.5` will work too
3435
- `./bootstrap`
3536
- `./configure --enable-generic --disable-8139too`
3637
- `make all modules`
3738
- `sudo make modules_install install`
3839
- `sudo depmod`
39-
- add the path to the `ethercat` binary to the `ETHERCAT_PATH` variable (ex. `export ETHERCAT_PATH=$HOME/ethercat`)
40+
41+
{: .info}
42+
> Rust stack will need to know where the `ethercat` binary is located.
43+
> So add the path to the `ethercat` binary to the `ETHERCAT_PATH` variable
44+
> - either by: `export ETHERCAT_PATH=$HOME/ethercat`
45+
> - or add it to the `.bashrc` file
4046
4147
## Configure EtherCAT master
4248
In order configure the `ethercat` we need to give the master the MAC address of the PC/ehternet port.
@@ -57,6 +63,7 @@ In order configure the `ethercat` we need to give the master the MAC address of
5763
- reload the rules:
5864
`sudo udevadm control --reload-rules && sudo udevadm trigger`
5965

66+
{: .info}
6067
> There are some helpful notion pages with a bit more info on the ethercat setup:
6168
> - [Setup EtherCAT](https://www.notion.so/pollen-robotics/Setup-EtherCAT-1ecce786847e495bb1b4b399740727af)
6269
> - [Integration to Bedrock](https://www.notion.so/pollen-robotics/EtherCAT-9864e7348e0341b592b2cf95acaf1bc2?pvs=4#f3a010c9cd474eea92a9f0dfe609a203) (a bit more recent)
@@ -66,8 +73,15 @@ In order configure the `ethercat` we need to give the master the MAC address of
6673

6774
## Start the EtherCAT master
6875

69-
- `sudo ethercatctl start`
70-
- verify that `/dev/EtherCAT0` exists (`ls /dev/EtherCAT0`).
76+
Start the `ethercat` master:
77+
```
78+
sudo ethercatctl start
79+
```
80+
81+
Verify that `/dev/EtherCAT0` exists
82+
```shell
83+
ls /dev/EtherCAT0
84+
```
7185

7286
The output should be something like:
7387
```shell

docs/installation/python_client.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ To use this client run the following command:
1717
maturin develop --release
1818
```
1919

20-
{: .note }
21-
> IMPORTANT: We suggest using a conda environment to install the client.
20+
{: .info }
21+
> You will hav to use a virtual environment to install the client with the `maturin` command. So make sure to activate the virtual environment before running the command. We suggest using `conda` to create the virtual environment, but you can use `venv` or `virtualenv` as well.
22+
>
23+
```bash
24+
conda create -n poulpe_ethercat python=3.10
25+
conda activate poulpe_ethercat
26+
```
2227

28+
Once you have the virtual environment activated you can run the following command:
2329
```bash
24-
conda create -n poulpe_ethercat python=3.8
2530
pip install maturin
26-
conda activate poulpe_ethercat
2731
maturin develop --release
2832
```
2933

docs/safety_features.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Safety features
3+
layout: default
4+
---
5+
6+
7+
# Safety features
8+
9+
Each layer of the code has its own safety features. The `ethercat_controller` deals with the EtherCAT communication safety features (see more in the [ethercat_controller docs](../software/ethercat_controller#safety-features)). The `poulpe_ethercat_controller` crate has its own safety features that are specific to the poulpe boards (see more in the [poulpe_ethercat_controller docs](../software/poulpe_ethercat_controller#safety-features)). The `poulpe_ethercat_grpc` crate has its own safety features that are specific to the GRPC communication (see more in the [poulpe_ethercat_grpc docs](../software/poulpe_ethercat_grpc#safety-features)).
10+
11+
`ethercat_controller` crate has the following safety features:
12+
- At the statup
13+
- Checks if the master and all the slaves are oprational
14+
- Checks if all the slaves are configured properly
15+
- During the operation
16+
- Checks if the master and all the slaves are oprational
17+
- Checks if all the slaves are connected to the master
18+
- Checks if new slaves are connected to the master
19+
20+
`poulpe_ethercat_controller` crate has the following safety features:
21+
- At the statup
22+
- Checks if ethercat network is operational and the topology is correct
23+
- Checks if all the boards are in the correct state
24+
- During the operation
25+
- Checks if the boards are in the correct state and only allows turning them on if they are in the correct state
26+
27+
`poulpe_ethercat_grpc` crate has the following safety features:
28+
- Real-time communication
29+
- All server and client messages are time stamped to ensure that the communication is real-time
30+
- The server discards all the client messages that are too old
31+
- The client that receives the messages that are too old will not process them and consider that the server is down
32+
- Safety features
33+
- The server checks if the boards are in the fault state and if any of them is it sends the emergency stop signal to all the boards
34+
- The server continues the operation, reading the baoards states but not sending any commands to the boards
35+
36+
37+
If any of the above safety features fails, the master will send an emergency stop signal (CiA402 QuickStop) to all the boards and stop the operation. The boards will go into the shut-down state.
38+
39+
40+
## Emergency stop
41+
42+
Additionally, anytime the ethercat master stops the operation, either in [standalone](../examples/standalone) or in the [GRPC server](../examples/grpc) mode, the poulpe boards will stop their operation and go into the shut-down state.
43+
44+
However, if the GRPC server is up and running, there is another way to send the emergency stop command to the boards without killing the server, using the emergency stop script. This usage is useful in order to enable providing the applications built on top of the GRPC server with the state data of the boards even after the emergency stop signal is sent. The code contains the precompiled script that sends the emergency stop (CiA402 QuickStop command) signal to all the boards connected to the ethercat network.
45+
46+
To run the script, navigate to the main directory and run the following command:
47+
48+
```shell
49+
sh emergency_stop_all.sh
50+
```

0 commit comments

Comments
 (0)