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
* Removed some unused configuration parameters
kShowDebugImagesDuringExposureSelection was not used and was confusing.
* Improved Tomcat webshare process, added HOUGH_GRADIENT_ALT - specific parameters to improve circle detection, updated and added documents.
This document describes the details of the interface PiTrac provides to allow other systems to receive shot data from PiTrac and to accept certain control instructions from outside (such as golf club selection. The interface is also used to support control and synchronization messages between the two Pi-based computers that comprise PiTrac. The web-based PiTrac GUI is an example of a client for the POI messages. The GUI consumes shot data messages and displays them to the user.
6
+
7
+
The inter-PiTrac messages may be expected to continue to change, at least at this early point in the system’s development. However, it is hoped that the messages that are sent outside of PiTrac, such as shot data, will remain fairly constant.
8
+
9
+
POI is built on the Apache [ActiveMQ](https://activemq.apache.org/) open source multi-protocol messaging platform. Byte-by-byte encoding is based on the [MsgPack](https://msgpack.org/index.html) standard to eliminate typical encoding issues such as big-endian/little-endian, etc. MsgPack is supported in over a dozen programming languages and across most popular operating systems. As such, almost anything should be able to communicate with PiTrac with a minimum of code.
10
+
11
+
ActiveMQ essentially provides a payload (along with a payload type) and the required message-brokering, routing, subscriptions, tracking, etc. for that payload. The payload is then formatted in a platform-independent manner by the MsgPack standard.
12
+
13
+
Although this document presents various constants and formats for the POI, the most authoritative source of this information is to be found in the C++ code of PiTrac, including the following files, and especially within the macros called MSGPACK\_DEFINE:
14
+
15
+
* gs\_ipc\_message.\*
16
+
* gs\_ipc\_result.\*
17
+
* gs\_ip\_control\_msg.\*
18
+
* gs\_clubs.\*
19
+
20
+
The above IPC (inter-process communication) classes provide both C++ representations of the IPC messages, as well as methods to help serialize and de-serialize the MsgPack-formatted payloads of the Active MQ messages into these classes.
21
+
22
+
When this document refers to types such as String or Float, those are to be understood as MsgPack types.
23
+
24
+
**POI Outputs:**
25
+
26
+
Each ActiveMQ IPC message sent to/from PiTrac has a particular message type that allows the receiver to determine how to de-serialize and parse the payload of the message. The potential types and their meanings are described below:
27
+
28
+
| Value | Message Type | Notes |
29
+
| :---- | :---- | :---- |
30
+
| 0 | Unknown | Essentially and error \- should not occur |
31
+
| 1 | RequestForCamera2Image | Sent by the Pi 1 system to signal the Pi 2 system to be ready to take a picture. This also signals to the Pi 2 that the Pi 1 system is going to expect a picture in a Camera2Image \- type message, and that the Pi 1 will be sending an external trigger to the Pi 2 camera. |
32
+
| 2 | Camera2Image | Sent by the Pi 2 system when it takes a picture. The message will include the picture itself. The picture is an OpenCV Mat object packed as a MsgPack serialized data type. See gpc\_ipc\_mat.\* in the PiTrac C++ source code. |
33
+
| 3 | RequestForCamera2TestStillImage | Reserved for testing modes. |
34
+
| 4 | Results | The result of the current system's operation, such as a ball hit |
35
+
| 5 | Shutdown | Tells the PiTrac system to shutdown and exit |
36
+
| 6 | Camera2ReturnPreImage | Picture of the 'hit' area before the ball is actually hit. Can be used for, e.g., subtractive filtering |
37
+
| 7 | ControlMessage | A control message such as a club selection. |
38
+
39
+
| Element | Field Name | MsgPack Type | Notes |
40
+
| :---- | :---- | :---- | :---- |
41
+
| 0 | Carry\_meters (\*) | Integer OR Float | Not currently computed. The carry is calculated by external golf sims like GSPro. |
42
+
| 1 | speed\_mpers (\*) | Integer OR Float | Ball speed in MPH |
43
+
| 2 | launch\_angle\_deg (\*) | Integer OR Float | Positive degrees are from the ground up to the line of flight. Must check type before decoding, due to an apparent issue in MsgPack for float values that are integer-like (e.g., 123.0). |
44
+
| 3 | side\_angle\_deg (\*) | Integer OR Float | Must check type before decoding. A positive side angle number means the ball will land to the right of the target, while a negative number means it will land to the left |
45
+
| 4 | back\_spin\_rpm (\*) | Integer | Generally positive. The spin that occurs from, e.g., a chip shot. |
46
+
| 5 | side\_spin\_rpm (\*) | Integer | Negative is left spin (counter-clockwise from above ball) |
47
+
| 6 | confidence (\*) | Integer | A value between 0 and 10\. 10 \- the results are as confident as the system can be. 0 \- no confidence at all, and probably an error occurred. |
Copy file name to clipboardExpand all lines: Documentation/Raspberry Pi Setup and Configuration.md
+25-24Lines changed: 25 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,35 +86,35 @@ These instructions start with a Raspberry Pi with nothing on it, and are meant t
86
86
a. If running headless, remotely login using putty or a ssh tool of your choice
87
87
1. Logging in from whatever computer you are reading this setup document on will make it easy to copy-paste from this document into files on the Pi
88
88
2. For example,
89
-
1.`putty rsp02 -l \<username\>` (the boot image should already allow putty)
89
+
1. putty rsp02 \-l \\\<username\\\> (the boot image should already allow putty)
90
90
b. If running directly with a monitor and keyboard, click on updates icon near top-right to make sure everything is up to date
91
91
3. Install everything to get up to date
92
92
c. Or, equivalently, do the following from the command line:
93
-
4.`sudo apt -y update`
94
-
5.`sudo apt -y upgrade`
95
-
6.`sudo reboot now` (to make sure everything is updated)
93
+
4. sudo apt \-y update
94
+
5. sudo apt \-y upgrade
95
+
6. sudo reboot now (to make sure everything is updated)
96
96
97
97
#### Remote Log into Pi
98
98
99
99
5. Remotely login (to be able to paste from this setup document)
100
-
a. `putty rsp01 -l \<username\>` (the boot image should already allow putty)
100
+
a. putty rsp01 \-l \\\<username\\\> (the boot image should already allow putty)
101
101
b. Then, follow the instructions below…
102
102
103
-
#### Sudo Priviledges
103
+
#### Sudo Privileges
104
104
105
105
6. If necessary, make sure that \<PiTracUserName\> has sudo privileges
106
106
a. Some guidance [here](https://askubuntu.com/questions/168280/how-do-i-grant-sudo-privileges-to-an-existing-user).
107
107
108
108
#### Install NVME Board
109
109
110
-
7. To Install an NVME Board on the Pi \[Optional, and probably only for the Pi 5 (confusingly referred to as the “Pi 1” computer in the PiTrac project)\]:
111
-
a. If you have a SSD drive, best to get it up and booting now
110
+
7. To Install an NVME Board on the Pi \[Optional, and probably only for the Pi 5 (confusingly referred to as the “Pi 1” computer in the PiTrac project):
111
+
a. If you have a SSD drive, best to get it up and booting now before you install everything on the slower, smaller MicroSD card instead.
112
112
b. See also the instructions here, which will work in most cases: [https://wiki.geekworm.com/NVMe\_SSD\_boot\_with\_the\_Raspberry\_Pi\_5](https://wiki.geekworm.com/NVMe_SSD_boot_with_the_Raspberry_Pi_5)
113
113
Although the instructions below should work as well.
114
114
c. With the Pi off, Install the NVMe Board and NVMe SSD drive per instructions of whatever board you are using.
115
115
d. Power up and Enable the PCIe interface (your instructions may differ):
116
-
1.`cd /boot/firmware/`
117
-
2.`sudo cp config.txt config.txt.ORIGINAL`
116
+
1. cd /boot/firmware/
117
+
2. sudo cp config.txt config.txt.ORIGINAL
118
118
3. By default the PCIe connector is not enabled.
119
119
4. To enable it you should add the following option into /boot/firmware/config.txt before the last “\[all\]” at the end of the file and reboot (sudo reboot now):
120
120
1.\# Enable the PCIe External Connector.
@@ -128,17 +128,18 @@ These instructions start with a Raspberry Pi with nothing on it, and are meant t
128
128
3. Select whatever order you want, usually NVMe card first
129
129
2. Shutdown, remove power to the Pi, and reboot. Afterward, an lsblk command should show something like this (see last line):
130
130
131
-
1\.pitrac@rsp05:\\\~ $ lsblk
131
+
pitrac@rsp05:\\\~ $ lsblk
132
132
133
-
2\. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
134
133
135
-
3\. mmcblk0179:0 0 29.7G 0 disk
134
+
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
136
135
137
-
4\. |-mmcblk0p1 179:1 0 512M 0 part /boot/firmware
136
+
mmcblk0 179:0 0 29.7G 0 disk
138
137
139
-
5\.\\\`-mmcblk0p2 179:2 0 29.2G 0 part /
138
+
|-mmcblk0p1 179:1 0 512M 0 part /boot/firmware
140
139
141
-
6\. nvme0n1 259:0 0 238.5G 0 disk
140
+
\\\`-mmcblk0p2179:2 0 29.2G 0 part /
141
+
142
+
nvme0n1 259:0 0 238.5G 0 disk
142
143
143
144
3. At this point, the NVMe drive should be accessible, and we will make a copy (image) of the bootup Micro SD card onto the SSD drive
144
145
4. From the Pi Graphical Desktop, Applications \=\>Accessories \=\>SD Card Copier on the main screen, run the SD Card Copier program, and copy the OS to the NVME ssd. There’s no need to select the separate UUID option.
@@ -149,7 +150,7 @@ These instructions start with a Raspberry Pi with nothing on it, and are meant t
149
150
#### NAS Drive Setup and Mounting
150
151
151
152
8. Setup mounting of a remote NAS drive (or similar)
152
-
a. To use for development so that you can’t lose everything if the Pi has an issue. Also allows for easier transfers of files to the Pi from another computer.
153
+
a. Many folks use an external NAS drive for development so that you can’t lose everything if an individual Pi has an issue. An external drive also allows for easier transfers of files to the Pi from another computer that can also see that drive.
153
154
b. The remote drive will store the development environment, though you can obviously set up the PiTrac not to need a separate drive once you have everything working. However, it’s really a good idea to have the development and test environment on a different computer than on the individual Pi’s.
154
155
c. There are many ways to automatically mount a removable drive to a Pi. The following is just one way that assumes you have a NAS with NFS services enabled and with a shareable drive that the Pi can read/write to.
155
156
1. NOTE: If this Pi will be anywhere in a public network, obviously do not include your password in the fstab\!
@@ -158,7 +159,7 @@ These instructions start with a Raspberry Pi with nothing on it, and are meant t
158
159
f. `sudo cp fstab fstab.original`
159
160
g. `sudo chmod 600 /etc/fstab`\[to try protect any passwords in the file\]
160
161
h. `sudo vi fstab`
161
-
2. If using NFS (seems easier):
162
+
2. If using NFS (usually easier) put the following the fstab file:
3. This will allow the Tomee system to access a directory that is outside of the main Tomee installation tree. This directory will be used to get debugging images from the other Pi into the web-based GUI that this Pi will be serving up.
522
523
4. NOTE \- if the shared directory that is mounted off of the other Pi does not exist, Tomee may not be able to start
523
524
15. Allow symbolic linking. In conf/context.xml, add before the end:
@@ -530,7 +531,7 @@ WantedBy=multi-user.target
530
531
5. Try the following to see how things are starting and to fix any problems:
531
532
1.`sudo tail -f /opt/tomee/logs/catalina.out`
532
533
6. Next login from a web console: http://\<Pi-with-Tomee\>:8080/manager/html
533
-
1. user-name/pwd is by default tomcat/tomcat
534
+
1. user-name/pwd is by default tomcat/tomcat. Change if not in a private network.
2. Run the new script to bring over the java and other web-based GUI files:
607
608
1. . ./refresh\_from\_dev.sh
608
609
2. NOTE that the above script will also move a copy of the golf\_sim\_config.json file into the shared directory that the GUI can access in order to get information about its run-time environment.
@@ -626,7 +627,7 @@ WantedBy=multi-user.target
626
627
1. cd /opt/tomee/webapps
627
628
2. sudo cp \~/Dev/WebAppDev/target/golfsim.war .
628
629
10. Confirm you can see the PiTrac GUI by entering the following into your browser:
**CONGRATULATIONS\!**\- At this point, you’ve (hopefully) built the PiTrac software. Please see the [Startup Documentation](https://github.com/jamespilgrim/PiTrac/blob/main/Documentation/PiTrac%20Start-Up%20Documentation.md) for how to get PiTrac working\!
0 commit comments