Git Product home page Git Product logo

jetbot_diff_drive's Introduction

Jetbot_Diff_Drive

For the previous version files, download this repo and inside the folder do git checkout cd8f47e

Brief Review

This project includes all necessary files reproduce a simulation of the waveshare Jetbot AI Kit model in rviz and gazebo to visualize the camera, control and navigate the differential drive robot.

At this point we have several algorithms for SLAM and Navigation that you will explore below like gmapping, karto, hector.

I based the structure of this repository using husky, turtlebot3 and Raymon Wijnands for move_base_flex repos mainly. Other repositories like Intel and PAL Robotics are mentioned below.

Several sensors are included in the simulation like:

  • 1 x RGB Camera
  • 1 x Intel Realsense Depth Camera D435
  • 1 x RPLIdar Laser Scan
  • 8 x Sonar
  • 1 x GPS
  • 1 x IMU
  • 1 x Odometry (see issues at the end of the document)

All sensors excluding the jetbot camera could be enabled or disabled visually.

NOTE:

  • For the realsense you will need to make the plugin first that is included here
  • For the IMU, GPS, Odometry and sonar you will need folder hector_gazebo_plugins from here or here
  • Several dependencies will be needed, see the package.xml dependencies of each one.

The robot is a WaveShare Jetbot AI Kit and its main goal is navigation.

Below a few image examples of the outcome.

The project tree:

The project is now divided in several folders and now you can easily excecute effectively each file.

Using Jetbot Differential Drive Package

NOTE: By default, all sensors are visually enabled.

  • Put the ball folder from jetbot_diff_drive/model folder inside ~/.gazebo/models folder to load also the soccer ball.
  • See prerequisites on the package.xml of each package.
  • Create a ROS ros workspace and compile an empty package:
    cd ~
    mkdir -p catkin_ws/src
    cd catkin_ws
    catkin_make
  • Open the .bashrc with nano:
    nano ~/.bashrc
  • Insert this line at the end of the ~/.bashrc file for sourcing your workspace:
    source ~/catkin_ws/devel/setup.bash
  • Clone this repo in the ~/catkin_ws/src folder by typing:
    cd ~/catkin_ws/src
    git clone https://github.com/issaiass/jetbot_diff_drive --recursive
    git clone https://github.com/issaiass/realsense_gazebo_plugin
    git clone https://github.com/issaiass/hector_gazebo_plugins
    cd ..
  • Go to the root folder ~/catkin_ws and make the folder running catkin_make to ensure the application compiles.
  • Now you can test in several ways the packages
  • For just only the robot description
    # 1st terminal - mount only the robot description
    roslaunch jetbot_description description.launch
    # 2nd terminal (optional) - get the robot description
    rosparam get /robot_description
  • Visualizing only the robot
  • You could enable more parameters if tab is pressed
    # visualize the robot in rviz
    roslaunch jetbot_viz view_model.launch
    # example... visualize the robot in rviz and disable intel realsense
    roslaunch jetbot_viz view_model.launch realsense_enable:=false
  • For just view gazebo simulation (no control)
  • There are more parameters for enabling sensors
  • Press tab if you want to see all parameters list
  • Basic spawning of the robot
    # spawn jetbot model in gazebo in turtlebot3_world
    roslaunch jetbot_gazebo spawn_jetbot.launch
    # example... spawn jetbot model in gazebo, other world
    roslaunch jetbot_gazebo spawn_jetbot.launch world_name:=<your_world>
  • For controlling the jetbot in gazebo and visualize in rviz
    # launch the jetbot to control it in gazebo and visualize in rviz simultaneously
    roslaunch jetbot_control control.launch
    # OR
    # Same as above but with multiple terminals (4 terminals to launch)
    roslaunch jetbot_gazebo spawn_jetbot.launch
    roslaunch jetbot_viz view_model.launch
    roslaunch jetbot_control jetbot_controller_manager.launch
    roslaunch jetbot_rqt_robot_steering.launch

Finally, control the robot with the rqt steering controller
  • For robot navigation (it is not fine tuned at this checkpoint):
    # 1st terminal, launch gazebo
    roslaunch jetbot_gazebo spawn_jetbot.launch
    # 2nd terminal, launch navigation node (dynamic window approach or time elastic band)
    # <option> = teb or dwa
    roslaunch jetbot_navigation jetbot_navigation.launch local_planner:=<option>
    # 2nd terminal, or launch navigation node (dynamic window approach only)
    # <option> = 0 or 1, 0 = move_base 1 = move_base_flex
    # Let's say we want move_base_flex, then the argument is 1
    roslaunch jetbot_navigation jetbot_navigation.launch move_base_flex:=<option>
  • For robot slam:
    # 1st terminal, launch gazebo
    roslaunch jetbot_gazebo spawn_jetbot.launch
    # 2nd terminal, launch slam node
    # <option>: gmapping, hector or karto
    roslaunch jetbot_navigation jetbot_slam.launch slam_methods:=<option>
    # 3rd terminal, launch a controller (option 1)
    roslaunch jetbot_control jetbot_rqt_control_steering.launch
    # 3rd terminal, launch a controller (option 2)
    rosrun jetbot_twist_keyboard teleop_twist_keyboard.py
    # 4rt terminal, save the map when finished
    rosrun map_server map_saver -f <path_and_name_of_map>
  • You could enable/disable any sensor in the launch file.
  • You must see that roscore and all configurations loading succesfully.

Results

You could see the results on this youtube video.

Last video update - Jetbot AI Kit Karto SLAM:

Previous videos list:

Jetbot AI Kit Hector SLAM

Jetbot AI Kit move_base_flex and dwa planner

SLAM using gmappig

Navigation Stack with DWA and TEB Planners

Odometry Plugin

Sonar Plugin

GPS Plugin

IMU Plugin

RPLidar

Realsense and PCL Demo in gazebo and rviz

ROS Controllers and Camera Plugin in gazebo and rviz

The video only shows the application running, not the explanation of the code.

Video Explanation

I will try my best for making an explanatory video of the application as in this youtube video.

Last video update - Explaining Jetbot AI Kit Karto SLAM:

Previous videos list:

Explaining Jetbot AI Kit Hector SLAM

Explaining Jetbot AI Kit move_base_flex and dwa planner

Explaining Move Base Flex

Explaining Jetbot AI Kit gmapping SLAM

Explaining Navigation Stack with DWA and TEB Planners

Explaining Odometry Plugin

Explaining Sonar Plugin

Explaining GPS Plugin

Explaing IMU Plugin

Explaining how to solve Model Sinking, not moving or drifting

Explaining RPLidar

Explanation Realsense and PCL in gazebo and rviz

Explanation ROS COntrollers and Camera Plugin in gazebo and rviz

Issues
  • When the navigation stack is running, in some point the map is not aligned with the laser scan, we have to test more if is the AMCL or other map parameters related to local planning.
  • URDF need some modification, if you disable the link of imu, gps will not link and will cause an error.
  • Always leave to true both, imu_enable and gps_enable. I will fix that later
  • Planners are not fine tunned and sometimes will cause the bot to go back and forth.
  • For some reason odometry plugin by p3d of libhector always read (in my case) frame id and child as odom the next plan is to make a simple node package to get the transformation between the base_link and base_footprint to get the transform and publish in a topic.
  • Cartographer is not working, does not publish submap_list
  • hdl_graph_slam maps realsense pointclouds, but position of the robot is odd, we are inspecting the input values to the tf transform inside the hdl_graph_slam configuration
Future Work

Planning to add to this project:

  • ❌ Probably i will add effort controllers
  • ✔️ Navigation capabilities
  • ❌ Navigation fine tunning
  • ✔️ Computer Vision capabilities
  • ❌ OpenVINO as an inference engine for future deep learning based projects
Contributing

Your contributions are always welcome! Please feel free to fork and modify the content but remember to finally do a pull request.

📱 Having Problems?

License

jetbot_diff_drive's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jetbot_diff_drive's Issues

Cannot load command parameter [robot_description]

Hi @issaiass Thanks for the great initiative. I would like to use your code. I manage to compile on Ubuntu 18.04 for ROS-Melodic. But when I run the following launch file, I get the below error. Can you please help me to solve the issue?

$ roslaunch jetbot_description description.launch

... logging to /home/zulfi/.ros/log/6eadf9f0-610f-11eb-9ff3-5076af742ac0/roslaunch-PTT035LT-14871.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Deprecated: xacro tag 'inertia' w/o 'xacro:' xml namespace prefix (will be forbidden in Noetic)
when processing file: /mnt/hdd/projects/catkin_jetbot/src/jetbot_description/urdf/jetbot.urdf.xacro
Use the following command to fix incorrect tag usage:
find . -iname "*.xacro" | xargs sed -i 's#<\([/]\?\)\(if\|unless\|include\|arg\|property\|macro\|insert_block\)#<\1xacro:\2#g'

Invalid parameter "ixz"
when instantiating macro: inertia (/mnt/hdd/projects/catkin_jetbot/src/jetbot_description/urdf/includes/gazebo/inertias.xacro)
instantiated from: cuboid_inertia (/mnt/hdd/projects/catkin_jetbot/src/jetbot_description/urdf/includes/gazebo/inertias.xacro)
instantiated from: chassis (/mnt/hdd/projects/catkin_jetbot/src/jetbot_description/urdf/includes/parts/chassis.xacro)
in file: /mnt/hdd/projects/catkin_jetbot/src/jetbot_description/urdf/jetbot.urdf.xacro
RLException: Invalid <param> tag: Cannot load command parameter [robot_description]: command [['/opt/ros/melodic/lib/xacro/xacro', '/mnt/hdd/projects/catkin_jetbot/src/jetbot_description/urdf/jetbot.urdf.xacro', 'pointcloud_enable:=true', 'realsense_enable:=true', 'lidar_enable:=true', 'visualize_laser:=true', 'imu_enable:=true', 'gps_enable:=true', 'ultrasonic_enable:=true']] returned with code [2]. 

Param xml is <param command="$(find xacro)/xacro $(arg model)" name="robot_description"/>
The traceback for the exception was written to the log file

Thanks in advance.

Fail to make jetbot_navigation

When I tried to make jetbot_navigation package,an error occures:
`-- +++ processing catkin package: 'jetbot_navigation'
-- ==> add_subdirectory(jetbot_navigation)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at jetbot_navigation/CMakeLists.txt:13 (roslaunch_add_file_check):
Unknown CMake command "roslaunch_add_file_check".

-- Configuring incomplete, errors occurred!
See also "/Users/reedpan/Seafile/ReedPan/College/Research/RE_ROS/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/Users/reedpan/Seafile/ReedPan/College/Research/RE_ROS/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed`

I think it is launch file's issue.
by adding roslaunch to find_package, the problem was sloved.
find_package(catkin REQUIRED COMPONENTS roslaunch amcl jetbot_viz map_server move_base )

invalid parameter error in melodic

encountered error:

Invalid parameter "ixz"
when instantiating macro: inertia (/catkin_ws/src/jetbot_diff_drive/urdf/includes/gazebo/inertias.xacro)
instantiated from: cuboid_inertia (/catkin_ws/src/jetbot_diff_drive/urdf/includes/gazebo/inertias.xacro)
in file: /catkin_ws/src/jetbot_diff_drive/urdf/includes/parts/chassis.xacro
included from: /catkin_ws/src/jetbot_diff_drive/urdf/jetbot.xacro
RLException: while processing /catkin_ws/src/jetbot_diff_drive/launch/gazebo.launch:
Invalid tag: Cannot load command parameter [robot_description]: command [['/opt/ros/melodic/lib/xacro/xacro', '/catkin_ws/src/jetbot_diff_drive/urdf/jetbot.xacro']] returned with> code [2].

There is something wrong with the macros defined in the file "inertias.xacro" that the system cannot load the parameters.

Had to remove all inertia description in the part files to avoid this error. Then Rviz load works fine, but when loading Gazebo the model of the robot cannot be loaded, error reports that

the robot has a joint called"lt_wheel_joint", which is not in the model.

I am running on ROS melodic on Ubuntu 18.04

Could NOT find jetbot_viz (missing: jetbot_viz_DIR)

Hi , when catkin "jetbot_navigation" i got "Could NOT find jetbot_viz" error
How can solution this problem , Thanks!

---------------Version information----------------
-I use waveshare jetbot image 18.04 upgrade to 20.04
-ROS version : noetic
-opencv 4.2.0
-python 3.8.10
------------------- error massage---------------------

-- Could NOT find jetbot_viz (missing: jetbot_viz_DIR)
-- Could not find the required component 'jetbot_viz'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "jetbot_viz" with
any of the following names:

jetbot_vizConfig.cmake
jetbot_viz-config.cmake

Add the installation prefix of "jetbot_viz" to CMAKE_PREFIX_PATH or set
"jetbot_viz_DIR" to a directory containing one of the above files. If
"jetbot_viz" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/jetbot/catkin_ws/build_isolated/jetbot_navigation/CMakeFiles/CMakeOutput.log".
See also "/home/jetbot/catkin_ws/build_isolated/jetbot_navigation/CMakeFiles/CMakeError.log".
<== Failed to process package 'jetbot_navigation':
Command '['/home/jetbot/catkin_ws/devel_isolated/jetbot_gazebo/env.sh', 'cmake', '/home/jetbot/catkin_ws/src/jetbot_diff_drive/jetbot_navigation', '-DCATKIN_DEVEL_PREFIX=/home/jetbot/catkin_ws/devel_isolated/jetbot_navigation', '-DCMAKE_INSTALL_PREFIX=/home/jetbot/catkin_ws/install_isolated', '-G', 'Unix Makefiles']' returned non-zero exit status 1.

Reproduce this error by running:
==> cd /home/jetbot/catkin_ws/build_isolated/jetbot_navigation && /home/jetbot/catkin_ws/devel_isolated/jetbot_gazebo/env.sh cmake /home/jetbot/catkin_ws/src/jetbot_diff_drive/jetbot_navigation -DCATKIN_DEVEL_PREFIX=/home/jetbot/catkin_ws/devel_isolated/jetbot_navigation -DCMAKE_INSTALL_PREFIX=/home/jetbot/catkin_ws/install_isolated -G 'Unix Makefiles'

Command failed, exiting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.