Use Isaac Sim libraries from C, C++, and Python#
Report the same categorized message through the public C, C++, and Python logging APIs. This comparison shows how to select a language API without changing the behavior or channel conventions of your application.
Learning objectives#
After completing this tutorial, you can:
Select the public C, C++, or Python API for an application.
Use stable logging channels consistently across languages.
Build, run, and test native and Python library consumers with the example runner.
Prerequisites#
Complete Install and run.
Install a C and C++ toolchain for the native examples. The Python example only requires the installed
isaacsim.common.loggingpackage.Run the commands in this tutorial from the repository root.
Examples used#
Example |
Role in this tutorial |
|---|---|
Uses the C API and explicitly manages the native library handle. |
|
Shows the C++ API and its type-safe native integration. |
|
Shows the installed Python package and direct module import. |
Each example page lists its source directory, requirements, and runner commands.
Compare the public language APIs#
All three APIs accept a dot-separated channel and a message. Keep channel names stable and identify the component that produces the message. Consumers can then filter output without parsing message text.
The C example includes isaacsim/common/logging/Logging.h and reports the
message through a macro:
#include <isaacsim/common/logging/Logging.h>
int main(void)
{
ISAACSIM_COMMON_LOGGING_REPORT("isaacsim.examples.hello_world.c", "Hello World from C.");
return 0;
}
The C++ example includes isaacsim/common/logging/Logging.hpp. Construct a
Logger once for a component and reuse it when that component reports
multiple messages:
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <isaacsim/common/logging/Logging.hpp>
int main()
{
const isaacsim::common::logging::Logger logger("isaacsim.examples.hello_world.cpp");
logger.report("Hello World from C++.");
return 0;
}
The Python package exposes the same object-oriented operation. Python does not need a separate native build step:
"""Run the Python Hello World example."""
from isaacsim.common.logging import Logger
def main() -> None:
"""Print the Hello World result through the installed Isaac Sim Python API."""
logger = Logger("isaacsim.examples.hello_world.python")
logger.report("Hello World from Python.")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass
Choose the API used by the rest of your application. Calling the library directly adds fewer dependencies than introducing a language binding for an operation that already has a native API.
Build and run the examples#
Build the native executables, then run all three variants:
source/examples/example.sh build hello_world.c
source/examples/example.sh build hello_world.cpp
source/examples/example.sh run hello_world.c
source/examples/example.sh run hello_world.cpp
source/examples/example.sh run hello_world.python
.\source\examples\example.bat build hello_world.c
.\source\examples\example.bat build hello_world.cpp
.\source\examples\example.bat run hello_world.c
.\source\examples\example.bat run hello_world.cpp
.\source\examples\example.bat run hello_world.python
Each program reports one message on its example-specific channel. The generated example pages list the exact SDK or Python package requirements for each variant.
Verify the language APIs#
Run the tests for all three examples:
source/examples/example.sh test hello_world.c
source/examples/example.sh test hello_world.cpp
source/examples/example.sh test hello_world.python
.\source\examples\example.bat test hello_world.c
.\source\examples\example.bat test hello_world.cpp
.\source\examples\example.bat test hello_world.python
The tests verify the complete channel and message emitted by each program.
Tradeoffs#
Use C for a procedural native interface, C++ when your component benefits from an owned logger object, and Python for Python-first applications.
Next steps#
Continue with Expose native Isaac Sim code to Python when Python must call application-specific C++ code rather than an existing Python API.