xviz icon indicating copy to clipboard operation
xviz copied to clipboard

Initial Cpp Implementation of XVIZ Protocol

Open mjxu96 opened this issue 4 years ago • 13 comments

Hi team,

This is my cpp implementation of XVIZ protocol wx9698/xviz. I have used it in my project CarlaViz. This version has implemented most builders and a simple server. This implementation is inspired by the Python version but realizes some functionalities that Python version did not include like UI builders and the binary version of XVIZ protocol. Also, it contains some tests and examples. I hope this can help the open source autonomous driving community before I leave the university.

Here are some concerns about this implementation:

  1. I use some open source codes in this implementation and they are all from Github public repos. Apart from these open source codes, all other codes written by myself are in MIT license. Please let me know if there are any copyright concerns before merging into this repo.
  2. Users need to be careful before using it because some semantics like move/copy operations in cpp are different from js/python.
  3. This implementation needs more tests.

mjxu96 avatar May 16 '20 00:05 mjxu96

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 16 '20 00:05 CLAassistant

This is really cool, thanks for the contribution! I definitely think we should merge this, but since it's large will take a bit for me to review.

Two things first:

  • Is there another way we can include the third party code vs. vendoring it into the repo here? Could we use Conan?

  • Would you be willing to contribute some configuration to our CI system so we could keep this working? And a clang-format configuration to keep the code consistent?

jlisee avatar May 21 '20 13:05 jlisee

This is very exciting! Just providing some quick "drive-by" comments:

  • Is there another way we can include the third party code vs. vendoring it into the repo here? Could we use Conan?
  • Would you be willing to contribute some configuration to our CI system so we could keep this working? And a clang-format configuration to keep the code consistent?

For what it's worth C++ is being introduced in other vis.gl frameworks (While not strictly a part of vis.gl, XVIZ is "related" to the vis.gl frameworks, in particular through streetscape.gl):

We are working on a C++ port of deck.gl and we recently made progress on a lot of these issues ("sophisticated" cmake build setups, clang-format and cpplint integration, vcpkg deps handling etc).

If interested, feel free to poke around deck.gl-native (this is currently an Unfolded repo but the intention is to transfer this repo to UCF/vis.gl once it matures).

Also we got a bunch of initial inspiration from the excellent H3 build setup.

This is not decided, but current thinking is for multi-language repos we will go with one root folder per language js, cpp, ... like Apache Arrow does.

ibgreen avatar May 21 '20 14:05 ibgreen

Sure. I will check Conan to see whether I can use it in this repo. And I will add some CI/CD configurations in the repo along with clang-format. Thank you.

mjxu96 avatar May 21 '20 17:05 mjxu96

Hi,

I have updated this PR. There are three major changes compared to the previous one:

  1. The library is updated to the latest version.
  2. I use vcpkg to manage third party libraries. Although I try to completely use vcpkg to manage all libraries, there are two libraries, which are not included in vcpkg, left in this repo. The first one is a macro logging library which is under the MIT license. The second one is the gltf library under the MIT license, in which I modified some codes to generate XVIZ binary protocol. These two libraries are all header-only libraries.
  3. The .clang-format file is provided to format all files.

mjxu96 avatar Jul 29 '20 14:07 mjxu96

I'll review this later this evening and try to move this forward. Thanks @wx9698

twojtasz avatar Jul 29 '20 19:07 twojtasz

Hi,

I updated this library again. Now vcpkg will need to download all libraries including protobuf and gtest. All proto files will be generated automatically during the building process. Currently I will set the cmake version >= 3.14 because of a problem caused by the latest cmake problem in protobuf. And I will lower the cmake version requirement as soon as the problem is resolved.

Gltf library has been removed in favor of the protobuf protocol.

mjxu96 avatar Jul 31 '20 16:07 mjxu96

@wx9698 let me check on the protobuf for decl UI.

twojtasz avatar Aug 04 '20 16:08 twojtasz

@wx9698 for the declarative ui protobuf definitions, it is in the Metadata message, and the ui_config is actual a Protobuf struct

https://github.com/uber/xviz/blob/master/xviz/v2/session.proto#L189

This means it is under specified relative to the other messages and this was important at the time. I don't know how this affects the generation, but I'd assume there must be some Python object => Protobuf Struct path.

twojtasz avatar Aug 05 '20 20:08 twojtasz

Yes, I see the implementation in the python code and has moved it in my cpp version. Please review the code and see if we can move forward.

mjxu96 avatar Aug 05 '20 23:08 mjxu96

@wx9698 sorry i've been behind on this. I am starting a new job. I will try to get to this ASAP and let you know. I dont' want it to go past September so I'll try hard to make time

twojtasz avatar Aug 27 '20 17:08 twojtasz

@twojtasz Never mind. Just take your time.

mjxu96 avatar Aug 28 '20 12:08 mjxu96

Have you forgotten about it? 😅 This is a cool thing, it would be nice to do a review to the end and merge

nuttert avatar Dec 08 '20 02:12 nuttert