Quantcast
Channel: Raspberry Pi – Into Robotics
Viewing all 146 articles
Browse latest View live

Tractobot: The Self-Driving Robot Tractor with ROS

$
0
0

What would be if farmers would become computer operators who just supervise the robots capable of working the land without the tractor’s operator intervention?

The robots capable of doing autonomous activities in agriculture already exist and are prepared to take on much of the responsibility of a tractor operator.

Tractobot is a project developed by Kyler Laird. Kyler started publishing information about the autonomous tractor as early as 2016, and the first thing he developed was an algorithm able to change the direction of the tractor.

The project has gone through many stages of development. One of the steps that led to the creation of an autonomous tractor was the use of the ROS framework.

Tractobot is already capable of going straight, turning, and manage the tools used in agricultural activities to work the land.

Besides the fact that the project itself consists of transforming normal tractors into robots, the total cost of conversion is quite small. Total costs are around $ 2,000, which is very cheap for such a project.

The biggest costs are for the GPS modules, Raspberry Pi and Arduino Nano.

You can see all the Tractobot variants on Kyler Laird’s YouTube channel.

The whole story of the Tractobot project is here.

Tractobot

Tractobot


Tinker Board: A more powerful processor, double RAM, but 30% more expensive than Raspberry Pi 3

$
0
0

Raspberry Pi is the leader in everything that means building things with a computer capable of running one of the many Linux distributions. Asus tries to test the same target market as Pi 3 with a computer that seems to have higher performance than Raspberry Pi 3.

If you have doubts which one is better for you, below I made a list of the major differences between the two Linux boards.

If I made a list of the Tinker disadvantages, these would be:

  • No documentation – at this time the documentation page displays “0 files found”.
  • An active community.
  • The board runs TinkerOS, a Debian-based operating system. It’s a new operating system without support and development tools.
  • Supports for 32-bit software, Pi 3 supports for 64 bits
  • For a third more performance, the price is a third bigger than Pi 3. The price for Tinker is $59.99, and for a Pi 3 the price is $39.99.

Advantages:

  • A more powerful processor compared to Raspberry Pi 3 (1.8GHz vs. 1.2GHz).
  • More RAM memory (2GB of DDR3 memory vs 1GB of RAM for Pi 3).
  • Capable of running 4K video.

These are the major differences between Tinker and Raspberry Pi 3. Most of the other specifications are compared to Raspberry Pi 3. Both have 40 pins for inputs and outputs, the dimensions differ slightly in favor of the Asus board, both have WiFi connections, etc.

ASUS Tinker

ASUS Tinker

RosBot: A H-bridge motor driver compatible with Raspberry Pi 2, 3 and Intel Up

$
0
0

With an Arduino UNO, you can easily control DC motors. With a Linux computer such as Raspberry Pi or Intel UP is a bit more difficult. The simple solution is to control with Pi or UP a motor driver with a built-in microcontroller. RosBot uses a microcontroller to control 2 stepper motors or 4 DC motors. It controls the motors in the same way like an Arduino UNO.

RosBot is designed to be directly attached to any of the Raspberry Pi 2, 3 B +, or Intel UP.

The board has two DRV8833 H-bridge motor drivers.

The microcontroller is ATmega328. It is an 8-bit microcontroller based on AVR architecture.

In addition to DC motors, RosBot has pins for control of up to 12 sensors.

RosBot specifications:

  • DC input: 5.5mm diameter, 5v~12v
  • On board regulator output: 5v 3A
  • USB Serial: CH340
  • Dimension: 65mm x 58mm

The price on Amazon is $29.99 + $10.05 for shipping. On Kittenbot, the same product costs $25.99 without shipping.

RosBot

RosBot

RosBot over Raspberry Pi

RosBot over Raspberry Pi

PiCar-S: A Kit for Raspberry Pi and Autonomous Robots

$
0
0

SunFounder has launched a new kit compatible with the Raspberry Pi 3 and Raspberry Pi 2 versions. The kit is actually a redesign of the classic 4-wheel platform used in most robot kits. The advantage is that all of the platform components can be replaced with components found in almost any robotics store.

The kit includes three sensors for at least three autonomous applications:

  1. the ultrasonic sensor is used to detect obstacles, so autonomous navigation;
  2. the light sensor is used to detect or track a light source;
  3. and a third sensor is the tracking module. With this module, you can schedule the robot autonomously track a line or follow a wall;

By using components and common parts in the DIY field, any user can add new functionalities. For example, Raspberry Pi is a computer capable of detecting or tracking objects captured with a video camera like a webcam. With OpenCV, the robot is able to detect and avoid obstacles in its path using artificial vision algorithms.

The kit price is $119.99. The price does not include the Raspberry Pi board, which must be purchased separately if you do not already have it.

PiCar-S: A Kit for Raspberry Pi and Autonomous Applications

PiCar-S: A Kit for Raspberry Pi and Autonomous Applications

The Best Raspberry Pi 3 Kits for Robotics

$
0
0

Using a robotic kit has the great advantage of having together all of the components you need to build a robot. Moreover, some kits allow the addition of new components or sensors, so using a single platform, you can build different robots.

Raspberry Pi 3 Resources:

Whether we are talking about remote controlled robots or autonomous robots, we need to connect to any of them. Raspberry Pi 3 brought a great advantage in the construction of robots – wireless connectivity. Controlling or programming the robot using the Internet or Bluetooth connectivity has become effortless.

In addition to wireless connectivity, let’s not forget that Pi 3 is a computer capable of running Linux distributions, algorithms and a set of useful frameworks such as ROS and OpenCV.

Below are the best kits compatible with Raspberry Pi 3. In addition, these kits can be used for a wide range of applications. From robots capable of detecting and avoiding obstacles using ultrasonic sensors or a webcam, to robot arms that can be programmed to grasp and move objects of different sizes. In addition, all of these kits can be controlled via the Internet or Bluetooth from a smartphone, tablet, or computer.

  • PiCar-S

    PiCar-S is a four-wheel kit compatible with Raspberry Pi 3 and Pi 2. The platform is not something new, it is a well-known four-wheel platform quite common in the hobby area. The kit does not include any of the two compatible boards. The sensors included in the kit can be used in various projects. From autonomous robot capable of detecting and avoiding obstacles, to line tracking robot.

    The kit price on Amazon is $119.99.

    PiCar-S

    PiCar-S

  • GoPiGo

    GoPiGo is a two-wheel mobile platform. The platform is compatible with most versions of Raspberry Pi, and of course Pi 3.

    Dexter Industries, the company that launched the platform, provides access to documentation, examples, and a number of APIs to develop applications.

    The kit does not include the Pi 3 board. All that is included in the package is the chassis, two motors, the motor controller and the power supply.

    The kit price on Amazon is $109.99.

    GoPiGo

    GoPiGo

  • AlphaBot

    AlphaBot is a GoPiGo-like robotic kit, but different in the sensors section. AlphaBot has attached a compatible Raspberry Pi 3 camera and a series of sensors for obstacle detection, speed measurement, or line tracking sensor. The camera uses a servo motor to move independently of the platform.

    The price on Amazon is $73.99.

    AlphaBot

    AlphaBot

  • Xiao R Geek

    Xiao R Geek is a kit from the GoPiGo and AlphaBot range, but the platform has four driven wheels. Such a kit is recommended for applications requiring greater stability and traction compared to two-wheel drive platforms. Two servo motors make the webcam attached to the chassis move vertically and horizontally, a benefit for applications that require high visibility.

    The kit includes all components including the Raspberry Pi 3 board and has a price of $299.

    Xiao R Geek

    Xiao R Geek

  • Three-wheeled Smart Car Kit

    This kit has an interesting feature for steering. The front wheels are powered by a servo motor that changes the wheel’s direction. This is just one of the important aspects. Equally important is the documentation that is not lacking and offers a whole series of examples. Of course, the focus is Raspberry Pi 3.

    The Pi 3 board is not included in the kit, and the price is $79.99.

    Three-wheeled Smart Car Kit

    Three-wheeled Smart Car Kit

  • DiddyBorg

    For a long time, any of the Raspberry Pi-compatible robotic kits has faded compared to the DiddyBorg platform. DiddyBorg is the largest and most powerful robot platform compatible with Raspberry Pi 3. Its powerful DC motors can push the robot on slopes up to 45%.

    The kit has a price of about 223EUR.

    DiddyBorg

    DiddyBorg

  • MeArm

    MeArm is a robotic arm designed as an educational tool for introduction to programming, electronics, engineering, and robotics. The kit comes with everything you need to put the robotic arm in motion. There is also documentation to control the robotic arm with any of the Raspberry Pi versions.

    The price is about 39EUR.

  • MeArm

    MeArm

ROS Kinetic: Publisher and Subscriber in Python

$
0
0

The first time I started reading about ROS was last year. Also at that time, I made the decision to learn as much about ROS and make as many projects as possible based on it. After reading the first tutorials, I was sure it would be painful until I’ll build the first robot based on ROS. And I was right.

The first step in ROS begins with this tutorial. Or better, everything starts with two nodes, the so-called basic elements. A node to publish data, and a node to read and display the data received. As an autodidact, I know how hard it is to learn things that are not explained in detail. In this tutorial, I put a lot of attention on resources and the steps needed to write and run two nodes: a Publisher node and a Subscriber node.

Read now the best books to learn ROS:

Note: I have written with capital letters the Publisher and Subscriber to highlight the two ROS concepts.

What you find in this tutorial
  1. Resources needed
  2. A short description of the Publisher and Subscriber nodes
  3. A schema of the nodes
  4. Creating the workspace and the package that will contain the nodes
  5. The Publisher
  6. The Subscriber
  7. Run nodes with an automatic launch file
  8. Helpful commands
  9. Statistics
  10. Conclusion

1. Resources needed

To write the two ROS nodes you need hardware and software resources. Below I made a list of mandatory resources, and in the end, I added an optional resource that can be helpful in developing complex projects.

Further reading on IntoRobotics:
  1. A Raspberry Pi 3 board connected to a monitor, a keyboard, and a mouse. In addition to these, you can use the SSH (Secure Shell) option or the graphical interface option. One of the applications that allow Pi control from another computer is Remote Desktop Connection. Here is a tutorial where you can find the settings to control Pi remotely.
  2. Ubuntu MATE installed on Raspberry Pi 3. There is a version of Ubuntu MATE specifically designed for Raspberry Pi.
  3. ROS Kinetic installed on Raspberry Pi 3. I explained the steps necessary to install the full version of ROS Kinetic in this tutorial.
  4. Optionally, you can install an IDE for Python. I use IDLE.

2. A short description of the Publisher and Subscriber nodes

The idea is to simulate the data transfer between a sensor (for example, it can be an ultrasonic sensor) and a program that commands the direction of the robot. An ultrasonic sensor such as HC-SR04 returns information as a numeric string. The string of numbers returned by the sensor will be read by the Subscriber node for the calculation and decision-making of the robot navigation.

To simulate such a simple scenario for sending and reading data, I’ve created two nodes. The Publisher node will generate a random number, while the Subscriber node will display the random number received from the Publisher node.

Below I draw the schema of the nodes, how the data will flow, the data type used to send the information from one node to the other, and the rate of data transmission.

3. A schema of the nodes

A node scheme that contains the names of the two nodes, the type of data sent / received, and the data sending rate.

A node scheme that contains the names of the two nodes, the type of data sent / received, and the data sending rate.

4. Creating the workspace and the package that will contain the nodes

This step is only valid if you have not already created a workspace. If the workspace is created, then you can skip the step 4.1 and jump directly to the following commands – section 4.2 – to create the package.

4.1 The commands to create the workspace
mkdir -p ~/your_workspace_name_here/src 
cd ~/ your_workspace_name_here/src
catkin_init_workspace
catkin_make
source devel/setup.bash

The above commands create a set of directories that will host all ROS nodes.

If the first two commands should be familiar, the following two commands are ROS-specific. Both commands are designed to create meta data for ROS. The “catkin_init_workspace” command creates the CmakeLists.txt file. The “catkin_make” command generates a series of directories to host files, libraries, or executable programs.

4.2 Commands for creating the ROS package

It is necessary that the ROS package containing the two nodes to be included in the workspace directory. In addition, each package will contain two files: CmakeLists.txt and package.xml.

The commands for creating the package are:

cd ~/your_workspace_name_here/src
catkin_create_pkg your_package_name rospy

‘catkin_create_pkg’ is the command for creating the new package.
‘rospy’ is the dependency of the new package created by the rospy package.

5. The Publisher

Below is the code for the Publisher node. This node will generate a random number between 0 and 5000 every 2 seconds. The file must be executable.

#!/usr/bin/env python
import rospy

from std_msgs.msg import Int32
from random import randint

//define the random_number Publisher
def random_number_publisher():
    rospy.init_node('random_number')
    pub=rospy.Publisher('rand_no', Int32, queue_size=10)
    rate= rospy.Rate(2)
//generate a random number at every 2 seconds
    while not rospy.is_shutdown():
        random_msg=randint(0,5000)
        rospy.loginfo(random_msg)
        pub.publish(random_msg)
        rate.sleep()

if __name__=='__main__':
    try:
        random_number_publisher()
    except rospy.ROSInterruptException:
        pass

To make an executable file, run the command:

chmod u+x the_file.py

6. The Subscriber

The Subscriber node will display all the random numbers sent by the Subscriber node. The display rate is the same as the Publisher node transmission rate. The file must also be executable.

#!/usr/bin/env python

import rospy

from std_msgs.msg import Int32
//define the display text
def callback(data):
    rospy.loginfo("I receive %s", data.data)

//define the subscriber
def random_subscriber():
    rospy.init_node('random_subscriber')
    rospy.Subscriber('rand_no',Int32, callback)
    rospy.spin()

if __name__=='__main__':
    random_subscriber()

7. Run nodes with an automatic launch file

To run the two files, you must run three shell commands in different terminals. The first terminal belongs to the roscore command. The second command belongs to the Publisher node, and the third is the Subscriber command. In order not to open a terminal and run the controls manually one by one, ROS provides us a tool that automatically runs all these commands. It’s about roslaunch.

To launch all files automatically, we need a file with the extension ‘.launch’. Our file contains the lines in the image below and will be saved in the Publisher and Subscriber package. The file must be executable, just like the other Publisher and Subscriber files.

The content of the file with the '.launch' extension

The content of the file with the ‘.launch’ extension

Running the roslaunch file

Running the roslaunch file

8. Helpful commands

  • rostopic info rand_no – displays information about the topic, in my case the topic name is rand_no
  • rostopic hz rand_no – displays the rate of posting
  • rostopic type rand_no – displays the topic type
  • rqt_graph – displays a window with the nodes and links between them

9. Statistics

The Raspberry Pi 3 board has limited memory and processing resources. That is why it is necessary to know at any moment the resources consumed by the ROS nodes. Below I monitored the Raspberry Pi load while running the two nodes. Depending on the applications turned on, the data below may differ. The capture below is done while running only the two ROS nodes.

The Raspberry Pi 3 statistics

The Raspberry Pi 3 statistics

10. Conclusion

This tutorial is for beginners, for those who want to learn to work with ROS. The two above mentioned nodes are a kind of “Hello World” in programming. If you went through the tutorial and put it into practice, you just took the first step in the ROS. It’s the first step in advanced robotics.

Installing and Setting Up Arduino with ROS Kinetic (Raspberry Pi 3)

$
0
0

This guide will walk you through how to install and setting up an Arduino board to work with Raspberry Pi 3 having in common ROS Kinetic.

To walk through this guide, you must have a Raspberry Pi 3 with ROS Kinetic installed, an Arduino UNO board connected via the USB port to Pi, and some Linux knowledge.

Arduino is an open-source development tool very easy to use both as hardware and software. This development board simplifies the robot construction process and is therefore used together with Raspberry Pi and ROS to control sensors, motors or any other component that can be controlled with a microcontroller.

The Arduino microcontroller can only run one ROS node at a time.

Read now the best books to learn ROS:

Install the Arduino IDE

Arduino is connected to Raspberry Pi 3 through the USB port. To program Arduino, you need to install the Arduino IDE on the Pi.

To install the Arduino IDE on the Ubuntu Mate operating system, use the following commands in the Linux terminal.

sudo apt-get update
sudo apt-get install arduino arduino-core

Install rosserial

After installing the Arduino IDE, the next step is installing the package that allows communication between ROS and the serial port of the Arduino board. The package is called rosserial_arduino and allows the node that will run on the Arduino to publish or subscribe to the nodes running on Raspberry Pi 3. The rosserial package contains three other packages: rosserial_msgs, rosserial_client, and rosserial_python.

sudo apt-get install ros-kinetic-rosserial-arduino
sudo apt-get install ros-kinetic-rosserial

After installing the Arduino IDE and the rosserial package, we will first check the IDE, but not before giving Administrator privileges to the current user for the Arduino Permission Checker.

The command is:

sudo usermod -a -G dialout your_user_here

To open the Arduino IDE, write the following command in the Ubuntu terminal:

arduino

Once we have checked the installation of the IDE, the next step is to close it and continue the setup operations. To close, use the Ctrl + C keys.

If you give the command ls in the Ubuntu terminal, you will find a new sketchbook directory. If you do not want to change your location or name, all Arduino sketches will be saved in this directory.

To write Arduino sketches for ROS, we need the ros_lib library.

Install the ros_lib library

The link between ROS and Arduino is through the ros_lib library. This library will be used as any other Arduino library.

To install the ros_lib library, type the following commands in the Ubuntu terminal:

cd sketchbook/libraries
rosrun rosserial_arduino make_library.py
make_library.py

make_library.py

If you browse the sketchbook/libraries/make_library.py/ros_lib/examples folder, you will find a list of examples that can be used in ROS projects. One of these examples is Ultrasound. In another tutorial, I will use this example to control one or more HC-SR04 ultrasonic sensors with ROS and Arduino.

The ros_lib examples

The ros_lib examples

Before checking the latest IDE settings, you must rename the ‘make_library.py’ folder. The Arduino IDE does not allow the use of points in the name of the libraries. So the name of the bookstore will become ‘make_library’.

Check the Arduino IDE settings

To check the settings made, we will open the Arduino IDE again. To launch the application, we will use the command:

arduino

After opening the IDE, check if you have access to the ros_lib examples: File -> Examples -> make_library -> ros_lib

ros_lib

ros_lib

Check the serial port:
Tools-> Serial Ports

Arduino's serial port

Arduino’s serial port


These are the steps to install and setup the Arduino IDE on Raspberry Pi 3 with ROS Kinetic.

Niryo One: The Robotic Arm Designed For ROS, Arduino and Raspberry Pi

$
0
0

The recipe for Niryo One is as follows: 3D printing, Raspberry Pi 3, Arduino Mega, RAMPS 1.4, ROS (Robot Operating System), Linux Ubuntu for Raspberry Pi, and lots of open-source code.

Let us study each feature:

3D printed:
All the components of the robotic arm that can be printed, have been printed with a 3D printer. The producers have used PLA as the printing material, but other materials may also be used.

Using the 3D printing technology to build most parts of the robot, the final price of such a project is lower when compared to traditional methods to build the same parts of a robot. Another benefit is that you can print components at home, or replace them if necessary.

Raspberry Pi 3: WiFi, Bluetooth, Ubuntu, ROS, Python.
Pi 3 connects the robot arm to the Internet or to a mobile device via WiFi and Bluetooth. Also, Pi runs important programs to control the Arduino board, and programs written in Python. In other words, Pi 3 running all programs that cannot run on the Arduino Mega.

Arduino Mega: the RAMPS 1.4 shield, control of DC motors, control of sensors.
That’s what Arduino does in this project. Read data from the sensors and control the DC motors. The data and commands are flowing through the RAMPS 1.4 shield.

RAMPS 1.4
RAMPS is a shield specifically designed to be compatible with the Arduino Mega board. This shield can control up to 5 stepper motors and few servo motors. It is interesting that such shields are used to build 3D printers. So, if you want to reuse some of the components of the robotic arm, you can build a 3D printer.

ROS: algorithms, applications
ROS running on the Raspberry Pi 3. The framework is designed to let the user add intelligence to the robotic arm. How? For example, it can add a camera and write an application for processing and analyze the images. In other words, the robotic arm can be programmed to recognize objects and sort them by color, size, etc. Moreover, ROS is open source and has a very active community.

Programs: open-source, GitHub
All the programs developed for Niryo will be available on GitHub. These programs can be downloaded and used to control the robotic arm.

Niryo One

Niryo One


Tractobot: The Self-Driving Robot Tractor with ROS

$
0
0

What would be if farmers would become computer operators who just supervise the robots capable of working the land without the tractor’s operator intervention?

The robots capable of doing autonomous activities in agriculture already exist and are prepared to take on much of the responsibility of a tractor operator.

Tractobot is a project developed by Kyler Laird. Kyler started publishing information about the autonomous tractor as early as 2016, and the first thing he developed was an algorithm able to change the direction of the tractor.

The project has gone through many stages of development. One of the steps that led to the creation of an autonomous tractor was the use of the ROS framework.

Tractobot is already capable of going straight, turning, and manage the tools used in agricultural activities to work the land.

Besides the fact that the project itself consists of transforming normal tractors into robots, the total cost of conversion is quite small. Total costs are around $ 2,000, which is very cheap for such a project.

The biggest costs are for the GPS modules, Raspberry Pi and Arduino Nano.

You can see all the Tractobot variants on Kyler Laird’s YouTube channel.

The whole story of the Tractobot project is here.

Tractobot

Tractobot

Template for a ROS Subscriber in Python

$
0
0

A few days ago I wrote a tutorial about a template for a Publisher node in Python. In the same tutorial, I used the template to write a ROS node to generate a random number.

Today, I continue the series of tutorials that ease the work of beginners in ROS, with a template for Subscriber in Python. In addition, in the article, you will find a template implementation with a ROS node that displays the data generated by the Publisher node from the previous tutorial.

Below you will find the template for a ROS Publisher node in Python. All you have to do is copy the text into a ‘. py’ file, delete the extra text and replace the text with capital letters.

Template for a ROS Publisher in Python

Template for a ROS Publisher in Python (image source)

#The ROS Node Subscriber template

#!/usr/bin/env python

#remove or add the library/libraries for ROS
import rospy, time, math, cv2, sys

#remove or add the message type
from std_msgs.msg import String, Float32, Image, LaserScan, Int32

#define function/functions to provide the required functionality
def name_callback(msg):
    make_something_here_with msg.data
    rospy.loginfo("I heard %s", msg.data)

if __name__=='__main__':
    #Add here the name of the ROS. In ROS, names are unique named.
    rospy.init_node('THE_NAME_OF_THE_NODE')
    #subscribe to a topic using rospy.Subscriber class
    sub=rospy.Subscriber('TOPIC_NAME', TOPIC_MESSAGE_TYPE, name_callback)
    rospy.spin()
 

I used the above template to write a ROS node that will display the random numbers sent by the node created to test the Publisher template.

#!/usr/bin/env python
import rospy

from std_msgs.msg import Int32
from random import randint


def random_callback(msg):
    rospy.loginfo("I heard %s", msg.data)

if __name__=='__main__':
    rospy.init_node('rand_subscriber')
   
    sub=rospy.Subscriber('rand_no', Int32, random_callback)
    rospy.spin()

To run the above node, navigate to the .py file and make it executable. The command is:

chmod u+x my_python_file.py

After the file is executable, you can run the node.

Step 1: open a new Terminal and run the command:

roscore

Step 2: open a new Terminal and run the Publisher node with the following command:

rosrun your_package your_ros_node_that_generates_random_number.py

Step 3: open a new Terminal and run the subscriber node with the following command:

rosrun your_package your_ros_node_for_subscriber.py

How To setup Raspberry Pi to identify two Arduino devices

$
0
0

The applications that run on Raspberry Pi can’t always identify the serial port that belongs to each Arduino board. If we don’t use an identifier for each board, the serial port may change every time we disconnect or connect the Arduino board to Raspberry Pi.

In this tutorial, I’ll show you how to configure Raspberry Pi to automatically identify two Arduino boards. The procedure can be extended to multiple boards, but in this tutorial, I’ve used two identical Arduino boards.

How To setup Raspberry Pi to identify two Arduino devices

How To setup Raspberry Pi to identify two Arduino devices

Below are the steps to identify each board separately, regardless of which USB port of the Pi is used.

Step 1: navigate to /etc/udev/rules.d/99-arduino.rules
Step 2: this command returns the two serial ports connected to the Arduino boards

ls /dev/ttyACM*
ls /dev/ttyACM* for two Arduino boards

ls /dev/ttyACM* for two Arduino boards

Step 3: after finding the KERNEL of the two Arduino boards, run for each board the command:

udevadm info -a -n /dev/ttyACM00 | less

Instead of ttyACM00, use the serial port of the Arduino board
Step 4: for each Arduino’s KERNEL, add a line to the file 99-arduino.rules

Setup Raspberry Pi

Step 5: refresh udev

sudo /etc/init.d/udev reload

This week in robotics: 7-13 August

$
0
0

7-13 August 2017 was a full-week for robotics. From launching new robot kits, military projects, to crowdfunding campaigns, tutorials about artificial intelligence, and a research to make likable robots. All of these are listed below.

  • ANYmal – The Swiss company Anybotics made another presentation of the robot with legs imitating a dog. The robot looks more advanced to mobility than the DARPA Alpha Dog;
  • A Japanese designed a wheel-shaped robot from a soft material;
  • GoPiGo3 is available on Amazon.com and RobotShop;
  • Someone built the smallest robot with artificial intelligence;
  • Norman Di Palo was in Japan and built a robot with artificial intelligence in a week;
  • This robot uses Kinect, ROS, a recognition algorithm and Raspberry Pi to follow a human;
  • CrazyPi is a new project on Kickstarter that is looking for crowdfunding. It is a robotic kit that can be used for a wide range of applications;
  • If you want to make a likeable robot, it must be imperfect;
  • Good to know if you plan to sell robots that uses open-source technologies;
  • A comparison Tensorflow vs Keras vs PyTorch;
  • A tutorial how to measure the distance using the HC-SR04 ultrasonic sensor and Raspberry Pi;
  • A long introduction in TensorFlow;
  • How to build an autonomous car with Raspberry Pi and TensorFlow;

Template for a ROS Subscriber Using rosserial on Arduino

$
0
0

A few weeks ago I started writing a series of tutorials that ease the work of beginners in ROS. The first tutorial was about a template for a publisher node, the second tutorial was about a template for a subscriber node in ROS, the third tutorial was a simple ROS subscriber and publisher in Python, and the fourth template is about a publisher using rosserial.

Today, I continue the series of tutorials with a template for a ROS subscriber using rosserial on the Arduino board. In addition, I’ll write a subscriber node based on the below template.

Below you will find the template for a ROS subscriber using rosserial on the Arduino board. To write your own subscriber using rosserial on Arduino, copy the template into Arduino IDE, delete the information that you don’t need and replace the text in capital letters.

ROS and Arduino

#include <ros.h>
#include <std_msgs/THE_TYPE_OF_THE_MESSAGE_YOU_SUBSCRIBER>

//create the ros node nh. The node will be used to publish to Arduino
ros::NodeHandle nh;


void messageCb(const std_msgs::MESSAGE_TYPE& msg)
{
  do_domething with msg.data;
 
}

ros::Subscriber<:message_type> sub("THE_TOPIC_THAT_SUBSCRIBER", &messageCb);

void setup()
{
  nh.initNode();
  nh.subscribe(sub);
}

void loop()
{
  nh.spinOnce();
  delay(10);
}

I used the above template to write a ROS node that will subscribe to a node that generates random numbers.

#include <ros.h>
#include <std_msgs/Int32.h>

ros::NodeHandle nh;

float var;

void messageCb(const std_msgs::Int32 &msg)
{
  var=msg.data;
 
  if(var > 2000)
   digitalWrite(13, HIGH);   // blink the led
      else
   digitalWrite(13, LOW);   // turn off the led
}

ros::Subscriber<:int32> sub("rand_no", &messageCb);

void setup()
{
  pinMode(13, OUTPUT);
  nh.initNode();
  nh.subscribe(sub);
}

void loop()
{
  nh.spinOnce();
  delay(200);
}

How to run the node
Step 1: Open a new Terminal, type roscore and press the Enter key;
Step 2: Open a new Terminal and run the node to publish the messages;
Step 3: Open another Terminal and start the subscriber node by typing the following command:

rosrun rosserial_python serial_node.py /dev/ttyACM0

How to use rosserial with two Arduinos and Raspberry Pi

$
0
0

Arduino is a good development board for reading data from various sensors and for controlling the robot’s DC motors. Raspberry Pi is a very good Linux computer running ROS. To benefit from both systems, the easiest way is to connect and make them communicate through ROS nodes.

In this tutorial, I’ll show you how to use two Arduino boards as an extension of the Raspberry Pi computer. For this tutorial, you need Raspberry Pi to be able to identify each Arduino board. Such a system becomes necessary when the robot’s architecture is complex.

At one time, only one ROS node can run on an Arduino board. So in this tutorial, I will use one of the two Arduino boards to generate a random number, and a second Arduino board to control the LED connected to pin 13. On both boards, I will run one ROS node that will send or receive data according to the chart below.

How To use rosserial with Two Arduinos and Raspberry Pi

How To use rosserial with Two Arduinos and Raspberry Pi

The description of the structure

  • The user will start all ROS nodes by running a .launch file.
  • The first Arduino board will run a random number script and send data to Raspberry Pi.
  • A ROS node will receive a random number from the first Arduino board. The node will run on Raspberry Pi and will command the LED on the second Arduino board.
  • The second Arduino board will turn ON and OFF the LED (pin 13) depending on the commands received from the ROS node running on the Pi board.

The ROS node for random number generation

#include <ros.h>
#include <ros/time.h>
#include <std_msgs/Int32.h>

int min=1;
int max=5000;
int rand_no;


ros::NodeHandle nh;
std_msgs::Int32 rand_msg;
ros::Publisher pub_random("/random_number", &rand_msg);

char frameid[] = "/randomData";

#this function returns the random number
int random_number(){
rand_no= random(min, max);
return rand_no;
   }

 
void setup() {
   nh.initNode();
   nh.advertise(pub_random);
}


void loop() {
 rand_msg.data=random_number();
 pub_random.publish(&rand_msg);
 nh.spinOnce();
 delay(1000);
 }

Testing the node
Step 1: Open a Linux Terminal and type the command:

roscore

Step 2: Open a second Linux Terminal and type the following command:

rosrun rosserial_python serial_node.py /dev/ttyACM*

Step 3: To see the random numbers generated by the Arduino node, open a third Terminal and type the following command:

rostopic echo /random_number

The ROS node that displays and calculates the LED’s stage

This node will run on Raspberry Pi and will be a ROS node in Python. Before you start writing the Python code, you must create the workspace and the package that contains the node. The necessary steps can be found in this article.

#!/usr/bin/env python

import rospy

from std_msgs.msg import Int32
from std_msgs.msg import String

var=None

#define the display text
def callback(msg):
    global var
    var=msg.data

 
if __name__=='__main__':
   
 rospy.init_node('random_LED')
 rospy.Subscriber('random_number',Int32, callback)
 pub=rospy.Publisher('LED', String, queue_size=1)
 rate=rospy.Rate(10)

while not rospy.is_shutdown():
     if var<=2500:
        #send message to turn OFF the LED
          varP="OFF"
          rospy.loginfo("The output is OFF and the var is: %s", var)
     else:
        #send message to turn ON the LED
         varP="ON"
         rospy.loginfo("The output is ON and the var is: %s", var)

pub.publish(varP)    
rate.sleep()

The ROS node that controls the LED

#include <ros.h>
#include <std_msgs/String.h>

ros::NodeHandle nh;

void messageCb(const std_msgs::String& msg)
{
  if(msg.data =="ON")
    digitalWrite(13, HIGH-digitalRead(13));   //blink the led
else
   digitalWrite(13, LOW-digitalRead(13));   //turn off the led
}

ros::Subscriber sub("OFF", &messageCb);

void setup()
{
  pinMode(13, OUTPUT);
  nh.initNode();
  nh.subscribe(sub);
}

void loop()
{
  nh.spinOnce();
  delay(1000);
}

Write the launch file

<launch>
<node pkg=”rosserial_python” type=”serial_node.py” name=”twoArduino_LED” output=”screen”>
<param name=”port” value=”/dev/ttyACM0″/>
<param name=”baud” value=”57600″/>
</node>
<node pkg=”rosserial_python” type=”serial_node.py” name=”twoArduinos_RandNo” output=”screen”>
<param name=”port” value=”/dev/ttyACM1″/>
<param name=”baud” value=”57600″/>
</node>
<node name=”random_number” pkg=”pi_and_arduino” type=”twoArduinos_Pi.py” output=”screen” />
</launch>

References:

 

DRONE PILOT: Self-Navigating Module for Robotics and Drones

$
0
0

DRONE PILOT is a module that includes the entire range of sensors required by a drone or a robot to navigate autonomously.

The designers use the RaspberryPi Compute Module 3 board as the brain of the module. This means that you have a larger Raspberry Pi community support.

The sensor list includes GPS, telemetry sensor, and Next Gen Airspeed sensor that takes into account the ambient temperature. Additional sensors can be added using additional ports.

A single DRONEE PILOT module without the Airspeed sensor, GPS antenna, and the Raspberry Pi module is priced at € 285. The price increases to € 394.99 if you add the sensor, the GPS antenna, and the Raspberry Pi module.

DRONE PILOT

DRONE PILOT


A Raspberry Pi Disk Image with Raspbian Stretch Lite + ROS + OpenCV

$
0
0
If you need to run ROS on a Raspberry Pi 3 or 3 B+, OpenCV 3.3.1 and you don’t need a GUI (Raspbian Stretch Lite doesn’t have a GUI), this image is handy. disk image source

A cheap system for detecting curved lanes (OpenCV, Raspberry Pi 3 and Nvidia Jetson TX2)

$
0
0
A relatively inexpensive method with good results for a robot capable of detecting the lines and the curved lines of a road is described in this project. Kemal Ficici has used OpenCV for computer vision, a Raspberry Pi 3 and … Read more →

How to Install ROS Kinetic on Raspberry Pi 3 running Raspbian Stretch Lite

$
0
0
I want to control an autonomous robot with a Raspberry Pi 3 board and ROS Kinetic. The Pi 3 will be connected to another Linux PC used for monitoring and control settings. The setup for computers are in this article. … Read more →

How To Setup ROS Kinetic To Communicate Between Raspberry Pi 3 and a remote Linux PC

$
0
0
I have a Raspberry Pi 3 running ROS Kinetic and I use it to control an autonomous robot. The plan is to improve my robot by adding computer vision capabilities. The Raspberry Pi has resources to build intelligent robots and … Read more →

Alternatives To Raspberry Pi 3 (B/B+) For Running ROS

$
0
0
I’m quite involved in developing an autonomous robot platform for outside work. The robot will work in the summer during the day for a few hours, which result in high temperatures for all its components. My main concern is the … Read more →
Viewing all 146 articles
Browse latest View live




Latest Images