Hydroponics Robot Part 3 – Mapping Issues Continued

Hydroponics Robot Part 3 – Mapping Issues Continued

Welcome back to the third part of my series on building a hydroponics robot! In this blog post, I’ll continue discussing the mapping issues I encountered while trying to navigate my robot through narrow passages and plant rows.

Increasing the global costmap

Previously, I tried increasing the global costmap to see if it would improve my robot’s alignment with the rows when it returned. Unfortunately, this didn’t seem to be enough, and the issue persisted. I suspected that the robot’s slight backward angle could be causing the problem, so I decided to try leveling it and see if it would help.

Leveling the robot

I attempted to level the robot to see if it would improve its alignment with the rows when it returned. If leveling the robot works, I may consider getting a gimble for it. However, since I couldn’t find a gimble on short notice, I ended up hot gluing two pringles can lids to the bottom of the bot as a temporary fix.

Recreating the map

Despite my efforts, I still had trouble with alignment and localization drifting. I suspected that I may need to recreate the map since different parts of the robot were having similar issues now.

Re-configuring the initial pose

I also re-configured the initial pose in nav2 so that I don’t have to keep resetting it. This should save me some time and effort during testing and troubleshooting.

Adjusting the parameters

I spent a lot of time messing around with params, but I was still unable to get the robot to navigate around a post without the localization drifting and getting stuck in a recovery loop. One config that did appear to have been missed was that the behavior global_frame was still set to odom instead of map.

Loads of trial and error, but sigma_hit under in nav2 config under amcl appeared to have significantly reduced drifting.

Repairing the tire tread

During my testing, I noticed that the tread of the tire (pvc end cap with rubber glued to it) was lost, so I needed to repair that before continuing.

Trouble navigating through a narrow passage

The robot was still hitting issues exiting a narrow passage but had no problems entering it. It actually seemed to be having trouble going from the middle of the lane to the other lane when the goal was within local costmap vision. I suspect that PathExpiringTimer may have helped with this, but I could not get it to work (probably set it in the wrong place).

I will consider writing a separate blog post about this issue. In the meantime, there’s more information about PathExpiringTimer in the links below:


And that’s it for this blog post! Despite the mapping issues, I’m still making progress with my hydroponics robot, and I’m excited to continue experimenting and tweaking it to get it just right. Stay tuned for more updates in the next part of this series!

Setting the initial pose using config in NAV2

While working through the articubots tutorials I have been setting my initial pose for nav2 manually using rviz2. It works but it can be a little tedious when testing changes that require frequent restarts.

Luckily, there’s a small section of config in nav2_params.yaml that you can use to set your initial pose:

amcl:
  ros__parameters:
    ...
    set_initial_pose: true
    initial_pose:
      x: -3.644
      y: -5.596
      yaw: -2.793

This means that it will default to this location when starting up.

Once you’ve configured it, you should see something like the following in your localization startup:

...
[map_server-1] [INFO] [1679645323.134873176] [map_server]: Configuring
[map_server-1] [INFO] [map_io]: Loading yaml file: /home/parallels/Desktop/dev_ws/install/my_bot/share/my_bot/maps/21_03_2023.yaml
[map_server-1] [DEBUG] [map_io]: resolution: 0.05
[map_server-1] [DEBUG] [map_io]: origin[0]: -7.34
[map_server-1] [DEBUG] [map_io]: origin[1]: -9.37
[map_server-1] [DEBUG] [map_io]: origin[2]: 0
[map_server-1] [DEBUG] [map_io]: free_thresh: 0.25
[map_server-1] [DEBUG] [map_io]: occupied_thresh: 0.65
[map_server-1] [DEBUG] [map_io]: mode: trinary
[map_server-1] [DEBUG] [map_io]: negate: 0
...

There’s a bit more info on this setup here, as well as a few notes on how to set it programatically instead.

Centring and Increasing the Size of your Global Costmap – ROS2, RVIZ2 and NAV2

Hi everyone,

I’ve been following the Articulated Robots tutorial series which has helped me to create a self navigating diff drive robot.

One issue I ran into after implementing Nav2 was that my Global Costmap was offset from the robot.

This ended up being a pretty easy fix. In your Nav2 configuration you can simply set rolling_window to true. This will centre the costmap on the robot as it moves around.

A second issue was the size of the costmap. I was only able to set navigation waypoints that were within 5m (note the size of the grey shading). To get around this you can use nav2 parameters again to increase the width and height. In my case I doubled the default (from 5m to 10m).

This is the config I ended up with:

global_costmap:
  global_costmap:
    ros__parameters:
      rolling_window: true
      width: 10
      height: 10

Thanks to these links for putting me on the right track: