This guide describes how to initialize an ACU application package using the provided development scripts.
Before continuing, ensure that the ACU SDK is installed prior to continuing with the following instructions. For the following guide, the location of the SDK scripts are assumed to be at the following path location:
/usr/acu_sdk/scripts
If this directory is included in the system $PATH, the path listing may be dropped when calling the script. If this path differs in your environment please replace the reference in the examples with your local directory.
To create the boilerplate for a new application, use the acu_create_pkg script. This script generates the necessary directory structure and a CMakeLists.txt file pre-configured for the ACU environment.
/usr/acu_sdk/scripts/acu_create_pkg <ProjectName>
(Replace
<ProjectName>with the name of your application, e.g.,
my-acu-app).
Permissions:
Ensure the acu_create_pkg script has execution privileges (chmod +x) before attempting to run it.
After running the script, a new directory named after your project will be created with the following structure:
<ProjectName>/
│ Dockerfile
│ Project.json
│
└───ProjectApplications
│ CMakeLists.txt
│
└───src
main.cpp
The Project.json file is a configuration manifest that defines metadata and runtime parameters about your application package.
Content:
name, description, version, developer, contactvolume, bind, explorer_bindExample:
{
"name":"SampleApp",
"description":"Write description of SampleApp",
"version":"1.0.0",
"developer":"Write your organization or group you belongs to.",
"contact":"Email, contact form address and something else.",
"volume":"",
"bind":""
}
The Dockerfile is a text document containing the commands used to assemble the application’s container image. The sample Dockerfile relies on the base_image_for_acu that comes with the SDK. The docker import of this image must be performed prior to building the container.
For more information see the following guide about Docker:
What is Docker?
FROM base_image_for_acu:1.0.0
COPY ProjectApplications/build/sample_app /usr/bin/sample_app
CMD ["/usr/bin/sample_app"]
This is the configuration file for CMake, the build system used to manage the compilation process. It describes how to compile the C++ source code into an executable binary, specifically handling the cross-compilation requirements of the ACU SDK.
cmake_minimum_required(VERSION 3.1)
project(sample_app CXX)
add_executable(sample_app src/main.cpp)
By default the application is created as a Hello World app. Executing the program will print "Hello sample app." to the system logs then exit.
For more information about the logging data see the linked article about the System Manager.
#include <iostream>
int main(void)
{
std::cout << "Hello sample app." << std::endl;
return 0;
}
After initializing the template package, the app can now be build and deployed or you can begin implementing your application logic.
proto files to generate usable C++ code to call APIs of one or more ACU services. For example, the Robot Control Service API to interact with the robot for reading or writing variables.Source Code:
Place your logic within the src/ directory. By default, the generated main.cpp serves as the starting point for your code.
Build Configuration:
If you add new libraries or source files, update the CMakeLists.txt file accordingly to ensure they are included in the build process.
| ⬅️ Previous | Next ➡️ | |
|---|---|---|
| Installation of the ACU SDK | Building and Deploying Your First ACU Application |