Environment Setup
Before using the OpenHiva framework to develop robot applications, prepare the development and running environments in advance.
- In the inference scenario, install the driver, CANN software package, and OpenHiva software package.
- In non-inference scenarios, install only the OpenHiva software package.
- Purchase the Atlas 200I DK A2 developer kit in advance. For details about the Atlas 200I DK A2 developer kit, see its documentation.
- (Optional) Install the driver and CANN software. For details, see CANN Software Installation Guide.
After the driver and CANN software are installed, the paths of the AscendCL header files and library files are as follows:
- Header file path: CANN software installation directory/include/acl
- Library file path: CANN software installation directory/lib64
- Download the OpenHiva software package.
Visit the download page of Ascend CANN Community Edition, find the Robot Middleware resource in the Version Mapping area, and click Download to obtain the latest Ascend-cann-robotmiddleware-{software_version}.run package.

- Install the OpenHiva software package.
- Installation in run mode (running state)
- Go to the directory where the .run package is stored and run the following command to install the software package as the running user (HwHiAiUser by default):
/bin/sh ./Ascend-cann-robotmiddleware-{software_version}.run --install-username=HwHiAiUser --install-usergroup=HwHiAiUser --quiet --run- --install-username: specifies the installation user, which is the owner of the file after installation.
- --install-usergroup: specifies the group to which the file belongs after installation. The group has all file access permissions.
- --quiet: Do not print intermediate process information.
- --run: specifies the run mode for installation in the running state. The generated .so library file is the .so file on which the user depends at runtime.
- After the installation is complete, run the reboot command to restart the device.
If the following process information is displayed after the restart, the software is successfully installed:

- Go to the directory where the .run package is stored and run the following command to install the software package as the running user (HwHiAiUser by default):
- Installation in SDK mode (compilation state)
- Go to the directory where the .run package is stored and run the following command to install the software package as the running user (HwHiAiUser by default):
/bin/sh ./Ascend-cann-robotmiddleware-{software_version}.run --install-username=HwHiAiUser --install-usergroup=HwHiAiUser --quiet --devel- --install-username: specifies the installation user, which is the owner of the file after installation.
- --install-usergroup: specifies the group to which the file belongs after installation. The group has all file access permissions.
- --quiet: Do not print intermediate process information.
- --devel: specifies the devel mode for installation in compilation state and generates the corresponding header file.
After the software package is successfully installed, you can view the dependent header files and library files. By default, the header files and library files are stored in the SDK directory.
- Obtain the header files required for invoking the OpenHiva APIs from the ${INSTALL_DIR}/robotmiddleware/sdk/include/hiva/cm directory.
- Obtain the library files required for compiling the OpenHiva APIs from the ${INSTALL_DIR}/robotmiddleware/sdk/lib/hiva/cm directory.
- Obtain the message header file generation tool header_generator (executable file for x86_64) from the ${INSTALL_DIR}/robotmiddleware/sdk/tools directory.
${INSTALL_DIR} is the root directory (/usr/local/Ascend by default) where robotmiddleware is installed. Replace it with the actual directory.
- Compile and generate the message header file.
Before using OpenHiva for Pub/Sub communication, prepare the message header file (*.h). Generally, the header_generator tool is used to generate the file. The procedure is as follows:
- Prepare the message file (*.msg) before compiling the binary.
Table 1 lists the basic message types supported by the built-in .msg file. You can also customize message types.
Table 1 Basic data types Data Format
Generated Data Type
bool
Bool data type
byte
Char data type
char
Char data type
float32
Float data type
int8
int8_t data type
uint8
uint8_t data type
float64
Double data type
int16
int16_t data type
uint16
uint16_t data type
int32
int32_t data type
uint32
uint32_t data type
int64
int64_t data type
uint64
uint64_t data type
time
Hiva::Time data type
duration
Hiva::Duration data type
string
std::string data type
The header file generation tool supports data of the std::vector and std::array types. The following uses int8 as an example:
int8[] int8_vec # The generated header file contains std::vector<int8_t> int8_vec. int8[10] int8_arr # The generated header file contains std::array<int8_t,10> int8_arr.
The vector and array data types can also be other basic data types or user-defined data types.
- Use the header file generation tool (header_generator) to generate the message header file (*.h).
Use the header_generator tool in the x86_64 environment and ensure that the GLIBC version is greater than or equal to GLIBCXX_3.4.26 (Ubuntu 20.04 or later is recommended).
Go to the ${INSTALL_DIR}/robotmiddleware/sdk/tools directory and run the following command. In the command, msg dir indicates the relative path of the .msg file directory specified by the user.
header_generator <msg dir> arm64 HIVA2
After this command is executed, the namespace of the message is the same as the msg dir, and the name of the generated message is the same as the *.msg name.
The following uses Hello.msg and World.msg as an example to describe the operation procedure:
- Save the header_generator binary file at the same level as the directory (kyber_msgs) where the message is located.
The contents of the World.msg and Hello.msg files are as follows. Hello.msg depends on World.msg.


- Go to the directory where header_generator is located and run the following command to generate a message header file:
./header_generator kyber_msgs arm64 HIVA2
After the command is executed successfully, the *.h header file with the same name is automatically generated in the directory where the *.msg file is located. The following uses the Hello.h header file as an example:

- After the header file is generated, developers can use this message type for Pub/Sub communication when developing OpenHiva applications.
- Save the header_generator binary file at the same level as the directory (kyber_msgs) where the message is located.
- Prepare the message file (*.msg) before compiling the binary.
- Go to the directory where the .run package is stored and run the following command to install the software package as the running user (HwHiAiUser by default):
- Installation in run mode (running state)
