Skip to content

MarineRoboticsGroup/graff_cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graff_cpp

Build Status

Overview

A C++ interface to the Caesar.jl framework using JSON over ZeroMQ. Communication with the Caesar endpoint currently follows a "request-reply" pattern.

Usage

The first step is to establish a connection to the Caesar endpoint, and registering a new session:

  graff::Endpoint ep;
  ep.Connect("tcp://127.0.0.1:5555");

  graff::Robot robot("krakenoid");
  graff::Session session("first dive");

  json reply;
  reply = graff::RegisterRobot(ep, robot);
  reply = graff::RegisterSession(ep, robot, session);

Syntax is similar to that of other libraries, such as isam, using dumb/shallow variables such as graff::Variable, graff::Factor, and graff::Distribution (or one of its derived types, such as graff::Normal):

  for (int i = 0; i < 6; ++i) {
    std::string idx = "x" + std::to_string(i);
    graff::Variable pose(idx, "Pose2");
    reply = graff::AddVariable(ep, session, pose);

    if (i > 0) {
      std::string prev_idx = "x" + std::to_string(i - 1);
      std::vector<double> mu = {10.0, 0.0, PI / 3.0};
      std::vector<double> sig = {0.01, 0.0, 0.0, 0.0, 0.01,
                                 0.0,  0.0, 0.0, 0.01};
      graff::Normal z(mu, sig);
      std::vector<std::string> nodes = {prev_idx, idx};
      graff::Factor odometry("Pose2Pose2", nodes, z);
      reply = graff::AddFactor(ep, session, odometry);
    }
  }

As an additional step, you must specify when the graph is ready to be solved:

The endpoint can then be queried for estimates:

Installation

Dependencies

  • ZeroMQ - can be obtained using your package manager via sudo apt install libzmq3-dev
  • Niels Lohmann's JSON library - taken care of by the configure.sh script
  • C++11 (gcc 4.9+ or clang 3.5+)
  • build-essential
  • cmake (3.0.2+)

Build

From the repository root:

./configure.sh 
mkdir build
cd build
cmake ..
make

Test

Head over to Caesar.jl and follow its setup instructions. Once complete, run graff_server.py - this will be your local proxy to the back-end.

Once the local proxy is running, try running the test application:

./build/bin/caesar_hexagonal

Integration

TODO

Releases

TODO

Contribute

Contributions to this interface are welcome! Please fork this repository, add the desired functionality, and submit a pull request.

About

A C++ interface to the Caesar.jl framework using JSON over ZeroMQ.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •