Kaya代码解析

作者: YottaYuan | 来源:发表于2020-04-04 17:33 被阅读0次

    kaya_hardware.subgraph.json文件

    此文件解析了kaya机器人硬件相关的细节

    "modules": [
        "dynamixel",
        "imu",
        "kaya",
        "realsense",
        "viewers"
      ],
    

    kaya_base

    "kaya_base": {
          "holonomic_to_wheels": {
            "max_linear_speed": 0.5,
            "max_angular_speed": 2.0
          }
        },
    
    {
            "name": "kaya_base",
            "components": [
              {
                "name": "message_ledger",
                "type": "isaac::alice::MessageLedger"
              },
              {
                "name": "holonomic_to_wheels",
                "type": "isaac::kaya::KayaBaseDriver"
              }
            ]
          },
    

    dynamixels

    {
            "name": "dynamixels",
            "components": [
              {
                "name": "message_ledger",
                "type": "isaac::alice::MessageLedger"
              },
              {
                "name": "driver",
                "type": "isaac::dynamixel::DynamixelDriver"
              },
              {
                "name": "isaac.alice.Failsafe",
                "type": "isaac::alice::Failsafe"
              }
            ]
          },
    

    与dynamixels交互

        {
          "source": "subgraph/interface/base_command",
            "target": "kaya_base/holonomic_to_wheels/base_command"
          },
          {
            "source": "kaya_base/holonomic_to_wheels/base_state",
            "target": "subgraph/interface/base_state"
          },
          {
            "source": "dynamixels/driver/state",
            "target": "kaya_base/holonomic_to_wheels/wheel_state"
          },
          {
            "source": "kaya_base/holonomic_to_wheels/wheel_command",
            "target": "dynamixels/driver/command"
          },
    

    isaac::alice::Subgraph

    //engine/alice/components/Subgraph.hpp

    #pragma once
    
    #include "engine/alice/component.hpp"
    
    namespace isaac {
    namespace alice {
    
    // Creates interface for a subgraph.
    // Subgraphs JSON files are modular and meaningful collections of nodes, edges, and configurations
    // that are ready to be plugged-in when creating application JSON files. For ease of use, each
    // subgraph has an interface node of isaac::alice::Subgraph type registered here. Interface node
    // receives and transmits messages for the other nodes of the subgraph, so that an application
    // using this subgraph can edge with the interface node instead of directly communicating with other
    // nodes within the subgraph. In the future, in addition to message passing, interface nodes will
    // 1. read parameters set by user and map them to other components in the subgraph,
    // 2. pass handles to the behavior trees within the subgraph,
    // 3. sync poses between inside and outside the subgraph.
    class Subgraph : public Component {};
    
    }  // namespace alice
    }  // namespace isaac
    
    ISAAC_ALICE_REGISTER_COMPONENT(isaac::alice::Subgraph)
    

    DynamixelDriver.hpp

    packages/dynamixel/components/dynamixelDriver.hpp

    电机和主板通过StateProto进行通信。

      // The desired angular speeds for each motor
      ISAAC_PROTO_RX(StateProto, command);
      // The measured angular speeds for each motor
      ISAAC_PROTO_TX(StateProto, state);
    

    state.capnp.h

    /home/nvidia/.cache/bazel/_bazel_nvidia/16b182569cf02a0dcbe9eb1e7674905b/execroot/com_nvidia_isaac/bazel-out/k8-opt/genfiles/messages/state.capnp.h

    // Generated by Cap'n Proto compiler, DO NOT EDIT
    // source: state.capnp
    
    #pragma once
    
    #include <capnp/generated-header-support.h>
    #include <kj/windows-sanity.h>
    
    #if CAPNP_VERSION != 7000
    #error "Version mismatch between generated code and library headers.  You must use the same version of the Cap'n Proto compiler and library."
    #endif
    
    #include "tensor.capnp.h"
    
    namespace capnp {
    namespace schemas {
    
    CAPNP_DECLARE_SCHEMA(b6e133a2596fcbc4);
    
    }  // namespace schemas
    }  // namespace capnp
    
    
    struct StateProto {
      StateProto() = delete;
    
      class Reader;
      class Builder;
      class Pipeline;
    
      struct _capnpPrivate {
        CAPNP_DECLARE_STRUCT_HEADER(b6e133a2596fcbc4, 0, 3)
        #if !CAPNP_LITE
        static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; }
        #endif  // !CAPNP_LITE
      };
    };
    
    // =======================================================================================
    
    class StateProto::Reader {
    public:
      typedef StateProto Reads;
    
      Reader() = default;
      inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}
    
      inline ::capnp::MessageSize totalSize() const {
        return _reader.totalSize().asPublic();
      }
    
    #if !CAPNP_LITE
      inline ::kj::StringTree toString() const {
        return ::capnp::_::structString(_reader, *_capnpPrivate::brand());
      }
    #endif  // !CAPNP_LITE
    
      inline bool hasPack() const;
      inline  ::TensorProto::Reader getPack() const;
    
      inline bool hasSchema() const;
      inline  ::capnp::Text::Reader getSchema() const;
    
      inline bool hasData() const;
      inline  ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>::Reader getData() const;
    
    private:
      ::capnp::_::StructReader _reader;
      template <typename, ::capnp::Kind>
      friend struct ::capnp::ToDynamic_;
      template <typename, ::capnp::Kind>
      friend struct ::capnp::_::PointerHelpers;
      template <typename, ::capnp::Kind>
      friend struct ::capnp::List;
      friend class ::capnp::MessageBuilder;
      friend class ::capnp::Orphanage;
    };
    
    class StateProto::Builder {
    public:
      typedef StateProto Builds;
    
      Builder() = delete;  // Deleted to discourage incorrect usage.
                           // You can explicitly initialize to nullptr instead.
      inline Builder(decltype(nullptr)) {}
      inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
      inline operator Reader() const { return Reader(_builder.asReader()); }
      inline Reader asReader() const { return *this; }
    
      inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); }
    #if !CAPNP_LITE
      inline ::kj::StringTree toString() const { return asReader().toString(); }
    #endif  // !CAPNP_LITE
    
      inline bool hasPack();
      inline  ::TensorProto::Builder getPack();
      inline void setPack( ::TensorProto::Reader value);
      inline  ::TensorProto::Builder initPack();
      inline void adoptPack(::capnp::Orphan< ::TensorProto>&& value);
      inline ::capnp::Orphan< ::TensorProto> disownPack();
    
      inline bool hasSchema();
      inline  ::capnp::Text::Builder getSchema();
      inline void setSchema( ::capnp::Text::Reader value);
      inline  ::capnp::Text::Builder initSchema(unsigned int size);
      inline void adoptSchema(::capnp::Orphan< ::capnp::Text>&& value);
      inline ::capnp::Orphan< ::capnp::Text> disownSchema();
    
      inline bool hasData();
      inline  ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>::Builder getData();
      inline void setData( ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>::Reader value);
      inline void setData(::kj::ArrayPtr<const double> value);
      inline  ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>::Builder initData(unsigned int size);
      inline void adoptData(::capnp::Orphan< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>>&& value);
      inline ::capnp::Orphan< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>> disownData();
    
    private:
      ::capnp::_::StructBuilder _builder;
      template <typename, ::capnp::Kind>
      friend struct ::capnp::ToDynamic_;
      friend class ::capnp::Orphanage;
      template <typename, ::capnp::Kind>
      friend struct ::capnp::_::PointerHelpers;
    };
    
    #if !CAPNP_LITE
    class StateProto::Pipeline {
    public:
      typedef StateProto Pipelines;
    
      inline Pipeline(decltype(nullptr)): _typeless(nullptr) {}
      inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless)
          : _typeless(kj::mv(typeless)) {}
    
      inline  ::TensorProto::Pipeline getPack();
    private:
      ::capnp::AnyPointer::Pipeline _typeless;
      friend class ::capnp::PipelineHook;
      template <typename, ::capnp::Kind>
      friend struct ::capnp::ToDynamic_;
    };
    #endif  // !CAPNP_LITE
    
    // =======================================================================================
    
    inline bool StateProto::Reader::hasPack() const {
      return !_reader.getPointerField(
          ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
    }
    inline bool StateProto::Builder::hasPack() {
      return !_builder.getPointerField(
          ::capnp::bounded<0>() * ::capnp::POINTERS).isNull();
    }
    inline  ::TensorProto::Reader StateProto::Reader::getPack() const {
      return ::capnp::_::PointerHelpers< ::TensorProto>::get(_reader.getPointerField(
          ::capnp::bounded<0>() * ::capnp::POINTERS));
    }
    inline  ::TensorProto::Builder StateProto::Builder::getPack() {
      return ::capnp::_::PointerHelpers< ::TensorProto>::get(_builder.getPointerField(
          ::capnp::bounded<0>() * ::capnp::POINTERS));
    }
    #if !CAPNP_LITE
    inline  ::TensorProto::Pipeline StateProto::Pipeline::getPack() {
      return  ::TensorProto::Pipeline(_typeless.getPointerField(0));
    }
    #endif  // !CAPNP_LITE
    inline void StateProto::Builder::setPack( ::TensorProto::Reader value) {
      ::capnp::_::PointerHelpers< ::TensorProto>::set(_builder.getPointerField(
          ::capnp::bounded<0>() * ::capnp::POINTERS), value);
    }
    inline  ::TensorProto::Builder StateProto::Builder::initPack() {
      return ::capnp::_::PointerHelpers< ::TensorProto>::init(_builder.getPointerField(
          ::capnp::bounded<0>() * ::capnp::POINTERS));
    }
    inline void StateProto::Builder::adoptPack(
        ::capnp::Orphan< ::TensorProto>&& value) {
      ::capnp::_::PointerHelpers< ::TensorProto>::adopt(_builder.getPointerField(
          ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value));
    }
    inline ::capnp::Orphan< ::TensorProto> StateProto::Builder::disownPack() {
      return ::capnp::_::PointerHelpers< ::TensorProto>::disown(_builder.getPointerField(
          ::capnp::bounded<0>() * ::capnp::POINTERS));
    }
    
    inline bool StateProto::Reader::hasSchema() const {
      return !_reader.getPointerField(
          ::capnp::bounded<1>() * ::capnp::POINTERS).isNull();
    }
    inline bool StateProto::Builder::hasSchema() {
      return !_builder.getPointerField(
          ::capnp::bounded<1>() * ::capnp::POINTERS).isNull();
    }
    inline  ::capnp::Text::Reader StateProto::Reader::getSchema() const {
      return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_reader.getPointerField(
          ::capnp::bounded<1>() * ::capnp::POINTERS));
    }
    inline  ::capnp::Text::Builder StateProto::Builder::getSchema() {
      return ::capnp::_::PointerHelpers< ::capnp::Text>::get(_builder.getPointerField(
          ::capnp::bounded<1>() * ::capnp::POINTERS));
    }
    inline void StateProto::Builder::setSchema( ::capnp::Text::Reader value) {
      ::capnp::_::PointerHelpers< ::capnp::Text>::set(_builder.getPointerField(
          ::capnp::bounded<1>() * ::capnp::POINTERS), value);
    }
    inline  ::capnp::Text::Builder StateProto::Builder::initSchema(unsigned int size) {
      return ::capnp::_::PointerHelpers< ::capnp::Text>::init(_builder.getPointerField(
          ::capnp::bounded<1>() * ::capnp::POINTERS), size);
    }
    inline void StateProto::Builder::adoptSchema(
        ::capnp::Orphan< ::capnp::Text>&& value) {
      ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(_builder.getPointerField(
          ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value));
    }
    inline ::capnp::Orphan< ::capnp::Text> StateProto::Builder::disownSchema() {
      return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(_builder.getPointerField(
          ::capnp::bounded<1>() * ::capnp::POINTERS));
    }
    
    inline bool StateProto::Reader::hasData() const {
      return !_reader.getPointerField(
          ::capnp::bounded<2>() * ::capnp::POINTERS).isNull();
    }
    inline bool StateProto::Builder::hasData() {
      return !_builder.getPointerField(
          ::capnp::bounded<2>() * ::capnp::POINTERS).isNull();
    }
    inline  ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>::Reader StateProto::Reader::getData() const {
      return ::capnp::_::PointerHelpers< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>>::get(_reader.getPointerField(
          ::capnp::bounded<2>() * ::capnp::POINTERS));
    }
    inline  ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>::Builder StateProto::Builder::getData() {
      return ::capnp::_::PointerHelpers< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>>::get(_builder.getPointerField(
          ::capnp::bounded<2>() * ::capnp::POINTERS));
    }
    inline void StateProto::Builder::setData( ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>::Reader value) {
      ::capnp::_::PointerHelpers< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>>::set(_builder.getPointerField(
          ::capnp::bounded<2>() * ::capnp::POINTERS), value);
    }
    inline void StateProto::Builder::setData(::kj::ArrayPtr<const double> value) {
      ::capnp::_::PointerHelpers< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>>::set(_builder.getPointerField(
          ::capnp::bounded<2>() * ::capnp::POINTERS), value);
    }
    inline  ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>::Builder StateProto::Builder::initData(unsigned int size) {
      return ::capnp::_::PointerHelpers< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>>::init(_builder.getPointerField(
          ::capnp::bounded<2>() * ::capnp::POINTERS), size);
    }
    inline void StateProto::Builder::adoptData(
        ::capnp::Orphan< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>>&& value) {
      ::capnp::_::PointerHelpers< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>>::adopt(_builder.getPointerField(
          ::capnp::bounded<2>() * ::capnp::POINTERS), kj::mv(value));
    }
    inline ::capnp::Orphan< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>> StateProto::Builder::disownData() {
      return ::capnp::_::PointerHelpers< ::capnp::List<double,  ::capnp::Kind::PRIMITIVE>>::disown(_builder.getPointerField(
          ::capnp::bounded<2>() * ::capnp::POINTERS));
    }
    

    state.capnp.c++

    /home/nvidia/.cache/bazel/_bazel_nvidia/16b182569cf02a0dcbe9eb1e7674905b/execroot/com_nvidia_isaac/bazel-out/k8-opt/genfiles/messages/state.capnp.c++

    // Generated by Cap'n Proto compiler, DO NOT EDIT
    // source: state.capnp
    
    #include "state.capnp.h"
    
    namespace capnp {
    namespace schemas {
    static const ::capnp::_::AlignedData<67> b_b6e133a2596fcbc4 = {
      {   0,   0,   0,   0,   5,   0,   6,   0,
        196, 203, 111,  89, 162,  51, 225, 182,
         21,   0,   0,   0,   1,   0,   0,   0,
         26, 192, 108,   8, 143, 192, 242, 128,
          3,   0,   7,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         21,   0,   0,   0,   2,   1,   0,   0,
         33,   0,   0,   0,   7,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         29,   0,   0,   0, 175,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
        109, 101, 115, 115,  97, 103, 101, 115,
         47, 115, 116,  97, 116, 101,  46,  99,
         97, 112, 110, 112,  58,  83, 116,  97,
        116, 101,  80, 114, 111, 116, 111,   0,
          0,   0,   0,   0,   1,   0,   1,   0,
         12,   0,   0,   0,   3,   0,   4,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   1,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         69,   0,   0,   0,  42,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         64,   0,   0,   0,   3,   0,   1,   0,
         76,   0,   0,   0,   2,   0,   1,   0,
          1,   0,   0,   0,   1,   0,   0,   0,
          0,   0,   1,   0,   1,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         73,   0,   0,   0,  58,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         68,   0,   0,   0,   3,   0,   1,   0,
         80,   0,   0,   0,   2,   0,   1,   0,
          2,   0,   0,   0,   2,   0,   0,   0,
          0,   0,   1,   0,   2,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         77,   0,   0,   0,  42,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         72,   0,   0,   0,   3,   0,   1,   0,
        100,   0,   0,   0,   2,   0,   1,   0,
        112,  97,  99, 107,   0,   0,   0,   0,
         16,   0,   0,   0,   0,   0,   0,   0,
        237, 156, 174,  53, 228, 229, 223, 206,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         16,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
        115,  99, 104, 101, 109,  97,   0,   0,
         12,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         12,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
        100,  97, 116,  97,   0,   0,   0,   0,
         14,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   3,   0,   1,   0,
         11,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
         14,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0, }
    };
    ::capnp::word const* const bp_b6e133a2596fcbc4 = b_b6e133a2596fcbc4.words;
    #if !CAPNP_LITE
    static const ::capnp::_::RawSchema* const d_b6e133a2596fcbc4[] = {
      &s_cedfe5e435ae9ced,
    };
    static const uint16_t m_b6e133a2596fcbc4[] = {2, 0, 1};
    static const uint16_t i_b6e133a2596fcbc4[] = {0, 1, 2};
    const ::capnp::_::RawSchema s_b6e133a2596fcbc4 = {
      0xb6e133a2596fcbc4, b_b6e133a2596fcbc4.words, 67, d_b6e133a2596fcbc4, m_b6e133a2596fcbc4,
      1, 3, i_b6e133a2596fcbc4, nullptr, nullptr, { &s_b6e133a2596fcbc4, nullptr, nullptr, 0, 0, nullptr }
    };
    #endif  // !CAPNP_LITE
    }  // namespace schemas
    }  // namespace capnp
    
    // =======================================================================================
    
    
    // StateProto
    constexpr uint16_t StateProto::_capnpPrivate::dataWordSize;
    constexpr uint16_t StateProto::_capnpPrivate::pointerCount;
    #if !CAPNP_LITE
    constexpr ::capnp::Kind StateProto::_capnpPrivate::kind;
    constexpr ::capnp::_::RawSchema const* StateProto::_capnpPrivate::schema;
    #endif  // !CAPNP_LITE
    

    相关文章

      网友评论

        本文标题:Kaya代码解析

        本文链接:https://www.haomeiwen.com/subject/zeggdhtx.html