99 lines
3.5 KiB
Markdown
99 lines
3.5 KiB
Markdown
|
|
# TriggerWithExternalDeviceAndEncoder Sample
|
||
|
|
|
||
|
|
With this sample, you can trigger data acquisition with signals input from the external device, trigger line scans with signals input from the encoder, and then retrieve and save the acquired data.
|
||
|
|
|
||
|
|
If you have any questions or have anything to share, feel free to post on the [Mech-Mind Online Community](https://community.mech-mind.com/). The community also contains a [specific category for development with Mech-Eye SDK](https://community.mech-mind.com/c/mech-eye-sdk-development/19).
|
||
|
|
|
||
|
|
## Build the Sample
|
||
|
|
|
||
|
|
Prerequisites and instructions for building the sample on Windows and Ubuntu are provided.
|
||
|
|
|
||
|
|
### Windows
|
||
|
|
|
||
|
|
#### Prerequisites
|
||
|
|
|
||
|
|
The following software are required to build this sample. Please download and install these software.
|
||
|
|
|
||
|
|
* [Mech-Eye SDK (latest version)](https://downloads.mech-mind.com/?tab=tab-sdk)
|
||
|
|
* [Visual Studio (version 2017 or above)](https://visualstudio.microsoft.com/vs/community/)
|
||
|
|
* [CMake (version 3.2 or above)](https://cmake.org/download/)
|
||
|
|
|
||
|
|
#### Instructions
|
||
|
|
|
||
|
|
1. Make sure that the sample is stored in a location with read and write permissions.
|
||
|
|
2. Run Cmake and set the source and build paths:
|
||
|
|
|
||
|
|
| Field | Path |
|
||
|
|
| :---- | :---- |
|
||
|
|
| Where is the source code | xxx/TriggerWithExternalDeviceAndEncoder |
|
||
|
|
| Where to build the binaries | xxx/TriggerWithExternalDeviceAndEncoder/build |
|
||
|
|
|
||
|
|
3. Click the **Configure** button. In the pop-up window, set the generator and platform according to the actual situation, and then click the **Finish** button.
|
||
|
|
4. When the log displays **Configuring done**, click the **Generate** button. When the log displays **Generating done**, click the **Open Project** button.
|
||
|
|
5. In Visual Studio toolbar, change the solution configuration from **Debug** to **Release**.
|
||
|
|
6. In the **Solution Explorer** panel, right-click the sample, and select **Set as Startup Project**.
|
||
|
|
7. Click the **Local Windows Debugger** button in the toolbar to run the sample.
|
||
|
|
8. Enter the index of the laser profiler to which you want to connect, and press the Enter key. The obtained files are saved to the `build` folder.
|
||
|
|
|
||
|
|
### Ubuntu
|
||
|
|
|
||
|
|
Ubuntu 18 or above is required.
|
||
|
|
|
||
|
|
#### Prerequisites
|
||
|
|
|
||
|
|
* Update the software source list.
|
||
|
|
|
||
|
|
```bash
|
||
|
|
sudo apt-get update
|
||
|
|
```
|
||
|
|
|
||
|
|
* Install required tools.
|
||
|
|
|
||
|
|
```bash
|
||
|
|
sudo apt-get install -y build-essential pkg-config cmake
|
||
|
|
```
|
||
|
|
|
||
|
|
* Install [Mech-Eye SDK (latest version)](https://downloads.mech-mind.com/?tab=tab-sdk).
|
||
|
|
|
||
|
|
>Note: If you have installed Mech-Eye SDK before, please uninstall it first with the following command:
|
||
|
|
>
|
||
|
|
>```bash
|
||
|
|
>sudo dpkg -P MechEyeApi
|
||
|
|
>```
|
||
|
|
|
||
|
|
* If the system architecture is AMD64, execute the following command:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
sudo dpkg -i 'Mech-Eye_API_x.x.x_amd64.deb'
|
||
|
|
```
|
||
|
|
|
||
|
|
* If the system architecture is ARM64, execute the following command:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
sudo dpkg -i 'Mech-Eye_API_x.x.x_arm64.deb'
|
||
|
|
```
|
||
|
|
|
||
|
|
#### Instructions
|
||
|
|
|
||
|
|
1. Navigate to the directory of the sample.
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd xxx/profiler/TriggerWithExternalDeviceAndEncoder/
|
||
|
|
```
|
||
|
|
|
||
|
|
2. Configure and build the sample.
|
||
|
|
|
||
|
|
```bash
|
||
|
|
sudo mkdir build && cd build
|
||
|
|
sudo cmake ..
|
||
|
|
sudo make
|
||
|
|
```
|
||
|
|
|
||
|
|
3. Run the sample.
|
||
|
|
|
||
|
|
```bash
|
||
|
|
sudo ./TriggerWithExternalDeviceAndEncoder
|
||
|
|
```
|
||
|
|
|
||
|
|
4. Enter the index of the laser profiler to which you want to connect, and press the Enter key. The obtained files are saved to `/TriggerWithExternalDeviceAndEncoder/build`.
|