Code Monkey home page Code Monkey logo

lidar_auto_docking's Introduction

lidar_auto_docking

The lidar_auto_docking package is a heavily refactored version of the fetch_open_auto_dock package. The package would send appropriate cmd_vel messages to bring the robot to a dock with a trapezium-shaped landmark. The distance between dock and base_link is used to determine if the robot has reached the dock.
There are two versions of this package. ROS2 Foxy on the (foxy-main) branch, ROS2 Humble on the (humble-main) branch. Do take note that the humble version of this package requires a separate package for messages, whereas the foxy version does not.

Prerequisites

This package would require the nav2 stack to be set-up on your robot.

This package requires a trapezium-shaped landmark with the following dimensions:

  1. The front face of the trapezium is 300mm long
  2. Each side of the trapezium is 100mm long at a 45 degree angle
    2d dock

You can create this trapezium out of any material you desire. Of course, the trapezium should be placed in the scan plane of the lidar.

Subscribed Topics

  1. /scan (laserscan topic)
  2. /tf (transformation from map->odom->base_link)
  3. /joy (joystick topic. Used to reset the chosen dock by the dock saver program)

Published Topics

  1. /autodock/cmd_vel (topic used to send velocity commands to the robot.)

Installation

  1. git clone the following messages package into your src folder:
git clone https://github.com/SynapseProgramming/lidar_auto_docking_messages.git
  1. Next, git clone this package into your colcon workspace and then run colcon build. If there are some dependencies that are not met, please run rosdep before building.

Usage

  1. Firstly, run nav2 on your robot. Place the robot about 1 metre in front of the dock.

robot infront dock

  1. Next, open a new terminal and launch:
ros2 launch lidar_auto_docking dockpose_saver_launch.py

detected dock

Once the robot has detected a suitable dock candidate, the dock frame would appear in rviz2.

gui window

Furthermore, a GUI window would pop up. The GUI would display the absolute distance(in metres) between base_link and the dock frame. You may wish to use this tool to decide a suitable distance for the robot to stop at the dock.

  1. Once you are satisfied with the selected dock, click on the save dock and bot pose button. This button would save the dock's position in the map frame. Also, the transformation between base_link and map would be saved.

saved dock coord

  1. Next, please modify the config/autodock_params.yaml file and key in suitable parameters. Please run colcon build once suitable parameters have been keyed in.

Docking

  1. please position the robot about 1-1.5m in front of the dock and run the following command to send the robot to the dock.
ros2 launch lidar_auto_docking dockrobot_launch.py

The robot should begin to move towards the dock. The robot would stop once the distance threshold(docked_distance_threshold) between dock and base_link has been reached.

Undocking

  1. To undock the robot, please run the following command:
ros2 launch lidar_auto_docking undock_robot_launch.py

The robot would undock from the dock, and it should turn 180 degrees.

Testing in simulation

Before testing docking on real hardware, I strongly recommend testing this package in simulation first(gazebo etc.)

  1. Firstly, place the Dock.stl file in the same folder as your .world file.

  2. Next, you may wish to copy and paste this code and place it in the world tag. To add the dock into your world.

<model name="dock">
                <!-- x y z r p y-->
                    <pose>-1.0 -0.35 0 1.57 0 1.57</pose>
                    <static>true</static>
                    <link name="body">
                      <visual name="visual">
                        <geometry>
                          <mesh><uri>file://Dock.stl</uri>
                          <scale>0.001 0.001 0.001</scale>
                        </mesh>
                        </geometry>
                      </visual>
                      <collision name="collision1">
                                <geometry>
                                  <mesh><uri>file://Dock.stl</uri>
                                   <scale>0.001 0.001 0.001</scale>
                                   </mesh>
                                </geometry>
                              </collision>

                    </link>
                  </model>

System Integration

As the main docking program is an action server, you could write action clients to customise where and when you want the robot to engage in the docking/undocking sequence.

If you wish, you could refer to dock_robot.py and undock_robot.py in the scripts folder as a reference.

lidar_auto_docking's People

Contributors

synapseprogramming avatar

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

Watchers

 avatar  avatar

lidar_auto_docking's Issues

CMake Error: add_custom_target cannot create target "ament_cmake_python_copy_lidar_auto_docking" because another target with the same name already exists.

Hi,

I'm trying to compile this package in ROS 2 Humble, but I'm getting this error:

CMake Error at /opt/ros/humble/share/ament_cmake_python/cmake/ament_python_install_package.cmake:122 (add_custom_target):
  add_custom_target cannot create target
  "ament_cmake_python_copy_lidar_auto_docking" because another target with
  the same name already exists.  The existing target is a custom target
  created in source directory "/home/user/ros2_ws/src/lidar_auto_docking".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_python/cmake/amrodrigoent_python_install_package.cmake:39 (_ament_cmake_python_install_package)
  CMakeLists.txt:65 (ament_python_install_package)


CMake Error at /opt/ros/humble/share/ament_cmake_python/cmake/ament_python_install_package.cmake:141 (add_custom_target):
  add_custom_target cannot create target
  "ament_cmake_python_build_lidar_auto_docking_egg" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory "/home/user/ros2_ws/src/lidar_auto_docking".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_python/cmake/ament_python_install_package.cmake:39 (_ament_cmake_python_install_package)
  CMakeLists.txt:65 (ament_python_install_package)

Maybe this is a Humble specific thing or a configuration in the CMakeLists.txt that my Humble installation isn't linking?

Appreciate your time and the work you are doing and sharing.

Does not compile

colcon build
Starting >>> lidar_auto_docking
--- stderr: lidar_auto_docking
CMake Error at CMakeLists.txt:35 (find_package):
By not providing "Findlidar_auto_docking_messages.cmake" in
CMAKE_MODULE_PATH this project has asked CMake to find a package
configuration file provided by "lidar_auto_docking_messages", but CMake did
not find one.

Could not find a package configuration file provided by
"lidar_auto_docking_messages" with any of the following names:

lidar_auto_docking_messagesConfig.cmake
lidar_auto_docking_messages-config.cmake

Add the installation prefix of "lidar_auto_docking_messages" to
CMAKE_PREFIX_PATH or set "lidar_auto_docking_messages_DIR" to a directory
containing one of the above files. If "lidar_auto_docking_messages"
provides a separate development package or SDK, be sure it has been
installed.

gmake: *** [Makefile:513: cmake_check_build_system] Error 1

Failed <<< lidar_auto_docking [2.68s, exited with code 2]

Summary: 0 packages finished [3.10s]
1 package failed: lidar_auto_docking
1 package had stderr output: lidar_auto_docking

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.