In the previous article , I showed you how to setup the basic ROS in Armbian Orange Pi combination. This time we will get a bit further in getting to understand some basic concepts and run a “hello world” code as well.
Orange Pi Zero
Orange Pi Zero Interfaceboard
For getting start you need to know the basics of python.
The core ROS concept is based loosely on Data Distribution Service. It consist of a Data distribution server or DDS which act as a middleman for passing information between clients. The DDS in ROS is called ROS Master or otherwise called roscore and the clients are called nodes. The roscore offers facility to publish/subscribe information to a topic. It also provides an XMLRPC-based API for Remote procedure call.
Apart from the mentioned core services it also provides parameter server and logging server. When developing a robot all you need to do is design how to different nodes should communicate and which node does what operation and etc. Each node can be writting in any language and there is already a list of languages ros clients are developed in languages such as c++, Python, Lisp, Ruby, Go, Nodejs, R etc.
The roscore needs to be run before you run your client and if you have already configured your bash as shown in the first tutorial, then roscore command will be available to you.
code@orangepizero:~$ roscore ... logging to /home/code/.ros/log/3f3ad618-a2f2-11e7-90c4-dc446db60d69/roslaunch-orangepizero-6575.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is &lt;1GB. started roslaunch server http://orangepizero:35649/ ros_comm version 1.12.7 SUMMARY ======== PARAMETERS * /rosdistro: kinetic * /rosversion: 1.12.7 NODES auto-starting new master process[master]: started with pid  ROS_MASTER_URI=http://orangepizero:11311/ setting /run_id to 3f3ad618-a2f2-11e7-90c4-dc446db60d69 process[rosout-1]: started with pid  started core service [/rosout]
Now the ROS Master that is the roscore is running successfully, lets try to test the server.
For this purpose we have a tool called rostopic. It is a command line tool for displaying debug information about ROS Topics, including publishers, subscribers, publishing rate, and ROS Messages. It also contains an experimental Python library for getting information about and interacting with topics dynamically.
code@orangepizero:~$ rostopic pub my_topic std_msgs/String "hello there" publishing and latching message. Press ctrl-C to terminate
code@orangepizero:~$ rostopic echo my_topic data: hello there ---
Here we are subscribing to the topic my_topic using the command rostopic echo my_topic. and from the other window we are publishing the string “hello there” using the command rostopic pub my_topic std_msgs/String “hello there”. We can list the topics in the list using the below command.
code@orangepizero:~$ rostopic list /my_topic /rosout /rosout_agg
Now we can see all the topics that are available and in that is our topic my_topic.
code@orangepizero:~$ rostopic info my_topic Type: std_msgs/String Publishers: * /rostopic_6277_1506542386742 (http://orangepizero:53189/) Subscribers: * /rostopic_6249_1506542382478 (http://orangepizero:51324/) * /rostopic_6538_1506543106943 (http://orangepizero:49806/)
If you see the information you can see a single publisher and two subscriber because I ran rostopic echo my_topic twice.
For more information about rostopic then try help command
code@orangepizero:~$ rostopic help rostopic is a command-line tool for printing information about ROS Topics. Commands: rostopic bw display bandwidth used by topic rostopic delay display delay of topic from timestamp in header rostopic echo print messages to screen rostopic find find topics by type rostopic hz display publishing rate of topic rostopic info print information about active topic rostopic list list active topics rostopic pub publish data to topic rostopic type print topic or field type Type rostopic <command> -h for more detailed usage, e.g. 'rostopic echo -h'
With this we conclude the part2 of the series and we will cover further topics in the next section leading to build a complete humanoid robot.