Difference between revisions of "Getting Started with ROS on Embedded Systems/User Guide/C++/Initialization"
Rgutierrez (talk | contribs) (Created page with " == Introduction == This wiki is based on the following ROS page: http://wiki.ros.org/roscpp/Overview/Initialization%20and%20Shutdown There are two levels of initialization f...") |
m |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Getting Started with ROS on Embedded Systems/Head|previous=User Guide/C++/Package set up|next=User Guide/C++/Topics|metakeywords=ROS}} | ||
== Introduction == | == Introduction == | ||
Line 41: | Line 42: | ||
rosrun <package> <node_name_executable> | rosrun <package> <node_name_executable> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | {{Getting Started with ROS on Embedded Systems/Foot|User Guide/C++/Package set up|User Guide/C++/Topics}} |
Latest revision as of 13:14, 8 March 2023
Getting Started with ROS on Embedded Systems RidgeRun documentation is currently under development. |
Getting Started with ROS on Embedded Systems | |
---|---|
![]() | |
ROS on Embedded Systems Basics | |
|
|
Getting Started | |
|
|
C++ User Guide | |
|
|
Examples | |
|
|
Performance | |
|
|
Contact Us |
Introduction
This wiki is based on the following ROS page: http://wiki.ros.org/roscpp/Overview/Initialization%20and%20Shutdown
There are two levels of initialization for a roscpp Node:
- Initializing the node through a call to one of the ros::init() functions. This provides command line arguments to ROS, and allows you to name your node and specify other options.
- Starting the node is most often done through creation of a ros::NodeHandle, but in advanced cases can be done in different ways.
Initialization
And example of initialization for the a ROS node inside a main.cpp can be the following:
ros::init(argc, argv, "rr_node");
Starting
Calling init doesn't actually start the node, it just initialized it, in order to start it, you can create a node handle, this will call the ros::start underneath:
ros::NodeHandle node_handle("node_namespace");
Look here that we just assigned a node namespace, we will take about them later in the names section.
Testing
You can test the node by adding this to the code:
while (ros::ok()){
/* Do something here */
ros::spin();
}
After compilation, you can launch the node by using:
rosrun <package> <node_name_executable>