viamcartographer

package module
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

README

viam-cartographer

(In)stability Notice

Warning This is an experimental feature. Stability is not guaranteed. Breaking changes are likely to occur, and occur often.

Overview

This repo wraps Cartographer as a modular resource so it is easily usable with the rest of Viam's ecosystem. Cartographer is a system that provides real-time Simultaneous Localization And Mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.

Getting started

Stable AppImages

Install viam-cartographer:

  • Linux aarch64:
    sudo curl -o /usr/local/bin/carto_grpc_server http://packages.viam.com/apps/slam-servers/carto_grpc_server-stable-aarch64.AppImage
    sudo chmod a+rx /usr/local/bin/carto_grpc_server
    
  • Linux x86_64:
    sudo curl -o /usr/local/bin/carto_grpc_server http://packages.viam.com/apps/slam-servers/carto_grpc_server-stable-x86_64.AppImage
    sudo chmod a+rx /usr/local/bin/carto_grpc_server
    
  • MacOS/Linux
    brew tap viamrobotics/brews && brew install carto-grpc-server
    

For next steps, see the Run Cartographer SLAM on your Robot with a LIDAR Tutorial.

Development

You can either install the latest AppImages for testing, or build the code from source.

Latest AppImages

You can install the latest AppImages using:

  • Linux aarch64:
    sudo curl -o /usr/local/bin/carto_grpc_server http://packages.viam.com/apps/slam-servers/carto_grpc_server-latest-aarch64.AppImage
    sudo chmod a+rx /usr/local/bin/carto_grpc_server
    
  • Linux x86_64:
    sudo curl -o /usr/local/bin/carto_grpc_server http://packages.viam.com/apps/slam-servers/carto_grpc_server-latest-x86_64.AppImage
    sudo chmod a+rx /usr/local/bin/carto_grpc_server
    
Build from source
Download
git clone --recurse-submodules https://github.com/viamrobotics/viam-cartographer.git

If you happened to use git clone only, you won't see the cartographer folder and will need to fetch it:

git submodule update --init

(Optional) Using Canon Images

If desired, Viam's canon tool can be used to create a docker container to build arm64 or amd64 binaries of the SLAM server. The canon tool can be installed by running the following command:

go install github.com/viamrobotics/canon@latest

And then by running one of the following commands in the viam-cartographer repository to create the container:

canon -arch arm64
canon -arch amd64

These containers are set to persist between sessions via the persistent parameter in the .canon.yaml file located in the root of viam-cartographer. More details regarding the use of Viam's canon tool can be found here.

Setup, build, and run the binary
# Setup the gRPC files
make bufinstall && make buf 
# Install dependencies
make setup
# Build & install the binary
make build
sudo cp viam-cartographer/build/carto_grpc_server /usr/local/bin
# Run the binary
carto_grpc_server
Linting
make lint-setup
make lint
Testing
make test
Working with submodules
Commit and push
  1. Commit and push changes in the cartographer submodule first.
  2. Commit and push changes in the viam-cartographer library last.

Or, alternatively:

  1. Commit changes in the cartographer submodule
  2. Commit changes in the main repo
  3. Push all changes by running git push --recurse-submodules=on-demand
Changing branches in a submodule

When changing branches in a submodule, update .gitmodules, e.g., changing to a branch called kk/fix-install:

...
[submodule "viam-cartographer/cartographer"]
        path = viam-cartographer/cartographer
        url = git@github.com:kkufieta/cartographer.git
        branch=kk/fix-install

Commit & push the changes.

When pulling those changes, run the following:

git pull
git submodule update --init --recursive

License

Copyright 2023 Viam Inc.

Apache 2.0 - See LICENSE file

Documentation

Overview

Package viamcartographer implements simultaneous localization and mapping. This is an Experimental package.

Index

Constants

View Source
const (
	// DefaultExecutableName is what this program expects to call to start the cartographer grpc server.
	DefaultExecutableName = "carto_grpc_server"
)

Variables

View Source
var Model = resource.NewModel("viam", "slam", "cartographer")

Model is the model name of cartographer.

Functions

func New

func New(
	ctx context.Context,
	deps registry.Dependencies,
	config config.Service,
	logger golog.Logger,
	bufferSLAMProcessLogs bool,
	executableName string,
	sensorValidationMaxTimeoutSec int,
	sensorValidationIntervalSec int,
	dialMaxTimeoutSec int,
) (slam.Service, error)

New returns a new slam service for the given robot.

Types

type SubAlgo

type SubAlgo string

SubAlgo defines the cartographer specific sub-algorithms that we support.

const Dim2d SubAlgo = "2d"

Dim2d runs cartographer with a 2D LIDAR only.

Directories

Path Synopsis
internal
dim-2d
Package dim2d implements the 2D sub algorithm
Package dim2d implements the 2D sub algorithm
inject
Package inject is used to mock a slam grpc client.
Package inject is used to mock a slam grpc client.
testhelper
Package testhelper implements a slam service definition with additional exported functions for the purpose of testing.
Package testhelper implements a slam service definition with additional exported functions for the purpose of testing.
Package main is a module with a cartographer SLAM service model.
Package main is a module with a cartographer SLAM service model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL