diff --git a/Go2Py/idl/Imu.idl b/Go2Py/idl/Imu.idl new file mode 100644 index 0000000..e502d2e --- /dev/null +++ b/Go2Py/idl/Imu.idl @@ -0,0 +1,9 @@ +module msgs{ + struct Imu { + float q[4]; + float gyro[3]; + float accel[3]; + float rpy[3]; + octet tmp; + }; +}; \ No newline at end of file diff --git a/Go2Py/idl/LowCmd.idl b/Go2Py/idl/LowCmd.idl new file mode 100644 index 0000000..3c7e593 --- /dev/null +++ b/Go2Py/idl/LowCmd.idl @@ -0,0 +1,10 @@ +module msgs{ + struct LowCmd { + float q[12]; + float dq[12]; + float tau_ff[12]; + float kp[12]; + float kv[12]; + octet e_stop; + }; +}; \ No newline at end of file diff --git a/Go2Py/idl/LowState.idl b/Go2Py/idl/LowState.idl new file mode 100644 index 0000000..1fd2377 --- /dev/null +++ b/Go2Py/idl/LowState.idl @@ -0,0 +1,12 @@ +module msgs{ + struct LowState { + float q[12]; + float dq[12]; + float ddq[12]; + float tau_est[12]; + float tmp[12]; + float contact[4]; + float voltage; + float current; + }; +}; \ No newline at end of file diff --git a/Go2Py/idl/libcycloneddsidlcxx.so.0.10.2 b/Go2Py/idl/libcycloneddsidlcxx.so.0.10.2 new file mode 100755 index 0000000..267b6aa Binary files /dev/null and b/Go2Py/idl/libcycloneddsidlcxx.so.0.10.2 differ diff --git a/Go2Py/make_msgs.sh b/Go2Py/make_msgs.sh new file mode 100755 index 0000000..8e1ce0f --- /dev/null +++ b/Go2Py/make_msgs.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +GREEN='\033[0;32m' +NC='\033[0m' # No Color + +echo -e "${GREEN} Starting IDL type generation...${NC}" +# Clean +rm -r msgs +# Make +for file in idl/*.idl +do + echo "Processing $file file..." + idlc -l py $file +done +mkdir msgs/cpp +cd msgs/cpp +for file in ../../idl/*.idl +do + echo "Processing $file file..." + idlc -l ../../idl/libcycloneddsidlcxx.so.0.10.2 $file +done +echo -e "${GREEN} Done with LCM type generation${NC}" \ No newline at end of file diff --git a/Go2Py/msgs/.idlpy_manifest b/Go2Py/msgs/.idlpy_manifest new file mode 100644 index 0000000..8ffd2a6 --- /dev/null +++ b/Go2Py/msgs/.idlpy_manifest @@ -0,0 +1,11 @@ +Imu + +Imu + +LowCmd + +LowCmd + +LowState + +LowState diff --git a/Go2Py/msgs/_Imu.py b/Go2Py/msgs/_Imu.py new file mode 100644 index 0000000..231946a --- /dev/null +++ b/Go2Py/msgs/_Imu.py @@ -0,0 +1,31 @@ +""" + Generated by Eclipse Cyclone DDS idlc Python Backend + Cyclone DDS IDL version: v0.11.0 + Module: msgs + IDL file: Imu.idl + +""" + +from enum import auto +from typing import TYPE_CHECKING, Optional +from dataclasses import dataclass + +import cyclonedds.idl as idl +import cyclonedds.idl.annotations as annotate +import cyclonedds.idl.types as types + +# root module import for resolving types +import msgs + + +@dataclass +@annotate.final +@annotate.autoid("sequential") +class Imu(idl.IdlStruct, typename="msgs.Imu"): + q: types.array[types.float32, 4] + gyro: types.array[types.float32, 3] + accel: types.array[types.float32, 3] + rpy: types.array[types.float32, 3] + tmp: types.uint8 + + diff --git a/Go2Py/msgs/_LowCmd.py b/Go2Py/msgs/_LowCmd.py new file mode 100644 index 0000000..777fb93 --- /dev/null +++ b/Go2Py/msgs/_LowCmd.py @@ -0,0 +1,32 @@ +""" + Generated by Eclipse Cyclone DDS idlc Python Backend + Cyclone DDS IDL version: v0.11.0 + Module: msgs + IDL file: LowCmd.idl + +""" + +from enum import auto +from typing import TYPE_CHECKING, Optional +from dataclasses import dataclass + +import cyclonedds.idl as idl +import cyclonedds.idl.annotations as annotate +import cyclonedds.idl.types as types + +# root module import for resolving types +import msgs + + +@dataclass +@annotate.final +@annotate.autoid("sequential") +class LowCmd(idl.IdlStruct, typename="msgs.LowCmd"): + q: types.array[types.float32, 12] + dq: types.array[types.float32, 12] + tau_ff: types.array[types.float32, 12] + kp: types.array[types.float32, 12] + kv: types.array[types.float32, 12] + e_stop: types.uint8 + + diff --git a/Go2Py/msgs/_LowState.py b/Go2Py/msgs/_LowState.py new file mode 100644 index 0000000..8856e56 --- /dev/null +++ b/Go2Py/msgs/_LowState.py @@ -0,0 +1,34 @@ +""" + Generated by Eclipse Cyclone DDS idlc Python Backend + Cyclone DDS IDL version: v0.11.0 + Module: msgs + IDL file: LowState.idl + +""" + +from enum import auto +from typing import TYPE_CHECKING, Optional +from dataclasses import dataclass + +import cyclonedds.idl as idl +import cyclonedds.idl.annotations as annotate +import cyclonedds.idl.types as types + +# root module import for resolving types +import msgs + + +@dataclass +@annotate.final +@annotate.autoid("sequential") +class LowState(idl.IdlStruct, typename="msgs.LowState"): + q: types.array[types.float32, 12] + dq: types.array[types.float32, 12] + ddq: types.array[types.float32, 12] + tau_est: types.array[types.float32, 12] + tmp: types.array[types.float32, 12] + contact: types.array[types.float32, 4] + voltage: types.float32 + current: types.float32 + + diff --git a/Go2Py/msgs/__init__.py b/Go2Py/msgs/__init__.py new file mode 100644 index 0000000..5a541f5 --- /dev/null +++ b/Go2Py/msgs/__init__.py @@ -0,0 +1,11 @@ +""" + Generated by Eclipse Cyclone DDS idlc Python Backend + Cyclone DDS IDL version: v0.11.0 + Module: msgs + +""" + +from ._Imu import Imu +from ._LowCmd import LowCmd +from ._LowState import LowState +__all__ = ["Imu", "LowCmd", "LowState", ] diff --git a/Go2Py/msgs/cpp/Imu.cpp b/Go2Py/msgs/cpp/Imu.cpp new file mode 100644 index 0000000..a5e6abd --- /dev/null +++ b/Go2Py/msgs/cpp/Imu.cpp @@ -0,0 +1,57 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Imu.idl + Source: Imu.cpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#include "Imu.hpp" + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::msgs::Imu>() { + static thread_local std::mutex mtx; + static thread_local propvec props; + static thread_local entity_properties_t *props_end = nullptr; + static thread_local std::atomic_bool initialized {false}; + key_endpoint keylist; + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + std::lock_guard lock(mtx); + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + props.clear(); + + props.push_back(entity_properties_t(0, 0, false, bb_unset, extensibility::ext_final)); //root + props.push_back(entity_properties_t(1, 0, false, get_bit_bound(), extensibility::ext_final, false)); //::q + props.push_back(entity_properties_t(1, 1, false, get_bit_bound(), extensibility::ext_final, false)); //::gyro + props.push_back(entity_properties_t(1, 2, false, get_bit_bound(), extensibility::ext_final, false)); //::accel + props.push_back(entity_properties_t(1, 3, false, get_bit_bound(), extensibility::ext_final, false)); //::rpy + props.push_back(entity_properties_t(1, 4, false, get_bit_bound(), extensibility::ext_final, false)); //::tmp + + entity_properties_t::finish(props, keylist); + props_end = props.data() + props.size(); + initialized.store(true, std::memory_order_release); + return props; +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + diff --git a/Go2Py/msgs/cpp/Imu.hpp b/Go2Py/msgs/cpp/Imu.hpp new file mode 100644 index 0000000..7ea97ff --- /dev/null +++ b/Go2Py/msgs/cpp/Imu.hpp @@ -0,0 +1,491 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Imu.idl + Source: Imu.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_IMU_HPP +#define DDSCXX_IMU_HPP + +#include +#include + +namespace msgs +{ +class Imu +{ +private: + std::array q_ = { }; + std::array gyro_ = { }; + std::array accel_ = { }; + std::array rpy_ = { }; + uint8_t tmp_ = 0; + +public: + Imu() = default; + + explicit Imu( + const std::array& q, + const std::array& gyro, + const std::array& accel, + const std::array& rpy, + uint8_t tmp) : + q_(q), + gyro_(gyro), + accel_(accel), + rpy_(rpy), + tmp_(tmp) { } + + const std::array& q() const { return this->q_; } + std::array& q() { return this->q_; } + void q(const std::array& _val_) { this->q_ = _val_; } + void q(std::array&& _val_) { this->q_ = _val_; } + const std::array& gyro() const { return this->gyro_; } + std::array& gyro() { return this->gyro_; } + void gyro(const std::array& _val_) { this->gyro_ = _val_; } + void gyro(std::array&& _val_) { this->gyro_ = _val_; } + const std::array& accel() const { return this->accel_; } + std::array& accel() { return this->accel_; } + void accel(const std::array& _val_) { this->accel_ = _val_; } + void accel(std::array&& _val_) { this->accel_ = _val_; } + const std::array& rpy() const { return this->rpy_; } + std::array& rpy() { return this->rpy_; } + void rpy(const std::array& _val_) { this->rpy_ = _val_; } + void rpy(std::array&& _val_) { this->rpy_ = _val_; } + uint8_t tmp() const { return this->tmp_; } + uint8_t& tmp() { return this->tmp_; } + void tmp(uint8_t _val_) { this->tmp_ = _val_; } + + bool operator==(const Imu& _other) const + { + (void) _other; + return q_ == _other.q_ && + gyro_ == _other.gyro_ && + accel_ == _other.accel_ && + rpy_ == _other.rpy_ && + tmp_ == _other.tmp_; + } + + bool operator!=(const Imu& _other) const + { + return !(*this == _other); + } + +}; + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::msgs::Imu>::getTypeName() +{ + return "msgs::Imu"; +} + +template <> constexpr bool TopicTraits<::msgs::Imu>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::msgs::Imu>::type_map_blob_sz() { return 442; } +template<> constexpr unsigned int TopicTraits<::msgs::Imu>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::msgs::Imu>::type_map_blob() { + static const uint8_t blob[] = { + 0xab, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xab, 0x8a, 0x74, 0xa0, 0x59, 0x30, 0x63, + 0x7f, 0xb3, 0x36, 0xe0, 0x64, 0x6f, 0xd3, 0x00, 0x93, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x41, 0xe1, 0xdb, 0x58, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x98, 0x30, + 0x99, 0x65, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0xb0, 0x7d, 0x92, 0xed, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xfa, 0x81, 0x6e, 0xdb, 0x00, + 0xde, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xa1, 0x90, 0x68, 0x0b, 0xcf, 0x24, 0x8c, + 0xb4, 0x1b, 0xaa, 0x07, 0x8f, 0xf4, 0x93, 0x00, 0xc6, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x6d, 0x73, 0x67, 0x73, + 0x3a, 0x3a, 0x49, 0x6d, 0x75, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x67, 0x79, 0x72, 0x6f, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x61, 0x63, 0x63, 0x65, 0x6c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x72, 0x70, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x74, 0x6d, 0x70, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xa1, 0x90, 0x68, + 0x0b, 0xcf, 0x24, 0x8c, 0xb4, 0x1b, 0xaa, 0x07, 0x8f, 0xf4, 0x93, 0xf1, 0xab, 0x8a, 0x74, 0xa0, + 0x59, 0x30, 0x63, 0x7f, 0xb3, 0x36, 0xe0, 0x64, 0x6f, 0xd3, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::msgs::Imu>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xab, 0x8a, 0x74, 0xa0, 0x59, 0x30, 0x63, 0x7f, 0xb3, 0x36, 0xe0, + 0x64, 0x6f, 0xd3, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xa1, 0x90, 0x68, 0x0b, 0xcf, 0x24, 0x8c, 0xb4, 0x1b, 0xaa, 0x07, + 0x8f, 0xf4, 0x93, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::msgs::Imu> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::msgs::Imu>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::msgs::Imu) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::msgs::Imu>(); + +template::value, bool> = true > +bool write(T& streamer, const ::msgs::Imu& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.gyro()[0], instance.gyro().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.accel()[0], instance.accel().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tmp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::msgs::Imu& instance, bool as_key) { + auto &props = get_type_props<::msgs::Imu>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::msgs::Imu& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.gyro()[0], instance.gyro().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.accel()[0], instance.accel().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tmp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::msgs::Imu& instance, bool as_key) { + auto &props = get_type_props<::msgs::Imu>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::msgs::Imu& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.gyro()[0], instance.gyro().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.accel()[0], instance.accel().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tmp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::msgs::Imu& instance, bool as_key) { + auto &props = get_type_props<::msgs::Imu>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::msgs::Imu& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.gyro()[0], instance.gyro().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.accel()[0], instance.accel().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tmp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::msgs::Imu& instance, bool as_key) { + auto &props = get_type_props<::msgs::Imu>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_IMU_HPP diff --git a/Go2Py/msgs/cpp/LowCmd.cpp b/Go2Py/msgs/cpp/LowCmd.cpp new file mode 100644 index 0000000..cda0954 --- /dev/null +++ b/Go2Py/msgs/cpp/LowCmd.cpp @@ -0,0 +1,58 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: LowCmd.idl + Source: LowCmd.cpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#include "LowCmd.hpp" + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::msgs::LowCmd>() { + static thread_local std::mutex mtx; + static thread_local propvec props; + static thread_local entity_properties_t *props_end = nullptr; + static thread_local std::atomic_bool initialized {false}; + key_endpoint keylist; + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + std::lock_guard lock(mtx); + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + props.clear(); + + props.push_back(entity_properties_t(0, 0, false, bb_unset, extensibility::ext_final)); //root + props.push_back(entity_properties_t(1, 0, false, get_bit_bound(), extensibility::ext_final, false)); //::q + props.push_back(entity_properties_t(1, 1, false, get_bit_bound(), extensibility::ext_final, false)); //::dq + props.push_back(entity_properties_t(1, 2, false, get_bit_bound(), extensibility::ext_final, false)); //::tau_ff + props.push_back(entity_properties_t(1, 3, false, get_bit_bound(), extensibility::ext_final, false)); //::kp + props.push_back(entity_properties_t(1, 4, false, get_bit_bound(), extensibility::ext_final, false)); //::kv + props.push_back(entity_properties_t(1, 5, false, get_bit_bound(), extensibility::ext_final, false)); //::e_stop + + entity_properties_t::finish(props, keylist); + props_end = props.data() + props.size(); + initialized.store(true, std::memory_order_release); + return props; +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + diff --git a/Go2Py/msgs/cpp/LowCmd.hpp b/Go2Py/msgs/cpp/LowCmd.hpp new file mode 100644 index 0000000..3280bf5 --- /dev/null +++ b/Go2Py/msgs/cpp/LowCmd.hpp @@ -0,0 +1,552 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: LowCmd.idl + Source: LowCmd.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_LOWCMD_HPP +#define DDSCXX_LOWCMD_HPP + +#include +#include + +namespace msgs +{ +class LowCmd +{ +private: + std::array q_ = { }; + std::array dq_ = { }; + std::array tau_ff_ = { }; + std::array kp_ = { }; + std::array kv_ = { }; + uint8_t e_stop_ = 0; + +public: + LowCmd() = default; + + explicit LowCmd( + const std::array& q, + const std::array& dq, + const std::array& tau_ff, + const std::array& kp, + const std::array& kv, + uint8_t e_stop) : + q_(q), + dq_(dq), + tau_ff_(tau_ff), + kp_(kp), + kv_(kv), + e_stop_(e_stop) { } + + const std::array& q() const { return this->q_; } + std::array& q() { return this->q_; } + void q(const std::array& _val_) { this->q_ = _val_; } + void q(std::array&& _val_) { this->q_ = _val_; } + const std::array& dq() const { return this->dq_; } + std::array& dq() { return this->dq_; } + void dq(const std::array& _val_) { this->dq_ = _val_; } + void dq(std::array&& _val_) { this->dq_ = _val_; } + const std::array& tau_ff() const { return this->tau_ff_; } + std::array& tau_ff() { return this->tau_ff_; } + void tau_ff(const std::array& _val_) { this->tau_ff_ = _val_; } + void tau_ff(std::array&& _val_) { this->tau_ff_ = _val_; } + const std::array& kp() const { return this->kp_; } + std::array& kp() { return this->kp_; } + void kp(const std::array& _val_) { this->kp_ = _val_; } + void kp(std::array&& _val_) { this->kp_ = _val_; } + const std::array& kv() const { return this->kv_; } + std::array& kv() { return this->kv_; } + void kv(const std::array& _val_) { this->kv_ = _val_; } + void kv(std::array&& _val_) { this->kv_ = _val_; } + uint8_t e_stop() const { return this->e_stop_; } + uint8_t& e_stop() { return this->e_stop_; } + void e_stop(uint8_t _val_) { this->e_stop_ = _val_; } + + bool operator==(const LowCmd& _other) const + { + (void) _other; + return q_ == _other.q_ && + dq_ == _other.dq_ && + tau_ff_ == _other.tau_ff_ && + kp_ == _other.kp_ && + kv_ == _other.kv_ && + e_stop_ == _other.e_stop_; + } + + bool operator!=(const LowCmd& _other) const + { + return !(*this == _other); + } + +}; + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::msgs::LowCmd>::getTypeName() +{ + return "msgs::LowCmd"; +} + +template <> constexpr bool TopicTraits<::msgs::LowCmd>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::msgs::LowCmd>::type_map_blob_sz() { return 518; } +template<> constexpr unsigned int TopicTraits<::msgs::LowCmd>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::msgs::LowCmd>::type_map_blob() { + static const uint8_t blob[] = { + 0xc7, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x99, 0xbb, 0x1c, 0xa1, 0x69, 0x8f, 0x02, + 0x5f, 0xc8, 0x64, 0x19, 0x21, 0x0b, 0x6a, 0x00, 0xaf, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x16, 0xfc, + 0x75, 0xc7, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x26, 0xb5, 0x68, 0xe4, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x82, 0xd0, 0x91, 0x47, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x41, 0x60, 0xe3, 0x55, 0x00, 0x0d, 0x01, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x2b, 0x33, 0x3f, 0xba, 0x68, 0xf3, 0xc8, 0xf8, 0xfe, 0xcd, 0x5a, + 0x4f, 0x81, 0xbf, 0x00, 0xf5, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x15, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x4c, 0x6f, + 0x77, 0x43, 0x6d, 0x64, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, + 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x74, 0x61, 0x75, 0x5f, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6b, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6b, 0x76, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x65, 0x5f, 0x73, 0x74, 0x6f, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x2b, 0x33, 0x3f, 0xba, 0x68, 0xf3, 0xc8, + 0xf8, 0xfe, 0xcd, 0x5a, 0x4f, 0x81, 0xbf, 0xf1, 0x99, 0xbb, 0x1c, 0xa1, 0x69, 0x8f, 0x02, 0x5f, + 0xc8, 0x64, 0x19, 0x21, 0x0b, 0x6a, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::msgs::LowCmd>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x99, 0xbb, 0x1c, 0xa1, 0x69, 0x8f, 0x02, 0x5f, 0xc8, 0x64, 0x19, + 0x21, 0x0b, 0x6a, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x2b, 0x33, 0x3f, 0xba, 0x68, 0xf3, 0xc8, 0xf8, 0xfe, 0xcd, 0x5a, + 0x4f, 0x81, 0xbf, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::msgs::LowCmd> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::msgs::LowCmd>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::msgs::LowCmd) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::msgs::LowCmd>(); + +template::value, bool> = true > +bool write(T& streamer, const ::msgs::LowCmd& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.dq()[0], instance.dq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.tau_ff()[0], instance.tau_ff().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.kp()[0], instance.kp().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.kv()[0], instance.kv().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.e_stop())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::msgs::LowCmd& instance, bool as_key) { + auto &props = get_type_props<::msgs::LowCmd>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::msgs::LowCmd& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.dq()[0], instance.dq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.tau_ff()[0], instance.tau_ff().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.kp()[0], instance.kp().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.kv()[0], instance.kv().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.e_stop())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::msgs::LowCmd& instance, bool as_key) { + auto &props = get_type_props<::msgs::LowCmd>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::msgs::LowCmd& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.dq()[0], instance.dq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.tau_ff()[0], instance.tau_ff().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.kp()[0], instance.kp().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.kv()[0], instance.kv().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.e_stop())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::msgs::LowCmd& instance, bool as_key) { + auto &props = get_type_props<::msgs::LowCmd>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::msgs::LowCmd& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.dq()[0], instance.dq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.tau_ff()[0], instance.tau_ff().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.kp()[0], instance.kp().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.kv()[0], instance.kv().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.e_stop())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::msgs::LowCmd& instance, bool as_key) { + auto &props = get_type_props<::msgs::LowCmd>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_LOWCMD_HPP diff --git a/Go2Py/msgs/cpp/LowState.cpp b/Go2Py/msgs/cpp/LowState.cpp new file mode 100644 index 0000000..dba5607 --- /dev/null +++ b/Go2Py/msgs/cpp/LowState.cpp @@ -0,0 +1,60 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: LowState.idl + Source: LowState.cpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#include "LowState.hpp" + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::msgs::LowState>() { + static thread_local std::mutex mtx; + static thread_local propvec props; + static thread_local entity_properties_t *props_end = nullptr; + static thread_local std::atomic_bool initialized {false}; + key_endpoint keylist; + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + std::lock_guard lock(mtx); + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + props.clear(); + + props.push_back(entity_properties_t(0, 0, false, bb_unset, extensibility::ext_final)); //root + props.push_back(entity_properties_t(1, 0, false, get_bit_bound(), extensibility::ext_final, false)); //::q + props.push_back(entity_properties_t(1, 1, false, get_bit_bound(), extensibility::ext_final, false)); //::dq + props.push_back(entity_properties_t(1, 2, false, get_bit_bound(), extensibility::ext_final, false)); //::ddq + props.push_back(entity_properties_t(1, 3, false, get_bit_bound(), extensibility::ext_final, false)); //::tau_est + props.push_back(entity_properties_t(1, 4, false, get_bit_bound(), extensibility::ext_final, false)); //::tmp + props.push_back(entity_properties_t(1, 5, false, get_bit_bound(), extensibility::ext_final, false)); //::contact + props.push_back(entity_properties_t(1, 6, false, get_bit_bound(), extensibility::ext_final, false)); //::voltage + props.push_back(entity_properties_t(1, 7, false, get_bit_bound(), extensibility::ext_final, false)); //::current + + entity_properties_t::finish(props, keylist); + props_end = props.data() + props.size(); + initialized.store(true, std::memory_order_release); + return props; +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + diff --git a/Go2Py/msgs/cpp/LowState.hpp b/Go2Py/msgs/cpp/LowState.hpp new file mode 100644 index 0000000..4356439 --- /dev/null +++ b/Go2Py/msgs/cpp/LowState.hpp @@ -0,0 +1,653 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: LowState.idl + Source: LowState.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_LOWSTATE_HPP +#define DDSCXX_LOWSTATE_HPP + +#include + +namespace msgs +{ +class LowState +{ +private: + std::array q_ = { }; + std::array dq_ = { }; + std::array ddq_ = { }; + std::array tau_est_ = { }; + std::array tmp_ = { }; + std::array contact_ = { }; + float voltage_ = 0.0f; + float current_ = 0.0f; + +public: + LowState() = default; + + explicit LowState( + const std::array& q, + const std::array& dq, + const std::array& ddq, + const std::array& tau_est, + const std::array& tmp, + const std::array& contact, + float voltage, + float current) : + q_(q), + dq_(dq), + ddq_(ddq), + tau_est_(tau_est), + tmp_(tmp), + contact_(contact), + voltage_(voltage), + current_(current) { } + + const std::array& q() const { return this->q_; } + std::array& q() { return this->q_; } + void q(const std::array& _val_) { this->q_ = _val_; } + void q(std::array&& _val_) { this->q_ = _val_; } + const std::array& dq() const { return this->dq_; } + std::array& dq() { return this->dq_; } + void dq(const std::array& _val_) { this->dq_ = _val_; } + void dq(std::array&& _val_) { this->dq_ = _val_; } + const std::array& ddq() const { return this->ddq_; } + std::array& ddq() { return this->ddq_; } + void ddq(const std::array& _val_) { this->ddq_ = _val_; } + void ddq(std::array&& _val_) { this->ddq_ = _val_; } + const std::array& tau_est() const { return this->tau_est_; } + std::array& tau_est() { return this->tau_est_; } + void tau_est(const std::array& _val_) { this->tau_est_ = _val_; } + void tau_est(std::array&& _val_) { this->tau_est_ = _val_; } + const std::array& tmp() const { return this->tmp_; } + std::array& tmp() { return this->tmp_; } + void tmp(const std::array& _val_) { this->tmp_ = _val_; } + void tmp(std::array&& _val_) { this->tmp_ = _val_; } + const std::array& contact() const { return this->contact_; } + std::array& contact() { return this->contact_; } + void contact(const std::array& _val_) { this->contact_ = _val_; } + void contact(std::array&& _val_) { this->contact_ = _val_; } + float voltage() const { return this->voltage_; } + float& voltage() { return this->voltage_; } + void voltage(float _val_) { this->voltage_ = _val_; } + float current() const { return this->current_; } + float& current() { return this->current_; } + void current(float _val_) { this->current_ = _val_; } + + bool operator==(const LowState& _other) const + { + (void) _other; + return q_ == _other.q_ && + dq_ == _other.dq_ && + ddq_ == _other.ddq_ && + tau_est_ == _other.tau_est_ && + tmp_ == _other.tmp_ && + contact_ == _other.contact_ && + voltage_ == _other.voltage_ && + current_ == _other.current_; + } + + bool operator!=(const LowState& _other) const + { + return !(*this == _other); + } + +}; + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::msgs::LowState>::getTypeName() +{ + return "msgs::LowState"; +} + +template <> constexpr bool TopicTraits<::msgs::LowState>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::msgs::LowState>::type_map_blob_sz() { return 630; } +template<> constexpr unsigned int TopicTraits<::msgs::LowState>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::msgs::LowState>::type_map_blob() { + static const uint8_t blob[] = { + 0xf3, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xd4, 0x69, 0x80, 0x35, 0xf5, 0x8b, 0x51, + 0xea, 0x7f, 0x47, 0x3a, 0x7b, 0x09, 0x0f, 0x00, 0xdb, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0xe9, 0x16, + 0x89, 0x09, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x8a, 0xf7, 0xae, 0xdf, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0xfa, 0x81, 0x6e, 0xdb, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x04, 0x09, 0x2f, 0x8a, 0x6b, 0xf3, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0xe4, 0x37, 0xba, 0x43, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x43, 0xb5, 0xc9, 0x17, 0x00, 0x52, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0x84, 0x20, 0x63, 0xda, 0x5c, 0x28, 0xbb, 0x27, 0x92, 0xe4, 0x1c, 0xce, 0x56, 0xbc, 0x00, + 0x3a, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x4c, 0x6f, 0x77, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x64, 0x71, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x74, 0x61, 0x75, 0x5f, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x74, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x63, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x76, 0x6f, 0x6c, 0x74, 0x61, 0x67, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x84, 0x20, 0x63, 0xda, 0x5c, 0x28, 0xbb, + 0x27, 0x92, 0xe4, 0x1c, 0xce, 0x56, 0xbc, 0xf1, 0xd4, 0x69, 0x80, 0x35, 0xf5, 0x8b, 0x51, 0xea, + 0x7f, 0x47, 0x3a, 0x7b, 0x09, 0x0f, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::msgs::LowState>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xd4, 0x69, 0x80, 0x35, 0xf5, 0x8b, 0x51, 0xea, 0x7f, 0x47, 0x3a, + 0x7b, 0x09, 0x0f, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x84, 0x20, 0x63, 0xda, 0x5c, 0x28, 0xbb, 0x27, 0x92, 0xe4, 0x1c, + 0xce, 0x56, 0xbc, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::msgs::LowState> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::msgs::LowState>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::msgs::LowState) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::msgs::LowState>(); + +template::value, bool> = true > +bool write(T& streamer, const ::msgs::LowState& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.dq()[0], instance.dq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.ddq()[0], instance.ddq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.tau_est()[0], instance.tau_est().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.tmp()[0], instance.tmp().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.contact()[0], instance.contact().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.voltage())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::msgs::LowState& instance, bool as_key) { + auto &props = get_type_props<::msgs::LowState>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::msgs::LowState& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.dq()[0], instance.dq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.ddq()[0], instance.ddq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.tau_est()[0], instance.tau_est().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.tmp()[0], instance.tmp().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.contact()[0], instance.contact().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.voltage())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::msgs::LowState& instance, bool as_key) { + auto &props = get_type_props<::msgs::LowState>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::msgs::LowState& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.dq()[0], instance.dq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.ddq()[0], instance.ddq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.tau_est()[0], instance.tau_est().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.tmp()[0], instance.tmp().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.contact()[0], instance.contact().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.voltage())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::msgs::LowState& instance, bool as_key) { + auto &props = get_type_props<::msgs::LowState>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::msgs::LowState& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.q()[0], instance.q().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.dq()[0], instance.dq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.ddq()[0], instance.ddq().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.tau_est()[0], instance.tau_est().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.tmp()[0], instance.tmp().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.contact()[0], instance.contact().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.voltage())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::msgs::LowState& instance, bool as_key) { + auto &props = get_type_props<::msgs::LowState>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_LOWSTATE_HPP