Skip to content

Autonomous Navigation

mEEtGandhi edited this page Jun 20, 2020 · 6 revisions

This page contains detailed procedures for simulating AGRIBOT in GAZEBO. Agribot is a four-wheel skid steer drive robot that we can control using a keyboard or autonomously with the help of sensor data. We have used rviz and mapviz for visualization purposes.

Installation:

  1. Clone repository into your directory.
$ git clone https://github.com/Dhruv2012/Autonomous-Farm-Robot.git
  1. Create your Catkin workspace and Copy all directories of agribot_ws/src into your workspace's src directory.
$ source /opt/ros/NAME-OF-YOUR-DISTRO/setup.bash    
$ mkdir -p ~/NAME-OF-WORKSPACE/src
$ cd ~/NAME-OF-WORKSPACE/
$ catkin_make

$ mv path_to_agribot_ws path_to_NAME_OF_WORKSPCE/src
$ cd ~/NAME-OF-WORKSPACE/
$ catkin_make 
  1. Check & Install Required dependencies.
$ rosdep install [package]
$ sudo apt-get install ros-melodic-ros-control
$ sudo apt-get install ros-melodic-gazebo-ros-control

Note: You may need some more installation of pkgs, try to install them into your system (/opt/ros/melodic/share). You also may have some broken pkgs, try to solve them before starting a simulation.

  1. Install Gazebo model from GAZEBO_MODEL_LIBRARY.
$ git clone https://github.com/osrf/gazebo_models.git

Make sure these models are copied into ~/.gazebo/models. You can check by GAZEBO API through model editor.

1. Teleoperation

The first step is using Keyboard_teleop node to control AGRIBOT in GAZEBO. Using teleop we can check functionality of AGRIBOT using ROS tools such as rostopic visualization, rosmsg, and through rqt. You can use any other teleop method in joy pkg.

  1. Load AGRIBOT into gazebo environment using launch file provided in agribot_description/launch/. Here we have created farming environment by integrating different models from GAZEBO_MODEL_LIBRARY. You can use empty_world by changing path in launch file. Avoid external terminals to provide goal location.
$ roslaunch agribot_description my_world.launch 
  1. Go into teleop_tools pkg and then keyboard_teleop pkg. You can run this node using 2 methods, either rosrun or python2.
$ rosrun keyboard_teleop keyboard_teleop.py
               or    
$ python2 keyboard_teleop.py

You can visualize topics and plots using rqt_plugins by running $ rqt.

  1. To visualize trajectory of AGRIBOT, launch mapviz from mapviz pkg.
$ roslaunch mapviz mapviz.launch  

2. Autonomous Navigation

Once we ready with all functionality checks, we can now work with an autonomous task. It is recommended that we first analyze sensor data before starting autonomous task script.

  1. Analyze data from rqt
$ rqt

Then select plugins/visualization/plots and select topics to view.

  1. Load AGRIBOT into gazebo environment using launch file provided in agribot_description/launch/. Also start mapviz for visualization.
$ roslaunch agribot_description my_world.launch 
$ roslaunch mapviz mapviz.launch 
  1. Now we can select GPS location of destination by traversing through field as GPS location varies time to time. We can use teleop operation or shortcut provided in GAZEBO API to collect GPS locations. Once we have GPS locations then first feed that location into external terminal. Now we can run scripts from autonomous_drive /scripts/autonomous_drive.py.
$ cd ~/NAME-OF-WORKSPACE/src/autonomous_drive/scripts
$ python autonomous_drive.py

Reference Links for more information:

  1. Programming Robots with ROS by Morgan Quigley, Brian Gerkey & William D. Smart
  2. ROS Robotics By Example by Carol Fairchild & Dr. Thomas L. Harman
  3. Simulation
  4. The Construct youtube channel
  5. ROS wiki is best place to learn..!!:punch: :v: