Skip to content

Commit dd3b9a0

Browse files
authored
Update dev docs (#605)
Fixes #603
1 parent 6048196 commit dd3b9a0

File tree

5 files changed

+92
-33
lines changed

5 files changed

+92
-33
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ root = true
88
end_of_line = lf
99
insert_final_newline = true
1010

11+
[*.py]
12+
indent_style = space
13+
indent_size = 4
14+
15+
[*.sh]
16+
indent_style = space
17+
indent_size = 2
18+
1119
# Tab indentation (no size specified)
1220
[Makefile]
1321
indent_style = tab

device-backend/control/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,27 @@ Please note that for camera we rely on the Raspberry OS packages `python3-picame
2222

2323
### Development
2424

25-
To install all dependencies including development tooling, run:
25+
Install all dependencies including development tooling:
2626

2727
```sh
2828
poetry install --with dev
2929
```
3030

31-
Then you can run the code auto-formatter on the project by running:
31+
Start controller for development:
32+
33+
```sh
34+
sudo systemctl stop planktoscope-org.device-backend.controller.service
35+
poetry run python -u planktoscopehat/main.py
36+
# make changes and restart
37+
```
38+
39+
Run the code auto-formatter on the project:
3240

3341
```sh
3442
poetry run poe fmt
3543
```
3644

37-
And you can run all checks (including code formatting and linting) by running:
45+
Run all checks (including code formatting and linting):
3846

3947
```sh
4048
poetry run poe check

documentation/docs/community/contribute/tips-and-tricks.md

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,6 @@ To setup the recommended development environment, run the following commands.
4444

4545
Make sure to replace `$planktoscope` with your PlanktoScope hostname, eg. `pkscope-sponge-bob-123`
4646

47-
<details>
48-
<summary>On the PlanktoScope</summary>
49-
50-
```sh
51-
cd ~/PlanktoScope
52-
# Enable Developer Mode
53-
./software/distro/setup/planktoscope-app-env/PlanktoScope/enable-developer-mode
54-
# Configure git
55-
git config --global user.email "you@example.com"
56-
git config --global user.name "Your Name"
57-
```
58-
59-
</details>
60-
6147
<details>
6248
<summary>On your computer</summary>
6349

@@ -74,14 +60,37 @@ Host $planktoscope
7460
# https://docs.github.com/en/authentication/connecting-to-github-with-ssh/using-ssh-agent-forwarding
7561
ForwardAgent yes
7662
User pi
77-
IdentityFile ~/.ssh/planktoscope
63+
IdentityFile ~/.ssh/$planktoscope
7864
```
7965

8066
</details>
8167

82-
---
68+
You can now SSH into your PlanktoScope without username / password (using `ssh $planktoscope`).
69+
70+
<details>
71+
<summary>On the PlanktoScope</summary>
72+
73+
```sh
74+
cd ~/PlanktoScope
75+
# Enable Developer Mode
76+
./software/distro/setup/planktoscope-app-env/PlanktoScope/enable-developer-mode
77+
78+
# Configure git
79+
git config --global user.email "you@example.com"
80+
git config --global user.name "Your Name"
81+
82+
# [Optional] change the remote
83+
84+
# If you are a contributor to github.com/PlanktoScope/PlanktoScope
85+
git remote set-url origin git@github.com:PlanktoScope/PlanktoScope.git
86+
87+
# If you have your own fork
88+
git remote set-url origin git@github.com:MYUSERNAME/PlanktoScope.git
89+
```
90+
91+
</details>
8392

84-
You can now SSH into your PlanktoScope without username / password (using `ssh $planktoscope`) and use `~/PlanktoScope` as a regular git repository.
93+
You can now use `~/PlanktoScope` as a regular git repository.
8594

8695
```sh
8796
ssh $planktoscope
@@ -91,30 +100,30 @@ git checkout master
91100
```
92101

93102
We recommend developping directly from the PlanktoScope using [Visual Studio Code and the Remote - SSH extension](https://code.visualstudio.com/docs/remote/ssh).
94-
Use `$planktoscope` as the host to connect to and open the "PlanktoScope" directory.
95-
96-
If you make changes to the backend, you can restart the backend and test your changes with
97-
98-
```sh
99-
sudo systemctl restart planktoscope-org.device-backend.controller.service
100-
```
103+
Use `$planktoscope` as the host to connect to and open the `/home/pi/PlanktoScope` directory.
101104

102105
## Connect to router
103106

104107
The default behavior of the PlanktoScope is to act as a router to connect your computer to it directly via WiFi or Ethernet.
105108

106109
If you have a LAN it may be more convenient to connect the PlanktoScope to it and act as a simple client.
107110

111+
<details>
112+
<summary>Ethernet</summary>
113+
108114
```sh
109115
nmcli connection up eth0-default
110116
```
111117

118+
</details>
119+
112120
<details>
113-
<summary>Revert changes</summary>
121+
<summary>WiFi</summary>
114122

115123
```sh
116-
# Ethernet
117-
nmcli connection down eth0-default
124+
nmcli connection down wlan0-hotspot
125+
nmcli device wifi list
126+
nmcli device wifi connect "<SSID>" --ask
118127
```
119128

120129
</details>
@@ -127,7 +136,17 @@ And access the UI with http://pkscope-example-name-0000/
127136

128137
If that doesn't work, type `nmap -sn 192.168.1.0/24` from your computer to find the PlanktoScope hostname and/or ip address.
129138

130-
See also the operating guide [Networking](https://docs-edge.planktoscope.community/operation/networking/)
139+
See also the operating guide [Networking](https://docs-edge.planktoscope.community/operation/networking/).
140+
141+
## Offline access
142+
143+
When network is not available you have several options for debugging
144+
145+
- Plug-in a keyboard and display (needs micro HDMI adapter)
146+
- [Connect a serial cable](https://www.jeffgeerling.com/blog/2021/attaching-raspberry-pis-serial-console-uart-debugging)
147+
- Use the [NanoKVM USB](https://wiki.sipeed.com/hardware/en/kvm/NanoKVM_USB/introduction.html)
148+
149+
The NanoKVM USB solution works for all setups.
131150

132151
## Backup and Restore SD Card
133152

@@ -147,6 +166,14 @@ xzcat sdcard.img.xz | sudo dd bs=1M of=/dev/device status=progress conv=fdatasyn
147166

148167
See also the operating guide [SD Card Cloning](../../operation/clone-sd.md).
149168

169+
## Opening a port on the firewall
170+
171+
https://firewalld.org/documentation/howto/open-a-port-or-service.html
172+
173+
## Working with GPIOs on the CLI
174+
175+
https://lloydrochester.com/post/hardware/libgpiod-intro-rpi/
176+
150177
## Documentation quick setup
151178

152179
This is a quick setup guide. See also

documentation/docs/troubleshooting/index.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
We don't yet have complete documentation to help you troubleshoot problems with your PlanktoScope! For now, you should [sign up](https://www.planktoscope.org/join) to join the PlanktoScope community on Slack, and ask for help in the `#3-start-testing` channel on Slack; or, if you have a GitHub account, you can start a new discussion in the PlanktoScope GitHub repository's ["Help/Support" forum](https://github.com/PlanktoScope/PlanktoScope/discussions/categories/help-support). Below, we provide some guides for troubleshooting particular situations:
44

5+
## Hostname/DHCP issue with Orange Livebox router
6+
7+
If you connected your PlanktoScope to a Orange Livebox, its hostname may be incorrect and change often. For example if your PlanktoScope name is `pretty-flower-123` the router may assign the hostname `pkscope-pretty-flower` instead of `pkscope-pretty-flower-123`.
8+
9+
You can workaround this issue by:
10+
11+
Assign the static hostname `pkscope-pretty-flower-123` to the PlanktoScope in the Livebox
12+
13+
or
14+
15+
[Change the PlanktoScope machine name](../operation/networking.md/#change-your-planktoscopes-name) to `pretty-flower`
16+
17+
See also [#603](https://github.com/PlanktoScope/PlanktoScope/issues/603)
18+
519
## Error with camera or Python backend
620

721
A common (and very broad) category of problems results in an error message like `If you see this, there probably is an error either with your camera or with the python service. Please try restarting your machine.` being displayed instead of a camera preview in the Node-RED dashboard. This error message can be caused by a variety of potential failure modes such as a disconnected camera or a crash in the Python hardware controller program (which controls the PlanktoScope's camera as well as the pump, focusing motors, etc.). If you see this problem, we recommend first checking whether the Python hardware controller is responsive to button-presses in the Node-RED dashboard for moving the pump and/or the focusing stepper motors; if so, then there is likely a problem specifically with the camera hardware or the camera preview. Otherwise, it is very possible that the Python hardware controller has crashed for other reasons. Troubleshooting this situation will require you to download the Python hardware controller's error logs so that you can attach the logs with a request for help on the PlanktoScope Slack community.
@@ -18,4 +32,4 @@ Then click on the download button in the upper-right toolbar:
1832
This will open a dialogue to select the archive format for downloading the logs. You can click the ".zip" button:
1933

2034
![landing page](./images/download-hardware-controller-logs-4.png)
21-
This will open a file saving dialogue to download a ZIP archive of the Python hardware controller's logs. Then you can upload this as an attachment to a message on Slack or GitHub asking for help with troubleshooting your problem.
35+
This will open a file saving dialogue to download a ZIP archive of the Python hardware controller's logs. Then you can upload this as an attachment to a message on Slack or GitHub asking for help with troubleshooting your problem.

software/distro/setup/planktoscope-app-env/PlanktoScope/enable-developer-mode

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ commit=$(yq -r '.commit' /usr/share/planktoscope/installer-versioning.yml)
66

77
cd $HOME/PlanktoScope
88
git init --initial-branch=master
9-
git remote add origin git@github.com:PlanktoScope/PlanktoScope.git
9+
git remote add origin https://github.com/PlanktoScope/PlanktoScope.git
1010
git fetch origin --filter=blob:none
1111
# "Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated."
1212
# https://git-scm.com/docs/git-reset#Documentation/git-reset.txt---mixed
1313
git reset --mixed $commit
1414

1515
cd $HOME/PlanktoScope/device-backend/control
1616
poetry install --with dev
17+
18+
cd $HOME/PlanktoScope

0 commit comments

Comments
 (0)