Implement node programming under Ros, implement one node to send message, another node to receive. There are many implementations, you can create a workspace package and a node directly in the command window, compile with Catkin_make, add a. Bash path, and then execute the rosrun packages node_name. This approach is error-prone for a ROS beginner, and many of the online tutorials have different problems, such as the need to modify the contents of CMakeLists.txt and package.xml, rather cumbersome. In order to avoid unnecessary trouble, beginners can use the IDE for node programming, to a certain level, and then use the above way to achieve. The following is an introduction to the Roboware software implementation of Helloword send and receive.
This example is done in the case of Ros, so for unnecessary trouble, it is best to run the example of a small turtle first.
1. Download the installation roboware.
To official website: http://www.roboware.me/#/home
Select Studio v1.2.64bit deb download. If it is a 32-bit machine Select v.2.0 32bit deb version.
Fool-mounted, always next step. Install it later as follows:
2. Create a workspace
After opening the software, select New workspace, here to select a folder, where the home folder is finally selected. Then under name: Robot
Robot is the new workspace name. After the build, a src folder appears, and a CMakeLists.txt file is created.
3. New Ros Package
Right-click Src folder Select "New Ros Package" in the name bar: Test
When you're done, a test folder appears with a SRC folder under it.
4. New Ros Node
Right-click the Test folder and select New C++ros node. In Name: Test
After the build, there are two. cpp files in the file, one is Test_pub.cpp, which is used to send HelloWorld information, called the sender. The other is that Test_sub.cpp is used to receive information called Subscribers.
5. Click on the top left corner of the hammer to compile the file, the Ros node interface will appear test node. See 100% instructions for compilation success.
The above completed the entire project compilation, this part of the content generally will not have any problems, the next step is to implement, the problem comes.
6. Open Ros Master
Roscore
7.rosrun Execution Node
Rosrun Test Test_pub
The reason for this analysis might be that the workspace was created when Ros was installed, the new workspace was different from the previous one, so the path to the new workspace needs to be added to the BASHRC file.
Then perform the following steps: Opening a new terminal enter the following command to open the file BASHRC
Gedit. BASHRC
Locate the Setup.bash file under the Devel file for the new workspace, and view its path to the end of the BASHRC file, as follows:
Then close all terminals and reopen the terminal to execute
Roscore
Then open a terminal:
Rosrun Test Test_pub
Appear:
This enables the sending
8. Execute the Receive node
Rosrun Test Test_sub
An issue with same name appears.
This is caused when we created the node without modifying the initialization file name in the CPP file.
Change the name to Test_pub and Test_sub
Save, recompile. Then the terminal is all shut down, re-executing open master and sending, receiving
Can be achieved by receiving.