Coder Social home page Coder Social logo

xcloudplatform / viam-cartographer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from viam-modules/viam-cartographer

0.0 0.0 0.0 526 KB

Cartographer integrated with Viam.

License: Apache License 2.0

Shell 1.13% C++ 51.75% C 19.30% Lua 3.01% Go 20.18% Makefile 0.84% CMake 3.79%

viam-cartographer's Introduction

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/cartographer-module https://storage.googleapis.com/packages.viam.com/apps/slam-servers/cartographer-module-stable-aarch64.AppImage
    sudo chmod a+rx /usr/local/bin/cartographer-module
  • Linux x86_64:
    sudo curl -o /usr/local/bin/cartographer-module https://storage.googleapis.com/packages.viam.com/apps/slam-servers/cartographer-module-stable-x86_64.AppImage
    sudo chmod a+rx /usr/local/bin/cartographer-module
  • MacOS/Linux
    brew tap viamrobotics/brews && brew install cartographer-module

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/cartographer-module https://storage.googleapis.com/packages.viam.com/apps/slam-servers/cartographer-module-latest-aarch64.AppImage
    sudo chmod a+rx /usr/local/bin/cartographer-module
  • Linux x86_64:
    sudo curl -o /usr/local/bin/cartographer-module https://storage.googleapis.com/packages.viam.com/apps/slam-servers/cartographer-module-latest-x86_64.AppImage
    sudo chmod a+rx /usr/local/bin/cartographer-module

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
# Install lua files
make install-lua-files
# Install the cartographer-module binary
make install
# Run the binary
cartographer-module

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 = [email protected]: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

Troubleshooting Build Failures

When building on MacOS and seeing errors related to protobuf such as

Undefined symbols for architecture arm64:
  "google::protobuf::internal::InternalMetadata::~InternalMetadata()", referenced from:
      google::protobuf::MessageLite::~MessageLite() in libviam-cartographer.a(common.pb.cc.o)
      google::protobuf::MessageLite::~MessageLite() in libviam-cartographer.a(slam.pb.cc.o)
      google::protobuf::MessageLite::~MessageLite() in libviam-cartographer.a(http.pb.cc.o)

or

/tmp/cartographer-module-20230421-29152-arkug3/viam-cartographer/../grpc/cpp/gen/google/api/http.pb.h:12:2: error: This file was generated by a newer version of protoc which is
/tmp/cartographer-module-20230421-29152-arkug3/viam-cartographer/../grpc/cpp/gen/google/api/http.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update
/tmp/cartographer-module-20230421-29152-arkug3/viam-cartographer/../grpc/cpp/gen/google/api/http.pb.h:14:2: error: your headers.

Then it possible your brew installation is using the incorrect version of protobuf. To check if you are seeing this issue run

protoc --version

If your version is 3.20.3 then you may be having this error. To fix take the following steps

  1. unlink protobuf@3
brew unlink protobuf@3
  1. link normal protobuf
brew unlink protobuf && brew link protobuf
  1. echo your path & confirm you are not manually pathing to protobuf@3. If you see protobuf@3 in your path, track down where that is being added to your path & remove it (try .zshrc / .bashrc)
echo $PATH
  1. Create a new terminal window to get a clean shell state

  2. Confirm you have a new version installed. The minimum version you should see on your Mac is 3.21.12

protoc --version

License

Copyright 2023 Viam Inc.

Apache 2.0 - See LICENSE file

viam-cartographer's People

Contributors

jeremyrhyde avatar nicksanford avatar kkufieta avatar johnn193 avatar dmhilly avatar kim-mishra avatar eshamaharishi avatar github-actions[bot] avatar tessavitabile avatar zaporter-work avatar

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.