Creating and Running a Hello World Component
Use the following procedure to create a simple component that prints hello world
to the terminal upon startup.
Create a new REDHAWK component Project:
- File > New > REDHAWK Component Project
Name the project: HelloWorld
Click Next.
Select:
- Prog. Lang: C++
Click Next.
Click Finish.
- If a dialog asks to switch to CPP perspective, click No.
Generate Code:
- In the editor tool bar, click Generate All Component Implementations
In the
HelloWorld.cpp
file, add the following include to the beginning of the file:#include <iostream>
In the
HelloWorld.cpp
file, add the following code to theserviceFunction()
method:std::cout<<"Hello world"<<std::endl;
Compile the project:
- Project > Build Project
Drag the project to the Target SDR section of the REDHAWK Explorer.
On a terminal, start a Python session.
Run the following commands:
>>> from ossie.utils import sb >>> hello_world = sb.launch("HelloWorld") >>> sb.start()