Skip to content

Code Development and Compilation Methods

OriginMan development fully follows ROS2 development methods. Here's a brief introduction to common package operations. For detailed ROS2 development principles, please refer to ROS2 Getting Started Tutorial.

Workspace

In ROS robot development, when we develop code for certain robot functions, all the code, parameters, scripts, and other files need to be managed in a folder, which is called a workspace in the ROS system.

The official OriginMan image has already created a workspace located in the /userdata folder, named dev_ws, which is called the workspace root directory. It contains five subfolders:

image-20220920221905698

  • src, source space, where future code and scripts need to be manually placed;
  • build, build space, stores intermediate files generated during compilation;
  • install, install space, stores compiled executables and scripts;
  • log, log space, stores various warnings, errors, and information logs during compilation and runtime.
  • config, configuration files, stores model configuration files for human tracking and gesture recognition applications (not required for ROS2 workspace).

Among these five spaces, most of our operations are performed in src, and after successful compilation, we execute the compilation results in install.

Packages

The OriginMan robot packages are located in the src folder under the /userdata/dev_ws workspace. Here are the package descriptions:

Package Name Description
originman_airiltag_detect Package for detecting and locating AirTags
originman_kick_ball Package for executing kicking actions
originman_teleop_keyboard Package for keyboard teleoperation control
originman_audio_control Package for audio-controlled robot actions
originman_line_follower Package for visual line following
originman_transport_lab Package for transport experiment functions
originman_color_detect Package for color detection and recognition
originman_llm_chat Package for LLM chat interaction
originman_action_imitation Package for human action imitation
originman_demo ROS2 version robot driver demo package
originman_pydemo Python-implemented robot demonstration examples

Compiling Code

After modifying package code or configuration files, use the following commands to compile the workspace. If there are missing dependencies or code errors, the compilation process will show errors; otherwise, the compilation should proceed without any errors:

$ cd /userdata/dev_ws/
$ colcon build

image-20220920222359026

Setting Environment Variables

After successful compilation, to allow the system to find our packages and executables, we need to set environment variables:

$ source /userdata/dev_ws/install/local_setup.bash # Only effective in current terminal
$ echo " source /userdata/dev_ws/install/local_setup.bash" >> ~/.bashrc # Effective in all terminals, only needs to be run once
Hint

The environment variables have already been configured in the .bashrc configuration file in the OriginMan image, no further configuration is needed.

Footer