https://berndpfrommer.github.io/tagslam_web/making_tags/
https://github.com/berndpfrommer/tagslam_root
https://optitag.io/blogs/news/designing-your-perfect-apriltag
Designing the perfect Apriltag
TagSLAM root repository
Use this repository to get a complete ROS/catkin workspace with all dependencies for the
TagSLAM project
.
This repository relies heavily on
git submodules
.
Installation instructions
Since this is ROS package, you will need to
install ROS
. This repo has been tested on Ubuntu 16.04 (ROS Kinetic) and Ubuntu 18.04 (ROS Melodic). On top of it, install the catkin tools:
sudo apt install python-catkin-tools
TagSLAM’s backend is based on GTSAM, so you will need to add a PPA.
If you previously installed GTSAM, you need to first remove the older version:
sudo apt remove gtsam
sudo add-apt-repository --remove ppa:bernd-pfrommer/gtsam
Now add the official borglab ppa and install GTSAM:
sudo apt-add-repository ppa:borglab/gtsam-release-4.0
sudo apt update
sudo apt install libgtsam-dev libgtsam-unstable-dev
Clone the full repo including all submodules, into a a new catkin workspace (
tagslam_root
):
cd ~
git clone --recursive https://github.com/berndpfrommer/tagslam_root.git
For Ubuntu 18.04 and later:
Configure and compile:
cd ~/tagslam_root
catkin config -DCMAKE_BUILD_TYPE=Release
catkin build
For Ubuntu 16.04:
Ubuntu 16.04 lacks support for C++ standard 17, so you need to install a later version of cmake and g++-7 from PPA repositories:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-7 g++-7
Then
upgrade cmake
:
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main'
sudp apt-get update
sudo apt-get install kitware-archive-keyring
sudo apt-key --keyring /etc/apt/trusted.gpg del C1F34CDD40CD72DA
sudo apt-get update
sudo apt-get install cmake
Direct cmake to use the g++-7 compiler:
cd ~/tagslam_root
catkin config -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-7
catkin build
You will get tons of warning messages, but it should compile.
Quick test
Overlay the newly created workspace and run a quick test:
source ~/tagslam_root/devel/setup.bash
roslaunch tagslam tagslam.launch bag:=`rospack find tagslam`/example/example.bag
(the rosnode will not exit, so you have to Ctrl-C out of it)
License
This software and any future contributions to it are licensed under the
Apache License 2.0
.
How to print your own AprilTags
There is a handy little program in the TagSLAM repo (courtesy of the Kalibr folks) with which you can generate a pdf of an AprilTag:
sudo apt install python-pyx
rosrun tagslam make_tag.py --nx 1 --ny 1 --marginx 0.00 --marginy 0.00 --tsize 0.16 --tspace 0.0 --startid 4 --tfam t36h11 --borderbits 1
参数含义:
parser = argparse.ArgumentParser(description=’Generate apriltag PDF.’, usage=usage)
outputOptions = parser.add_argument_group(‘Output options’)
outputOptions.add_argument(‘output’, nargs=”?”, default=”target”, help=’Output filename’)
genericOptions = parser.add_argument_group(‘Generic grid options’)
genericOptions.add_argument(‘–nx’, type=int, default=6, dest=’n_cols’, help=’The number of tags in x direction (default: %(default)s)\n’)
genericOptions.add_argument(‘–ny’, type=int, default=7, dest=’n_rows’, help=’The number of tags in y direction (default: %(default)s)’)
genericOptions.add_argument(‘–marginx’, type=float, default=0, dest=’marginx’, help=’Margin [m] in x direction (default: %(default)s)’)
genericOptions.add_argument(‘–marginy’, type=float, default=0, dest=’marginy’, help=’Margin [m] in y direction (default: %(default)s)’)
genericOptions.add_argument(‘–color’, default=”Black”, dest=’color’, help=’Color in cmyk space (default: %(default)s)’) aprilOptions = parser.add_argument_group(‘Apriltag arguments’)
aprilOptions.add_argument(‘–tsize’, type=float, default=0.08, dest=’tsize’, help=’The size of one tag [m] (default: %(default)s)’)
aprilOptions.add_argument(‘–tspace’, type=float, default=0.3, dest=’tagspacing’, help=’The space between the tags in fraction of the edge size [0..1] (default: %(default)s)’)
aprilOptions.add_argument(‘–tfam’, default=’t36h11′, dest=’tagfamiliy’, help=’Familiy of April tags {0} (default: %(default)s)’.format(AprilTagCodes.TagFamilies.keys()))
aprilOptions.add_argument(‘–startid’, default=0, type=int, dest=’startid’, help=’Start number for apriltag (default: %(default)s)’)
aprilOptions.add_argument(‘–borderbits’, default=2, type=int, dest=’borderBits’, help=’number of bits used for black border (default: %(default)s)’)
aprilOptions.add_argument(‘–symm_corners’, default=False, dest=’symmCorners’, action=’store_true’, help=’add black corner squares (default: %(default)s)’)