mn-banjar / arduino_robot_arm_gripper

ROS packages to control an Arduino robot arm by using Moveit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

arduino_robot_arm_gripper

ROS packages that can be used to plan and execute motion trajectories for a robot arm in simulation and real-life.

These packages were tested under ROS kinetic and Ubuntu 16.04 and it works perfectly on ROS melodic

The robot arm uses Moveit plugin to apply kinematics by the KDL solver. These packages can be tested in the gazebo simulation tool and the real robot arm, where the ROS system and Arduino code share the /joint_states topic to control motors.

Dependencies

run this instruction inside your workspace:

$ rosdep install --from-paths src --ignore-src -r -y

make sure you installed all these packages:

$ sudo apt-get install ros-kinetic-moveit
$ sudo apt-get install ros-kinetic-joint-state-publisher ros-kinetic-joint-state-publisher-gui
$ sudo apt-get install ros-kinetic-gazebo-ros-control joint-state-publisher
$ sudo apt-get install ros-kinetic-ros-controllers ros-kinetic-ros-control

Robot Arm

The robot arm has 5 joints, 4 joints to connect the arm links where the last joint for the gripper.

Circuit diagram

circuit

Robot initial positions

positions

Usage

Controlling the robot arm by joint_state_publisher

$ roslaunch arm_pkg check_motors.launch

You can also connect with hardware by running:

$ rosrun rosserial_python serial_node.py _port:=/dev/ttyUSB0 _baud:=115200

(Note: You may need to use ttyACM)

Simulation

Run the following instructions to use gazebo

$ roslaunch arm_pkg check_motors.launch
$ roslaunch arm_pkg check_motors_gazebo.launch
$ rosrun arm_pkg joint_states_to_gazebo.py

(Note: you may need to make the python script executable by changing the permission)

Controlling the robot arm by Moveit and kinematics

$ roslaunch moveit_config_pkg demo.launch

You can also connect with hardware by running:

$ rosrun rosserial_python serial_node.py _port:=/dev/ttyUSB0 _baud:=115200

(Note: You may need to use ttyACM)

Simulation

Run the following instruction to use gazebo

$ roslaunch moveit_config_pkg demo_gazebo.launch


Pick and place by using OpenCV

Preparation

Download webcam extension for VirtualBox

https://scribles.net/using-webcam-in-virtualbox-guest-os-on-windows-host/

Testing the camera and OpenCV

Run color_thresholding.py to test the camera

Before running, find the camera index normally it is video0

$ ls -l /dev | grep video

If it is not, update line 8 in color_thresholding.py

8 cap=cv2.VideoCapture(0)

Then run

$ python color_thresholding.py

Using OpenCV with the robot arm in ROS

In Real Robot

  • In a terminal run

$ roslaunch moveit_config_pkg demo.launch

this will run Rviz

  • connect with Arduino:
  1. select the Arduino port to be used on Ubuntu system

  2. change the permissions (it might be ttyACM)

    $ ls -l /dev | grep ttyUSB

    $ sudo chmod -R 777 /dev/ttyUSB0

  3. upload the code from Arduino IDE

$ rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 _baud:=115200

  • In another terminal

$ rosrun moveit_config_pkg get_pose_openCV.py

This will detect blue color and publish the x,y coordinates to /direction topic

(Note: check the camera index and update the script if needed)

  • Open another terminal

$ rosrun moveit_config_pkg move_group_interface

This will subscribe to /direction topic and execute motion by using Moveit move group

In simulation (Gazebo)

  • In a terminal run

$ roslaunch moveit_config_pkg demo_gazebo.launch

this will run Rviz and gazebo

  • In another terminal

$ rosrun moveit_config_pkg get_pose_openCV.py

This will detect blue color and publish the x,y coordinates to /direction topic

(Note: check the camera index and update the script if needed)

  • Open another terminal

$ rosrun moveit_config_pkg move_group_interface

This will subscribe to /direction topic and execute motion by using Moveit move group

About

ROS packages to control an Arduino robot arm by using Moveit


Languages

Language:Python 53.2%Language:CMake 25.2%Language:C++ 21.6%