Skip to content

ENPM662 - Introduction to Robot Modeling Project 2 Simulation Agricultural Robot with ROS and Gazebo Classic

License

Notifications You must be signed in to change notification settings

Jomaxdrill/fruit_vehicle_arm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agricultural Robot

ENPM662 - Introduction to Robot Modeling Project 2: Agricultural Robot model and simulation for picking apples

The following project made use of the CAD software Solidworks and software framework ROS and additional tools like Gazebo/RVizto simulate the task of a vehicle attached with a robot arm specialized in picking apples from trees.

Screenshot 2024-12-08 144511

Operating system

Ubuntu 20.04

Required installations

  • Python >= 3.8
  • sympy
  • ROS2 galatic
  • Gazebo (consider migration for 2025 to Gazebo Garden)
  • RVIZ2

Key Contributions of Each Member

Jonathan -CAD models of the environment as the trees& apples plus set stable URDF assembling with vehicle done in (https://github.com/Jomaxdrill/ROS_vehicle) . Keep track of progress and testing/debug of every step of the project. Helped fix integrity issues of the model. Created & organized github repository.

Kent- CAD model of the Robot Arm, DH table, forward kinematics validation and report of the project.

Robens- Built upon initial ros package by adding Lidar Sensor,IMU and vacuum gripper plugins & controllers. Debugging of interactions between objects. coding of teleop script and autonomous mode.

Hamsa - Inverse kinematics validation, workspace study , testing of trajectories execution for robot arm. Help in controller scripts.

GENERAL SETUP

-Verify you have ROS2 galatic distribution installed and also CMAKE necessary installations. Refer to: https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html On command line run:

echo $ROS_DISTRO

-Install previously the following packages and any additional in your linux distribution running on the terminal the command:

sudo apt install python3-colcon-common-extensions

-Install all necessary dependencies and libraries with pip for insrtance. Recommended to run in your own python environment.

Steps to build and run project.

Install python packages

In case of missing libraries you can use pip to install them:

pip install NAME_OF_LIBRARY
pip install 
pip install numpy
pip install matplotlib

Create the workspace and install all dependencies priorly

Create a folder in your system and locate the src pkg

  mkdir -p ~/test_ws/src
  cd ~/test_ws/src

Clone the repository package inside this folder

   git clone https://github.com/Jomaxdrill/fruit_mobile_robot.git

You should get a folder called fruit_vehicle_arm with the content of the repository inside. It should be like the following example:

image

Downlod all the dependencies before runnning a build.

rosdep install -i --from-path src --rosdistro galactic -y

Run this command to be at root of your workspace (~/test_ws) and build your workspace

cd ../
colcon build 

In case you got an error while building regarding an include folder not found run this command while being in the workspace folder

image

mkdir -p ~/src/fruit_vehicle_arm/include/fruit_vehicle_arm

And run again the build command

colcon build --packages-select fruit_vehicle_arm

Source ROS (Package will be identified) However you can do make this default when opening the terminal by modifying the .bashrc file. Don't forget your user password to give permissions

sudo nano ~/.bashrc

image

 source /opt/ros/galactic/setup.bash

Source package to be identified. Do this for every new terminal you open locating the Workspace folder:

source install/setup.bash

image

Before launch also run the following commands to install the controller dependencies:

sudo apt install ros-galactic-ros2-control ros-galactic-ros2-controllers ros-galactic-gazebo-ros2-control
sudo apt-get install ros-galactic-controller-manager

Download all the additionals

Add the odometry package

Odometry package is needed to track robot position and orientation as it contains plugin features. Vacuum gripper package is also necessary to be able to catch apples in gazebo.

To add it go to the folder additionals inside the package folder fruit_vehicle_arm and copy the folder odometry to the src folder of your workspace. Final result should look like this

image

You could confirm it was sucessfully done by running a general command colcon build and giving no errors .

colcon build 

image

Add gazebo models

To run the world successfully custom objects of tree and apples need to be downloaded.

To add it go to the folder additionals inside the package folder fruit_vehicle_arm and copy the folders app_body and tree_body to the location of your gazebo Result should look like this:

image

image

Gazebo

Run the following command at the root of your workspace once you source it

ros2 launch fruit_vehicle_arm gazebo.launch.py

This will display the robot in the world with apples and trees ready to run after the autonomous mode script. Sometimes at first could not due to bugs with controller manager. Open a new terminal , locate the workspace folder and run again the command.

image

RVIZ

To launch rviz open a new terminal, source the package and run:

ros2 launch fruit_vehicle_arm display.launch.py

image

Use the joint state publisher provided to try some poses for the arm for example

image

To visualize lidar scanner run before in other terminal the gazebo simulation and after launch RVIZ again and use the Add button and look for select the laser scanner plugin

image

After check for the scan topic and it should be visible the lidar.

image

As an extra step be sure inside the topic opetions, the Reliability Policy is set as Best Effort

image

Running scripts

Inside the src folder of the package, these are the following scripts you can execute:

image

Forward and inverse kinematics

Locate the folder where the scripts are is:

cd ~\src\fruit_vehicle_arm\src

Run the corresponding script:

python3 forward_position_kinematics_validation.py

This script will ask for the user to provide joint angles to give a final end effector matrix. This applies only for the robot arm.

Aditionally there is a matlab script (test_robot.m) using peter corke robotics toolbox for visualize the robot and interact with it.

Screenshot 2024-12-05 140523

python3 Inverse_kinematics_and_validation.py

This script simulates the end effector of the robot drawing a circle f radius 2 inches. The plotted circle on the YZ - plane.

Doing the grasping task

Be sure to open the gazebo by following the previous steps to open it.

Open a new terminal,source the package and run:

ros2 run fruit_vehicle_arm truck_and_arm_autonomous_control.py

The agricultural robot will spawn from position [0.0, 0.25, 0.05] and move from its origin near the trees to catch the apples attached to them with its robot arm.

image

Teleoperation:

Close any previously running gazebo terminals then

Build and source fruit_vehicle_arm then launch gazebo with the command:

  colcon build --packages-select fruit_vehicle_arm
  ros2 launch fruit_vehicle_arm gazebo.launch.py

Open a new terminal and run:

  ros2 run fruit_vehicle_arm teleop.py

Robot can now be controlled with W, A, S, D with W and S increasing and decreasing velocity respectively and A and D turning the wheel left and right respectively.

For moving the arm using numbers key combinations of

  • Keys arm1: 1,5
  • Keys arm2: 2,6
  • Keys arm3: 3,7
  • Keys arm4: 4,8

Check the odom topic

Open a new terminal,source package and run:

ros2 run fruit_vehicle_arm odom_subscriber.py

This will give information of the current position of the robot

If odometry was settled correctly you can visualize it via the topic /odom, using programs as rqt_plot or plotjugger. For more information refer to the following useful link tutorial. All credits to the author https://www.youtube.com/watch?v=MnMGjvYxlUk You can also run if installed

ros2 run rqt_plot rqt_plot

image

Videolinks

Apple picking

https://drive.google.com/file/d/1bWp0tc4YbuVi7mIBvuK-GSt5amngVuD6/view?usp=sharing

Teleoperation

https://drive.google.com/file/d/17SFGPVSB7CHLmiUaYZs7CN_LTJuTty-l/view?usp=sharing

Use with RVIZ

https://drive.google.com/file/d/1abLG8P37SsgXIo9mUsSpZqwMaZRfMZdK/view?usp=sharing

About

ENPM662 - Introduction to Robot Modeling Project 2 Simulation Agricultural Robot with ROS and Gazebo Classic

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published