Skip to content

kylerhunag/gesture_controlled_robot_pet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gesture Controlled Robot Pet

Consider having a pet that is smart, responds to your commands without training, and even takes pictures for you! You don’t even have to pick up after or buy kibble for this pet! This is a dream come true for those craving an animal companion but cannot afford the time, money, or maintenance required for real animals. Robot pets are one example of how technology can assist in scenarios where companionship and fun are needed, but the handling and upkeep of real pets isn’t possible; especially in healthcare or senior homes.

Apart from doing normal pet things such as moving around and performing a few tricks, it can also perform robot tasks, like capturing photos with the camera in its nose. It can also remember you and follow you around for as long as you like. You can also deactivate this pet for some privacy and activate it back again when you feel like you need its company.

Through its camera “eyes”, this robot pet uses a combination of machine learning and computer vision techniques to see and respond to commands given through its owner’s body gestures. The robot pet can track, recognize, and perform a task such as following the user. The user is thus able to control the pet from a distance, enabling full autonomy.

Repo

Gestures

Below are the gestures included in the repository.

Command Gesture Description Output
Activate Robot starts functioning and responding to commands
Deactivate Robot goes to “sleep” state and can only be woken up by giving it activate command
Move Forwards Moves the robot forwards
Move Backwards Moves the robot backwards
Spin Right Spins the robot right
Spin Left Spins the robot left
Take a Picture Initiates the routine to take a photo
Follow Initiates the routine to follow the person who gave the follow gesture
Stop Follow Stops the follow routine if the robot is in follow mode

Hardware

Setup and Connection Notes

  • Build robot base without using the Arduino or the ultrasonic sensors, you can find the instructions here
  • Connect robot base parts to Raspberry Pi (see pinout in RaspberryPi_robot_pet/server_v9.py)
  • Connect Raspberry Pi Camera to CAMERA1 on the Atlas 200 DK, you can follow this guide
  • Set the output voltage of the power bank to 12 V. (Hold the power button and then double click a few times.)
    • The Atlas Board can be connected to the "DC-Out" port; the router and the Pi can be connected to the USB ports.
  • Router connection (After you've completed 1st step of Atlas 200DK Setup and 2nd step of Raspberry Pi Setup)
    • Raspberry Pi connected to Atlas 200DK via wireless connection
    • Atlas 200DK connected to the router via Ethernet cord
    • Laptop connected to the router via wireless connection

Setup

Development Environment (PC)

Development PC requires Ubuntu 18.04 system (can be virtual machine), and have CANN installed. Please setup follow the this official guide or this wiki

Atlas 200DK Setup

  1. Setup the Atlas 200 DK board, following this wiki or the official guide

  2. Power the Atlas DK board and set up the router connections. You can follow this guide

  3. Attach raspberry Pi camera to the board (https://support.huaweicloud.com/intl/en-us/qs-atlas200dkappc32/atlased_04_0006.html).

  4. Set up RC Car by following instructions here.

  5. On Atlas 200 DK, git clone this repo (No internet access? Just try connecting Atlas 200 Dk to a router with Ethernet Cable. For details, check official document or our router connection guide)

    git clone https://github.com/kylerhunag/gesture_controlled_robot_pet.git

  6. Install the required dependencies to run this project:

    cd ~/gesture_controlled_robot_pet/Atlas_robot_pet

    pip3 install -r requirements.txt

Robot Operating System (ROS) Setup

The Robot Operating System (ROS) is a set of software libraries and tools that help you build robot applications. In order to set up ROS on the Atlas 200 DK board refer to the following guide below:

ROS Setup

Once the conda environment and ROS has been set up on the board we have to create a workspace and a ROS project such that we can run our code. The following code describes how to do so:

  1. Once you have created and built your ROS package you can now copy paste the scripts and launch folder from ~/gesture_controlled_robot_pet/ROS to ~/catkin_ws/src/<package_name>/

  2. Here we used robot_pet as our package_name. Once all the scripts and launch files are copied into the catkin_ws we need to make the files executable and as such do chmod +x <file name> for all the files that have been copied. Before running the ROS project ensure that the presenter server script is running and the Raspberry PI script is running.

  3. Activate the environment you just created. Install the dependencies listed in the requirements.txt. And lastly run:

cd ~/catkin_ws

source ./devel/setup.bash

catkin_make to build the nodes.

Raspberry Pi Setup

  1. Install the latest version of Raspbian onto an SD card
    Follow the steps in the link:
    https://www.raspberrypi.org/documentation/installation/installing-images/
  2. Insert SD card into Pi and power on the Pi by plugging it into a 5V power source.
  3. Make sure you complete the Router connection
  4. Update the system by opening a terminal and entering:
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install python3-pip
    sudo apt install unclutter
  5. Retrieve the files to be downloaded onto the Raspberry Pi, which are located in the folder “RaspberryPi_robot_pet”, either from cloning this repository or from the GitHub repository directly. Make sure the following files are in a folder called “RaspberryPi_robot_pet”:
    • Raspberry-Pi_robot_pet/happy.mp4
    • Raspberry-Pi_robot_pet/neu.mp4
    • Raspberry-Pi_robot_pet/white.jpeg
    • Raspberry-Pi_robot_pet/body_img.jpg
    • Raspberry-Pi_robot_pet/camera_img.jpg
    • Raspberry-Pi_robot_pet/deactivate.jpg
    • Raspberry-Pi_robot_pet/follow_img.jpg
    • Raspberry-Pi_robot_pet/server_v9.py
    • Raspberry-Pi_robot_pet/requirements.txt
  6. Navigate to the directory where the main Raspberry Pi program is located, for example:
    cd /home/pi/Documents/Capstone/Raspberry-Pi_robot_pet/
  7. Install OpenCV and numpy for Python 3:
    pip3 install -r requirements.txt
  8. Install the LCD driver
    Follow instruction under the link:
    https://github.com/goodtft/LCD-show

Run the Robot

Raspberry Pi

  1. Start Raspberry Pi into Raspbian OS
  2. ssh into the Pi
  3. Navigate to the directory where the main Raspberry Pi program is located, for example:
    cd /home/pi/Documents/Capstone/Raspberry-Pi_robot_pet/
  4. Ensure that Pi and the Atlas 200DK are in the same network. Run the main program for the robot control:
    python3 server_v9.py

Atlas 200DK

  1. Login to Atlas 200 DK from PC (Refer to this guide on how to setup and access). Note, it is required to use VScode with Remote-SSH extension to login remotely, otherwise you might not get the video stream to display on your PC.

  2. Navigate to the presenter server directory and start the presenter server:

    cd ~/gesture_controlled_robot_pet/Atlas_robot_pet/presenterserver

    bash run_presenter_server.sh body_pose.conf

Robot Operating System (ROS) on 200DK

The ROS project can now be run. In order to run the project refer to the following set of commands:

cd ~/catkin_ws

source ./devel/setup.bash

roslaunch <package_name> robot_pet_launch.launch

Third Party Links

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 52.8%
  • JavaScript 39.2%
  • C++ 3.0%
  • HTML 2.0%
  • CSS 1.2%
  • Shell 1.1%
  • Other 0.7%