Tuesday, April 3, 2018

NanoPi ROS (NanoPi NEO Plus 2 + Robotic Operating System)

Hello, here we are once again to tackle a very interesting topic- this time its about a single board computer which  will be sufficient in compiling  and running the entire package of Robotic Operating System (ROS) . I have given some times to figure out a kind of single board which has a power of computing ,enough memory (RAM)  and GPU ready to lower the production price of our robots. To date, I see some failures posted on the internet that NanoPi M3 wasn't working with ROS my sympathy to them for the so called  problem that lost their appetite and to totally ignore the board's potential. So, I urge my self a second opportunity of exploiting the problem and  how to test NanoPi. If this board doesn't really work well on R.O.S then   there is no doubt that it would have a "not good" impression(?) since the board was not so popular with the rest of the SBC brands in the market. I would charge it on my own technical experiences , for the benefit of the doubt so lets then give it a try.

So why NanoPi NEO Plus 2? Of course one simple answer is that I have tested it running other than that there is no reason choose this nano computer to be posted here. NanoPi  SBC only cost 24$ , ran on a 64 bit mode  of quad-core processor , can store data of 1GB DDR3 in its RAM including  LAN and Wifi as its features. Compared to other single board computer in the market its price will really entice hobbyist for their robots. Comparing performance and cost will definitely give an advantage to this board to have a priority on imaging with  ROS. A sort of  computer platform with considerable performance and price it is worth than not trying it.

I would like to thank the linorobot(Juan Miguel Jimeno)  community for this guidelines and other folks who are eager to contribute for  learning,teaching and  experimenting ROS for the geeks. Also , we want to promote Philippine Society of Computer Engineering through out the country and most of founders are Oragons. So much inspiration why we keep striving to cope-up with the global robotics . PSCoE  believes its not too late to go with the race  now and soon we are happy and we are heading further than our expectations.

Thank you guys!  

LAN Cable

Ubunto 16.04
ROS (kenetic)


1) We need to follow the steps on installing an image to NanoPI NEO Plus 2, in our installation here we preferred the Ubuntu-16.04-xenial-core

2) Please activate both LAN and WiFi Network communications, see to it that they can communicate each other in the network , so you may use ssh,ping and etc.


3) Lets us now copy some ROS installation guide, or you can compile all these command lines into  a file  script

3.a) Install dependencies
pi#   sudo apt-get update
pi#   sudo apt-get upgrade
pi#   sudo apt-get install -y avahi-daemon
pi#   sudo apt-get install -y openssh-server
pi#   sudo apt-get install -y python-setuptools
pi#   sudo apt-get install -y python-dev
pi#   sudo apt-get install -y build-essential
pi#   sudo apt-get install -y python-gudev

3.b)  Install ROS package
pi#   sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
pi#   wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
pi#   sudo apt-get update
pi#    sudo apt-get -y install ros-kinetic-ros-base
pi#    sudo apt-get install python-rosdep -y
pi#    sudo `which rosdep` init
pi#    rosdep update

pi#    rosdep install --default-yes --from-paths . --ignore-src --rosdistro kinetic
pi#    source /opt/ros/kinetic/setup.bash
pi#   export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages

pi#   echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
pi#   source ~/.bashrc

3.c) Install ROS libraries
pi#    source /opt/ros/kinetic/setup.bash
pi#    sudo apt-get install -y ros-kinetic-roslint
pi#    sudo apt-get install -y ros-kinetic-rosserial
pi#    sudo apt-get install -y ros-kinetic-rosserial-arduino
pi#    sudo apt-get install -y ros-kinetic-imu-filter-madgwick
pi#    sudo apt-get install -y ros-kinetic-gmapping
pi#    sudo apt-get install -y ros-kinetic-map-server
pi#    sudo apt-get install -y ros-kinetic-navigation

3.d) Install ROS available sensors libraries(LIDAR and cameras)
pi#      sudo apt-get install -y ros-kinetic-xv-11-laser-driver   
pi#      sudo apt-get install -y ros-kinetic-freenect-launch
pi#      sudo apt-get install -y ros-kinetic-depthimage-to-laserscan
pi#      sudo apt-get install -y ros-kinetic-realsense_camera
pi#      sudo apt-get install -y ros-kinetic-depthimage-to-laserscan

4) Create a catkin workspace(xentrinobot is just my own robot's alias)
pi#   mkdir -p xentrinobot_ws/src
pi#   cd xentrinobot_ws/src
pi#   catkin_init_workspace

4.a) enter your catkin development inside this workspace
pi#   cd ~/xentrinobot_ws
pi#   catkin_make  -j2
pi#   source devel/setup.bash
pi#   echo "source ~/xentrinobot_ws/devel/setup.bash" >> ~/.bashrc
pi#   source ~/.bashrc

5)Connect  NanoPi from your Computer(PC)
pi# ifconfig
pi#  ssh pi@
Use ROS between NanoPi and your PC

5.a) First, set IP Address to set hosts name.Then  edit the file /etc/hosts with some editor.
pi#  sudo vi /etc/hosts

5.b)Add these two lines and save it.  NanoPi  MyComputer

Note: This is just an example please change it as to what IP addresses that you have.

5.c) Check if the hosts is right by using ping

p# ping NanoPi

Please run roscore at NanoPi , in this example we use NanoPi as our computer on-boarded in a robot so it initialize as a master.  Before starting roscore, export to ROS_HOSTNAME and ROS_MASTER_URI

p#   export ROS_HOSTNAME=NanoPi
pi#  export ROS_MASTER_URI=http://NanoPi:11311
pi#  roscore

5.d)  Then, using your developmental computer, export to ROS_HOSTNAME and ROS_MASTER_URI in your PC
robook# export ROS_HOSTNAME=MyComputer
robook# export ROS_MASTER_URI=http://NanoPi:11311

5.e) Now, you can see rostopic of NanoPi
robook# rostopic list


0) If some errors occur , please try to look a missing package that are need to be installed or compile.

1)  if using a single board computer please make a lesser thread during the catkin compilation "catkin_make -j 2 , one or two threads will do for that purpose.

2) If catkin_make is not recognize , try to use source /devel/setup.bash for its workspace initialization

3) For RPLIDAR undetected usb/serial port , possible issue is the un installed usb driver ( https://www.silabs.com/documents/public/release-notes/Linux_CP210x_VCP_3.x.x_4.x.x_Release_Notes.txt)

Try this link with your verified e-mail :
pi#   sudo apt-get install libusb*
pi#  wget https://www.silabs.com/documents/login/

3.a)  Support for the CP2010N

This driver is an example of how to perform GPIO operations within the CP210x driver since the driver on kernel.org does not support GPIO at this time. This driver has only been written and tested on the Linux 3.13.0 kernel on Ubuntu 14.04. This driver is a modified version of the existing driver in the Linux 3.13.0 kernel, which is maintained at kernel.org. It is recommended to use the driver there that matches your specific kernel version: www.kernel.org

3.b) Build instructions:
1. make ( your cp210x driver )
2. cp cp210x.ko to /lib/modules//kernel/drivers/usb/serial
3. insmod /lib/modules/4. insmod cp210x.ko

3.c) GPIO example:
This shows how to use the two IOCTLs to set GPIO state.

3.d) Build instructions:
1. g++ cp210x_gpio_example.c -o cp210x_gpio_example
2. ./cp210x_gpio_example



IOT Embedded boards are used also in ROS
NanoPi Boards are no joke