diff --git a/generate.sh b/generate.sh index 79fa57e..746d0cd 100755 --- a/generate.sh +++ b/generate.sh @@ -35,15 +35,21 @@ rm -rf "$SCRIPT_DIR/generated/lua_lcm_msgs" echo -e "\033[32mLCM -> Lua done\033[0m" # Generate TypeScript bindings -rm -rf "$SCRIPT_DIR/generated/ts_lcm_msgs" +# Only the per-package directories are generated; anything else in there is +# hand-written, so clear the packages instead of the whole tree. +mkdir -p "$SCRIPT_DIR/generated/ts_lcm_msgs" +find "$SCRIPT_DIR/generated/ts_lcm_msgs" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} + deno run --allow-read --allow-write "$SCRIPT_DIR/tools/ts/gen/mod.ts" -q -o "$SCRIPT_DIR/generated/ts_lcm_msgs" "$SCRIPT_DIR/lcm_types"/*.lcm # Copy to msgs package (for JSR publishing - symlinks not supported) rm -rf "$SCRIPT_DIR/tools/ts/msgs/generated" -cp -r "$SCRIPT_DIR/generated/ts_lcm_msgs" "$SCRIPT_DIR/tools/ts/msgs/generated" +mkdir -p "$SCRIPT_DIR/tools/ts/msgs/generated" +cp -r "$SCRIPT_DIR/generated/ts_lcm_msgs"/*/ "$SCRIPT_DIR/tools/ts/msgs/generated/" echo -e "\033[32mLCM -> TypeScript done\033[0m" # Generate Rust bindings -rm -rf "$SCRIPT_DIR/generated/rust_lcm_msgs" +# The generator owns src/ and Cargo.toml; tests/, Cargo.lock and .gitignore are +# hand-written, so only clear src/ rather than the whole crate. +rm -rf "$SCRIPT_DIR/generated/rust_lcm_msgs/src" python3 "$SCRIPT_DIR/tools/rust/lcm_rust_gen.py" "$SCRIPT_DIR/lcm_types" -o "$SCRIPT_DIR/generated/rust_lcm_msgs" (cd "$SCRIPT_DIR/generated/rust_lcm_msgs" && cargo check --quiet) echo -e "\033[32mLCM -> Rust done\033[0m" diff --git a/generated/cpp_lcm_msgs/dimos_control_msgs/CommandProfile.hpp b/generated/cpp_lcm_msgs/dimos_control_msgs/CommandProfile.hpp new file mode 100644 index 0000000..46f2209 --- /dev/null +++ b/generated/cpp_lcm_msgs/dimos_control_msgs/CommandProfile.hpp @@ -0,0 +1,245 @@ +/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY + * BY HAND!! + * + * Generated by lcm-gen 1.5.2 + **/ + +#ifndef __dimos_control_msgs_CommandProfile_hpp__ +#define __dimos_control_msgs_CommandProfile_hpp__ + +#include + +#include +#include + +namespace dimos_control_msgs +{ + +class CommandProfile +{ + public: + std::string name; + + int32_t required_fields_length; + + int32_t optional_fields_length; + + /** + * LCM Type: string[required_fields_length] + */ + std::vector< std::string > required_fields; + + /** + * LCM Type: string[optional_fields_length] + */ + std::vector< std::string > optional_fields; + + int8_t uniform_across_resources; + + public: + /** + * Encode a message into binary form. + * + * @param buf The output buffer. + * @param offset Encoding starts at thie byte offset into @p buf. + * @param maxlen Maximum number of bytes to write. This should generally be + * equal to getEncodedSize(). + * @return The number of bytes encoded, or <0 on error. + */ + inline int encode(void *buf, int offset, int maxlen) const; + + /** + * Check how many bytes are required to encode this message. + */ + inline int getEncodedSize() const; + + /** + * Decode a message from binary form into this instance. + * + * @param buf The buffer containing the encoded message. + * @param offset The byte offset into @p buf where the encoded message starts. + * @param maxlen The maximum number of bytes to read while decoding. + * @return The number of bytes decoded, or <0 if an error occured. + */ + inline int decode(const void *buf, int offset, int maxlen); + + /** + * Retrieve the 64-bit fingerprint identifying the structure of the message. + * Note that the fingerprint is the same for all instances of the same + * message type, and is a fingerprint on the message type definition, not on + * the message contents. + */ + inline static int64_t getHash(); + + /** + * Returns "CommandProfile" + */ + inline static const char* getTypeName(); + + // LCM support functions. Users should not call these + inline int _encodeNoHash(void *buf, int offset, int maxlen) const; + inline int _getEncodedSizeNoHash() const; + inline int _decodeNoHash(const void *buf, int offset, int maxlen); + inline static uint64_t _computeHash(const __lcm_hash_ptr *p); +}; + +int CommandProfile::encode(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + int64_t hash = getHash(); + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos); + if (tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int CommandProfile::decode(const void *buf, int offset, int maxlen) +{ + int pos = 0, thislen; + + int64_t msg_hash; + thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1); + if (thislen < 0) return thislen; else pos += thislen; + if (msg_hash != getHash()) return -1; + + thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos); + if (thislen < 0) return thislen; else pos += thislen; + + return pos; +} + +int CommandProfile::getEncodedSize() const +{ + return 8 + _getEncodedSizeNoHash(); +} + +int64_t CommandProfile::getHash() +{ + static int64_t hash = static_cast(_computeHash(NULL)); + return hash; +} + +const char* CommandProfile::getTypeName() +{ + return "CommandProfile"; +} + +int CommandProfile::_encodeNoHash(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + + char* name_cstr = const_cast(this->name.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &name_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_encode_array(buf, offset + pos, maxlen - pos, &this->required_fields_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_encode_array(buf, offset + pos, maxlen - pos, &this->optional_fields_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + for (int a0 = 0; a0 < this->required_fields_length; a0++) { + char* __cstr = const_cast(this->required_fields[a0].c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &__cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + } + + for (int a0 = 0; a0 < this->optional_fields_length; a0++) { + char* __cstr = const_cast(this->optional_fields[a0].c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &__cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + } + + tlen = __boolean_encode_array(buf, offset + pos, maxlen - pos, &this->uniform_across_resources, 1); + if(tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int CommandProfile::_decodeNoHash(const void *buf, int offset, int maxlen) +{ + int pos = 0, tlen; + + int32_t __name_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__name_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__name_len__ > maxlen - pos) return -1; + this->name.assign( + static_cast(buf) + offset + pos, __name_len__ - 1); + pos += __name_len__; + + tlen = __int32_t_decode_array(buf, offset + pos, maxlen - pos, &this->required_fields_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_decode_array(buf, offset + pos, maxlen - pos, &this->optional_fields_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + try { + this->required_fields.resize(this->required_fields_length); + } catch (...) { + return -1; + } + for (int a0 = 0; a0 < this->required_fields_length; a0++) { + int32_t __elem_len; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__elem_len, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__elem_len > maxlen - pos) return -1; + this->required_fields[a0].assign(static_cast(buf) + offset + pos, __elem_len - 1); + pos += __elem_len; + } + + try { + this->optional_fields.resize(this->optional_fields_length); + } catch (...) { + return -1; + } + for (int a0 = 0; a0 < this->optional_fields_length; a0++) { + int32_t __elem_len; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__elem_len, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__elem_len > maxlen - pos) return -1; + this->optional_fields[a0].assign(static_cast(buf) + offset + pos, __elem_len - 1); + pos += __elem_len; + } + + tlen = __boolean_decode_array(buf, offset + pos, maxlen - pos, &this->uniform_across_resources, 1); + if(tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int CommandProfile::_getEncodedSizeNoHash() const +{ + int enc_size = 0; + enc_size += this->name.size() + 4 + 1; + enc_size += __int32_t_encoded_array_size(NULL, 1); + enc_size += __int32_t_encoded_array_size(NULL, 1); + for (int a0 = 0; a0 < this->required_fields_length; a0++) { + enc_size += this->required_fields[a0].size() + 4 + 1; + } + for (int a0 = 0; a0 < this->optional_fields_length; a0++) { + enc_size += this->optional_fields[a0].size() + 4 + 1; + } + enc_size += __boolean_encoded_array_size(NULL, 1); + return enc_size; +} + +uint64_t CommandProfile::_computeHash(const __lcm_hash_ptr *) +{ + uint64_t hash = 0x38538e7a9d86eb4aLL; + return (hash<<1) + ((hash>>63)&1); +} + +} + +#endif diff --git a/generated/cpp_lcm_msgs/dimos_control_msgs/ConnectionControl.hpp b/generated/cpp_lcm_msgs/dimos_control_msgs/ConnectionControl.hpp new file mode 100644 index 0000000..8196937 --- /dev/null +++ b/generated/cpp_lcm_msgs/dimos_control_msgs/ConnectionControl.hpp @@ -0,0 +1,261 @@ +/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY + * BY HAND!! + * + * Generated by lcm-gen 1.5.2 + **/ + +#ifndef __dimos_control_msgs_ConnectionControl_hpp__ +#define __dimos_control_msgs_ConnectionControl_hpp__ + +#include + +#include +#include + +namespace dimos_control_msgs +{ + +class ConnectionControl +{ + public: + int32_t target_sources_length; + + /** + * LCM Type: string[target_sources_length] + */ + std::vector< std::string > target_sources; + + int64_t operation_id; + + int8_t operation; + + int64_t proposed_control_epoch; + + std::string reason; + + public: + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t PREPARE_ARM = 1; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t COMMIT_ARM = 2; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t ABORT_ARM = 3; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t SAFE_STOP = 4; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t CLEAR_SAFE_STOP = 5; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t ESTOP = 6; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t CLEAR_ESTOP = 7; + + public: + /** + * Encode a message into binary form. + * + * @param buf The output buffer. + * @param offset Encoding starts at thie byte offset into @p buf. + * @param maxlen Maximum number of bytes to write. This should generally be + * equal to getEncodedSize(). + * @return The number of bytes encoded, or <0 on error. + */ + inline int encode(void *buf, int offset, int maxlen) const; + + /** + * Check how many bytes are required to encode this message. + */ + inline int getEncodedSize() const; + + /** + * Decode a message from binary form into this instance. + * + * @param buf The buffer containing the encoded message. + * @param offset The byte offset into @p buf where the encoded message starts. + * @param maxlen The maximum number of bytes to read while decoding. + * @return The number of bytes decoded, or <0 if an error occured. + */ + inline int decode(const void *buf, int offset, int maxlen); + + /** + * Retrieve the 64-bit fingerprint identifying the structure of the message. + * Note that the fingerprint is the same for all instances of the same + * message type, and is a fingerprint on the message type definition, not on + * the message contents. + */ + inline static int64_t getHash(); + + /** + * Returns "ConnectionControl" + */ + inline static const char* getTypeName(); + + // LCM support functions. Users should not call these + inline int _encodeNoHash(void *buf, int offset, int maxlen) const; + inline int _getEncodedSizeNoHash() const; + inline int _decodeNoHash(const void *buf, int offset, int maxlen); + inline static uint64_t _computeHash(const __lcm_hash_ptr *p); +}; + +int ConnectionControl::encode(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + int64_t hash = getHash(); + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos); + if (tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ConnectionControl::decode(const void *buf, int offset, int maxlen) +{ + int pos = 0, thislen; + + int64_t msg_hash; + thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1); + if (thislen < 0) return thislen; else pos += thislen; + if (msg_hash != getHash()) return -1; + + thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos); + if (thislen < 0) return thislen; else pos += thislen; + + return pos; +} + +int ConnectionControl::getEncodedSize() const +{ + return 8 + _getEncodedSizeNoHash(); +} + +int64_t ConnectionControl::getHash() +{ + static int64_t hash = static_cast(_computeHash(NULL)); + return hash; +} + +const char* ConnectionControl::getTypeName() +{ + return "ConnectionControl"; +} + +int ConnectionControl::_encodeNoHash(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + + tlen = __int32_t_encode_array(buf, offset + pos, maxlen - pos, &this->target_sources_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + for (int a0 = 0; a0 < this->target_sources_length; a0++) { + char* __cstr = const_cast(this->target_sources[a0].c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &__cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + } + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->operation_id, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->operation, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->proposed_control_epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + char* reason_cstr = const_cast(this->reason.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &reason_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ConnectionControl::_decodeNoHash(const void *buf, int offset, int maxlen) +{ + int pos = 0, tlen; + + tlen = __int32_t_decode_array(buf, offset + pos, maxlen - pos, &this->target_sources_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + try { + this->target_sources.resize(this->target_sources_length); + } catch (...) { + return -1; + } + for (int a0 = 0; a0 < this->target_sources_length; a0++) { + int32_t __elem_len; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__elem_len, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__elem_len > maxlen - pos) return -1; + this->target_sources[a0].assign(static_cast(buf) + offset + pos, __elem_len - 1); + pos += __elem_len; + } + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->operation_id, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->operation, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->proposed_control_epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + int32_t __reason_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__reason_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__reason_len__ > maxlen - pos) return -1; + this->reason.assign( + static_cast(buf) + offset + pos, __reason_len__ - 1); + pos += __reason_len__; + + return pos; +} + +int ConnectionControl::_getEncodedSizeNoHash() const +{ + int enc_size = 0; + enc_size += __int32_t_encoded_array_size(NULL, 1); + for (int a0 = 0; a0 < this->target_sources_length; a0++) { + enc_size += this->target_sources[a0].size() + 4 + 1; + } + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += __int8_t_encoded_array_size(NULL, 1); + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += this->reason.size() + 4 + 1; + return enc_size; +} + +uint64_t ConnectionControl::_computeHash(const __lcm_hash_ptr *) +{ + uint64_t hash = 0xb82d9643472f465dLL; + return (hash<<1) + ((hash>>63)&1); +} + +} + +#endif diff --git a/generated/cpp_lcm_msgs/dimos_control_msgs/ConnectionDescription.hpp b/generated/cpp_lcm_msgs/dimos_control_msgs/ConnectionDescription.hpp new file mode 100644 index 0000000..f262872 --- /dev/null +++ b/generated/cpp_lcm_msgs/dimos_control_msgs/ConnectionDescription.hpp @@ -0,0 +1,411 @@ +/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY + * BY HAND!! + * + * Generated by lcm-gen 1.5.2 + **/ + +#ifndef __dimos_control_msgs_ConnectionDescription_hpp__ +#define __dimos_control_msgs_ConnectionDescription_hpp__ + +#include + +#include +#include +#include "dimos_control_msgs/ResourceDescription.hpp" +#include "dimos_control_msgs/InterfaceDescription.hpp" +#include "dimos_control_msgs/CommandProfile.hpp" + +namespace dimos_control_msgs +{ + +class ConnectionDescription +{ + public: + std::string source; + + int64_t description_epoch; + + int32_t resources_length; + + int32_t interfaces_length; + + int32_t command_profiles_length; + + /** + * LCM Type: dimos_control_msgs.ResourceDescription[resources_length] + */ + std::vector< dimos_control_msgs::ResourceDescription > resources; + + /** + * LCM Type: dimos_control_msgs.InterfaceDescription[interfaces_length] + */ + std::vector< dimos_control_msgs::InterfaceDescription > interfaces; + + /** + * LCM Type: dimos_control_msgs.CommandProfile[command_profiles_length] + */ + std::vector< dimos_control_msgs::CommandProfile > command_profiles; + + double expected_state_rate_hz; + + double state_stale_timeout_s; + + double command_watchdog_timeout_s; + + int8_t activation_policy; + + int8_t armed_idle_policy; + + std::string safe_stop_behavior; + + int8_t process_loss_classification; + + std::string process_loss_evidence; + + public: + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t DIRECT = 1; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t OPERATOR_CONFIRMED = 2; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t APPLY_OMISSION = 1; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t ARMED_IDLE_SAFE_STOP = 2; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t NATIVE_WATCHDOG = 1; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t EXTERNAL_SUPERVISOR = 2; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t INTRINSICALLY_SAFE = 3; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t SIMULATION = 4; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t UNPROTECTED = 5; + + public: + /** + * Encode a message into binary form. + * + * @param buf The output buffer. + * @param offset Encoding starts at thie byte offset into @p buf. + * @param maxlen Maximum number of bytes to write. This should generally be + * equal to getEncodedSize(). + * @return The number of bytes encoded, or <0 on error. + */ + inline int encode(void *buf, int offset, int maxlen) const; + + /** + * Check how many bytes are required to encode this message. + */ + inline int getEncodedSize() const; + + /** + * Decode a message from binary form into this instance. + * + * @param buf The buffer containing the encoded message. + * @param offset The byte offset into @p buf where the encoded message starts. + * @param maxlen The maximum number of bytes to read while decoding. + * @return The number of bytes decoded, or <0 if an error occured. + */ + inline int decode(const void *buf, int offset, int maxlen); + + /** + * Retrieve the 64-bit fingerprint identifying the structure of the message. + * Note that the fingerprint is the same for all instances of the same + * message type, and is a fingerprint on the message type definition, not on + * the message contents. + */ + inline static int64_t getHash(); + + /** + * Returns "ConnectionDescription" + */ + inline static const char* getTypeName(); + + // LCM support functions. Users should not call these + inline int _encodeNoHash(void *buf, int offset, int maxlen) const; + inline int _getEncodedSizeNoHash() const; + inline int _decodeNoHash(const void *buf, int offset, int maxlen); + inline static uint64_t _computeHash(const __lcm_hash_ptr *p); +}; + +int ConnectionDescription::encode(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + int64_t hash = getHash(); + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos); + if (tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ConnectionDescription::decode(const void *buf, int offset, int maxlen) +{ + int pos = 0, thislen; + + int64_t msg_hash; + thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1); + if (thislen < 0) return thislen; else pos += thislen; + if (msg_hash != getHash()) return -1; + + thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos); + if (thislen < 0) return thislen; else pos += thislen; + + return pos; +} + +int ConnectionDescription::getEncodedSize() const +{ + return 8 + _getEncodedSizeNoHash(); +} + +int64_t ConnectionDescription::getHash() +{ + static int64_t hash = static_cast(_computeHash(NULL)); + return hash; +} + +const char* ConnectionDescription::getTypeName() +{ + return "ConnectionDescription"; +} + +int ConnectionDescription::_encodeNoHash(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + + char* source_cstr = const_cast(this->source.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &source_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->description_epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_encode_array(buf, offset + pos, maxlen - pos, &this->resources_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_encode_array(buf, offset + pos, maxlen - pos, &this->interfaces_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_encode_array(buf, offset + pos, maxlen - pos, &this->command_profiles_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + for (int a0 = 0; a0 < this->resources_length; a0++) { + tlen = this->resources[a0]._encodeNoHash(buf, offset + pos, maxlen - pos); + if(tlen < 0) return tlen; else pos += tlen; + } + + for (int a0 = 0; a0 < this->interfaces_length; a0++) { + tlen = this->interfaces[a0]._encodeNoHash(buf, offset + pos, maxlen - pos); + if(tlen < 0) return tlen; else pos += tlen; + } + + for (int a0 = 0; a0 < this->command_profiles_length; a0++) { + tlen = this->command_profiles[a0]._encodeNoHash(buf, offset + pos, maxlen - pos); + if(tlen < 0) return tlen; else pos += tlen; + } + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->expected_state_rate_hz, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->state_stale_timeout_s, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->command_watchdog_timeout_s, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->activation_policy, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->armed_idle_policy, 1); + if(tlen < 0) return tlen; else pos += tlen; + + char* safe_stop_behavior_cstr = const_cast(this->safe_stop_behavior.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &safe_stop_behavior_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->process_loss_classification, 1); + if(tlen < 0) return tlen; else pos += tlen; + + char* process_loss_evidence_cstr = const_cast(this->process_loss_evidence.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &process_loss_evidence_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ConnectionDescription::_decodeNoHash(const void *buf, int offset, int maxlen) +{ + int pos = 0, tlen; + + int32_t __source_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__source_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__source_len__ > maxlen - pos) return -1; + this->source.assign( + static_cast(buf) + offset + pos, __source_len__ - 1); + pos += __source_len__; + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->description_epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_decode_array(buf, offset + pos, maxlen - pos, &this->resources_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_decode_array(buf, offset + pos, maxlen - pos, &this->interfaces_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_decode_array(buf, offset + pos, maxlen - pos, &this->command_profiles_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + try { + this->resources.resize(this->resources_length); + } catch (...) { + return -1; + } + for (int a0 = 0; a0 < this->resources_length; a0++) { + tlen = this->resources[a0]._decodeNoHash(buf, offset + pos, maxlen - pos); + if(tlen < 0) return tlen; else pos += tlen; + } + + try { + this->interfaces.resize(this->interfaces_length); + } catch (...) { + return -1; + } + for (int a0 = 0; a0 < this->interfaces_length; a0++) { + tlen = this->interfaces[a0]._decodeNoHash(buf, offset + pos, maxlen - pos); + if(tlen < 0) return tlen; else pos += tlen; + } + + try { + this->command_profiles.resize(this->command_profiles_length); + } catch (...) { + return -1; + } + for (int a0 = 0; a0 < this->command_profiles_length; a0++) { + tlen = this->command_profiles[a0]._decodeNoHash(buf, offset + pos, maxlen - pos); + if(tlen < 0) return tlen; else pos += tlen; + } + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->expected_state_rate_hz, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->state_stale_timeout_s, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->command_watchdog_timeout_s, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->activation_policy, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->armed_idle_policy, 1); + if(tlen < 0) return tlen; else pos += tlen; + + int32_t __safe_stop_behavior_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__safe_stop_behavior_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__safe_stop_behavior_len__ > maxlen - pos) return -1; + this->safe_stop_behavior.assign( + static_cast(buf) + offset + pos, __safe_stop_behavior_len__ - 1); + pos += __safe_stop_behavior_len__; + + tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->process_loss_classification, 1); + if(tlen < 0) return tlen; else pos += tlen; + + int32_t __process_loss_evidence_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__process_loss_evidence_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__process_loss_evidence_len__ > maxlen - pos) return -1; + this->process_loss_evidence.assign( + static_cast(buf) + offset + pos, __process_loss_evidence_len__ - 1); + pos += __process_loss_evidence_len__; + + return pos; +} + +int ConnectionDescription::_getEncodedSizeNoHash() const +{ + int enc_size = 0; + enc_size += this->source.size() + 4 + 1; + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += __int32_t_encoded_array_size(NULL, 1); + enc_size += __int32_t_encoded_array_size(NULL, 1); + enc_size += __int32_t_encoded_array_size(NULL, 1); + for (int a0 = 0; a0 < this->resources_length; a0++) { + enc_size += this->resources[a0]._getEncodedSizeNoHash(); + } + for (int a0 = 0; a0 < this->interfaces_length; a0++) { + enc_size += this->interfaces[a0]._getEncodedSizeNoHash(); + } + for (int a0 = 0; a0 < this->command_profiles_length; a0++) { + enc_size += this->command_profiles[a0]._getEncodedSizeNoHash(); + } + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __int8_t_encoded_array_size(NULL, 1); + enc_size += __int8_t_encoded_array_size(NULL, 1); + enc_size += this->safe_stop_behavior.size() + 4 + 1; + enc_size += __int8_t_encoded_array_size(NULL, 1); + enc_size += this->process_loss_evidence.size() + 4 + 1; + return enc_size; +} + +uint64_t ConnectionDescription::_computeHash(const __lcm_hash_ptr *p) +{ + const __lcm_hash_ptr *fp; + for(fp = p; fp != NULL; fp = fp->parent) + if(fp->v == ConnectionDescription::getHash) + return 0; + const __lcm_hash_ptr cp = { p, ConnectionDescription::getHash }; + + uint64_t hash = 0x31d30851f65c7d8cLL + + dimos_control_msgs::ResourceDescription::_computeHash(&cp) + + dimos_control_msgs::InterfaceDescription::_computeHash(&cp) + + dimos_control_msgs::CommandProfile::_computeHash(&cp); + + return (hash<<1) + ((hash>>63)&1); +} + +} + +#endif diff --git a/generated/cpp_lcm_msgs/dimos_control_msgs/ConnectionStatus.hpp b/generated/cpp_lcm_msgs/dimos_control_msgs/ConnectionStatus.hpp new file mode 100644 index 0000000..605fb8e --- /dev/null +++ b/generated/cpp_lcm_msgs/dimos_control_msgs/ConnectionStatus.hpp @@ -0,0 +1,294 @@ +/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY + * BY HAND!! + * + * Generated by lcm-gen 1.5.2 + **/ + +#ifndef __dimos_control_msgs_ConnectionStatus_hpp__ +#define __dimos_control_msgs_ConnectionStatus_hpp__ + +#include + +#include + +namespace dimos_control_msgs +{ + +class ConnectionStatus +{ + public: + std::string source; + + double source_ts; + + int8_t lifecycle_state; + + int64_t description_epoch; + + int64_t control_epoch; + + int64_t last_operation_id; + + int8_t last_operation; + + int8_t acknowledgement; + + std::string fault; + + public: + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t STANDBY = 1; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t PREPARING = 2; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t PREPARED = 3; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t COMMITTING = 4; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t ARMED = 5; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t SAFE_STOPPED = 6; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t ESTOPPED = 7; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t NONE = 0; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t PENDING = 1; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t SUCCEEDED = 2; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t REJECTED = 3; + + public: + /** + * Encode a message into binary form. + * + * @param buf The output buffer. + * @param offset Encoding starts at thie byte offset into @p buf. + * @param maxlen Maximum number of bytes to write. This should generally be + * equal to getEncodedSize(). + * @return The number of bytes encoded, or <0 on error. + */ + inline int encode(void *buf, int offset, int maxlen) const; + + /** + * Check how many bytes are required to encode this message. + */ + inline int getEncodedSize() const; + + /** + * Decode a message from binary form into this instance. + * + * @param buf The buffer containing the encoded message. + * @param offset The byte offset into @p buf where the encoded message starts. + * @param maxlen The maximum number of bytes to read while decoding. + * @return The number of bytes decoded, or <0 if an error occured. + */ + inline int decode(const void *buf, int offset, int maxlen); + + /** + * Retrieve the 64-bit fingerprint identifying the structure of the message. + * Note that the fingerprint is the same for all instances of the same + * message type, and is a fingerprint on the message type definition, not on + * the message contents. + */ + inline static int64_t getHash(); + + /** + * Returns "ConnectionStatus" + */ + inline static const char* getTypeName(); + + // LCM support functions. Users should not call these + inline int _encodeNoHash(void *buf, int offset, int maxlen) const; + inline int _getEncodedSizeNoHash() const; + inline int _decodeNoHash(const void *buf, int offset, int maxlen); + inline static uint64_t _computeHash(const __lcm_hash_ptr *p); +}; + +int ConnectionStatus::encode(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + int64_t hash = getHash(); + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos); + if (tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ConnectionStatus::decode(const void *buf, int offset, int maxlen) +{ + int pos = 0, thislen; + + int64_t msg_hash; + thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1); + if (thislen < 0) return thislen; else pos += thislen; + if (msg_hash != getHash()) return -1; + + thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos); + if (thislen < 0) return thislen; else pos += thislen; + + return pos; +} + +int ConnectionStatus::getEncodedSize() const +{ + return 8 + _getEncodedSizeNoHash(); +} + +int64_t ConnectionStatus::getHash() +{ + static int64_t hash = static_cast(_computeHash(NULL)); + return hash; +} + +const char* ConnectionStatus::getTypeName() +{ + return "ConnectionStatus"; +} + +int ConnectionStatus::_encodeNoHash(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + + char* source_cstr = const_cast(this->source.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &source_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->source_ts, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->lifecycle_state, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->description_epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->control_epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->last_operation_id, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->last_operation, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->acknowledgement, 1); + if(tlen < 0) return tlen; else pos += tlen; + + char* fault_cstr = const_cast(this->fault.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &fault_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ConnectionStatus::_decodeNoHash(const void *buf, int offset, int maxlen) +{ + int pos = 0, tlen; + + int32_t __source_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__source_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__source_len__ > maxlen - pos) return -1; + this->source.assign( + static_cast(buf) + offset + pos, __source_len__ - 1); + pos += __source_len__; + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->source_ts, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->lifecycle_state, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->description_epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->control_epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->last_operation_id, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->last_operation, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->acknowledgement, 1); + if(tlen < 0) return tlen; else pos += tlen; + + int32_t __fault_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__fault_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__fault_len__ > maxlen - pos) return -1; + this->fault.assign( + static_cast(buf) + offset + pos, __fault_len__ - 1); + pos += __fault_len__; + + return pos; +} + +int ConnectionStatus::_getEncodedSizeNoHash() const +{ + int enc_size = 0; + enc_size += this->source.size() + 4 + 1; + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __int8_t_encoded_array_size(NULL, 1); + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += __int8_t_encoded_array_size(NULL, 1); + enc_size += __int8_t_encoded_array_size(NULL, 1); + enc_size += this->fault.size() + 4 + 1; + return enc_size; +} + +uint64_t ConnectionStatus::_computeHash(const __lcm_hash_ptr *) +{ + uint64_t hash = 0xc90f95ebfad6e276LL; + return (hash<<1) + ((hash>>63)&1); +} + +} + +#endif diff --git a/generated/cpp_lcm_msgs/dimos_control_msgs/ControlValues.hpp b/generated/cpp_lcm_msgs/dimos_control_msgs/ControlValues.hpp new file mode 100644 index 0000000..c65851a --- /dev/null +++ b/generated/cpp_lcm_msgs/dimos_control_msgs/ControlValues.hpp @@ -0,0 +1,250 @@ +/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY + * BY HAND!! + * + * Generated by lcm-gen 1.5.2 + **/ + +#ifndef __dimos_control_msgs_ControlValues_hpp__ +#define __dimos_control_msgs_ControlValues_hpp__ + +#include + +#include +#include + +namespace dimos_control_msgs +{ + +class ControlValues +{ + public: + std::string source; + + double source_ts; + + int64_t epoch; + + int64_t sequence; + + int32_t interface_names_length; + + int32_t values_length; + + /** + * LCM Type: string[interface_names_length] + */ + std::vector< std::string > interface_names; + + /** + * LCM Type: double[values_length] + */ + std::vector< double > values; + + public: + /** + * Encode a message into binary form. + * + * @param buf The output buffer. + * @param offset Encoding starts at thie byte offset into @p buf. + * @param maxlen Maximum number of bytes to write. This should generally be + * equal to getEncodedSize(). + * @return The number of bytes encoded, or <0 on error. + */ + inline int encode(void *buf, int offset, int maxlen) const; + + /** + * Check how many bytes are required to encode this message. + */ + inline int getEncodedSize() const; + + /** + * Decode a message from binary form into this instance. + * + * @param buf The buffer containing the encoded message. + * @param offset The byte offset into @p buf where the encoded message starts. + * @param maxlen The maximum number of bytes to read while decoding. + * @return The number of bytes decoded, or <0 if an error occured. + */ + inline int decode(const void *buf, int offset, int maxlen); + + /** + * Retrieve the 64-bit fingerprint identifying the structure of the message. + * Note that the fingerprint is the same for all instances of the same + * message type, and is a fingerprint on the message type definition, not on + * the message contents. + */ + inline static int64_t getHash(); + + /** + * Returns "ControlValues" + */ + inline static const char* getTypeName(); + + // LCM support functions. Users should not call these + inline int _encodeNoHash(void *buf, int offset, int maxlen) const; + inline int _getEncodedSizeNoHash() const; + inline int _decodeNoHash(const void *buf, int offset, int maxlen); + inline static uint64_t _computeHash(const __lcm_hash_ptr *p); +}; + +int ControlValues::encode(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + int64_t hash = getHash(); + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos); + if (tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ControlValues::decode(const void *buf, int offset, int maxlen) +{ + int pos = 0, thislen; + + int64_t msg_hash; + thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1); + if (thislen < 0) return thislen; else pos += thislen; + if (msg_hash != getHash()) return -1; + + thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos); + if (thislen < 0) return thislen; else pos += thislen; + + return pos; +} + +int ControlValues::getEncodedSize() const +{ + return 8 + _getEncodedSizeNoHash(); +} + +int64_t ControlValues::getHash() +{ + static int64_t hash = static_cast(_computeHash(NULL)); + return hash; +} + +const char* ControlValues::getTypeName() +{ + return "ControlValues"; +} + +int ControlValues::_encodeNoHash(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + + char* source_cstr = const_cast(this->source.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &source_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->source_ts, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->sequence, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_encode_array(buf, offset + pos, maxlen - pos, &this->interface_names_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_encode_array(buf, offset + pos, maxlen - pos, &this->values_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + for (int a0 = 0; a0 < this->interface_names_length; a0++) { + char* __cstr = const_cast(this->interface_names[a0].c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &__cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + } + + if(this->values_length > 0) { + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->values[0], this->values_length); + if(tlen < 0) return tlen; else pos += tlen; + } + + return pos; +} + +int ControlValues::_decodeNoHash(const void *buf, int offset, int maxlen) +{ + int pos = 0, tlen; + + int32_t __source_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__source_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__source_len__ > maxlen - pos) return -1; + this->source.assign( + static_cast(buf) + offset + pos, __source_len__ - 1); + pos += __source_len__; + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->source_ts, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->epoch, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->sequence, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_decode_array(buf, offset + pos, maxlen - pos, &this->interface_names_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int32_t_decode_array(buf, offset + pos, maxlen - pos, &this->values_length, 1); + if(tlen < 0) return tlen; else pos += tlen; + + try { + this->interface_names.resize(this->interface_names_length); + } catch (...) { + return -1; + } + for (int a0 = 0; a0 < this->interface_names_length; a0++) { + int32_t __elem_len; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__elem_len, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__elem_len > maxlen - pos) return -1; + this->interface_names[a0].assign(static_cast(buf) + offset + pos, __elem_len - 1); + pos += __elem_len; + } + + if(this->values_length) { + this->values.resize(this->values_length); + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->values[0], this->values_length); + if(tlen < 0) return tlen; else pos += tlen; + } + + return pos; +} + +int ControlValues::_getEncodedSizeNoHash() const +{ + int enc_size = 0; + enc_size += this->source.size() + 4 + 1; + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += __int32_t_encoded_array_size(NULL, 1); + enc_size += __int32_t_encoded_array_size(NULL, 1); + for (int a0 = 0; a0 < this->interface_names_length; a0++) { + enc_size += this->interface_names[a0].size() + 4 + 1; + } + enc_size += __double_encoded_array_size(NULL, this->values_length); + return enc_size; +} + +uint64_t ControlValues::_computeHash(const __lcm_hash_ptr *) +{ + uint64_t hash = 0x98d9f64b18d5a4cfLL; + return (hash<<1) + ((hash>>63)&1); +} + +} + +#endif diff --git a/generated/cpp_lcm_msgs/dimos_control_msgs/InterfaceDescription.hpp b/generated/cpp_lcm_msgs/dimos_control_msgs/InterfaceDescription.hpp new file mode 100644 index 0000000..60929ce --- /dev/null +++ b/generated/cpp_lcm_msgs/dimos_control_msgs/InterfaceDescription.hpp @@ -0,0 +1,324 @@ +/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY + * BY HAND!! + * + * Generated by lcm-gen 1.5.2 + **/ + +#ifndef __dimos_control_msgs_InterfaceDescription_hpp__ +#define __dimos_control_msgs_InterfaceDescription_hpp__ + +#include + +#include + +namespace dimos_control_msgs +{ + +class InterfaceDescription +{ + public: + std::string name; + + std::string resource; + + std::string field; + + std::string unit; + + int8_t state; + + int8_t command; + + int8_t has_hard_min; + + double hard_min; + + int8_t has_hard_max; + + double hard_max; + + int8_t has_soft_min; + + double soft_min; + + int8_t has_soft_max; + + double soft_max; + + int8_t omission_policy; + + public: + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t HOLD_LAST = 1; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t ZERO = 2; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t SAFE_STOP = 3; + + public: + /** + * Encode a message into binary form. + * + * @param buf The output buffer. + * @param offset Encoding starts at thie byte offset into @p buf. + * @param maxlen Maximum number of bytes to write. This should generally be + * equal to getEncodedSize(). + * @return The number of bytes encoded, or <0 on error. + */ + inline int encode(void *buf, int offset, int maxlen) const; + + /** + * Check how many bytes are required to encode this message. + */ + inline int getEncodedSize() const; + + /** + * Decode a message from binary form into this instance. + * + * @param buf The buffer containing the encoded message. + * @param offset The byte offset into @p buf where the encoded message starts. + * @param maxlen The maximum number of bytes to read while decoding. + * @return The number of bytes decoded, or <0 if an error occured. + */ + inline int decode(const void *buf, int offset, int maxlen); + + /** + * Retrieve the 64-bit fingerprint identifying the structure of the message. + * Note that the fingerprint is the same for all instances of the same + * message type, and is a fingerprint on the message type definition, not on + * the message contents. + */ + inline static int64_t getHash(); + + /** + * Returns "InterfaceDescription" + */ + inline static const char* getTypeName(); + + // LCM support functions. Users should not call these + inline int _encodeNoHash(void *buf, int offset, int maxlen) const; + inline int _getEncodedSizeNoHash() const; + inline int _decodeNoHash(const void *buf, int offset, int maxlen); + inline static uint64_t _computeHash(const __lcm_hash_ptr *p); +}; + +int InterfaceDescription::encode(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + int64_t hash = getHash(); + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos); + if (tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int InterfaceDescription::decode(const void *buf, int offset, int maxlen) +{ + int pos = 0, thislen; + + int64_t msg_hash; + thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1); + if (thislen < 0) return thislen; else pos += thislen; + if (msg_hash != getHash()) return -1; + + thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos); + if (thislen < 0) return thislen; else pos += thislen; + + return pos; +} + +int InterfaceDescription::getEncodedSize() const +{ + return 8 + _getEncodedSizeNoHash(); +} + +int64_t InterfaceDescription::getHash() +{ + static int64_t hash = static_cast(_computeHash(NULL)); + return hash; +} + +const char* InterfaceDescription::getTypeName() +{ + return "InterfaceDescription"; +} + +int InterfaceDescription::_encodeNoHash(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + + char* name_cstr = const_cast(this->name.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &name_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + char* resource_cstr = const_cast(this->resource.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &resource_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + char* field_cstr = const_cast(this->field.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &field_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + char* unit_cstr = const_cast(this->unit.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &unit_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_encode_array(buf, offset + pos, maxlen - pos, &this->state, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_encode_array(buf, offset + pos, maxlen - pos, &this->command, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_encode_array(buf, offset + pos, maxlen - pos, &this->has_hard_min, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->hard_min, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_encode_array(buf, offset + pos, maxlen - pos, &this->has_hard_max, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->hard_max, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_encode_array(buf, offset + pos, maxlen - pos, &this->has_soft_min, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->soft_min, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_encode_array(buf, offset + pos, maxlen - pos, &this->has_soft_max, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->soft_max, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->omission_policy, 1); + if(tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int InterfaceDescription::_decodeNoHash(const void *buf, int offset, int maxlen) +{ + int pos = 0, tlen; + + int32_t __name_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__name_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__name_len__ > maxlen - pos) return -1; + this->name.assign( + static_cast(buf) + offset + pos, __name_len__ - 1); + pos += __name_len__; + + int32_t __resource_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__resource_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__resource_len__ > maxlen - pos) return -1; + this->resource.assign( + static_cast(buf) + offset + pos, __resource_len__ - 1); + pos += __resource_len__; + + int32_t __field_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__field_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__field_len__ > maxlen - pos) return -1; + this->field.assign( + static_cast(buf) + offset + pos, __field_len__ - 1); + pos += __field_len__; + + int32_t __unit_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__unit_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__unit_len__ > maxlen - pos) return -1; + this->unit.assign( + static_cast(buf) + offset + pos, __unit_len__ - 1); + pos += __unit_len__; + + tlen = __boolean_decode_array(buf, offset + pos, maxlen - pos, &this->state, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_decode_array(buf, offset + pos, maxlen - pos, &this->command, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_decode_array(buf, offset + pos, maxlen - pos, &this->has_hard_min, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->hard_min, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_decode_array(buf, offset + pos, maxlen - pos, &this->has_hard_max, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->hard_max, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_decode_array(buf, offset + pos, maxlen - pos, &this->has_soft_min, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->soft_min, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_decode_array(buf, offset + pos, maxlen - pos, &this->has_soft_max, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->soft_max, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->omission_policy, 1); + if(tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int InterfaceDescription::_getEncodedSizeNoHash() const +{ + int enc_size = 0; + enc_size += this->name.size() + 4 + 1; + enc_size += this->resource.size() + 4 + 1; + enc_size += this->field.size() + 4 + 1; + enc_size += this->unit.size() + 4 + 1; + enc_size += __boolean_encoded_array_size(NULL, 1); + enc_size += __boolean_encoded_array_size(NULL, 1); + enc_size += __boolean_encoded_array_size(NULL, 1); + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __boolean_encoded_array_size(NULL, 1); + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __boolean_encoded_array_size(NULL, 1); + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __boolean_encoded_array_size(NULL, 1); + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __int8_t_encoded_array_size(NULL, 1); + return enc_size; +} + +uint64_t InterfaceDescription::_computeHash(const __lcm_hash_ptr *) +{ + uint64_t hash = 0xbfb21e12c9a9bd0dLL; + return (hash<<1) + ((hash>>63)&1); +} + +} + +#endif diff --git a/generated/cpp_lcm_msgs/dimos_control_msgs/ResourceDescription.hpp b/generated/cpp_lcm_msgs/dimos_control_msgs/ResourceDescription.hpp new file mode 100644 index 0000000..0c09dbc --- /dev/null +++ b/generated/cpp_lcm_msgs/dimos_control_msgs/ResourceDescription.hpp @@ -0,0 +1,205 @@ +/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY + * BY HAND!! + * + * Generated by lcm-gen 1.5.2 + **/ + +#ifndef __dimos_control_msgs_ResourceDescription_hpp__ +#define __dimos_control_msgs_ResourceDescription_hpp__ + +#include + +#include + +namespace dimos_control_msgs +{ + +class ResourceDescription +{ + public: + std::string name; + + int8_t resource_type; + + std::string group_name; + + public: + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t JOINT = 1; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t GRIPPER = 2; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t BASE = 3; + // If you're using C++11 and are getting compiler errors saying + // things like ‘constexpr’ needed for in-class initialization of + // static data member then re-run lcm-gen with '--cpp-std=c++11' + // to generate code that is compliant with C++11 + static const int8_t IMU = 4; + + public: + /** + * Encode a message into binary form. + * + * @param buf The output buffer. + * @param offset Encoding starts at thie byte offset into @p buf. + * @param maxlen Maximum number of bytes to write. This should generally be + * equal to getEncodedSize(). + * @return The number of bytes encoded, or <0 on error. + */ + inline int encode(void *buf, int offset, int maxlen) const; + + /** + * Check how many bytes are required to encode this message. + */ + inline int getEncodedSize() const; + + /** + * Decode a message from binary form into this instance. + * + * @param buf The buffer containing the encoded message. + * @param offset The byte offset into @p buf where the encoded message starts. + * @param maxlen The maximum number of bytes to read while decoding. + * @return The number of bytes decoded, or <0 if an error occured. + */ + inline int decode(const void *buf, int offset, int maxlen); + + /** + * Retrieve the 64-bit fingerprint identifying the structure of the message. + * Note that the fingerprint is the same for all instances of the same + * message type, and is a fingerprint on the message type definition, not on + * the message contents. + */ + inline static int64_t getHash(); + + /** + * Returns "ResourceDescription" + */ + inline static const char* getTypeName(); + + // LCM support functions. Users should not call these + inline int _encodeNoHash(void *buf, int offset, int maxlen) const; + inline int _getEncodedSizeNoHash() const; + inline int _decodeNoHash(const void *buf, int offset, int maxlen); + inline static uint64_t _computeHash(const __lcm_hash_ptr *p); +}; + +int ResourceDescription::encode(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + int64_t hash = getHash(); + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos); + if (tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ResourceDescription::decode(const void *buf, int offset, int maxlen) +{ + int pos = 0, thislen; + + int64_t msg_hash; + thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1); + if (thislen < 0) return thislen; else pos += thislen; + if (msg_hash != getHash()) return -1; + + thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos); + if (thislen < 0) return thislen; else pos += thislen; + + return pos; +} + +int ResourceDescription::getEncodedSize() const +{ + return 8 + _getEncodedSizeNoHash(); +} + +int64_t ResourceDescription::getHash() +{ + static int64_t hash = static_cast(_computeHash(NULL)); + return hash; +} + +const char* ResourceDescription::getTypeName() +{ + return "ResourceDescription"; +} + +int ResourceDescription::_encodeNoHash(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + + char* name_cstr = const_cast(this->name.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &name_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int8_t_encode_array(buf, offset + pos, maxlen - pos, &this->resource_type, 1); + if(tlen < 0) return tlen; else pos += tlen; + + char* group_name_cstr = const_cast(this->group_name.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &group_name_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ResourceDescription::_decodeNoHash(const void *buf, int offset, int maxlen) +{ + int pos = 0, tlen; + + int32_t __name_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__name_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__name_len__ > maxlen - pos) return -1; + this->name.assign( + static_cast(buf) + offset + pos, __name_len__ - 1); + pos += __name_len__; + + tlen = __int8_t_decode_array(buf, offset + pos, maxlen - pos, &this->resource_type, 1); + if(tlen < 0) return tlen; else pos += tlen; + + int32_t __group_name_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__group_name_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__group_name_len__ > maxlen - pos) return -1; + this->group_name.assign( + static_cast(buf) + offset + pos, __group_name_len__ - 1); + pos += __group_name_len__; + + return pos; +} + +int ResourceDescription::_getEncodedSizeNoHash() const +{ + int enc_size = 0; + enc_size += this->name.size() + 4 + 1; + enc_size += __int8_t_encoded_array_size(NULL, 1); + enc_size += this->group_name.size() + 4 + 1; + return enc_size; +} + +uint64_t ResourceDescription::_computeHash(const __lcm_hash_ptr *) +{ + uint64_t hash = 0x802e2d1f1cd1df73LL; + return (hash<<1) + ((hash>>63)&1); +} + +} + +#endif diff --git a/generated/cpp_lcm_msgs/dimos_core_msgs/ModuleReadiness.hpp b/generated/cpp_lcm_msgs/dimos_core_msgs/ModuleReadiness.hpp new file mode 100644 index 0000000..eb1123a --- /dev/null +++ b/generated/cpp_lcm_msgs/dimos_core_msgs/ModuleReadiness.hpp @@ -0,0 +1,210 @@ +/** THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY + * BY HAND!! + * + * Generated by lcm-gen 1.5.2 + **/ + +#ifndef __dimos_core_msgs_ModuleReadiness_hpp__ +#define __dimos_core_msgs_ModuleReadiness_hpp__ + +#include + +#include + +namespace dimos_core_msgs +{ + +class ModuleReadiness +{ + public: + std::string source; + + int64_t generation; + + int64_t sequence; + + double source_ts; + + int8_t ready; + + std::string reason; + + public: + /** + * Encode a message into binary form. + * + * @param buf The output buffer. + * @param offset Encoding starts at thie byte offset into @p buf. + * @param maxlen Maximum number of bytes to write. This should generally be + * equal to getEncodedSize(). + * @return The number of bytes encoded, or <0 on error. + */ + inline int encode(void *buf, int offset, int maxlen) const; + + /** + * Check how many bytes are required to encode this message. + */ + inline int getEncodedSize() const; + + /** + * Decode a message from binary form into this instance. + * + * @param buf The buffer containing the encoded message. + * @param offset The byte offset into @p buf where the encoded message starts. + * @param maxlen The maximum number of bytes to read while decoding. + * @return The number of bytes decoded, or <0 if an error occured. + */ + inline int decode(const void *buf, int offset, int maxlen); + + /** + * Retrieve the 64-bit fingerprint identifying the structure of the message. + * Note that the fingerprint is the same for all instances of the same + * message type, and is a fingerprint on the message type definition, not on + * the message contents. + */ + inline static int64_t getHash(); + + /** + * Returns "ModuleReadiness" + */ + inline static const char* getTypeName(); + + // LCM support functions. Users should not call these + inline int _encodeNoHash(void *buf, int offset, int maxlen) const; + inline int _getEncodedSizeNoHash() const; + inline int _decodeNoHash(const void *buf, int offset, int maxlen); + inline static uint64_t _computeHash(const __lcm_hash_ptr *p); +}; + +int ModuleReadiness::encode(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + int64_t hash = getHash(); + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos); + if (tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ModuleReadiness::decode(const void *buf, int offset, int maxlen) +{ + int pos = 0, thislen; + + int64_t msg_hash; + thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &msg_hash, 1); + if (thislen < 0) return thislen; else pos += thislen; + if (msg_hash != getHash()) return -1; + + thislen = this->_decodeNoHash(buf, offset + pos, maxlen - pos); + if (thislen < 0) return thislen; else pos += thislen; + + return pos; +} + +int ModuleReadiness::getEncodedSize() const +{ + return 8 + _getEncodedSizeNoHash(); +} + +int64_t ModuleReadiness::getHash() +{ + static int64_t hash = static_cast(_computeHash(NULL)); + return hash; +} + +const char* ModuleReadiness::getTypeName() +{ + return "ModuleReadiness"; +} + +int ModuleReadiness::_encodeNoHash(void *buf, int offset, int maxlen) const +{ + int pos = 0, tlen; + + char* source_cstr = const_cast(this->source.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &source_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->generation, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &this->sequence, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_encode_array(buf, offset + pos, maxlen - pos, &this->source_ts, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_encode_array(buf, offset + pos, maxlen - pos, &this->ready, 1); + if(tlen < 0) return tlen; else pos += tlen; + + char* reason_cstr = const_cast(this->reason.c_str()); + tlen = __string_encode_array( + buf, offset + pos, maxlen - pos, &reason_cstr, 1); + if(tlen < 0) return tlen; else pos += tlen; + + return pos; +} + +int ModuleReadiness::_decodeNoHash(const void *buf, int offset, int maxlen) +{ + int pos = 0, tlen; + + int32_t __source_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__source_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__source_len__ > maxlen - pos) return -1; + this->source.assign( + static_cast(buf) + offset + pos, __source_len__ - 1); + pos += __source_len__; + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->generation, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this->sequence, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __double_decode_array(buf, offset + pos, maxlen - pos, &this->source_ts, 1); + if(tlen < 0) return tlen; else pos += tlen; + + tlen = __boolean_decode_array(buf, offset + pos, maxlen - pos, &this->ready, 1); + if(tlen < 0) return tlen; else pos += tlen; + + int32_t __reason_len__; + tlen = __int32_t_decode_array( + buf, offset + pos, maxlen - pos, &__reason_len__, 1); + if(tlen < 0) return tlen; else pos += tlen; + if(__reason_len__ > maxlen - pos) return -1; + this->reason.assign( + static_cast(buf) + offset + pos, __reason_len__ - 1); + pos += __reason_len__; + + return pos; +} + +int ModuleReadiness::_getEncodedSizeNoHash() const +{ + int enc_size = 0; + enc_size += this->source.size() + 4 + 1; + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += __int64_t_encoded_array_size(NULL, 1); + enc_size += __double_encoded_array_size(NULL, 1); + enc_size += __boolean_encoded_array_size(NULL, 1); + enc_size += this->reason.size() + 4 + 1; + return enc_size; +} + +uint64_t ModuleReadiness::_computeHash(const __lcm_hash_ptr *) +{ + uint64_t hash = 0x150d1bfa7d87808dLL; + return (hash<<1) + ((hash>>63)&1); +} + +} + +#endif diff --git a/generated/cs_lcm_msgs/dimos_control_msgs/CommandProfile.cs b/generated/cs_lcm_msgs/dimos_control_msgs/CommandProfile.cs new file mode 100644 index 0000000..bac287b --- /dev/null +++ b/generated/cs_lcm_msgs/dimos_control_msgs/CommandProfile.cs @@ -0,0 +1,140 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen 1.5.2 + * DO NOT MODIFY BY HAND!!!! + */ + +using System; +using System.Collections.Generic; +using System.IO; +using LCM.LCM; + +namespace dimos_control_msgs +{ + public sealed class CommandProfile : LCM.LCM.LCMEncodable + { + public String name; + public int required_fields_length; + public int optional_fields_length; + public String[] required_fields; + public String[] optional_fields; + public bool uniform_across_resources; + + public CommandProfile() + { + } + + public static readonly ulong LCM_FINGERPRINT; + public static readonly ulong LCM_FINGERPRINT_BASE = 0x38538e7a9d86eb4aL; + + static CommandProfile() + { + LCM_FINGERPRINT = _hashRecursive(new List()); + } + + public static ulong _hashRecursive(List classes) + { + if (classes.Contains("dimos_control_msgs.CommandProfile")) + return 0L; + + classes.Add("dimos_control_msgs.CommandProfile"); + ulong hash = LCM_FINGERPRINT_BASE + ; + classes.RemoveAt(classes.Count - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void Encode(LCMDataOutputStream outs) + { + outs.Write((long) LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(LCMDataOutputStream outs) + { + byte[] __strbuf = null; + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.name); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + outs.Write(this.required_fields_length); + + outs.Write(this.optional_fields_length); + + for (int a = 0; a < this.required_fields_length; a++) { + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.required_fields[a]); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + } + + for (int a = 0; a < this.optional_fields_length; a++) { + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.optional_fields[a]); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + } + + outs.Write(this.uniform_across_resources); + + } + + public CommandProfile(byte[] data) : this(new LCMDataInputStream(data)) + { + } + + public CommandProfile(LCMDataInputStream ins) + { + if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT) + throw new System.IO.IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.CommandProfile _decodeRecursiveFactory(LCMDataInputStream ins) + { + dimos_control_msgs.CommandProfile o = new dimos_control_msgs.CommandProfile(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(LCMDataInputStream ins) + { + byte[] __strbuf = null; + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.name = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + this.required_fields_length = ins.ReadInt32(); + + this.optional_fields_length = ins.ReadInt32(); + + this.required_fields = new String[(int) required_fields_length]; + for (int a = 0; a < this.required_fields_length; a++) { + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.required_fields[a] = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + } + + this.optional_fields = new String[(int) optional_fields_length]; + for (int a = 0; a < this.optional_fields_length; a++) { + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.optional_fields[a] = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + } + + this.uniform_across_resources = ins.ReadBoolean(); + + } + + public dimos_control_msgs.CommandProfile Copy() + { + dimos_control_msgs.CommandProfile outobj = new dimos_control_msgs.CommandProfile(); + outobj.name = this.name; + + outobj.required_fields_length = this.required_fields_length; + + outobj.optional_fields_length = this.optional_fields_length; + + outobj.required_fields = new String[(int) required_fields_length]; + for (int a = 0; a < this.required_fields_length; a++) { + outobj.required_fields[a] = this.required_fields[a]; + } + + outobj.optional_fields = new String[(int) optional_fields_length]; + for (int a = 0; a < this.optional_fields_length; a++) { + outobj.optional_fields[a] = this.optional_fields[a]; + } + + outobj.uniform_across_resources = this.uniform_across_resources; + + return outobj; + } + } +} + diff --git a/generated/cs_lcm_msgs/dimos_control_msgs/ConnectionControl.cs b/generated/cs_lcm_msgs/dimos_control_msgs/ConnectionControl.cs new file mode 100644 index 0000000..c5b2bed --- /dev/null +++ b/generated/cs_lcm_msgs/dimos_control_msgs/ConnectionControl.cs @@ -0,0 +1,140 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen 1.5.2 + * DO NOT MODIFY BY HAND!!!! + */ + +using System; +using System.Collections.Generic; +using System.IO; +using LCM.LCM; + +namespace dimos_control_msgs +{ + public sealed class ConnectionControl : LCM.LCM.LCMEncodable + { + public int target_sources_length; + public String[] target_sources; + public long operation_id; + public sbyte operation; + public long proposed_control_epoch; + public String reason; + + public ConnectionControl() + { + } + + public static readonly ulong LCM_FINGERPRINT; + public static readonly ulong LCM_FINGERPRINT_BASE = 0xb82d9643472f465dL; + + public const int PREPARE_ARM = 1; + public const int COMMIT_ARM = 2; + public const int ABORT_ARM = 3; + public const int SAFE_STOP = 4; + public const int CLEAR_SAFE_STOP = 5; + public const int ESTOP = 6; + public const int CLEAR_ESTOP = 7; + + static ConnectionControl() + { + LCM_FINGERPRINT = _hashRecursive(new List()); + } + + public static ulong _hashRecursive(List classes) + { + if (classes.Contains("dimos_control_msgs.ConnectionControl")) + return 0L; + + classes.Add("dimos_control_msgs.ConnectionControl"); + ulong hash = LCM_FINGERPRINT_BASE + ; + classes.RemoveAt(classes.Count - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void Encode(LCMDataOutputStream outs) + { + outs.Write((long) LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(LCMDataOutputStream outs) + { + byte[] __strbuf = null; + outs.Write(this.target_sources_length); + + for (int a = 0; a < this.target_sources_length; a++) { + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.target_sources[a]); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + } + + outs.Write(this.operation_id); + + outs.Write(this.operation); + + outs.Write(this.proposed_control_epoch); + + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.reason); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + } + + public ConnectionControl(byte[] data) : this(new LCMDataInputStream(data)) + { + } + + public ConnectionControl(LCMDataInputStream ins) + { + if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT) + throw new System.IO.IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ConnectionControl _decodeRecursiveFactory(LCMDataInputStream ins) + { + dimos_control_msgs.ConnectionControl o = new dimos_control_msgs.ConnectionControl(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(LCMDataInputStream ins) + { + byte[] __strbuf = null; + this.target_sources_length = ins.ReadInt32(); + + this.target_sources = new String[(int) target_sources_length]; + for (int a = 0; a < this.target_sources_length; a++) { + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.target_sources[a] = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + } + + this.operation_id = ins.ReadInt64(); + + this.operation = ins.ReadSByte(); + + this.proposed_control_epoch = ins.ReadInt64(); + + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.reason = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + } + + public dimos_control_msgs.ConnectionControl Copy() + { + dimos_control_msgs.ConnectionControl outobj = new dimos_control_msgs.ConnectionControl(); + outobj.target_sources_length = this.target_sources_length; + + outobj.target_sources = new String[(int) target_sources_length]; + for (int a = 0; a < this.target_sources_length; a++) { + outobj.target_sources[a] = this.target_sources[a]; + } + + outobj.operation_id = this.operation_id; + + outobj.operation = this.operation; + + outobj.proposed_control_epoch = this.proposed_control_epoch; + + outobj.reason = this.reason; + + return outobj; + } + } +} + diff --git a/generated/cs_lcm_msgs/dimos_control_msgs/ConnectionDescription.cs b/generated/cs_lcm_msgs/dimos_control_msgs/ConnectionDescription.cs new file mode 100644 index 0000000..a921c45 --- /dev/null +++ b/generated/cs_lcm_msgs/dimos_control_msgs/ConnectionDescription.cs @@ -0,0 +1,231 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen 1.5.2 + * DO NOT MODIFY BY HAND!!!! + */ + +using System; +using System.Collections.Generic; +using System.IO; +using LCM.LCM; + +namespace dimos_control_msgs +{ + public sealed class ConnectionDescription : LCM.LCM.LCMEncodable + { + public String source; + public long description_epoch; + public int resources_length; + public int interfaces_length; + public int command_profiles_length; + public dimos_control_msgs.ResourceDescription[] resources; + public dimos_control_msgs.InterfaceDescription[] interfaces; + public dimos_control_msgs.CommandProfile[] command_profiles; + public double expected_state_rate_hz; + public double state_stale_timeout_s; + public double command_watchdog_timeout_s; + public sbyte activation_policy; + public sbyte armed_idle_policy; + public String safe_stop_behavior; + public sbyte process_loss_classification; + public String process_loss_evidence; + + public ConnectionDescription() + { + } + + public static readonly ulong LCM_FINGERPRINT; + public static readonly ulong LCM_FINGERPRINT_BASE = 0x31d30851f65c7d8cL; + + public const int DIRECT = 1; + public const int OPERATOR_CONFIRMED = 2; + public const int APPLY_OMISSION = 1; + public const int ARMED_IDLE_SAFE_STOP = 2; + public const int NATIVE_WATCHDOG = 1; + public const int EXTERNAL_SUPERVISOR = 2; + public const int INTRINSICALLY_SAFE = 3; + public const int SIMULATION = 4; + public const int UNPROTECTED = 5; + + static ConnectionDescription() + { + LCM_FINGERPRINT = _hashRecursive(new List()); + } + + public static ulong _hashRecursive(List classes) + { + if (classes.Contains("dimos_control_msgs.ConnectionDescription")) + return 0L; + + classes.Add("dimos_control_msgs.ConnectionDescription"); + ulong hash = LCM_FINGERPRINT_BASE + + dimos_control_msgs.ResourceDescription._hashRecursive(classes) + + dimos_control_msgs.InterfaceDescription._hashRecursive(classes) + + dimos_control_msgs.CommandProfile._hashRecursive(classes) + ; + classes.RemoveAt(classes.Count - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void Encode(LCMDataOutputStream outs) + { + outs.Write((long) LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(LCMDataOutputStream outs) + { + byte[] __strbuf = null; + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.source); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + outs.Write(this.description_epoch); + + outs.Write(this.resources_length); + + outs.Write(this.interfaces_length); + + outs.Write(this.command_profiles_length); + + for (int a = 0; a < this.resources_length; a++) { + this.resources[a]._encodeRecursive(outs); + } + + for (int a = 0; a < this.interfaces_length; a++) { + this.interfaces[a]._encodeRecursive(outs); + } + + for (int a = 0; a < this.command_profiles_length; a++) { + this.command_profiles[a]._encodeRecursive(outs); + } + + outs.Write(this.expected_state_rate_hz); + + outs.Write(this.state_stale_timeout_s); + + outs.Write(this.command_watchdog_timeout_s); + + outs.Write(this.activation_policy); + + outs.Write(this.armed_idle_policy); + + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.safe_stop_behavior); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + outs.Write(this.process_loss_classification); + + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.process_loss_evidence); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + } + + public ConnectionDescription(byte[] data) : this(new LCMDataInputStream(data)) + { + } + + public ConnectionDescription(LCMDataInputStream ins) + { + if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT) + throw new System.IO.IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ConnectionDescription _decodeRecursiveFactory(LCMDataInputStream ins) + { + dimos_control_msgs.ConnectionDescription o = new dimos_control_msgs.ConnectionDescription(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(LCMDataInputStream ins) + { + byte[] __strbuf = null; + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.source = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + this.description_epoch = ins.ReadInt64(); + + this.resources_length = ins.ReadInt32(); + + this.interfaces_length = ins.ReadInt32(); + + this.command_profiles_length = ins.ReadInt32(); + + this.resources = new dimos_control_msgs.ResourceDescription[(int) resources_length]; + for (int a = 0; a < this.resources_length; a++) { + this.resources[a] = dimos_control_msgs.ResourceDescription._decodeRecursiveFactory(ins); + } + + this.interfaces = new dimos_control_msgs.InterfaceDescription[(int) interfaces_length]; + for (int a = 0; a < this.interfaces_length; a++) { + this.interfaces[a] = dimos_control_msgs.InterfaceDescription._decodeRecursiveFactory(ins); + } + + this.command_profiles = new dimos_control_msgs.CommandProfile[(int) command_profiles_length]; + for (int a = 0; a < this.command_profiles_length; a++) { + this.command_profiles[a] = dimos_control_msgs.CommandProfile._decodeRecursiveFactory(ins); + } + + this.expected_state_rate_hz = ins.ReadDouble(); + + this.state_stale_timeout_s = ins.ReadDouble(); + + this.command_watchdog_timeout_s = ins.ReadDouble(); + + this.activation_policy = ins.ReadSByte(); + + this.armed_idle_policy = ins.ReadSByte(); + + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.safe_stop_behavior = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + this.process_loss_classification = ins.ReadSByte(); + + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.process_loss_evidence = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + } + + public dimos_control_msgs.ConnectionDescription Copy() + { + dimos_control_msgs.ConnectionDescription outobj = new dimos_control_msgs.ConnectionDescription(); + outobj.source = this.source; + + outobj.description_epoch = this.description_epoch; + + outobj.resources_length = this.resources_length; + + outobj.interfaces_length = this.interfaces_length; + + outobj.command_profiles_length = this.command_profiles_length; + + outobj.resources = new dimos_control_msgs.ResourceDescription[(int) resources_length]; + for (int a = 0; a < this.resources_length; a++) { + outobj.resources[a] = this.resources[a].Copy(); + } + + outobj.interfaces = new dimos_control_msgs.InterfaceDescription[(int) interfaces_length]; + for (int a = 0; a < this.interfaces_length; a++) { + outobj.interfaces[a] = this.interfaces[a].Copy(); + } + + outobj.command_profiles = new dimos_control_msgs.CommandProfile[(int) command_profiles_length]; + for (int a = 0; a < this.command_profiles_length; a++) { + outobj.command_profiles[a] = this.command_profiles[a].Copy(); + } + + outobj.expected_state_rate_hz = this.expected_state_rate_hz; + + outobj.state_stale_timeout_s = this.state_stale_timeout_s; + + outobj.command_watchdog_timeout_s = this.command_watchdog_timeout_s; + + outobj.activation_policy = this.activation_policy; + + outobj.armed_idle_policy = this.armed_idle_policy; + + outobj.safe_stop_behavior = this.safe_stop_behavior; + + outobj.process_loss_classification = this.process_loss_classification; + + outobj.process_loss_evidence = this.process_loss_evidence; + + return outobj; + } + } +} + diff --git a/generated/cs_lcm_msgs/dimos_control_msgs/ConnectionStatus.cs b/generated/cs_lcm_msgs/dimos_control_msgs/ConnectionStatus.cs new file mode 100644 index 0000000..76ae5d7 --- /dev/null +++ b/generated/cs_lcm_msgs/dimos_control_msgs/ConnectionStatus.cs @@ -0,0 +1,157 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen 1.5.2 + * DO NOT MODIFY BY HAND!!!! + */ + +using System; +using System.Collections.Generic; +using System.IO; +using LCM.LCM; + +namespace dimos_control_msgs +{ + public sealed class ConnectionStatus : LCM.LCM.LCMEncodable + { + public String source; + public double source_ts; + public sbyte lifecycle_state; + public long description_epoch; + public long control_epoch; + public long last_operation_id; + public sbyte last_operation; + public sbyte acknowledgement; + public String fault; + + public ConnectionStatus() + { + } + + public static readonly ulong LCM_FINGERPRINT; + public static readonly ulong LCM_FINGERPRINT_BASE = 0xc90f95ebfad6e276L; + + public const int STANDBY = 1; + public const int PREPARING = 2; + public const int PREPARED = 3; + public const int COMMITTING = 4; + public const int ARMED = 5; + public const int SAFE_STOPPED = 6; + public const int ESTOPPED = 7; + public const int NONE = 0; + public const int PENDING = 1; + public const int SUCCEEDED = 2; + public const int REJECTED = 3; + + static ConnectionStatus() + { + LCM_FINGERPRINT = _hashRecursive(new List()); + } + + public static ulong _hashRecursive(List classes) + { + if (classes.Contains("dimos_control_msgs.ConnectionStatus")) + return 0L; + + classes.Add("dimos_control_msgs.ConnectionStatus"); + ulong hash = LCM_FINGERPRINT_BASE + ; + classes.RemoveAt(classes.Count - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void Encode(LCMDataOutputStream outs) + { + outs.Write((long) LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(LCMDataOutputStream outs) + { + byte[] __strbuf = null; + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.source); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + outs.Write(this.source_ts); + + outs.Write(this.lifecycle_state); + + outs.Write(this.description_epoch); + + outs.Write(this.control_epoch); + + outs.Write(this.last_operation_id); + + outs.Write(this.last_operation); + + outs.Write(this.acknowledgement); + + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.fault); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + } + + public ConnectionStatus(byte[] data) : this(new LCMDataInputStream(data)) + { + } + + public ConnectionStatus(LCMDataInputStream ins) + { + if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT) + throw new System.IO.IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ConnectionStatus _decodeRecursiveFactory(LCMDataInputStream ins) + { + dimos_control_msgs.ConnectionStatus o = new dimos_control_msgs.ConnectionStatus(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(LCMDataInputStream ins) + { + byte[] __strbuf = null; + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.source = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + this.source_ts = ins.ReadDouble(); + + this.lifecycle_state = ins.ReadSByte(); + + this.description_epoch = ins.ReadInt64(); + + this.control_epoch = ins.ReadInt64(); + + this.last_operation_id = ins.ReadInt64(); + + this.last_operation = ins.ReadSByte(); + + this.acknowledgement = ins.ReadSByte(); + + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.fault = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + } + + public dimos_control_msgs.ConnectionStatus Copy() + { + dimos_control_msgs.ConnectionStatus outobj = new dimos_control_msgs.ConnectionStatus(); + outobj.source = this.source; + + outobj.source_ts = this.source_ts; + + outobj.lifecycle_state = this.lifecycle_state; + + outobj.description_epoch = this.description_epoch; + + outobj.control_epoch = this.control_epoch; + + outobj.last_operation_id = this.last_operation_id; + + outobj.last_operation = this.last_operation; + + outobj.acknowledgement = this.acknowledgement; + + outobj.fault = this.fault; + + return outobj; + } + } +} + diff --git a/generated/cs_lcm_msgs/dimos_control_msgs/ControlValues.cs b/generated/cs_lcm_msgs/dimos_control_msgs/ControlValues.cs new file mode 100644 index 0000000..6893c66 --- /dev/null +++ b/generated/cs_lcm_msgs/dimos_control_msgs/ControlValues.cs @@ -0,0 +1,154 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen 1.5.2 + * DO NOT MODIFY BY HAND!!!! + */ + +using System; +using System.Collections.Generic; +using System.IO; +using LCM.LCM; + +namespace dimos_control_msgs +{ + public sealed class ControlValues : LCM.LCM.LCMEncodable + { + public String source; + public double source_ts; + public long epoch; + public long sequence; + public int interface_names_length; + public int values_length; + public String[] interface_names; + public double[] values; + + public ControlValues() + { + } + + public static readonly ulong LCM_FINGERPRINT; + public static readonly ulong LCM_FINGERPRINT_BASE = 0x98d9f64b18d5a4cfL; + + static ControlValues() + { + LCM_FINGERPRINT = _hashRecursive(new List()); + } + + public static ulong _hashRecursive(List classes) + { + if (classes.Contains("dimos_control_msgs.ControlValues")) + return 0L; + + classes.Add("dimos_control_msgs.ControlValues"); + ulong hash = LCM_FINGERPRINT_BASE + ; + classes.RemoveAt(classes.Count - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void Encode(LCMDataOutputStream outs) + { + outs.Write((long) LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(LCMDataOutputStream outs) + { + byte[] __strbuf = null; + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.source); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + outs.Write(this.source_ts); + + outs.Write(this.epoch); + + outs.Write(this.sequence); + + outs.Write(this.interface_names_length); + + outs.Write(this.values_length); + + for (int a = 0; a < this.interface_names_length; a++) { + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.interface_names[a]); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + } + + for (int a = 0; a < this.values_length; a++) { + outs.Write(this.values[a]); + } + + } + + public ControlValues(byte[] data) : this(new LCMDataInputStream(data)) + { + } + + public ControlValues(LCMDataInputStream ins) + { + if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT) + throw new System.IO.IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ControlValues _decodeRecursiveFactory(LCMDataInputStream ins) + { + dimos_control_msgs.ControlValues o = new dimos_control_msgs.ControlValues(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(LCMDataInputStream ins) + { + byte[] __strbuf = null; + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.source = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + this.source_ts = ins.ReadDouble(); + + this.epoch = ins.ReadInt64(); + + this.sequence = ins.ReadInt64(); + + this.interface_names_length = ins.ReadInt32(); + + this.values_length = ins.ReadInt32(); + + this.interface_names = new String[(int) interface_names_length]; + for (int a = 0; a < this.interface_names_length; a++) { + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.interface_names[a] = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + } + + this.values = new double[(int) values_length]; + for (int a = 0; a < this.values_length; a++) { + this.values[a] = ins.ReadDouble(); + } + + } + + public dimos_control_msgs.ControlValues Copy() + { + dimos_control_msgs.ControlValues outobj = new dimos_control_msgs.ControlValues(); + outobj.source = this.source; + + outobj.source_ts = this.source_ts; + + outobj.epoch = this.epoch; + + outobj.sequence = this.sequence; + + outobj.interface_names_length = this.interface_names_length; + + outobj.values_length = this.values_length; + + outobj.interface_names = new String[(int) interface_names_length]; + for (int a = 0; a < this.interface_names_length; a++) { + outobj.interface_names[a] = this.interface_names[a]; + } + + outobj.values = new double[(int) values_length]; + for (int a = 0; a < this.values_length; a++) { + outobj.values[a] = this.values[a]; + } + + return outobj; + } + } +} + diff --git a/generated/cs_lcm_msgs/dimos_control_msgs/InterfaceDescription.cs b/generated/cs_lcm_msgs/dimos_control_msgs/InterfaceDescription.cs new file mode 100644 index 0000000..b8b93d9 --- /dev/null +++ b/generated/cs_lcm_msgs/dimos_control_msgs/InterfaceDescription.cs @@ -0,0 +1,191 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen 1.5.2 + * DO NOT MODIFY BY HAND!!!! + */ + +using System; +using System.Collections.Generic; +using System.IO; +using LCM.LCM; + +namespace dimos_control_msgs +{ + public sealed class InterfaceDescription : LCM.LCM.LCMEncodable + { + public String name; + public String resource; + public String field; + public String unit; + public bool state; + public bool command; + public bool has_hard_min; + public double hard_min; + public bool has_hard_max; + public double hard_max; + public bool has_soft_min; + public double soft_min; + public bool has_soft_max; + public double soft_max; + public sbyte omission_policy; + + public InterfaceDescription() + { + } + + public static readonly ulong LCM_FINGERPRINT; + public static readonly ulong LCM_FINGERPRINT_BASE = 0xbfb21e12c9a9bd0dL; + + public const int HOLD_LAST = 1; + public const int ZERO = 2; + public const int SAFE_STOP = 3; + + static InterfaceDescription() + { + LCM_FINGERPRINT = _hashRecursive(new List()); + } + + public static ulong _hashRecursive(List classes) + { + if (classes.Contains("dimos_control_msgs.InterfaceDescription")) + return 0L; + + classes.Add("dimos_control_msgs.InterfaceDescription"); + ulong hash = LCM_FINGERPRINT_BASE + ; + classes.RemoveAt(classes.Count - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void Encode(LCMDataOutputStream outs) + { + outs.Write((long) LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(LCMDataOutputStream outs) + { + byte[] __strbuf = null; + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.name); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.resource); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.field); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.unit); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + outs.Write(this.state); + + outs.Write(this.command); + + outs.Write(this.has_hard_min); + + outs.Write(this.hard_min); + + outs.Write(this.has_hard_max); + + outs.Write(this.hard_max); + + outs.Write(this.has_soft_min); + + outs.Write(this.soft_min); + + outs.Write(this.has_soft_max); + + outs.Write(this.soft_max); + + outs.Write(this.omission_policy); + + } + + public InterfaceDescription(byte[] data) : this(new LCMDataInputStream(data)) + { + } + + public InterfaceDescription(LCMDataInputStream ins) + { + if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT) + throw new System.IO.IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.InterfaceDescription _decodeRecursiveFactory(LCMDataInputStream ins) + { + dimos_control_msgs.InterfaceDescription o = new dimos_control_msgs.InterfaceDescription(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(LCMDataInputStream ins) + { + byte[] __strbuf = null; + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.name = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.resource = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.field = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.unit = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + this.state = ins.ReadBoolean(); + + this.command = ins.ReadBoolean(); + + this.has_hard_min = ins.ReadBoolean(); + + this.hard_min = ins.ReadDouble(); + + this.has_hard_max = ins.ReadBoolean(); + + this.hard_max = ins.ReadDouble(); + + this.has_soft_min = ins.ReadBoolean(); + + this.soft_min = ins.ReadDouble(); + + this.has_soft_max = ins.ReadBoolean(); + + this.soft_max = ins.ReadDouble(); + + this.omission_policy = ins.ReadSByte(); + + } + + public dimos_control_msgs.InterfaceDescription Copy() + { + dimos_control_msgs.InterfaceDescription outobj = new dimos_control_msgs.InterfaceDescription(); + outobj.name = this.name; + + outobj.resource = this.resource; + + outobj.field = this.field; + + outobj.unit = this.unit; + + outobj.state = this.state; + + outobj.command = this.command; + + outobj.has_hard_min = this.has_hard_min; + + outobj.hard_min = this.hard_min; + + outobj.has_hard_max = this.has_hard_max; + + outobj.hard_max = this.hard_max; + + outobj.has_soft_min = this.has_soft_min; + + outobj.soft_min = this.soft_min; + + outobj.has_soft_max = this.has_soft_max; + + outobj.soft_max = this.soft_max; + + outobj.omission_policy = this.omission_policy; + + return outobj; + } + } +} + diff --git a/generated/cs_lcm_msgs/dimos_control_msgs/ResourceDescription.cs b/generated/cs_lcm_msgs/dimos_control_msgs/ResourceDescription.cs new file mode 100644 index 0000000..c62ba8b --- /dev/null +++ b/generated/cs_lcm_msgs/dimos_control_msgs/ResourceDescription.cs @@ -0,0 +1,108 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen 1.5.2 + * DO NOT MODIFY BY HAND!!!! + */ + +using System; +using System.Collections.Generic; +using System.IO; +using LCM.LCM; + +namespace dimos_control_msgs +{ + public sealed class ResourceDescription : LCM.LCM.LCMEncodable + { + public String name; + public sbyte resource_type; + public String group_name; + + public ResourceDescription() + { + } + + public static readonly ulong LCM_FINGERPRINT; + public static readonly ulong LCM_FINGERPRINT_BASE = 0x802e2d1f1cd1df73L; + + public const int JOINT = 1; + public const int GRIPPER = 2; + public const int BASE = 3; + public const int IMU = 4; + + static ResourceDescription() + { + LCM_FINGERPRINT = _hashRecursive(new List()); + } + + public static ulong _hashRecursive(List classes) + { + if (classes.Contains("dimos_control_msgs.ResourceDescription")) + return 0L; + + classes.Add("dimos_control_msgs.ResourceDescription"); + ulong hash = LCM_FINGERPRINT_BASE + ; + classes.RemoveAt(classes.Count - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void Encode(LCMDataOutputStream outs) + { + outs.Write((long) LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(LCMDataOutputStream outs) + { + byte[] __strbuf = null; + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.name); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + outs.Write(this.resource_type); + + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.group_name); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + } + + public ResourceDescription(byte[] data) : this(new LCMDataInputStream(data)) + { + } + + public ResourceDescription(LCMDataInputStream ins) + { + if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT) + throw new System.IO.IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ResourceDescription _decodeRecursiveFactory(LCMDataInputStream ins) + { + dimos_control_msgs.ResourceDescription o = new dimos_control_msgs.ResourceDescription(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(LCMDataInputStream ins) + { + byte[] __strbuf = null; + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.name = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + this.resource_type = ins.ReadSByte(); + + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.group_name = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + } + + public dimos_control_msgs.ResourceDescription Copy() + { + dimos_control_msgs.ResourceDescription outobj = new dimos_control_msgs.ResourceDescription(); + outobj.name = this.name; + + outobj.resource_type = this.resource_type; + + outobj.group_name = this.group_name; + + return outobj; + } + } +} + diff --git a/generated/cs_lcm_msgs/dimos_core_msgs/ModuleReadiness.cs b/generated/cs_lcm_msgs/dimos_core_msgs/ModuleReadiness.cs new file mode 100644 index 0000000..6bd2098 --- /dev/null +++ b/generated/cs_lcm_msgs/dimos_core_msgs/ModuleReadiness.cs @@ -0,0 +1,124 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen 1.5.2 + * DO NOT MODIFY BY HAND!!!! + */ + +using System; +using System.Collections.Generic; +using System.IO; +using LCM.LCM; + +namespace dimos_core_msgs +{ + public sealed class ModuleReadiness : LCM.LCM.LCMEncodable + { + public String source; + public long generation; + public long sequence; + public double source_ts; + public bool ready; + public String reason; + + public ModuleReadiness() + { + } + + public static readonly ulong LCM_FINGERPRINT; + public static readonly ulong LCM_FINGERPRINT_BASE = 0x150d1bfa7d87808dL; + + static ModuleReadiness() + { + LCM_FINGERPRINT = _hashRecursive(new List()); + } + + public static ulong _hashRecursive(List classes) + { + if (classes.Contains("dimos_core_msgs.ModuleReadiness")) + return 0L; + + classes.Add("dimos_core_msgs.ModuleReadiness"); + ulong hash = LCM_FINGERPRINT_BASE + ; + classes.RemoveAt(classes.Count - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void Encode(LCMDataOutputStream outs) + { + outs.Write((long) LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(LCMDataOutputStream outs) + { + byte[] __strbuf = null; + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.source); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + outs.Write(this.generation); + + outs.Write(this.sequence); + + outs.Write(this.source_ts); + + outs.Write(this.ready); + + __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.reason); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); + + } + + public ModuleReadiness(byte[] data) : this(new LCMDataInputStream(data)) + { + } + + public ModuleReadiness(LCMDataInputStream ins) + { + if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT) + throw new System.IO.IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_core_msgs.ModuleReadiness _decodeRecursiveFactory(LCMDataInputStream ins) + { + dimos_core_msgs.ModuleReadiness o = new dimos_core_msgs.ModuleReadiness(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(LCMDataInputStream ins) + { + byte[] __strbuf = null; + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.source = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + this.generation = ins.ReadInt64(); + + this.sequence = ins.ReadInt64(); + + this.source_ts = ins.ReadDouble(); + + this.ready = ins.ReadBoolean(); + + __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.reason = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf); + + } + + public dimos_core_msgs.ModuleReadiness Copy() + { + dimos_core_msgs.ModuleReadiness outobj = new dimos_core_msgs.ModuleReadiness(); + outobj.source = this.source; + + outobj.generation = this.generation; + + outobj.sequence = this.sequence; + + outobj.source_ts = this.source_ts; + + outobj.ready = this.ready; + + outobj.reason = this.reason; + + return outobj; + } + } +} + diff --git a/generated/java_lcm_msgs/dimos_control_msgs/CommandProfile.java b/generated/java_lcm_msgs/dimos_control_msgs/CommandProfile.java new file mode 100644 index 0000000..8102acf --- /dev/null +++ b/generated/java_lcm_msgs/dimos_control_msgs/CommandProfile.java @@ -0,0 +1,148 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen + * DO NOT MODIFY BY HAND!!!! + * lcm-gen 1.5.2 + */ + +package dimos_control_msgs; + +import java.io.*; +import java.util.*; +import lcm.lcm.*; + +public final class CommandProfile implements lcm.lcm.LCMEncodable +{ + public String name; + + public int required_fields_length; + + public int optional_fields_length; + + /** + * LCM Type: string[required_fields_length] + */ + public String required_fields[]; + + /** + * LCM Type: string[optional_fields_length] + */ + public String optional_fields[]; + + public boolean uniform_across_resources; + + + public CommandProfile() + { + } + + public static final long LCM_FINGERPRINT; + public static final long LCM_FINGERPRINT_BASE = 0x38538e7a9d86eb4aL; + + static { + LCM_FINGERPRINT = _hashRecursive(new ArrayList>()); + } + + public static long _hashRecursive(ArrayList> classes) + { + if (classes.contains(dimos_control_msgs.CommandProfile.class)) + return 0L; + + classes.add(dimos_control_msgs.CommandProfile.class); + long hash = LCM_FINGERPRINT_BASE + ; + classes.remove(classes.size() - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void encode(DataOutput outs) throws IOException + { + outs.writeLong(LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(DataOutput outs) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[this.name.length()]; this.name.getChars(0, this.name.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + outs.writeInt(this.required_fields_length); + + outs.writeInt(this.optional_fields_length); + + for (int a = 0; a < this.required_fields_length; a++) { + __strbuf = new char[this.required_fields[a].length()]; this.required_fields[a].getChars(0, this.required_fields[a].length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + } + + for (int a = 0; a < this.optional_fields_length; a++) { + __strbuf = new char[this.optional_fields[a].length()]; this.optional_fields[a].getChars(0, this.optional_fields[a].length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + } + + outs.writeByte( this.uniform_across_resources ? 1 : 0); + + } + + public CommandProfile(byte[] data) throws IOException + { + this(new LCMDataInputStream(data)); + } + + public CommandProfile(DataInput ins) throws IOException + { + if (ins.readLong() != LCM_FINGERPRINT) + throw new IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.CommandProfile _decodeRecursiveFactory(DataInput ins) throws IOException + { + dimos_control_msgs.CommandProfile o = new dimos_control_msgs.CommandProfile(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(DataInput ins) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.name = new String(__strbuf); + + this.required_fields_length = ins.readInt(); + + this.optional_fields_length = ins.readInt(); + + this.required_fields = new String[(int) required_fields_length]; + for (int a = 0; a < this.required_fields_length; a++) { + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.required_fields[a] = new String(__strbuf); + } + + this.optional_fields = new String[(int) optional_fields_length]; + for (int a = 0; a < this.optional_fields_length; a++) { + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.optional_fields[a] = new String(__strbuf); + } + + this.uniform_across_resources = ins.readByte()!=0; + + } + + public dimos_control_msgs.CommandProfile copy() + { + dimos_control_msgs.CommandProfile outobj = new dimos_control_msgs.CommandProfile(); + outobj.name = this.name; + + outobj.required_fields_length = this.required_fields_length; + + outobj.optional_fields_length = this.optional_fields_length; + + outobj.required_fields = new String[(int) required_fields_length]; + if (this.required_fields_length > 0) + System.arraycopy(this.required_fields, 0, outobj.required_fields, 0, (int) this.required_fields_length); + outobj.optional_fields = new String[(int) optional_fields_length]; + if (this.optional_fields_length > 0) + System.arraycopy(this.optional_fields, 0, outobj.optional_fields, 0, (int) this.optional_fields_length); + outobj.uniform_across_resources = this.uniform_across_resources; + + return outobj; + } + +} + diff --git a/generated/java_lcm_msgs/dimos_control_msgs/ConnectionControl.java b/generated/java_lcm_msgs/dimos_control_msgs/ConnectionControl.java new file mode 100644 index 0000000..8387ce8 --- /dev/null +++ b/generated/java_lcm_msgs/dimos_control_msgs/ConnectionControl.java @@ -0,0 +1,147 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen + * DO NOT MODIFY BY HAND!!!! + * lcm-gen 1.5.2 + */ + +package dimos_control_msgs; + +import java.io.*; +import java.util.*; +import lcm.lcm.*; + +public final class ConnectionControl implements lcm.lcm.LCMEncodable +{ + public int target_sources_length; + + /** + * LCM Type: string[target_sources_length] + */ + public String target_sources[]; + + public long operation_id; + + public byte operation; + + public long proposed_control_epoch; + + public String reason; + + + public ConnectionControl() + { + } + + public static final long LCM_FINGERPRINT; + public static final long LCM_FINGERPRINT_BASE = 0xb82d9643472f465dL; + + public static final byte PREPARE_ARM = (byte) 1; + public static final byte COMMIT_ARM = (byte) 2; + public static final byte ABORT_ARM = (byte) 3; + public static final byte SAFE_STOP = (byte) 4; + public static final byte CLEAR_SAFE_STOP = (byte) 5; + public static final byte ESTOP = (byte) 6; + public static final byte CLEAR_ESTOP = (byte) 7; + + static { + LCM_FINGERPRINT = _hashRecursive(new ArrayList>()); + } + + public static long _hashRecursive(ArrayList> classes) + { + if (classes.contains(dimos_control_msgs.ConnectionControl.class)) + return 0L; + + classes.add(dimos_control_msgs.ConnectionControl.class); + long hash = LCM_FINGERPRINT_BASE + ; + classes.remove(classes.size() - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void encode(DataOutput outs) throws IOException + { + outs.writeLong(LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(DataOutput outs) throws IOException + { + char[] __strbuf = null; + outs.writeInt(this.target_sources_length); + + for (int a = 0; a < this.target_sources_length; a++) { + __strbuf = new char[this.target_sources[a].length()]; this.target_sources[a].getChars(0, this.target_sources[a].length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + } + + outs.writeLong(this.operation_id); + + outs.writeByte(this.operation); + + outs.writeLong(this.proposed_control_epoch); + + __strbuf = new char[this.reason.length()]; this.reason.getChars(0, this.reason.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + } + + public ConnectionControl(byte[] data) throws IOException + { + this(new LCMDataInputStream(data)); + } + + public ConnectionControl(DataInput ins) throws IOException + { + if (ins.readLong() != LCM_FINGERPRINT) + throw new IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ConnectionControl _decodeRecursiveFactory(DataInput ins) throws IOException + { + dimos_control_msgs.ConnectionControl o = new dimos_control_msgs.ConnectionControl(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(DataInput ins) throws IOException + { + char[] __strbuf = null; + this.target_sources_length = ins.readInt(); + + this.target_sources = new String[(int) target_sources_length]; + for (int a = 0; a < this.target_sources_length; a++) { + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.target_sources[a] = new String(__strbuf); + } + + this.operation_id = ins.readLong(); + + this.operation = ins.readByte(); + + this.proposed_control_epoch = ins.readLong(); + + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.reason = new String(__strbuf); + + } + + public dimos_control_msgs.ConnectionControl copy() + { + dimos_control_msgs.ConnectionControl outobj = new dimos_control_msgs.ConnectionControl(); + outobj.target_sources_length = this.target_sources_length; + + outobj.target_sources = new String[(int) target_sources_length]; + if (this.target_sources_length > 0) + System.arraycopy(this.target_sources, 0, outobj.target_sources, 0, (int) this.target_sources_length); + outobj.operation_id = this.operation_id; + + outobj.operation = this.operation; + + outobj.proposed_control_epoch = this.proposed_control_epoch; + + outobj.reason = this.reason; + + return outobj; + } + +} + diff --git a/generated/java_lcm_msgs/dimos_control_msgs/ConnectionDescription.java b/generated/java_lcm_msgs/dimos_control_msgs/ConnectionDescription.java new file mode 100644 index 0000000..00e7a74 --- /dev/null +++ b/generated/java_lcm_msgs/dimos_control_msgs/ConnectionDescription.java @@ -0,0 +1,256 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen + * DO NOT MODIFY BY HAND!!!! + * lcm-gen 1.5.2 + */ + +package dimos_control_msgs; + +import java.io.*; +import java.util.*; +import lcm.lcm.*; + +public final class ConnectionDescription implements lcm.lcm.LCMEncodable +{ + public String source; + + public long description_epoch; + + public int resources_length; + + public int interfaces_length; + + public int command_profiles_length; + + /** + * LCM Type: dimos_control_msgs.ResourceDescription[resources_length] + */ + public dimos_control_msgs.ResourceDescription resources[]; + + /** + * LCM Type: dimos_control_msgs.InterfaceDescription[interfaces_length] + */ + public dimos_control_msgs.InterfaceDescription interfaces[]; + + /** + * LCM Type: dimos_control_msgs.CommandProfile[command_profiles_length] + */ + public dimos_control_msgs.CommandProfile command_profiles[]; + + public double expected_state_rate_hz; + + public double state_stale_timeout_s; + + public double command_watchdog_timeout_s; + + public byte activation_policy; + + public byte armed_idle_policy; + + public String safe_stop_behavior; + + public byte process_loss_classification; + + public String process_loss_evidence; + + + public ConnectionDescription() + { + } + + public static final long LCM_FINGERPRINT; + public static final long LCM_FINGERPRINT_BASE = 0x31d30851f65c7d8cL; + + public static final byte DIRECT = (byte) 1; + public static final byte OPERATOR_CONFIRMED = (byte) 2; + public static final byte APPLY_OMISSION = (byte) 1; + public static final byte ARMED_IDLE_SAFE_STOP = (byte) 2; + public static final byte NATIVE_WATCHDOG = (byte) 1; + public static final byte EXTERNAL_SUPERVISOR = (byte) 2; + public static final byte INTRINSICALLY_SAFE = (byte) 3; + public static final byte SIMULATION = (byte) 4; + public static final byte UNPROTECTED = (byte) 5; + + static { + LCM_FINGERPRINT = _hashRecursive(new ArrayList>()); + } + + public static long _hashRecursive(ArrayList> classes) + { + if (classes.contains(dimos_control_msgs.ConnectionDescription.class)) + return 0L; + + classes.add(dimos_control_msgs.ConnectionDescription.class); + long hash = LCM_FINGERPRINT_BASE + + dimos_control_msgs.ResourceDescription._hashRecursive(classes) + + dimos_control_msgs.InterfaceDescription._hashRecursive(classes) + + dimos_control_msgs.CommandProfile._hashRecursive(classes) + ; + classes.remove(classes.size() - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void encode(DataOutput outs) throws IOException + { + outs.writeLong(LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(DataOutput outs) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[this.source.length()]; this.source.getChars(0, this.source.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + outs.writeLong(this.description_epoch); + + outs.writeInt(this.resources_length); + + outs.writeInt(this.interfaces_length); + + outs.writeInt(this.command_profiles_length); + + for (int a = 0; a < this.resources_length; a++) { + this.resources[a]._encodeRecursive(outs); + } + + for (int a = 0; a < this.interfaces_length; a++) { + this.interfaces[a]._encodeRecursive(outs); + } + + for (int a = 0; a < this.command_profiles_length; a++) { + this.command_profiles[a]._encodeRecursive(outs); + } + + outs.writeDouble(this.expected_state_rate_hz); + + outs.writeDouble(this.state_stale_timeout_s); + + outs.writeDouble(this.command_watchdog_timeout_s); + + outs.writeByte(this.activation_policy); + + outs.writeByte(this.armed_idle_policy); + + __strbuf = new char[this.safe_stop_behavior.length()]; this.safe_stop_behavior.getChars(0, this.safe_stop_behavior.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + outs.writeByte(this.process_loss_classification); + + __strbuf = new char[this.process_loss_evidence.length()]; this.process_loss_evidence.getChars(0, this.process_loss_evidence.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + } + + public ConnectionDescription(byte[] data) throws IOException + { + this(new LCMDataInputStream(data)); + } + + public ConnectionDescription(DataInput ins) throws IOException + { + if (ins.readLong() != LCM_FINGERPRINT) + throw new IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ConnectionDescription _decodeRecursiveFactory(DataInput ins) throws IOException + { + dimos_control_msgs.ConnectionDescription o = new dimos_control_msgs.ConnectionDescription(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(DataInput ins) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.source = new String(__strbuf); + + this.description_epoch = ins.readLong(); + + this.resources_length = ins.readInt(); + + this.interfaces_length = ins.readInt(); + + this.command_profiles_length = ins.readInt(); + + this.resources = new dimos_control_msgs.ResourceDescription[(int) resources_length]; + for (int a = 0; a < this.resources_length; a++) { + this.resources[a] = dimos_control_msgs.ResourceDescription._decodeRecursiveFactory(ins); + } + + this.interfaces = new dimos_control_msgs.InterfaceDescription[(int) interfaces_length]; + for (int a = 0; a < this.interfaces_length; a++) { + this.interfaces[a] = dimos_control_msgs.InterfaceDescription._decodeRecursiveFactory(ins); + } + + this.command_profiles = new dimos_control_msgs.CommandProfile[(int) command_profiles_length]; + for (int a = 0; a < this.command_profiles_length; a++) { + this.command_profiles[a] = dimos_control_msgs.CommandProfile._decodeRecursiveFactory(ins); + } + + this.expected_state_rate_hz = ins.readDouble(); + + this.state_stale_timeout_s = ins.readDouble(); + + this.command_watchdog_timeout_s = ins.readDouble(); + + this.activation_policy = ins.readByte(); + + this.armed_idle_policy = ins.readByte(); + + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.safe_stop_behavior = new String(__strbuf); + + this.process_loss_classification = ins.readByte(); + + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.process_loss_evidence = new String(__strbuf); + + } + + public dimos_control_msgs.ConnectionDescription copy() + { + dimos_control_msgs.ConnectionDescription outobj = new dimos_control_msgs.ConnectionDescription(); + outobj.source = this.source; + + outobj.description_epoch = this.description_epoch; + + outobj.resources_length = this.resources_length; + + outobj.interfaces_length = this.interfaces_length; + + outobj.command_profiles_length = this.command_profiles_length; + + outobj.resources = new dimos_control_msgs.ResourceDescription[(int) resources_length]; + for (int a = 0; a < this.resources_length; a++) { + outobj.resources[a] = this.resources[a].copy(); + } + + outobj.interfaces = new dimos_control_msgs.InterfaceDescription[(int) interfaces_length]; + for (int a = 0; a < this.interfaces_length; a++) { + outobj.interfaces[a] = this.interfaces[a].copy(); + } + + outobj.command_profiles = new dimos_control_msgs.CommandProfile[(int) command_profiles_length]; + for (int a = 0; a < this.command_profiles_length; a++) { + outobj.command_profiles[a] = this.command_profiles[a].copy(); + } + + outobj.expected_state_rate_hz = this.expected_state_rate_hz; + + outobj.state_stale_timeout_s = this.state_stale_timeout_s; + + outobj.command_watchdog_timeout_s = this.command_watchdog_timeout_s; + + outobj.activation_policy = this.activation_policy; + + outobj.armed_idle_policy = this.armed_idle_policy; + + outobj.safe_stop_behavior = this.safe_stop_behavior; + + outobj.process_loss_classification = this.process_loss_classification; + + outobj.process_loss_evidence = this.process_loss_evidence; + + return outobj; + } + +} + diff --git a/generated/java_lcm_msgs/dimos_control_msgs/ConnectionStatus.java b/generated/java_lcm_msgs/dimos_control_msgs/ConnectionStatus.java new file mode 100644 index 0000000..837afd5 --- /dev/null +++ b/generated/java_lcm_msgs/dimos_control_msgs/ConnectionStatus.java @@ -0,0 +1,166 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen + * DO NOT MODIFY BY HAND!!!! + * lcm-gen 1.5.2 + */ + +package dimos_control_msgs; + +import java.io.*; +import java.util.*; +import lcm.lcm.*; + +public final class ConnectionStatus implements lcm.lcm.LCMEncodable +{ + public String source; + + public double source_ts; + + public byte lifecycle_state; + + public long description_epoch; + + public long control_epoch; + + public long last_operation_id; + + public byte last_operation; + + public byte acknowledgement; + + public String fault; + + + public ConnectionStatus() + { + } + + public static final long LCM_FINGERPRINT; + public static final long LCM_FINGERPRINT_BASE = 0xc90f95ebfad6e276L; + + public static final byte STANDBY = (byte) 1; + public static final byte PREPARING = (byte) 2; + public static final byte PREPARED = (byte) 3; + public static final byte COMMITTING = (byte) 4; + public static final byte ARMED = (byte) 5; + public static final byte SAFE_STOPPED = (byte) 6; + public static final byte ESTOPPED = (byte) 7; + public static final byte NONE = (byte) 0; + public static final byte PENDING = (byte) 1; + public static final byte SUCCEEDED = (byte) 2; + public static final byte REJECTED = (byte) 3; + + static { + LCM_FINGERPRINT = _hashRecursive(new ArrayList>()); + } + + public static long _hashRecursive(ArrayList> classes) + { + if (classes.contains(dimos_control_msgs.ConnectionStatus.class)) + return 0L; + + classes.add(dimos_control_msgs.ConnectionStatus.class); + long hash = LCM_FINGERPRINT_BASE + ; + classes.remove(classes.size() - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void encode(DataOutput outs) throws IOException + { + outs.writeLong(LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(DataOutput outs) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[this.source.length()]; this.source.getChars(0, this.source.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + outs.writeDouble(this.source_ts); + + outs.writeByte(this.lifecycle_state); + + outs.writeLong(this.description_epoch); + + outs.writeLong(this.control_epoch); + + outs.writeLong(this.last_operation_id); + + outs.writeByte(this.last_operation); + + outs.writeByte(this.acknowledgement); + + __strbuf = new char[this.fault.length()]; this.fault.getChars(0, this.fault.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + } + + public ConnectionStatus(byte[] data) throws IOException + { + this(new LCMDataInputStream(data)); + } + + public ConnectionStatus(DataInput ins) throws IOException + { + if (ins.readLong() != LCM_FINGERPRINT) + throw new IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ConnectionStatus _decodeRecursiveFactory(DataInput ins) throws IOException + { + dimos_control_msgs.ConnectionStatus o = new dimos_control_msgs.ConnectionStatus(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(DataInput ins) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.source = new String(__strbuf); + + this.source_ts = ins.readDouble(); + + this.lifecycle_state = ins.readByte(); + + this.description_epoch = ins.readLong(); + + this.control_epoch = ins.readLong(); + + this.last_operation_id = ins.readLong(); + + this.last_operation = ins.readByte(); + + this.acknowledgement = ins.readByte(); + + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.fault = new String(__strbuf); + + } + + public dimos_control_msgs.ConnectionStatus copy() + { + dimos_control_msgs.ConnectionStatus outobj = new dimos_control_msgs.ConnectionStatus(); + outobj.source = this.source; + + outobj.source_ts = this.source_ts; + + outobj.lifecycle_state = this.lifecycle_state; + + outobj.description_epoch = this.description_epoch; + + outobj.control_epoch = this.control_epoch; + + outobj.last_operation_id = this.last_operation_id; + + outobj.last_operation = this.last_operation; + + outobj.acknowledgement = this.acknowledgement; + + outobj.fault = this.fault; + + return outobj; + } + +} + diff --git a/generated/java_lcm_msgs/dimos_control_msgs/ControlValues.java b/generated/java_lcm_msgs/dimos_control_msgs/ControlValues.java new file mode 100644 index 0000000..3e13810 --- /dev/null +++ b/generated/java_lcm_msgs/dimos_control_msgs/ControlValues.java @@ -0,0 +1,164 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen + * DO NOT MODIFY BY HAND!!!! + * lcm-gen 1.5.2 + */ + +package dimos_control_msgs; + +import java.io.*; +import java.util.*; +import lcm.lcm.*; + +public final class ControlValues implements lcm.lcm.LCMEncodable +{ + public String source; + + public double source_ts; + + public long epoch; + + public long sequence; + + public int interface_names_length; + + public int values_length; + + /** + * LCM Type: string[interface_names_length] + */ + public String interface_names[]; + + /** + * LCM Type: double[values_length] + */ + public double values[]; + + + public ControlValues() + { + } + + public static final long LCM_FINGERPRINT; + public static final long LCM_FINGERPRINT_BASE = 0x98d9f64b18d5a4cfL; + + static { + LCM_FINGERPRINT = _hashRecursive(new ArrayList>()); + } + + public static long _hashRecursive(ArrayList> classes) + { + if (classes.contains(dimos_control_msgs.ControlValues.class)) + return 0L; + + classes.add(dimos_control_msgs.ControlValues.class); + long hash = LCM_FINGERPRINT_BASE + ; + classes.remove(classes.size() - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void encode(DataOutput outs) throws IOException + { + outs.writeLong(LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(DataOutput outs) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[this.source.length()]; this.source.getChars(0, this.source.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + outs.writeDouble(this.source_ts); + + outs.writeLong(this.epoch); + + outs.writeLong(this.sequence); + + outs.writeInt(this.interface_names_length); + + outs.writeInt(this.values_length); + + for (int a = 0; a < this.interface_names_length; a++) { + __strbuf = new char[this.interface_names[a].length()]; this.interface_names[a].getChars(0, this.interface_names[a].length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + } + + for (int a = 0; a < this.values_length; a++) { + outs.writeDouble(this.values[a]); + } + + } + + public ControlValues(byte[] data) throws IOException + { + this(new LCMDataInputStream(data)); + } + + public ControlValues(DataInput ins) throws IOException + { + if (ins.readLong() != LCM_FINGERPRINT) + throw new IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ControlValues _decodeRecursiveFactory(DataInput ins) throws IOException + { + dimos_control_msgs.ControlValues o = new dimos_control_msgs.ControlValues(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(DataInput ins) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.source = new String(__strbuf); + + this.source_ts = ins.readDouble(); + + this.epoch = ins.readLong(); + + this.sequence = ins.readLong(); + + this.interface_names_length = ins.readInt(); + + this.values_length = ins.readInt(); + + this.interface_names = new String[(int) interface_names_length]; + for (int a = 0; a < this.interface_names_length; a++) { + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.interface_names[a] = new String(__strbuf); + } + + this.values = new double[(int) values_length]; + for (int a = 0; a < this.values_length; a++) { + this.values[a] = ins.readDouble(); + } + + } + + public dimos_control_msgs.ControlValues copy() + { + dimos_control_msgs.ControlValues outobj = new dimos_control_msgs.ControlValues(); + outobj.source = this.source; + + outobj.source_ts = this.source_ts; + + outobj.epoch = this.epoch; + + outobj.sequence = this.sequence; + + outobj.interface_names_length = this.interface_names_length; + + outobj.values_length = this.values_length; + + outobj.interface_names = new String[(int) interface_names_length]; + if (this.interface_names_length > 0) + System.arraycopy(this.interface_names, 0, outobj.interface_names, 0, (int) this.interface_names_length); + outobj.values = new double[(int) values_length]; + if (this.values_length > 0) + System.arraycopy(this.values, 0, outobj.values, 0, (int) this.values_length); + return outobj; + } + +} + diff --git a/generated/java_lcm_msgs/dimos_control_msgs/InterfaceDescription.java b/generated/java_lcm_msgs/dimos_control_msgs/InterfaceDescription.java new file mode 100644 index 0000000..12686c3 --- /dev/null +++ b/generated/java_lcm_msgs/dimos_control_msgs/InterfaceDescription.java @@ -0,0 +1,206 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen + * DO NOT MODIFY BY HAND!!!! + * lcm-gen 1.5.2 + */ + +package dimos_control_msgs; + +import java.io.*; +import java.util.*; +import lcm.lcm.*; + +public final class InterfaceDescription implements lcm.lcm.LCMEncodable +{ + public String name; + + public String resource; + + public String field; + + public String unit; + + public boolean state; + + public boolean command; + + public boolean has_hard_min; + + public double hard_min; + + public boolean has_hard_max; + + public double hard_max; + + public boolean has_soft_min; + + public double soft_min; + + public boolean has_soft_max; + + public double soft_max; + + public byte omission_policy; + + + public InterfaceDescription() + { + } + + public static final long LCM_FINGERPRINT; + public static final long LCM_FINGERPRINT_BASE = 0xbfb21e12c9a9bd0dL; + + public static final byte HOLD_LAST = (byte) 1; + public static final byte ZERO = (byte) 2; + public static final byte SAFE_STOP = (byte) 3; + + static { + LCM_FINGERPRINT = _hashRecursive(new ArrayList>()); + } + + public static long _hashRecursive(ArrayList> classes) + { + if (classes.contains(dimos_control_msgs.InterfaceDescription.class)) + return 0L; + + classes.add(dimos_control_msgs.InterfaceDescription.class); + long hash = LCM_FINGERPRINT_BASE + ; + classes.remove(classes.size() - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void encode(DataOutput outs) throws IOException + { + outs.writeLong(LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(DataOutput outs) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[this.name.length()]; this.name.getChars(0, this.name.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + __strbuf = new char[this.resource.length()]; this.resource.getChars(0, this.resource.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + __strbuf = new char[this.field.length()]; this.field.getChars(0, this.field.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + __strbuf = new char[this.unit.length()]; this.unit.getChars(0, this.unit.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + outs.writeByte( this.state ? 1 : 0); + + outs.writeByte( this.command ? 1 : 0); + + outs.writeByte( this.has_hard_min ? 1 : 0); + + outs.writeDouble(this.hard_min); + + outs.writeByte( this.has_hard_max ? 1 : 0); + + outs.writeDouble(this.hard_max); + + outs.writeByte( this.has_soft_min ? 1 : 0); + + outs.writeDouble(this.soft_min); + + outs.writeByte( this.has_soft_max ? 1 : 0); + + outs.writeDouble(this.soft_max); + + outs.writeByte(this.omission_policy); + + } + + public InterfaceDescription(byte[] data) throws IOException + { + this(new LCMDataInputStream(data)); + } + + public InterfaceDescription(DataInput ins) throws IOException + { + if (ins.readLong() != LCM_FINGERPRINT) + throw new IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.InterfaceDescription _decodeRecursiveFactory(DataInput ins) throws IOException + { + dimos_control_msgs.InterfaceDescription o = new dimos_control_msgs.InterfaceDescription(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(DataInput ins) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.name = new String(__strbuf); + + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.resource = new String(__strbuf); + + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.field = new String(__strbuf); + + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.unit = new String(__strbuf); + + this.state = ins.readByte()!=0; + + this.command = ins.readByte()!=0; + + this.has_hard_min = ins.readByte()!=0; + + this.hard_min = ins.readDouble(); + + this.has_hard_max = ins.readByte()!=0; + + this.hard_max = ins.readDouble(); + + this.has_soft_min = ins.readByte()!=0; + + this.soft_min = ins.readDouble(); + + this.has_soft_max = ins.readByte()!=0; + + this.soft_max = ins.readDouble(); + + this.omission_policy = ins.readByte(); + + } + + public dimos_control_msgs.InterfaceDescription copy() + { + dimos_control_msgs.InterfaceDescription outobj = new dimos_control_msgs.InterfaceDescription(); + outobj.name = this.name; + + outobj.resource = this.resource; + + outobj.field = this.field; + + outobj.unit = this.unit; + + outobj.state = this.state; + + outobj.command = this.command; + + outobj.has_hard_min = this.has_hard_min; + + outobj.hard_min = this.hard_min; + + outobj.has_hard_max = this.has_hard_max; + + outobj.hard_max = this.hard_max; + + outobj.has_soft_min = this.has_soft_min; + + outobj.soft_min = this.soft_min; + + outobj.has_soft_max = this.has_soft_max; + + outobj.soft_max = this.soft_max; + + outobj.omission_policy = this.omission_policy; + + return outobj; + } + +} + diff --git a/generated/java_lcm_msgs/dimos_control_msgs/ResourceDescription.java b/generated/java_lcm_msgs/dimos_control_msgs/ResourceDescription.java new file mode 100644 index 0000000..f6a2df7 --- /dev/null +++ b/generated/java_lcm_msgs/dimos_control_msgs/ResourceDescription.java @@ -0,0 +1,111 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen + * DO NOT MODIFY BY HAND!!!! + * lcm-gen 1.5.2 + */ + +package dimos_control_msgs; + +import java.io.*; +import java.util.*; +import lcm.lcm.*; + +public final class ResourceDescription implements lcm.lcm.LCMEncodable +{ + public String name; + + public byte resource_type; + + public String group_name; + + + public ResourceDescription() + { + } + + public static final long LCM_FINGERPRINT; + public static final long LCM_FINGERPRINT_BASE = 0x802e2d1f1cd1df73L; + + public static final byte JOINT = (byte) 1; + public static final byte GRIPPER = (byte) 2; + public static final byte BASE = (byte) 3; + public static final byte IMU = (byte) 4; + + static { + LCM_FINGERPRINT = _hashRecursive(new ArrayList>()); + } + + public static long _hashRecursive(ArrayList> classes) + { + if (classes.contains(dimos_control_msgs.ResourceDescription.class)) + return 0L; + + classes.add(dimos_control_msgs.ResourceDescription.class); + long hash = LCM_FINGERPRINT_BASE + ; + classes.remove(classes.size() - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void encode(DataOutput outs) throws IOException + { + outs.writeLong(LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(DataOutput outs) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[this.name.length()]; this.name.getChars(0, this.name.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + outs.writeByte(this.resource_type); + + __strbuf = new char[this.group_name.length()]; this.group_name.getChars(0, this.group_name.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + } + + public ResourceDescription(byte[] data) throws IOException + { + this(new LCMDataInputStream(data)); + } + + public ResourceDescription(DataInput ins) throws IOException + { + if (ins.readLong() != LCM_FINGERPRINT) + throw new IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_control_msgs.ResourceDescription _decodeRecursiveFactory(DataInput ins) throws IOException + { + dimos_control_msgs.ResourceDescription o = new dimos_control_msgs.ResourceDescription(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(DataInput ins) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.name = new String(__strbuf); + + this.resource_type = ins.readByte(); + + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.group_name = new String(__strbuf); + + } + + public dimos_control_msgs.ResourceDescription copy() + { + dimos_control_msgs.ResourceDescription outobj = new dimos_control_msgs.ResourceDescription(); + outobj.name = this.name; + + outobj.resource_type = this.resource_type; + + outobj.group_name = this.group_name; + + return outobj; + } + +} + diff --git a/generated/java_lcm_msgs/dimos_core_msgs/ModuleReadiness.java b/generated/java_lcm_msgs/dimos_core_msgs/ModuleReadiness.java new file mode 100644 index 0000000..95bd6ad --- /dev/null +++ b/generated/java_lcm_msgs/dimos_core_msgs/ModuleReadiness.java @@ -0,0 +1,130 @@ +/* LCM type definition class file + * This file was automatically generated by lcm-gen + * DO NOT MODIFY BY HAND!!!! + * lcm-gen 1.5.2 + */ + +package dimos_core_msgs; + +import java.io.*; +import java.util.*; +import lcm.lcm.*; + +public final class ModuleReadiness implements lcm.lcm.LCMEncodable +{ + public String source; + + public long generation; + + public long sequence; + + public double source_ts; + + public boolean ready; + + public String reason; + + + public ModuleReadiness() + { + } + + public static final long LCM_FINGERPRINT; + public static final long LCM_FINGERPRINT_BASE = 0x150d1bfa7d87808dL; + + static { + LCM_FINGERPRINT = _hashRecursive(new ArrayList>()); + } + + public static long _hashRecursive(ArrayList> classes) + { + if (classes.contains(dimos_core_msgs.ModuleReadiness.class)) + return 0L; + + classes.add(dimos_core_msgs.ModuleReadiness.class); + long hash = LCM_FINGERPRINT_BASE + ; + classes.remove(classes.size() - 1); + return (hash<<1) + ((hash>>63)&1); + } + + public void encode(DataOutput outs) throws IOException + { + outs.writeLong(LCM_FINGERPRINT); + _encodeRecursive(outs); + } + + public void _encodeRecursive(DataOutput outs) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[this.source.length()]; this.source.getChars(0, this.source.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + outs.writeLong(this.generation); + + outs.writeLong(this.sequence); + + outs.writeDouble(this.source_ts); + + outs.writeByte( this.ready ? 1 : 0); + + __strbuf = new char[this.reason.length()]; this.reason.getChars(0, this.reason.length(), __strbuf, 0); outs.writeInt(__strbuf.length+1); for (int _i = 0; _i < __strbuf.length; _i++) outs.write(__strbuf[_i]); outs.writeByte(0); + + } + + public ModuleReadiness(byte[] data) throws IOException + { + this(new LCMDataInputStream(data)); + } + + public ModuleReadiness(DataInput ins) throws IOException + { + if (ins.readLong() != LCM_FINGERPRINT) + throw new IOException("LCM Decode error: bad fingerprint"); + + _decodeRecursive(ins); + } + + public static dimos_core_msgs.ModuleReadiness _decodeRecursiveFactory(DataInput ins) throws IOException + { + dimos_core_msgs.ModuleReadiness o = new dimos_core_msgs.ModuleReadiness(); + o._decodeRecursive(ins); + return o; + } + + public void _decodeRecursive(DataInput ins) throws IOException + { + char[] __strbuf = null; + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.source = new String(__strbuf); + + this.generation = ins.readLong(); + + this.sequence = ins.readLong(); + + this.source_ts = ins.readDouble(); + + this.ready = ins.readByte()!=0; + + __strbuf = new char[ins.readInt()-1]; for (int _i = 0; _i < __strbuf.length; _i++) __strbuf[_i] = (char) (ins.readByte()&0xff); ins.readByte(); this.reason = new String(__strbuf); + + } + + public dimos_core_msgs.ModuleReadiness copy() + { + dimos_core_msgs.ModuleReadiness outobj = new dimos_core_msgs.ModuleReadiness(); + outobj.source = this.source; + + outobj.generation = this.generation; + + outobj.sequence = this.sequence; + + outobj.source_ts = this.source_ts; + + outobj.ready = this.ready; + + outobj.reason = this.reason; + + return outobj; + } + +} + diff --git a/generated/lua_lcm_msgs/actionlib_msgs/init.lua b/generated/lua_lcm_msgs/actionlib_msgs/init.lua index 718bc08..980c546 100644 --- a/generated/lua_lcm_msgs/actionlib_msgs/init.lua +++ b/generated/lua_lcm_msgs/actionlib_msgs/init.lua @@ -7,9 +7,9 @@ lcm-gen 1.5.2 local M = {} +M.GoalStatusArray = require('actionlib_msgs.GoalStatusArray') M.GoalStatus = require('actionlib_msgs.GoalStatus') M.GoalID = require('actionlib_msgs.GoalID') -M.GoalStatusArray = require('actionlib_msgs.GoalStatusArray') return M diff --git a/generated/lua_lcm_msgs/diagnostic_msgs/init.lua b/generated/lua_lcm_msgs/diagnostic_msgs/init.lua index 61dbfbf..6b436d3 100644 --- a/generated/lua_lcm_msgs/diagnostic_msgs/init.lua +++ b/generated/lua_lcm_msgs/diagnostic_msgs/init.lua @@ -8,8 +8,8 @@ lcm-gen 1.5.2 local M = {} M.DiagnosticStatus = require('diagnostic_msgs.DiagnosticStatus') -M.DiagnosticArray = require('diagnostic_msgs.DiagnosticArray') M.KeyValue = require('diagnostic_msgs.KeyValue') +M.DiagnosticArray = require('diagnostic_msgs.DiagnosticArray') return M diff --git a/generated/lua_lcm_msgs/dimos_control_msgs/CommandProfile.lua b/generated/lua_lcm_msgs/dimos_control_msgs/CommandProfile.lua new file mode 100644 index 0000000..6bd8223 --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_control_msgs/CommandProfile.lua @@ -0,0 +1,145 @@ +--[[ +LCM type definitions +This file automatically generated by lcm 1.5.2. +DO NOT MODIFY BY HAND!!!! +--]] + +local lcm = require('lcm') + +local setmetatable = setmetatable +local ipairs = ipairs +local table = table +local string = string +local unpack = unpack or table.unpack + +-- buffer helper for decoding +local _buffer_helper = {} +_buffer_helper.__index = _buffer_helper + +function _buffer_helper:new(data_str) + + local obj = {buffer = data_str, index = 1} + setmetatable(obj, self) + + return obj +end + +function _buffer_helper:read(n_bytes) + + local partial = self.buffer:sub(self.index, self.index + n_bytes - 1) + self.index = self.index + n_bytes + + if self.index > #self.buffer + 1 then + error('buffer ran out of bytes') + end + + return partial +end + +local CommandProfile = {} +CommandProfile.__index = CommandProfile + +CommandProfile.name = 'dimos_control_msgs.CommandProfile' +CommandProfile.packagename = 'dimos_control_msgs' +CommandProfile.shortname = 'CommandProfile' + +function CommandProfile:new() + + local obj = {} + + obj.name = '' + obj.required_fields_length = 0 + obj.optional_fields_length = 0 + obj.required_fields = {} + obj.optional_fields = {} + obj.uniform_across_resources = false + + setmetatable(obj, self) + + return obj +end + +function CommandProfile._get_hash_recursive(parents) + + local newparents = {} + + for _, v in ipairs(parents) do + if v == CommandProfile then return lcm._hash.new('0x0') end + table.insert(newparents, v) + end + + table.insert(newparents, CommandProfile) + + local hash = lcm._hash.new('0x38538e7a9d86eb4a') + hash:rotate(1) + + return hash +end + +CommandProfile._packed_fingerprint = lcm._pack.pack('>X', CommandProfile._get_hash_recursive({})) + +function CommandProfile:encode() + + return CommandProfile._packed_fingerprint .. self:_encode_one() +end + +function CommandProfile:_encode_one() + + local buf_table = {} + + local __name_tmpstr = lcm._pack.prepare_string(self.name) + table.insert(buf_table, lcm._pack.pack('>I', #__name_tmpstr + 1)) + table.insert(buf_table, __name_tmpstr .. '\0') + table.insert(buf_table, lcm._pack.pack('>ii', self.required_fields_length, self.optional_fields_length)) + for i0 = 1, self.required_fields_length do + local __required_fields_tmpstr = lcm._pack.prepare_string(self.required_fields[i0]) + table.insert(buf_table, lcm._pack.pack('>I', #__required_fields_tmpstr + 1)) + table.insert(buf_table, __required_fields_tmpstr .. '\0') + end + for i0 = 1, self.optional_fields_length do + local __optional_fields_tmpstr = lcm._pack.prepare_string(self.optional_fields[i0]) + table.insert(buf_table, lcm._pack.pack('>I', #__optional_fields_tmpstr + 1)) + table.insert(buf_table, __optional_fields_tmpstr .. '\0') + end + table.insert(buf_table, lcm._pack.pack('>?', self.uniform_across_resources)) + + return table.concat(buf_table) +end + +function CommandProfile.decode(data) + + if data:sub(1, 8) ~= CommandProfile._packed_fingerprint then + error('bad fingerprint') + end + + return CommandProfile._decode_one(data:sub(9)) +end + +function CommandProfile._decode_one(data) + + if not data.read then + data = _buffer_helper:new(data) + end + + local obj = CommandProfile:new() + + local __name_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.name = lcm._pack.prepare_string(data:read(__name_tmpstrlen)) + obj.required_fields_length, obj.optional_fields_length = lcm._pack.unpack('>ii', data:read(8)) + obj.required_fields = {} + for i0 = 1, obj.required_fields_length do + local __required_fields_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.required_fields[i0] = lcm._pack.prepare_string(data:read(__required_fields_tmpstrlen)) + end + obj.optional_fields = {} + for i0 = 1, obj.optional_fields_length do + local __optional_fields_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.optional_fields[i0] = lcm._pack.prepare_string(data:read(__optional_fields_tmpstrlen)) + end + obj.uniform_across_resources = lcm._pack.unpack('>?', data:read(1)) + + return obj +end + +return CommandProfile + diff --git a/generated/lua_lcm_msgs/dimos_control_msgs/ConnectionControl.lua b/generated/lua_lcm_msgs/dimos_control_msgs/ConnectionControl.lua new file mode 100644 index 0000000..2f3fdf1 --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_control_msgs/ConnectionControl.lua @@ -0,0 +1,143 @@ +--[[ +LCM type definitions +This file automatically generated by lcm 1.5.2. +DO NOT MODIFY BY HAND!!!! +--]] + +local lcm = require('lcm') + +local setmetatable = setmetatable +local ipairs = ipairs +local table = table +local string = string +local unpack = unpack or table.unpack + +-- buffer helper for decoding +local _buffer_helper = {} +_buffer_helper.__index = _buffer_helper + +function _buffer_helper:new(data_str) + + local obj = {buffer = data_str, index = 1} + setmetatable(obj, self) + + return obj +end + +function _buffer_helper:read(n_bytes) + + local partial = self.buffer:sub(self.index, self.index + n_bytes - 1) + self.index = self.index + n_bytes + + if self.index > #self.buffer + 1 then + error('buffer ran out of bytes') + end + + return partial +end + +local ConnectionControl = {} +ConnectionControl.__index = ConnectionControl + + ConnectionControl.PREPARE_ARM = 1 + ConnectionControl.COMMIT_ARM = 2 + ConnectionControl.ABORT_ARM = 3 + ConnectionControl.SAFE_STOP = 4 + ConnectionControl.CLEAR_SAFE_STOP = 5 + ConnectionControl.ESTOP = 6 + ConnectionControl.CLEAR_ESTOP = 7 + +ConnectionControl.name = 'dimos_control_msgs.ConnectionControl' +ConnectionControl.packagename = 'dimos_control_msgs' +ConnectionControl.shortname = 'ConnectionControl' + +function ConnectionControl:new() + + local obj = {} + + obj.target_sources_length = 0 + obj.target_sources = {} + obj.operation_id = 0 + obj.operation = 0 + obj.proposed_control_epoch = 0 + obj.reason = '' + + setmetatable(obj, self) + + return obj +end + +function ConnectionControl._get_hash_recursive(parents) + + local newparents = {} + + for _, v in ipairs(parents) do + if v == ConnectionControl then return lcm._hash.new('0x0') end + table.insert(newparents, v) + end + + table.insert(newparents, ConnectionControl) + + local hash = lcm._hash.new('0xb82d9643472f465d') + hash:rotate(1) + + return hash +end + +ConnectionControl._packed_fingerprint = lcm._pack.pack('>X', ConnectionControl._get_hash_recursive({})) + +function ConnectionControl:encode() + + return ConnectionControl._packed_fingerprint .. self:_encode_one() +end + +function ConnectionControl:_encode_one() + + local buf_table = {} + + table.insert(buf_table, lcm._pack.pack('>i', self.target_sources_length)) + for i0 = 1, self.target_sources_length do + local __target_sources_tmpstr = lcm._pack.prepare_string(self.target_sources[i0]) + table.insert(buf_table, lcm._pack.pack('>I', #__target_sources_tmpstr + 1)) + table.insert(buf_table, __target_sources_tmpstr .. '\0') + end + table.insert(buf_table, lcm._pack.pack('>qbq', self.operation_id, self.operation, self.proposed_control_epoch)) + local __reason_tmpstr = lcm._pack.prepare_string(self.reason) + table.insert(buf_table, lcm._pack.pack('>I', #__reason_tmpstr + 1)) + table.insert(buf_table, __reason_tmpstr .. '\0') + + return table.concat(buf_table) +end + +function ConnectionControl.decode(data) + + if data:sub(1, 8) ~= ConnectionControl._packed_fingerprint then + error('bad fingerprint') + end + + return ConnectionControl._decode_one(data:sub(9)) +end + +function ConnectionControl._decode_one(data) + + if not data.read then + data = _buffer_helper:new(data) + end + + local obj = ConnectionControl:new() + + obj.target_sources_length = lcm._pack.unpack('>i', data:read(4)) + obj.target_sources = {} + for i0 = 1, obj.target_sources_length do + local __target_sources_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.target_sources[i0] = lcm._pack.prepare_string(data:read(__target_sources_tmpstrlen)) + end + obj.operation_id, obj.operation, obj.proposed_control_epoch = lcm._pack.unpack('>qbq', data:read(17)) + local __reason_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.reason = lcm._pack.prepare_string(data:read(__reason_tmpstrlen)) + + return obj +end + +return ConnectionControl + diff --git a/generated/lua_lcm_msgs/dimos_control_msgs/ConnectionDescription.lua b/generated/lua_lcm_msgs/dimos_control_msgs/ConnectionDescription.lua new file mode 100644 index 0000000..21bcc43 --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_control_msgs/ConnectionDescription.lua @@ -0,0 +1,185 @@ +--[[ +LCM type definitions +This file automatically generated by lcm 1.5.2. +DO NOT MODIFY BY HAND!!!! +--]] + +local lcm = require('lcm') + +local dimos_control_msgs_ResourceDescription = require('dimos_control_msgs.ResourceDescription') +local dimos_control_msgs_InterfaceDescription = require('dimos_control_msgs.InterfaceDescription') +local dimos_control_msgs_CommandProfile = require('dimos_control_msgs.CommandProfile') + +local setmetatable = setmetatable +local ipairs = ipairs +local table = table +local string = string +local unpack = unpack or table.unpack + +-- buffer helper for decoding +local _buffer_helper = {} +_buffer_helper.__index = _buffer_helper + +function _buffer_helper:new(data_str) + + local obj = {buffer = data_str, index = 1} + setmetatable(obj, self) + + return obj +end + +function _buffer_helper:read(n_bytes) + + local partial = self.buffer:sub(self.index, self.index + n_bytes - 1) + self.index = self.index + n_bytes + + if self.index > #self.buffer + 1 then + error('buffer ran out of bytes') + end + + return partial +end + +local ConnectionDescription = {} +ConnectionDescription.__index = ConnectionDescription + + ConnectionDescription.DIRECT = 1 + ConnectionDescription.OPERATOR_CONFIRMED = 2 + ConnectionDescription.APPLY_OMISSION = 1 + ConnectionDescription.ARMED_IDLE_SAFE_STOP = 2 + ConnectionDescription.NATIVE_WATCHDOG = 1 + ConnectionDescription.EXTERNAL_SUPERVISOR = 2 + ConnectionDescription.INTRINSICALLY_SAFE = 3 + ConnectionDescription.SIMULATION = 4 + ConnectionDescription.UNPROTECTED = 5 + +ConnectionDescription.name = 'dimos_control_msgs.ConnectionDescription' +ConnectionDescription.packagename = 'dimos_control_msgs' +ConnectionDescription.shortname = 'ConnectionDescription' + +function ConnectionDescription:new() + + local obj = {} + + obj.source = '' + obj.description_epoch = 0 + obj.resources_length = 0 + obj.interfaces_length = 0 + obj.command_profiles_length = 0 + obj.resources = {} + obj.interfaces = {} + obj.command_profiles = {} + obj.expected_state_rate_hz = 0.0 + obj.state_stale_timeout_s = 0.0 + obj.command_watchdog_timeout_s = 0.0 + obj.activation_policy = 0 + obj.armed_idle_policy = 0 + obj.safe_stop_behavior = '' + obj.process_loss_classification = 0 + obj.process_loss_evidence = '' + + setmetatable(obj, self) + + return obj +end + +function ConnectionDescription._get_hash_recursive(parents) + + local newparents = {} + + for _, v in ipairs(parents) do + if v == ConnectionDescription then return lcm._hash.new('0x0') end + table.insert(newparents, v) + end + + table.insert(newparents, ConnectionDescription) + + local hash = lcm._hash.new('0x31d30851f65c7d8c') + + dimos_control_msgs_ResourceDescription._get_hash_recursive(newparents) + + dimos_control_msgs_InterfaceDescription._get_hash_recursive(newparents) + + dimos_control_msgs_CommandProfile._get_hash_recursive(newparents) + hash:rotate(1) + + return hash +end + +ConnectionDescription._packed_fingerprint = lcm._pack.pack('>X', ConnectionDescription._get_hash_recursive({})) + +function ConnectionDescription:encode() + + return ConnectionDescription._packed_fingerprint .. self:_encode_one() +end + +function ConnectionDescription:_encode_one() + + local buf_table = {} + + local __source_tmpstr = lcm._pack.prepare_string(self.source) + table.insert(buf_table, lcm._pack.pack('>I', #__source_tmpstr + 1)) + table.insert(buf_table, __source_tmpstr .. '\0') + table.insert(buf_table, lcm._pack.pack('>qiii', self.description_epoch, self.resources_length, self.interfaces_length, self.command_profiles_length)) + for i0 = 1, self.resources_length do + table.insert(buf_table, self.resources[i0]:_encode_one()) + end + for i0 = 1, self.interfaces_length do + table.insert(buf_table, self.interfaces[i0]:_encode_one()) + end + for i0 = 1, self.command_profiles_length do + table.insert(buf_table, self.command_profiles[i0]:_encode_one()) + end + table.insert(buf_table, lcm._pack.pack('>dddbb', self.expected_state_rate_hz, self.state_stale_timeout_s, self.command_watchdog_timeout_s, self.activation_policy, self.armed_idle_policy)) + local __safe_stop_behavior_tmpstr = lcm._pack.prepare_string(self.safe_stop_behavior) + table.insert(buf_table, lcm._pack.pack('>I', #__safe_stop_behavior_tmpstr + 1)) + table.insert(buf_table, __safe_stop_behavior_tmpstr .. '\0') + table.insert(buf_table, lcm._pack.pack('>b', self.process_loss_classification)) + local __process_loss_evidence_tmpstr = lcm._pack.prepare_string(self.process_loss_evidence) + table.insert(buf_table, lcm._pack.pack('>I', #__process_loss_evidence_tmpstr + 1)) + table.insert(buf_table, __process_loss_evidence_tmpstr .. '\0') + + return table.concat(buf_table) +end + +function ConnectionDescription.decode(data) + + if data:sub(1, 8) ~= ConnectionDescription._packed_fingerprint then + error('bad fingerprint') + end + + return ConnectionDescription._decode_one(data:sub(9)) +end + +function ConnectionDescription._decode_one(data) + + if not data.read then + data = _buffer_helper:new(data) + end + + local obj = ConnectionDescription:new() + + local __source_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.source = lcm._pack.prepare_string(data:read(__source_tmpstrlen)) + obj.description_epoch, obj.resources_length, obj.interfaces_length, obj.command_profiles_length = lcm._pack.unpack('>qiii', data:read(20)) + obj.resources = {} + for i0 = 1, obj.resources_length do + obj.resources[i0] = dimos_control_msgs_ResourceDescription._decode_one(data) + end + obj.interfaces = {} + for i0 = 1, obj.interfaces_length do + obj.interfaces[i0] = dimos_control_msgs_InterfaceDescription._decode_one(data) + end + obj.command_profiles = {} + for i0 = 1, obj.command_profiles_length do + obj.command_profiles[i0] = dimos_control_msgs_CommandProfile._decode_one(data) + end + obj.expected_state_rate_hz, obj.state_stale_timeout_s, obj.command_watchdog_timeout_s, obj.activation_policy, obj.armed_idle_policy = lcm._pack.unpack('>dddbb', data:read(26)) + local __safe_stop_behavior_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.safe_stop_behavior = lcm._pack.prepare_string(data:read(__safe_stop_behavior_tmpstrlen)) + obj.process_loss_classification = lcm._pack.unpack('>b', data:read(1)) + local __process_loss_evidence_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.process_loss_evidence = lcm._pack.prepare_string(data:read(__process_loss_evidence_tmpstrlen)) + + return obj +end + +return ConnectionDescription + diff --git a/generated/lua_lcm_msgs/dimos_control_msgs/ConnectionStatus.lua b/generated/lua_lcm_msgs/dimos_control_msgs/ConnectionStatus.lua new file mode 100644 index 0000000..76a81ee --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_control_msgs/ConnectionStatus.lua @@ -0,0 +1,143 @@ +--[[ +LCM type definitions +This file automatically generated by lcm 1.5.2. +DO NOT MODIFY BY HAND!!!! +--]] + +local lcm = require('lcm') + +local setmetatable = setmetatable +local ipairs = ipairs +local table = table +local string = string +local unpack = unpack or table.unpack + +-- buffer helper for decoding +local _buffer_helper = {} +_buffer_helper.__index = _buffer_helper + +function _buffer_helper:new(data_str) + + local obj = {buffer = data_str, index = 1} + setmetatable(obj, self) + + return obj +end + +function _buffer_helper:read(n_bytes) + + local partial = self.buffer:sub(self.index, self.index + n_bytes - 1) + self.index = self.index + n_bytes + + if self.index > #self.buffer + 1 then + error('buffer ran out of bytes') + end + + return partial +end + +local ConnectionStatus = {} +ConnectionStatus.__index = ConnectionStatus + + ConnectionStatus.STANDBY = 1 + ConnectionStatus.PREPARING = 2 + ConnectionStatus.PREPARED = 3 + ConnectionStatus.COMMITTING = 4 + ConnectionStatus.ARMED = 5 + ConnectionStatus.SAFE_STOPPED = 6 + ConnectionStatus.ESTOPPED = 7 + ConnectionStatus.NONE = 0 + ConnectionStatus.PENDING = 1 + ConnectionStatus.SUCCEEDED = 2 + ConnectionStatus.REJECTED = 3 + +ConnectionStatus.name = 'dimos_control_msgs.ConnectionStatus' +ConnectionStatus.packagename = 'dimos_control_msgs' +ConnectionStatus.shortname = 'ConnectionStatus' + +function ConnectionStatus:new() + + local obj = {} + + obj.source = '' + obj.source_ts = 0.0 + obj.lifecycle_state = 0 + obj.description_epoch = 0 + obj.control_epoch = 0 + obj.last_operation_id = 0 + obj.last_operation = 0 + obj.acknowledgement = 0 + obj.fault = '' + + setmetatable(obj, self) + + return obj +end + +function ConnectionStatus._get_hash_recursive(parents) + + local newparents = {} + + for _, v in ipairs(parents) do + if v == ConnectionStatus then return lcm._hash.new('0x0') end + table.insert(newparents, v) + end + + table.insert(newparents, ConnectionStatus) + + local hash = lcm._hash.new('0xc90f95ebfad6e276') + hash:rotate(1) + + return hash +end + +ConnectionStatus._packed_fingerprint = lcm._pack.pack('>X', ConnectionStatus._get_hash_recursive({})) + +function ConnectionStatus:encode() + + return ConnectionStatus._packed_fingerprint .. self:_encode_one() +end + +function ConnectionStatus:_encode_one() + + local buf_table = {} + + local __source_tmpstr = lcm._pack.prepare_string(self.source) + table.insert(buf_table, lcm._pack.pack('>I', #__source_tmpstr + 1)) + table.insert(buf_table, __source_tmpstr .. '\0') + table.insert(buf_table, lcm._pack.pack('>dbqqqbb', self.source_ts, self.lifecycle_state, self.description_epoch, self.control_epoch, self.last_operation_id, self.last_operation, self.acknowledgement)) + local __fault_tmpstr = lcm._pack.prepare_string(self.fault) + table.insert(buf_table, lcm._pack.pack('>I', #__fault_tmpstr + 1)) + table.insert(buf_table, __fault_tmpstr .. '\0') + + return table.concat(buf_table) +end + +function ConnectionStatus.decode(data) + + if data:sub(1, 8) ~= ConnectionStatus._packed_fingerprint then + error('bad fingerprint') + end + + return ConnectionStatus._decode_one(data:sub(9)) +end + +function ConnectionStatus._decode_one(data) + + if not data.read then + data = _buffer_helper:new(data) + end + + local obj = ConnectionStatus:new() + + local __source_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.source = lcm._pack.prepare_string(data:read(__source_tmpstrlen)) + obj.source_ts, obj.lifecycle_state, obj.description_epoch, obj.control_epoch, obj.last_operation_id, obj.last_operation, obj.acknowledgement = lcm._pack.unpack('>dbqqqbb', data:read(35)) + local __fault_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.fault = lcm._pack.prepare_string(data:read(__fault_tmpstrlen)) + + return obj +end + +return ConnectionStatus + diff --git a/generated/lua_lcm_msgs/dimos_control_msgs/ControlValues.lua b/generated/lua_lcm_msgs/dimos_control_msgs/ControlValues.lua new file mode 100644 index 0000000..08ba83c --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_control_msgs/ControlValues.lua @@ -0,0 +1,137 @@ +--[[ +LCM type definitions +This file automatically generated by lcm 1.5.2. +DO NOT MODIFY BY HAND!!!! +--]] + +local lcm = require('lcm') + +local setmetatable = setmetatable +local ipairs = ipairs +local table = table +local string = string +local unpack = unpack or table.unpack + +-- buffer helper for decoding +local _buffer_helper = {} +_buffer_helper.__index = _buffer_helper + +function _buffer_helper:new(data_str) + + local obj = {buffer = data_str, index = 1} + setmetatable(obj, self) + + return obj +end + +function _buffer_helper:read(n_bytes) + + local partial = self.buffer:sub(self.index, self.index + n_bytes - 1) + self.index = self.index + n_bytes + + if self.index > #self.buffer + 1 then + error('buffer ran out of bytes') + end + + return partial +end + +local ControlValues = {} +ControlValues.__index = ControlValues + +ControlValues.name = 'dimos_control_msgs.ControlValues' +ControlValues.packagename = 'dimos_control_msgs' +ControlValues.shortname = 'ControlValues' + +function ControlValues:new() + + local obj = {} + + obj.source = '' + obj.source_ts = 0.0 + obj.epoch = 0 + obj.sequence = 0 + obj.interface_names_length = 0 + obj.values_length = 0 + obj.interface_names = {} + obj.values = {} + + setmetatable(obj, self) + + return obj +end + +function ControlValues._get_hash_recursive(parents) + + local newparents = {} + + for _, v in ipairs(parents) do + if v == ControlValues then return lcm._hash.new('0x0') end + table.insert(newparents, v) + end + + table.insert(newparents, ControlValues) + + local hash = lcm._hash.new('0x98d9f64b18d5a4cf') + hash:rotate(1) + + return hash +end + +ControlValues._packed_fingerprint = lcm._pack.pack('>X', ControlValues._get_hash_recursive({})) + +function ControlValues:encode() + + return ControlValues._packed_fingerprint .. self:_encode_one() +end + +function ControlValues:_encode_one() + + local buf_table = {} + + local __source_tmpstr = lcm._pack.prepare_string(self.source) + table.insert(buf_table, lcm._pack.pack('>I', #__source_tmpstr + 1)) + table.insert(buf_table, __source_tmpstr .. '\0') + table.insert(buf_table, lcm._pack.pack('>dqqii', self.source_ts, self.epoch, self.sequence, self.interface_names_length, self.values_length)) + for i0 = 1, self.interface_names_length do + local __interface_names_tmpstr = lcm._pack.prepare_string(self.interface_names[i0]) + table.insert(buf_table, lcm._pack.pack('>I', #__interface_names_tmpstr + 1)) + table.insert(buf_table, __interface_names_tmpstr .. '\0') + end + table.insert(buf_table, lcm._pack.pack(string.format('>%dd', self.values_length), unpack(self.values))) + + return table.concat(buf_table) +end + +function ControlValues.decode(data) + + if data:sub(1, 8) ~= ControlValues._packed_fingerprint then + error('bad fingerprint') + end + + return ControlValues._decode_one(data:sub(9)) +end + +function ControlValues._decode_one(data) + + if not data.read then + data = _buffer_helper:new(data) + end + + local obj = ControlValues:new() + + local __source_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.source = lcm._pack.prepare_string(data:read(__source_tmpstrlen)) + obj.source_ts, obj.epoch, obj.sequence, obj.interface_names_length, obj.values_length = lcm._pack.unpack('>dqqii', data:read(32)) + obj.interface_names = {} + for i0 = 1, obj.interface_names_length do + local __interface_names_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.interface_names[i0] = lcm._pack.prepare_string(data:read(__interface_names_tmpstrlen)) + end + obj.values = {lcm._pack.unpack(string.format('>%dd', obj.values_length), data:read(obj.values_length * 8))} + + return obj +end + +return ControlValues + diff --git a/generated/lua_lcm_msgs/dimos_control_msgs/InterfaceDescription.lua b/generated/lua_lcm_msgs/dimos_control_msgs/InterfaceDescription.lua new file mode 100644 index 0000000..6e44fee --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_control_msgs/InterfaceDescription.lua @@ -0,0 +1,151 @@ +--[[ +LCM type definitions +This file automatically generated by lcm 1.5.2. +DO NOT MODIFY BY HAND!!!! +--]] + +local lcm = require('lcm') + +local setmetatable = setmetatable +local ipairs = ipairs +local table = table +local string = string +local unpack = unpack or table.unpack + +-- buffer helper for decoding +local _buffer_helper = {} +_buffer_helper.__index = _buffer_helper + +function _buffer_helper:new(data_str) + + local obj = {buffer = data_str, index = 1} + setmetatable(obj, self) + + return obj +end + +function _buffer_helper:read(n_bytes) + + local partial = self.buffer:sub(self.index, self.index + n_bytes - 1) + self.index = self.index + n_bytes + + if self.index > #self.buffer + 1 then + error('buffer ran out of bytes') + end + + return partial +end + +local InterfaceDescription = {} +InterfaceDescription.__index = InterfaceDescription + + InterfaceDescription.HOLD_LAST = 1 + InterfaceDescription.ZERO = 2 + InterfaceDescription.SAFE_STOP = 3 + +InterfaceDescription.name = 'dimos_control_msgs.InterfaceDescription' +InterfaceDescription.packagename = 'dimos_control_msgs' +InterfaceDescription.shortname = 'InterfaceDescription' + +function InterfaceDescription:new() + + local obj = {} + + obj.name = '' + obj.resource = '' + obj.field = '' + obj.unit = '' + obj.state = false + obj.command = false + obj.has_hard_min = false + obj.hard_min = 0.0 + obj.has_hard_max = false + obj.hard_max = 0.0 + obj.has_soft_min = false + obj.soft_min = 0.0 + obj.has_soft_max = false + obj.soft_max = 0.0 + obj.omission_policy = 0 + + setmetatable(obj, self) + + return obj +end + +function InterfaceDescription._get_hash_recursive(parents) + + local newparents = {} + + for _, v in ipairs(parents) do + if v == InterfaceDescription then return lcm._hash.new('0x0') end + table.insert(newparents, v) + end + + table.insert(newparents, InterfaceDescription) + + local hash = lcm._hash.new('0xbfb21e12c9a9bd0d') + hash:rotate(1) + + return hash +end + +InterfaceDescription._packed_fingerprint = lcm._pack.pack('>X', InterfaceDescription._get_hash_recursive({})) + +function InterfaceDescription:encode() + + return InterfaceDescription._packed_fingerprint .. self:_encode_one() +end + +function InterfaceDescription:_encode_one() + + local buf_table = {} + + local __name_tmpstr = lcm._pack.prepare_string(self.name) + table.insert(buf_table, lcm._pack.pack('>I', #__name_tmpstr + 1)) + table.insert(buf_table, __name_tmpstr .. '\0') + local __resource_tmpstr = lcm._pack.prepare_string(self.resource) + table.insert(buf_table, lcm._pack.pack('>I', #__resource_tmpstr + 1)) + table.insert(buf_table, __resource_tmpstr .. '\0') + local __field_tmpstr = lcm._pack.prepare_string(self.field) + table.insert(buf_table, lcm._pack.pack('>I', #__field_tmpstr + 1)) + table.insert(buf_table, __field_tmpstr .. '\0') + local __unit_tmpstr = lcm._pack.prepare_string(self.unit) + table.insert(buf_table, lcm._pack.pack('>I', #__unit_tmpstr + 1)) + table.insert(buf_table, __unit_tmpstr .. '\0') + table.insert(buf_table, lcm._pack.pack('>???d?d?d?db', self.state, self.command, self.has_hard_min, self.hard_min, self.has_hard_max, self.hard_max, self.has_soft_min, self.soft_min, self.has_soft_max, self.soft_max, self.omission_policy)) + + return table.concat(buf_table) +end + +function InterfaceDescription.decode(data) + + if data:sub(1, 8) ~= InterfaceDescription._packed_fingerprint then + error('bad fingerprint') + end + + return InterfaceDescription._decode_one(data:sub(9)) +end + +function InterfaceDescription._decode_one(data) + + if not data.read then + data = _buffer_helper:new(data) + end + + local obj = InterfaceDescription:new() + + local __name_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.name = lcm._pack.prepare_string(data:read(__name_tmpstrlen)) + local __resource_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.resource = lcm._pack.prepare_string(data:read(__resource_tmpstrlen)) + local __field_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.field = lcm._pack.prepare_string(data:read(__field_tmpstrlen)) + local __unit_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.unit = lcm._pack.prepare_string(data:read(__unit_tmpstrlen)) + obj.state, obj.command, obj.has_hard_min, obj.hard_min, obj.has_hard_max, obj.hard_max, obj.has_soft_min, obj.soft_min, obj.has_soft_max, obj.soft_max, obj.omission_policy = lcm._pack.unpack('>???d?d?d?db', data:read(39)) + + return obj +end + +return InterfaceDescription + diff --git a/generated/lua_lcm_msgs/dimos_control_msgs/ResourceDescription.lua b/generated/lua_lcm_msgs/dimos_control_msgs/ResourceDescription.lua new file mode 100644 index 0000000..dcdb0f8 --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_control_msgs/ResourceDescription.lua @@ -0,0 +1,130 @@ +--[[ +LCM type definitions +This file automatically generated by lcm 1.5.2. +DO NOT MODIFY BY HAND!!!! +--]] + +local lcm = require('lcm') + +local setmetatable = setmetatable +local ipairs = ipairs +local table = table +local string = string +local unpack = unpack or table.unpack + +-- buffer helper for decoding +local _buffer_helper = {} +_buffer_helper.__index = _buffer_helper + +function _buffer_helper:new(data_str) + + local obj = {buffer = data_str, index = 1} + setmetatable(obj, self) + + return obj +end + +function _buffer_helper:read(n_bytes) + + local partial = self.buffer:sub(self.index, self.index + n_bytes - 1) + self.index = self.index + n_bytes + + if self.index > #self.buffer + 1 then + error('buffer ran out of bytes') + end + + return partial +end + +local ResourceDescription = {} +ResourceDescription.__index = ResourceDescription + + ResourceDescription.JOINT = 1 + ResourceDescription.GRIPPER = 2 + ResourceDescription.BASE = 3 + ResourceDescription.IMU = 4 + +ResourceDescription.name = 'dimos_control_msgs.ResourceDescription' +ResourceDescription.packagename = 'dimos_control_msgs' +ResourceDescription.shortname = 'ResourceDescription' + +function ResourceDescription:new() + + local obj = {} + + obj.name = '' + obj.resource_type = 0 + obj.group_name = '' + + setmetatable(obj, self) + + return obj +end + +function ResourceDescription._get_hash_recursive(parents) + + local newparents = {} + + for _, v in ipairs(parents) do + if v == ResourceDescription then return lcm._hash.new('0x0') end + table.insert(newparents, v) + end + + table.insert(newparents, ResourceDescription) + + local hash = lcm._hash.new('0x802e2d1f1cd1df73') + hash:rotate(1) + + return hash +end + +ResourceDescription._packed_fingerprint = lcm._pack.pack('>X', ResourceDescription._get_hash_recursive({})) + +function ResourceDescription:encode() + + return ResourceDescription._packed_fingerprint .. self:_encode_one() +end + +function ResourceDescription:_encode_one() + + local buf_table = {} + + local __name_tmpstr = lcm._pack.prepare_string(self.name) + table.insert(buf_table, lcm._pack.pack('>I', #__name_tmpstr + 1)) + table.insert(buf_table, __name_tmpstr .. '\0') + table.insert(buf_table, lcm._pack.pack('>b', self.resource_type)) + local __group_name_tmpstr = lcm._pack.prepare_string(self.group_name) + table.insert(buf_table, lcm._pack.pack('>I', #__group_name_tmpstr + 1)) + table.insert(buf_table, __group_name_tmpstr .. '\0') + + return table.concat(buf_table) +end + +function ResourceDescription.decode(data) + + if data:sub(1, 8) ~= ResourceDescription._packed_fingerprint then + error('bad fingerprint') + end + + return ResourceDescription._decode_one(data:sub(9)) +end + +function ResourceDescription._decode_one(data) + + if not data.read then + data = _buffer_helper:new(data) + end + + local obj = ResourceDescription:new() + + local __name_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.name = lcm._pack.prepare_string(data:read(__name_tmpstrlen)) + obj.resource_type = lcm._pack.unpack('>b', data:read(1)) + local __group_name_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.group_name = lcm._pack.prepare_string(data:read(__group_name_tmpstrlen)) + + return obj +end + +return ResourceDescription + diff --git a/generated/lua_lcm_msgs/dimos_control_msgs/init.lua b/generated/lua_lcm_msgs/dimos_control_msgs/init.lua new file mode 100644 index 0000000..a6c3701 --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_control_msgs/init.lua @@ -0,0 +1,19 @@ +--[[ +LCM package init.lua file +This file automatically generated by lcm-gen. +DO NOT MODIFY BY HAND!!!! +lcm-gen 1.5.2 +--]] + +local M = {} + +M.ConnectionControl = require('dimos_control_msgs.ConnectionControl') +M.ConnectionStatus = require('dimos_control_msgs.ConnectionStatus') +M.ResourceDescription = require('dimos_control_msgs.ResourceDescription') +M.ConnectionDescription = require('dimos_control_msgs.ConnectionDescription') +M.InterfaceDescription = require('dimos_control_msgs.InterfaceDescription') +M.CommandProfile = require('dimos_control_msgs.CommandProfile') +M.ControlValues = require('dimos_control_msgs.ControlValues') + +return M + diff --git a/generated/lua_lcm_msgs/dimos_core_msgs/ModuleReadiness.lua b/generated/lua_lcm_msgs/dimos_core_msgs/ModuleReadiness.lua new file mode 100644 index 0000000..48873e9 --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_core_msgs/ModuleReadiness.lua @@ -0,0 +1,128 @@ +--[[ +LCM type definitions +This file automatically generated by lcm 1.5.2. +DO NOT MODIFY BY HAND!!!! +--]] + +local lcm = require('lcm') + +local setmetatable = setmetatable +local ipairs = ipairs +local table = table +local string = string +local unpack = unpack or table.unpack + +-- buffer helper for decoding +local _buffer_helper = {} +_buffer_helper.__index = _buffer_helper + +function _buffer_helper:new(data_str) + + local obj = {buffer = data_str, index = 1} + setmetatable(obj, self) + + return obj +end + +function _buffer_helper:read(n_bytes) + + local partial = self.buffer:sub(self.index, self.index + n_bytes - 1) + self.index = self.index + n_bytes + + if self.index > #self.buffer + 1 then + error('buffer ran out of bytes') + end + + return partial +end + +local ModuleReadiness = {} +ModuleReadiness.__index = ModuleReadiness + +ModuleReadiness.name = 'dimos_core_msgs.ModuleReadiness' +ModuleReadiness.packagename = 'dimos_core_msgs' +ModuleReadiness.shortname = 'ModuleReadiness' + +function ModuleReadiness:new() + + local obj = {} + + obj.source = '' + obj.generation = 0 + obj.sequence = 0 + obj.source_ts = 0.0 + obj.ready = false + obj.reason = '' + + setmetatable(obj, self) + + return obj +end + +function ModuleReadiness._get_hash_recursive(parents) + + local newparents = {} + + for _, v in ipairs(parents) do + if v == ModuleReadiness then return lcm._hash.new('0x0') end + table.insert(newparents, v) + end + + table.insert(newparents, ModuleReadiness) + + local hash = lcm._hash.new('0x150d1bfa7d87808d') + hash:rotate(1) + + return hash +end + +ModuleReadiness._packed_fingerprint = lcm._pack.pack('>X', ModuleReadiness._get_hash_recursive({})) + +function ModuleReadiness:encode() + + return ModuleReadiness._packed_fingerprint .. self:_encode_one() +end + +function ModuleReadiness:_encode_one() + + local buf_table = {} + + local __source_tmpstr = lcm._pack.prepare_string(self.source) + table.insert(buf_table, lcm._pack.pack('>I', #__source_tmpstr + 1)) + table.insert(buf_table, __source_tmpstr .. '\0') + table.insert(buf_table, lcm._pack.pack('>qqd?', self.generation, self.sequence, self.source_ts, self.ready)) + local __reason_tmpstr = lcm._pack.prepare_string(self.reason) + table.insert(buf_table, lcm._pack.pack('>I', #__reason_tmpstr + 1)) + table.insert(buf_table, __reason_tmpstr .. '\0') + + return table.concat(buf_table) +end + +function ModuleReadiness.decode(data) + + if data:sub(1, 8) ~= ModuleReadiness._packed_fingerprint then + error('bad fingerprint') + end + + return ModuleReadiness._decode_one(data:sub(9)) +end + +function ModuleReadiness._decode_one(data) + + if not data.read then + data = _buffer_helper:new(data) + end + + local obj = ModuleReadiness:new() + + local __source_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.source = lcm._pack.prepare_string(data:read(__source_tmpstrlen)) + obj.generation, obj.sequence, obj.source_ts, obj.ready = lcm._pack.unpack('>qqd?', data:read(25)) + local __reason_tmpstrlen = lcm._pack.unpack('>I', data:read(4)) + obj.reason = lcm._pack.prepare_string(data:read(__reason_tmpstrlen)) + + return obj +end + +return ModuleReadiness + diff --git a/generated/lua_lcm_msgs/dimos_core_msgs/init.lua b/generated/lua_lcm_msgs/dimos_core_msgs/init.lua new file mode 100644 index 0000000..d1fdc94 --- /dev/null +++ b/generated/lua_lcm_msgs/dimos_core_msgs/init.lua @@ -0,0 +1,13 @@ +--[[ +LCM package init.lua file +This file automatically generated by lcm-gen. +DO NOT MODIFY BY HAND!!!! +lcm-gen 1.5.2 +--]] + +local M = {} + +M.ModuleReadiness = require('dimos_core_msgs.ModuleReadiness') + +return M + diff --git a/generated/lua_lcm_msgs/foxglove_msgs/init.lua b/generated/lua_lcm_msgs/foxglove_msgs/init.lua index af22f25..0dc513e 100644 --- a/generated/lua_lcm_msgs/foxglove_msgs/init.lua +++ b/generated/lua_lcm_msgs/foxglove_msgs/init.lua @@ -9,10 +9,10 @@ local M = {} M.KeyValuePair = require('foxglove_msgs.KeyValuePair') M.SceneEntityDeletion = require('foxglove_msgs.SceneEntityDeletion') +M.RawAudio = require('foxglove_msgs.RawAudio') M.LinePrimitive = require('foxglove_msgs.LinePrimitive') M.LocationFix = require('foxglove_msgs.LocationFix') M.PoseInFrame = require('foxglove_msgs.PoseInFrame') -M.ArrowPrimitive = require('foxglove_msgs.ArrowPrimitive') M.FrameTransform = require('foxglove_msgs.FrameTransform') M.CompressedVideo = require('foxglove_msgs.CompressedVideo') M.Vector2 = require('foxglove_msgs.Vector2') @@ -23,25 +23,25 @@ M.LaserScan = require('foxglove_msgs.LaserScan') M.Point2 = require('foxglove_msgs.Point2') M.Log = require('foxglove_msgs.Log') M.PosesInFrame = require('foxglove_msgs.PosesInFrame') -M.SceneEntity = require('foxglove_msgs.SceneEntity') +M.CameraCalibration = require('foxglove_msgs.CameraCalibration') M.PointsAnnotation = require('foxglove_msgs.PointsAnnotation') +M.SceneEntity = require('foxglove_msgs.SceneEntity') M.RawImage = require('foxglove_msgs.RawImage') -M.TriangleListPrimitive = require('foxglove_msgs.TriangleListPrimitive') M.CylinderPrimitive = require('foxglove_msgs.CylinderPrimitive') -M.CameraCalibration = require('foxglove_msgs.CameraCalibration') +M.TriangleListPrimitive = require('foxglove_msgs.TriangleListPrimitive') M.PackedElementField = require('foxglove_msgs.PackedElementField') M.ImageAnnotations = require('foxglove_msgs.ImageAnnotations') M.TextAnnotation = require('foxglove_msgs.TextAnnotation') M.SceneUpdate = require('foxglove_msgs.SceneUpdate') -M.GeoJSON = require('foxglove_msgs.GeoJSON') -M.FrameTransforms = require('foxglove_msgs.FrameTransforms') M.Grid = require('foxglove_msgs.Grid') +M.FrameTransforms = require('foxglove_msgs.FrameTransforms') M.CubePrimitive = require('foxglove_msgs.CubePrimitive') +M.GeoJSON = require('foxglove_msgs.GeoJSON') M.PointCloud = require('foxglove_msgs.PointCloud') M.Color = require('foxglove_msgs.Color') M.SpherePrimitive = require('foxglove_msgs.SpherePrimitive') M.CircleAnnotation = require('foxglove_msgs.CircleAnnotation') -M.RawAudio = require('foxglove_msgs.RawAudio') +M.ArrowPrimitive = require('foxglove_msgs.ArrowPrimitive') return M diff --git a/generated/lua_lcm_msgs/geometry_msgs/init.lua b/generated/lua_lcm_msgs/geometry_msgs/init.lua index 95d897c..09f5def 100644 --- a/generated/lua_lcm_msgs/geometry_msgs/init.lua +++ b/generated/lua_lcm_msgs/geometry_msgs/init.lua @@ -7,35 +7,35 @@ lcm-gen 1.5.2 local M = {} -M.AccelWithCovarianceStamped = require('geometry_msgs.AccelWithCovarianceStamped') +M.Transform = require('geometry_msgs.Transform') M.PointStamped = require('geometry_msgs.PointStamped') M.PoseWithCovarianceStamped = require('geometry_msgs.PoseWithCovarianceStamped') M.Vector3Stamped = require('geometry_msgs.Vector3Stamped') M.PoseWithCovariance = require('geometry_msgs.PoseWithCovariance') M.Vector3 = require('geometry_msgs.Vector3') M.InertiaStamped = require('geometry_msgs.InertiaStamped') -M.Quaternion = require('geometry_msgs.Quaternion') -M.Point = require('geometry_msgs.Point') +M.PoseArray = require('geometry_msgs.PoseArray') +M.QuaternionStamped = require('geometry_msgs.QuaternionStamped') M.Point32 = require('geometry_msgs.Point32') -M.PoseStamped = require('geometry_msgs.PoseStamped') +M.PolygonStamped = require('geometry_msgs.PolygonStamped') M.TransformStamped = require('geometry_msgs.TransformStamped') M.TwistWithCovarianceStamped = require('geometry_msgs.TwistWithCovarianceStamped') -M.PolygonStamped = require('geometry_msgs.PolygonStamped') -M.Accel = require('geometry_msgs.Accel') +M.PoseStamped = require('geometry_msgs.PoseStamped') +M.AccelStamped = require('geometry_msgs.AccelStamped') M.AccelWithCovariance = require('geometry_msgs.AccelWithCovariance') -M.PoseArray = require('geometry_msgs.PoseArray') +M.Point = require('geometry_msgs.Point') M.Twist = require('geometry_msgs.Twist') -M.WrenchStamped = require('geometry_msgs.WrenchStamped') -M.Polygon = require('geometry_msgs.Polygon') M.Pose2D = require('geometry_msgs.Pose2D') +M.Polygon = require('geometry_msgs.Polygon') +M.Quaternion = require('geometry_msgs.Quaternion') M.Pose = require('geometry_msgs.Pose') -M.AccelStamped = require('geometry_msgs.AccelStamped') +M.Wrench = require('geometry_msgs.Wrench') M.TwistWithCovariance = require('geometry_msgs.TwistWithCovariance') -M.QuaternionStamped = require('geometry_msgs.QuaternionStamped') +M.AccelWithCovarianceStamped = require('geometry_msgs.AccelWithCovarianceStamped') +M.WrenchStamped = require('geometry_msgs.WrenchStamped') M.Inertia = require('geometry_msgs.Inertia') -M.Transform = require('geometry_msgs.Transform') M.TwistStamped = require('geometry_msgs.TwistStamped') -M.Wrench = require('geometry_msgs.Wrench') +M.Accel = require('geometry_msgs.Accel') return M diff --git a/generated/lua_lcm_msgs/nav_msgs/init.lua b/generated/lua_lcm_msgs/nav_msgs/init.lua index d20a825..3a41011 100644 --- a/generated/lua_lcm_msgs/nav_msgs/init.lua +++ b/generated/lua_lcm_msgs/nav_msgs/init.lua @@ -8,10 +8,10 @@ lcm-gen 1.5.2 local M = {} M.OccupancyGrid = require('nav_msgs.OccupancyGrid') -M.GridCells = require('nav_msgs.GridCells') M.Path = require('nav_msgs.Path') -M.Odometry = require('nav_msgs.Odometry') M.MapMetaData = require('nav_msgs.MapMetaData') +M.Odometry = require('nav_msgs.Odometry') +M.GridCells = require('nav_msgs.GridCells') return M diff --git a/generated/lua_lcm_msgs/sensor_msgs/init.lua b/generated/lua_lcm_msgs/sensor_msgs/init.lua index f8e719f..893a2c6 100644 --- a/generated/lua_lcm_msgs/sensor_msgs/init.lua +++ b/generated/lua_lcm_msgs/sensor_msgs/init.lua @@ -11,29 +11,29 @@ M.MultiEchoLaserScan = require('sensor_msgs.MultiEchoLaserScan') M.MultiDOFJointState = require('sensor_msgs.MultiDOFJointState') M.JoyFeedbackArray = require('sensor_msgs.JoyFeedbackArray') M.JoyFeedback = require('sensor_msgs.JoyFeedback') -M.Joy = require('sensor_msgs.Joy') M.Temperature = require('sensor_msgs.Temperature') +M.Joy = require('sensor_msgs.Joy') +M.Range = require('sensor_msgs.Range') M.RegionOfInterest = require('sensor_msgs.RegionOfInterest') M.ChannelFloat32 = require('sensor_msgs.ChannelFloat32') +M.RelativeHumidity = require('sensor_msgs.RelativeHumidity') M.Imu = require('sensor_msgs.Imu') M.PointCloud = require('sensor_msgs.PointCloud') -M.NavSatFix = require('sensor_msgs.NavSatFix') M.PointField = require('sensor_msgs.PointField') +M.NavSatFix = require('sensor_msgs.NavSatFix') M.LaserScan = require('sensor_msgs.LaserScan') M.CompressedImage = require('sensor_msgs.CompressedImage') M.MagneticField = require('sensor_msgs.MagneticField') M.Image = require('sensor_msgs.Image') M.PointCloud2 = require('sensor_msgs.PointCloud2') -M.JointState = require('sensor_msgs.JointState') M.CameraInfo = require('sensor_msgs.CameraInfo') -M.BatteryState = require('sensor_msgs.BatteryState') +M.JointState = require('sensor_msgs.JointState') +M.Illuminance = require('sensor_msgs.Illuminance') M.NavSatStatus = require('sensor_msgs.NavSatStatus') -M.TimeReference = require('sensor_msgs.TimeReference') -M.Range = require('sensor_msgs.Range') M.FluidPressure = require('sensor_msgs.FluidPressure') -M.Illuminance = require('sensor_msgs.Illuminance') +M.TimeReference = require('sensor_msgs.TimeReference') M.LaserEcho = require('sensor_msgs.LaserEcho') -M.RelativeHumidity = require('sensor_msgs.RelativeHumidity') +M.BatteryState = require('sensor_msgs.BatteryState') return M diff --git a/generated/lua_lcm_msgs/std_msgs/init.lua b/generated/lua_lcm_msgs/std_msgs/init.lua index 0df5e3b..6fc6651 100644 --- a/generated/lua_lcm_msgs/std_msgs/init.lua +++ b/generated/lua_lcm_msgs/std_msgs/init.lua @@ -13,12 +13,13 @@ M.Int32MultiArray = require('std_msgs.Int32MultiArray') M.UInt64MultiArray = require('std_msgs.UInt64MultiArray') M.UInt8MultiArray = require('std_msgs.UInt8MultiArray') M.Int64MultiArray = require('std_msgs.Int64MultiArray') +M.Int32 = require('std_msgs.Int32') M.Float64 = require('std_msgs.Float64') -M.Char = require('std_msgs.Char') +M.Int16MultiArray = require('std_msgs.Int16MultiArray') M.UInt16MultiArray = require('std_msgs.UInt16MultiArray') M.String = require('std_msgs.String') M.Int8MultiArray = require('std_msgs.Int8MultiArray') -M.Int16MultiArray = require('std_msgs.Int16MultiArray') +M.Char = require('std_msgs.Char') M.Int16 = require('std_msgs.Int16') M.Time = require('std_msgs.Time') M.UInt64 = require('std_msgs.UInt64') @@ -36,9 +37,8 @@ M.Float64MultiArray = require('std_msgs.Float64MultiArray') M.UInt16 = require('std_msgs.UInt16') M.ColorRGBA = require('std_msgs.ColorRGBA') M.UInt32MultiArray = require('std_msgs.UInt32MultiArray') -M.Bool = require('std_msgs.Bool') M.Empty = require('std_msgs.Empty') -M.Int32 = require('std_msgs.Int32') +M.Bool = require('std_msgs.Bool') return M diff --git a/generated/lua_lcm_msgs/tf2_msgs/init.lua b/generated/lua_lcm_msgs/tf2_msgs/init.lua index c1b29ac..ce2e8c1 100644 --- a/generated/lua_lcm_msgs/tf2_msgs/init.lua +++ b/generated/lua_lcm_msgs/tf2_msgs/init.lua @@ -7,8 +7,8 @@ lcm-gen 1.5.2 local M = {} -M.TF2Error = require('tf2_msgs.TF2Error') M.TFMessage = require('tf2_msgs.TFMessage') +M.TF2Error = require('tf2_msgs.TF2Error') return M diff --git a/generated/lua_lcm_msgs/trajectory_msgs/init.lua b/generated/lua_lcm_msgs/trajectory_msgs/init.lua index a27a64f..35c9e77 100644 --- a/generated/lua_lcm_msgs/trajectory_msgs/init.lua +++ b/generated/lua_lcm_msgs/trajectory_msgs/init.lua @@ -7,10 +7,10 @@ lcm-gen 1.5.2 local M = {} -M.MultiDOFJointTrajectory = require('trajectory_msgs.MultiDOFJointTrajectory') +M.JointTrajectoryPoint = require('trajectory_msgs.JointTrajectoryPoint') M.MultiDOFJointTrajectoryPoint = require('trajectory_msgs.MultiDOFJointTrajectoryPoint') +M.MultiDOFJointTrajectory = require('trajectory_msgs.MultiDOFJointTrajectory') M.JointTrajectory = require('trajectory_msgs.JointTrajectory') -M.JointTrajectoryPoint = require('trajectory_msgs.JointTrajectoryPoint') return M diff --git a/generated/lua_lcm_msgs/vision_msgs/init.lua b/generated/lua_lcm_msgs/vision_msgs/init.lua index 71e1db9..a191c05 100644 --- a/generated/lua_lcm_msgs/vision_msgs/init.lua +++ b/generated/lua_lcm_msgs/vision_msgs/init.lua @@ -7,22 +7,22 @@ lcm-gen 1.5.2 local M = {} -M.BoundingBox2D = require('vision_msgs.BoundingBox2D') -M.ObjectHypothesisWithPose = require('vision_msgs.ObjectHypothesisWithPose') -M.VisionInfo = require('vision_msgs.VisionInfo') -M.BoundingBox3DArray = require('vision_msgs.BoundingBox3DArray') M.Detection2DArray = require('vision_msgs.Detection2DArray') +M.ObjectHypothesisWithPose = require('vision_msgs.ObjectHypothesisWithPose') M.BoundingBox2DArray = require('vision_msgs.BoundingBox2DArray') +M.BoundingBox3DArray = require('vision_msgs.BoundingBox3DArray') M.BoundingBox3D = require('vision_msgs.BoundingBox3D') +M.VisionInfo = require('vision_msgs.VisionInfo') +M.Detection2D = require('vision_msgs.Detection2D') M.Detection3D = require('vision_msgs.Detection3D') M.ObjectHypothesis = require('vision_msgs.ObjectHypothesis') M.LabelInfo = require('vision_msgs.LabelInfo') M.Pose2D = require('vision_msgs.Pose2D') M.VisionClass = require('vision_msgs.VisionClass') -M.Classification = require('vision_msgs.Classification') -M.Point2D = require('vision_msgs.Point2D') M.Detection3DArray = require('vision_msgs.Detection3DArray') -M.Detection2D = require('vision_msgs.Detection2D') +M.Point2D = require('vision_msgs.Point2D') +M.Classification = require('vision_msgs.Classification') +M.BoundingBox2D = require('vision_msgs.BoundingBox2D') return M diff --git a/generated/lua_lcm_msgs/visualization_msgs/init.lua b/generated/lua_lcm_msgs/visualization_msgs/init.lua index 6c436c3..a1405ac 100644 --- a/generated/lua_lcm_msgs/visualization_msgs/init.lua +++ b/generated/lua_lcm_msgs/visualization_msgs/init.lua @@ -10,13 +10,13 @@ local M = {} M.InteractiveMarkerControl = require('visualization_msgs.InteractiveMarkerControl') M.MarkerArray = require('visualization_msgs.MarkerArray') M.InteractiveMarkerFeedback = require('visualization_msgs.InteractiveMarkerFeedback') -M.ImageMarker = require('visualization_msgs.ImageMarker') M.InteractiveMarkerInit = require('visualization_msgs.InteractiveMarkerInit') M.InteractiveMarkerUpdate = require('visualization_msgs.InteractiveMarkerUpdate') M.Marker = require('visualization_msgs.Marker') -M.InteractiveMarkerPose = require('visualization_msgs.InteractiveMarkerPose') M.InteractiveMarker = require('visualization_msgs.InteractiveMarker') +M.InteractiveMarkerPose = require('visualization_msgs.InteractiveMarkerPose') M.MenuEntry = require('visualization_msgs.MenuEntry') +M.ImageMarker = require('visualization_msgs.ImageMarker') return M diff --git a/generated/python_lcm_msgs/fix_imports.py b/generated/python_lcm_msgs/fix_imports.py index 107fc71..8f2f141 100644 --- a/generated/python_lcm_msgs/fix_imports.py +++ b/generated/python_lcm_msgs/fix_imports.py @@ -12,12 +12,14 @@ # Message packages to update imports for MSG_PACKAGES = [ + "dimos_control_msgs", + "dimos_core_msgs", "sensor_msgs", - "geometry_msgs", + "geometry_msgs", "std_msgs", "actionlib_msgs", "builtin_interfaces", - "diagnostic_msgs", + "diagnostic_msgs", "foxglove_msgs", "nav_msgs", "shape_msgs", @@ -28,20 +30,21 @@ "visualization_msgs", ] + def fix_file_imports(file_path): """Fix import statements in a file.""" - with open(file_path, 'r') as f: + with open(file_path, "r") as f: content = f.read() updated = False - + # Get the package name from the file path pkg_name = None for pkg in MSG_PACKAGES: if pkg in str(file_path): pkg_name = pkg break - + if not pkg_name: return False @@ -50,131 +53,149 @@ def fix_file_imports(file_path): # If the file imports a package directly (import pkg_name) if pkg == pkg_name: # Change 'import pkg_name' to 'from . import *' - pattern = fr'\nimport\s+{pkg}\s*\n' + pattern = rf"\nimport\s+{pkg}\s*\n" if re.search(pattern, content): - content = re.sub(pattern, '\nfrom . import *\n', content) + content = re.sub(pattern, "\nfrom . import *\n", content) updated = True - + # Replace pkg_name.ClassName() with just ClassName() # But exclude msg_name = "pkg_name.ClassName" patterns - pattern = fr'{pkg}\.\w+' + pattern = rf"{pkg}\.\w+" matches = re.findall(pattern, content) for match in matches: # Skip if this is part of msg_name assignment - msg_name_pattern = fr'msg_name\s*=\s*["\']' + re.escape(match) + r'["\']' + msg_name_pattern = r'msg_name\s*=\s*["\']' + re.escape(match) + r'["\']' if re.search(msg_name_pattern, content): print(f"Skipping {match} as it's part of msg_name") continue - class_name = match.split('.')[1] + class_name = match.split(".")[1] content = content.replace(match, class_name) updated = True else: # For cross-package imports (e.g., geometry_msgs importing std_msgs) - pattern = fr'\nimport\s+{pkg}\s*\n' + pattern = rf"\nimport\s+{pkg}\s*\n" if re.search(pattern, content): - content = re.sub(pattern, f'\nfrom lcm_msgs import {pkg}\n', content) + content = re.sub(pattern, f"\nfrom lcm_msgs import {pkg}\n", content) updated = True - + # Additional fix: Add specific imports for referenced classes in the same package # Extract the filename without extension to get the class name - current_class = os.path.basename(file_path).replace('.py', '') - + current_class = os.path.basename(file_path).replace(".py", "") + # Get directory of the current file to find other module files dir_path = os.path.dirname(file_path) - + # Find all classes referenced in the file - class_pattern = r'self\.[\w\.]+ = ([A-Z][a-zA-Z0-9]+)\(\)' + class_pattern = r"self\.[\w\.]+ = ([A-Z][a-zA-Z0-9]+)\(\)" referenced_classes = re.findall(class_pattern, content) - + # Also check for class references in static methods - static_class_pattern = r'([A-Z][a-zA-Z0-9]+)\._(?:decode_one|get_hash_recursive|get_packed_fingerprint)' + static_class_pattern = r"([A-Z][a-zA-Z0-9]+)\._(?:decode_one|get_hash_recursive|get_packed_fingerprint)" referenced_classes.extend(re.findall(static_class_pattern, content)) - + # Make the list unique referenced_classes = list(set(referenced_classes)) - + # Remove self-references if current_class in referenced_classes: referenced_classes.remove(current_class) - + # Check if each referenced class exists as a file in the same directory for class_name in referenced_classes: class_file = os.path.join(dir_path, f"{class_name}.py") if os.path.exists(class_file): # Remove any existing import for this class that might be causing issues - existing_import_pattern = fr'from \. import {class_name}' + existing_import_pattern = rf"from \. import {class_name}" if re.search(existing_import_pattern, content): - content = re.sub(existing_import_pattern, '', content) - + content = re.sub(existing_import_pattern, "", content) + # Add correct import (from .ClassName import ClassName) # Add import if not already present with the correct format if f"from .{class_name} import {class_name}" not in content: # Add after other imports but before class definition import_line = f"from .{class_name} import {class_name}\n" - + # Find a good spot to insert the import - after other imports but before class definition import_section_end = 0 - + # Look for the last import or from statement before the class definition - for match in re.finditer(r'^(import|from)\s+.*?\n', content, re.MULTILINE): + for match in re.finditer( + r"^(import|from)\s+.*?\n", content, re.MULTILINE + ): end_pos = match.end() if end_pos > import_section_end: import_section_end = end_pos - + # If we found imports, add after them if import_section_end > 0: - content = content[:import_section_end] + import_line + content[import_section_end:] + content = ( + content[:import_section_end] + + import_line + + content[import_section_end:] + ) else: # Otherwise, find the class definition and add before it - class_match = re.search(r'^class\s+\w+', content, re.MULTILINE) + class_match = re.search(r"^class\s+\w+", content, re.MULTILINE) if class_match: # Add imports right before the class definition with proper spacing class_start = class_match.start() # Find the start of the line - line_start = content.rfind('\n', 0, class_start) + 1 - content = content[:line_start] + import_line + '\n' + content[line_start:] + line_start = content.rfind("\n", 0, class_start) + 1 + content = ( + content[:line_start] + + import_line + + "\n" + + content[line_start:] + ) else: # Last resort: add after docstring docstring_end = content.find('"""', content.find('"""') + 3) + 3 if docstring_end > 6: - content = content[:docstring_end] + "\n\n" + import_line + content[docstring_end:] + content = ( + content[:docstring_end] + + "\n\n" + + import_line + + content[docstring_end:] + ) else: # Give up and add at line 10 - lines = content.split('\n') + lines = content.split("\n") insert_pos = min(10, len(lines) - 1) lines.insert(insert_pos, import_line.strip()) - content = '\n'.join(lines) - + content = "\n".join(lines) + updated = True print(f"Added import for {class_name} in {file_path}") if updated: print(f"Fixed imports in {file_path}") - with open(file_path, 'w') as f: + with open(file_path, "w") as f: f.write(content) return True return False + def main(): """Main function.""" # Find the lcm_msgs directory script_dir = Path(os.path.dirname(os.path.abspath(__file__))) - lcm_msgs_dir = script_dir / 'lcm_msgs' - + lcm_msgs_dir = script_dir / "lcm_msgs" + if not lcm_msgs_dir.exists() or not lcm_msgs_dir.is_dir(): print(f"Error: lcm_msgs directory not found at {lcm_msgs_dir}") return - + # Find all Python files in the lcm_msgs directory - python_files = list(lcm_msgs_dir.glob('**/*.py')) - + python_files = list(lcm_msgs_dir.glob("**/*.py")) + # Fix the import statements in each file fixed_count = 0 for file_path in python_files: if fix_file_imports(file_path): fixed_count += 1 - + print(f"Fixed imports in {fixed_count} files.") -if __name__ == '__main__': + +if __name__ == "__main__": main() diff --git a/generated/python_lcm_msgs/lcm_msgs/actionlib_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/actionlib_msgs/__init__.py index ee38fc9..c3fa196 100644 --- a/generated/python_lcm_msgs/lcm_msgs/actionlib_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/actionlib_msgs/__init__.py @@ -4,6 +4,6 @@ lcm-gen 1.5.2 """ +from .GoalStatusArray import GoalStatusArray as GoalStatusArray from .GoalStatus import GoalStatus as GoalStatus from .GoalID import GoalID as GoalID -from .GoalStatusArray import GoalStatusArray as GoalStatusArray diff --git a/generated/python_lcm_msgs/lcm_msgs/diagnostic_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/diagnostic_msgs/__init__.py index 30fec0c..72e5319 100644 --- a/generated/python_lcm_msgs/lcm_msgs/diagnostic_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/diagnostic_msgs/__init__.py @@ -4,6 +4,6 @@ lcm-gen 1.5.2 """ -from .DiagnosticArray import DiagnosticArray as DiagnosticArray -from .DiagnosticStatus import DiagnosticStatus as DiagnosticStatus from .KeyValue import KeyValue as KeyValue +from .DiagnosticStatus import DiagnosticStatus as DiagnosticStatus +from .DiagnosticArray import DiagnosticArray as DiagnosticArray diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/CommandProfile.py b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/CommandProfile.py new file mode 100644 index 0000000..2ec60bb --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/CommandProfile.py @@ -0,0 +1,155 @@ +"""LCM type definitions +This file automatically generated by lcm. +DO NOT MODIFY BY HAND!!!! +""" + +from io import BytesIO +import struct +import sys + + +class CommandProfile(object): + msg_name = "dimos_control_msgs.CommandProfile" + + __slots__ = [ + "name", + "required_fields_length", + "optional_fields_length", + "required_fields", + "optional_fields", + "uniform_across_resources", + ] + + __typenames__ = ["string", "int32_t", "int32_t", "string", "string", "boolean"] + + __dimensions__ = [ + None, + None, + None, + ["required_fields_length"], + ["optional_fields_length"], + None, + ] + + name: "string" + required_fields_length: "int32_t" + optional_fields_length: "int32_t" + required_fields: "string" + optional_fields: "string" + uniform_across_resources: "boolean" + + def __init__( + self, + name="", + required_fields_length=0, + optional_fields_length=0, + required_fields=[], + optional_fields=[], + uniform_across_resources=False, + ): + # LCM Type: string + self.name = name + # LCM Type: int32_t + self.required_fields_length = required_fields_length + # LCM Type: int32_t + self.optional_fields_length = optional_fields_length + # LCM Type: string[required_fields_length] + self.required_fields = required_fields + # LCM Type: string[optional_fields_length] + self.optional_fields = optional_fields + # LCM Type: boolean + self.uniform_across_resources = uniform_across_resources + + def lcm_encode(self): + buf = BytesIO() + buf.write(CommandProfile._get_packed_fingerprint()) + self._encode_one(buf) + return buf.getvalue() + + def _encode_one(self, buf): + __name_encoded = self.name.encode("utf-8") + buf.write(struct.pack(">I", len(__name_encoded) + 1)) + buf.write(__name_encoded) + buf.write(b"\0") + buf.write( + struct.pack(">ii", self.required_fields_length, self.optional_fields_length) + ) + for i0 in range(self.required_fields_length): + __required_fields_encoded = self.required_fields[i0].encode("utf-8") + buf.write(struct.pack(">I", len(__required_fields_encoded) + 1)) + buf.write(__required_fields_encoded) + buf.write(b"\0") + for i0 in range(self.optional_fields_length): + __optional_fields_encoded = self.optional_fields[i0].encode("utf-8") + buf.write(struct.pack(">I", len(__optional_fields_encoded) + 1)) + buf.write(__optional_fields_encoded) + buf.write(b"\0") + buf.write(struct.pack(">b", self.uniform_across_resources)) + + @classmethod + def lcm_decode(cls, data: bytes): + if hasattr(data, "read"): + buf = data + else: + buf = BytesIO(data) + if buf.read(8) != cls._get_packed_fingerprint(): + raise ValueError("Decode error") + return cls._decode_one(buf) + + @classmethod + def _decode_one(cls, buf): + self = cls() + __name_len = struct.unpack(">I", buf.read(4))[0] + self.name = buf.read(__name_len)[:-1].decode("utf-8", "replace") + self.required_fields_length, self.optional_fields_length = struct.unpack( + ">ii", buf.read(8) + ) + self.required_fields = [] + for i0 in range(self.required_fields_length): + __required_fields_len = struct.unpack(">I", buf.read(4))[0] + self.required_fields.append( + buf.read(__required_fields_len)[:-1].decode("utf-8", "replace") + ) + self.optional_fields = [] + for i0 in range(self.optional_fields_length): + __optional_fields_len = struct.unpack(">I", buf.read(4))[0] + self.optional_fields.append( + buf.read(__optional_fields_len)[:-1].decode("utf-8", "replace") + ) + self.uniform_across_resources = bool(struct.unpack("b", buf.read(1))[0]) + return self + + @classmethod + def _get_field_type(cls, field_name): + """Get the type for a field from annotations.""" + annotation = cls.__annotations__.get(field_name) + if annotation is None: + return None + if isinstance(annotation, str): + module = sys.modules[cls.__module__] + if hasattr(module, annotation): + return getattr(module, annotation) + return None + return annotation + + @classmethod + def _get_hash_recursive(cls, parents): + if cls in parents: + return 0 + tmphash = (0x38538E7A9D86EB4A) & 0xFFFFFFFFFFFFFFFF + tmphash = ( + ((tmphash << 1) & 0xFFFFFFFFFFFFFFFF) + (tmphash >> 63) + ) & 0xFFFFFFFFFFFFFFFF + return tmphash + + _packed_fingerprint = None + + @classmethod + def _get_packed_fingerprint(cls): + if cls._packed_fingerprint is None: + cls._packed_fingerprint = struct.pack(">Q", cls._get_hash_recursive([])) + return cls._packed_fingerprint + + def get_hash(self): + """Get the LCM hash of the struct""" + return struct.unpack(">Q", cls._get_packed_fingerprint())[0] diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ConnectionControl.py b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ConnectionControl.py new file mode 100644 index 0000000..0fdc326 --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ConnectionControl.py @@ -0,0 +1,147 @@ +"""LCM type definitions +This file automatically generated by lcm. +DO NOT MODIFY BY HAND!!!! +""" + +from io import BytesIO +import struct +import sys + + +class ConnectionControl(object): + msg_name = "dimos_control_msgs.ConnectionControl" + + __slots__ = [ + "target_sources_length", + "target_sources", + "operation_id", + "operation", + "proposed_control_epoch", + "reason", + ] + + __typenames__ = ["int32_t", "string", "int64_t", "int8_t", "int64_t", "string"] + + __dimensions__ = [None, ["target_sources_length"], None, None, None, None] + + target_sources_length: "int32_t" + target_sources: "string" + operation_id: "int64_t" + operation: "int8_t" + proposed_control_epoch: "int64_t" + reason: "string" + + PREPARE_ARM = 1 + COMMIT_ARM = 2 + ABORT_ARM = 3 + SAFE_STOP = 4 + CLEAR_SAFE_STOP = 5 + ESTOP = 6 + CLEAR_ESTOP = 7 + + def __init__( + self, + target_sources_length=0, + target_sources=[], + operation_id=0, + operation=0, + proposed_control_epoch=0, + reason="", + ): + # LCM Type: int32_t + self.target_sources_length = target_sources_length + # LCM Type: string[target_sources_length] + self.target_sources = target_sources + # LCM Type: int64_t + self.operation_id = operation_id + # LCM Type: int8_t + self.operation = operation + # LCM Type: int64_t + self.proposed_control_epoch = proposed_control_epoch + # LCM Type: string + self.reason = reason + + def lcm_encode(self): + buf = BytesIO() + buf.write(ConnectionControl._get_packed_fingerprint()) + self._encode_one(buf) + return buf.getvalue() + + def _encode_one(self, buf): + buf.write(struct.pack(">i", self.target_sources_length)) + for i0 in range(self.target_sources_length): + __target_sources_encoded = self.target_sources[i0].encode("utf-8") + buf.write(struct.pack(">I", len(__target_sources_encoded) + 1)) + buf.write(__target_sources_encoded) + buf.write(b"\0") + buf.write( + struct.pack( + ">qbq", self.operation_id, self.operation, self.proposed_control_epoch + ) + ) + __reason_encoded = self.reason.encode("utf-8") + buf.write(struct.pack(">I", len(__reason_encoded) + 1)) + buf.write(__reason_encoded) + buf.write(b"\0") + + @classmethod + def lcm_decode(cls, data: bytes): + if hasattr(data, "read"): + buf = data + else: + buf = BytesIO(data) + if buf.read(8) != cls._get_packed_fingerprint(): + raise ValueError("Decode error") + return cls._decode_one(buf) + + @classmethod + def _decode_one(cls, buf): + self = cls() + self.target_sources_length = struct.unpack(">i", buf.read(4))[0] + self.target_sources = [] + for i0 in range(self.target_sources_length): + __target_sources_len = struct.unpack(">I", buf.read(4))[0] + self.target_sources.append( + buf.read(__target_sources_len)[:-1].decode("utf-8", "replace") + ) + self.operation_id, self.operation, self.proposed_control_epoch = struct.unpack( + ">qbq", buf.read(17) + ) + __reason_len = struct.unpack(">I", buf.read(4))[0] + self.reason = buf.read(__reason_len)[:-1].decode("utf-8", "replace") + return self + + @classmethod + def _get_field_type(cls, field_name): + """Get the type for a field from annotations.""" + annotation = cls.__annotations__.get(field_name) + if annotation is None: + return None + if isinstance(annotation, str): + module = sys.modules[cls.__module__] + if hasattr(module, annotation): + return getattr(module, annotation) + return None + return annotation + + @classmethod + def _get_hash_recursive(cls, parents): + if cls in parents: + return 0 + tmphash = (0xB82D9643472F465D) & 0xFFFFFFFFFFFFFFFF + tmphash = ( + ((tmphash << 1) & 0xFFFFFFFFFFFFFFFF) + (tmphash >> 63) + ) & 0xFFFFFFFFFFFFFFFF + return tmphash + + _packed_fingerprint = None + + @classmethod + def _get_packed_fingerprint(cls): + if cls._packed_fingerprint is None: + cls._packed_fingerprint = struct.pack(">Q", cls._get_hash_recursive([])) + return cls._packed_fingerprint + + def get_hash(self): + """Get the LCM hash of the struct""" + return struct.unpack(">Q", cls._get_packed_fingerprint())[0] diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ConnectionDescription.py b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ConnectionDescription.py new file mode 100644 index 0000000..992580c --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ConnectionDescription.py @@ -0,0 +1,302 @@ +"""LCM type definitions +This file automatically generated by lcm. +DO NOT MODIFY BY HAND!!!! +""" + +from io import BytesIO +import struct +import sys + +from . import * +from .CommandProfile import CommandProfile +from .InterfaceDescription import InterfaceDescription +from .ResourceDescription import ResourceDescription + + +class ConnectionDescription(object): + msg_name = "dimos_control_msgs.ConnectionDescription" + + __slots__ = [ + "source", + "description_epoch", + "resources_length", + "interfaces_length", + "command_profiles_length", + "resources", + "interfaces", + "command_profiles", + "expected_state_rate_hz", + "state_stale_timeout_s", + "command_watchdog_timeout_s", + "activation_policy", + "armed_idle_policy", + "safe_stop_behavior", + "process_loss_classification", + "process_loss_evidence", + ] + + __typenames__ = [ + "string", + "int64_t", + "int32_t", + "int32_t", + "int32_t", + "ResourceDescription", + "InterfaceDescription", + "CommandProfile", + "double", + "double", + "double", + "int8_t", + "int8_t", + "string", + "int8_t", + "string", + ] + + __dimensions__ = [ + None, + None, + None, + None, + None, + ["resources_length"], + ["interfaces_length"], + ["command_profiles_length"], + None, + None, + None, + None, + None, + None, + None, + None, + ] + + source: "string" + description_epoch: "int64_t" + resources_length: "int32_t" + interfaces_length: "int32_t" + command_profiles_length: "int32_t" + resources: ResourceDescription + interfaces: InterfaceDescription + command_profiles: CommandProfile + expected_state_rate_hz: "double" + state_stale_timeout_s: "double" + command_watchdog_timeout_s: "double" + activation_policy: "int8_t" + armed_idle_policy: "int8_t" + safe_stop_behavior: "string" + process_loss_classification: "int8_t" + process_loss_evidence: "string" + + DIRECT = 1 + OPERATOR_CONFIRMED = 2 + APPLY_OMISSION = 1 + ARMED_IDLE_SAFE_STOP = 2 + NATIVE_WATCHDOG = 1 + EXTERNAL_SUPERVISOR = 2 + INTRINSICALLY_SAFE = 3 + SIMULATION = 4 + UNPROTECTED = 5 + + def __init__( + self, + source="", + description_epoch=0, + resources_length=0, + interfaces_length=0, + command_profiles_length=0, + resources=[], + interfaces=[], + command_profiles=[], + expected_state_rate_hz=0.0, + state_stale_timeout_s=0.0, + command_watchdog_timeout_s=0.0, + activation_policy=0, + armed_idle_policy=0, + safe_stop_behavior="", + process_loss_classification=0, + process_loss_evidence="", + ): + # LCM Type: string + self.source = source + # LCM Type: int64_t + self.description_epoch = description_epoch + # LCM Type: int32_t + self.resources_length = resources_length + # LCM Type: int32_t + self.interfaces_length = interfaces_length + # LCM Type: int32_t + self.command_profiles_length = command_profiles_length + # LCM Type: ResourceDescription[resources_length] + self.resources = resources + # LCM Type: InterfaceDescription[interfaces_length] + self.interfaces = interfaces + # LCM Type: CommandProfile[command_profiles_length] + self.command_profiles = command_profiles + # LCM Type: double + self.expected_state_rate_hz = expected_state_rate_hz + # LCM Type: double + self.state_stale_timeout_s = state_stale_timeout_s + # LCM Type: double + self.command_watchdog_timeout_s = command_watchdog_timeout_s + # LCM Type: int8_t + self.activation_policy = activation_policy + # LCM Type: int8_t + self.armed_idle_policy = armed_idle_policy + # LCM Type: string + self.safe_stop_behavior = safe_stop_behavior + # LCM Type: int8_t + self.process_loss_classification = process_loss_classification + # LCM Type: string + self.process_loss_evidence = process_loss_evidence + + def lcm_encode(self): + buf = BytesIO() + buf.write(ConnectionDescription._get_packed_fingerprint()) + self._encode_one(buf) + return buf.getvalue() + + def _encode_one(self, buf): + __source_encoded = self.source.encode("utf-8") + buf.write(struct.pack(">I", len(__source_encoded) + 1)) + buf.write(__source_encoded) + buf.write(b"\0") + buf.write( + struct.pack( + ">qiii", + self.description_epoch, + self.resources_length, + self.interfaces_length, + self.command_profiles_length, + ) + ) + for i0 in range(self.resources_length): + assert ( + self.resources[i0]._get_packed_fingerprint() + == ResourceDescription._get_packed_fingerprint() + ) + self.resources[i0]._encode_one(buf) + for i0 in range(self.interfaces_length): + assert ( + self.interfaces[i0]._get_packed_fingerprint() + == InterfaceDescription._get_packed_fingerprint() + ) + self.interfaces[i0]._encode_one(buf) + for i0 in range(self.command_profiles_length): + assert ( + self.command_profiles[i0]._get_packed_fingerprint() + == CommandProfile._get_packed_fingerprint() + ) + self.command_profiles[i0]._encode_one(buf) + buf.write( + struct.pack( + ">dddbb", + self.expected_state_rate_hz, + self.state_stale_timeout_s, + self.command_watchdog_timeout_s, + self.activation_policy, + self.armed_idle_policy, + ) + ) + __safe_stop_behavior_encoded = self.safe_stop_behavior.encode("utf-8") + buf.write(struct.pack(">I", len(__safe_stop_behavior_encoded) + 1)) + buf.write(__safe_stop_behavior_encoded) + buf.write(b"\0") + buf.write(struct.pack(">b", self.process_loss_classification)) + __process_loss_evidence_encoded = self.process_loss_evidence.encode("utf-8") + buf.write(struct.pack(">I", len(__process_loss_evidence_encoded) + 1)) + buf.write(__process_loss_evidence_encoded) + buf.write(b"\0") + + @classmethod + def lcm_decode(cls, data: bytes): + if hasattr(data, "read"): + buf = data + else: + buf = BytesIO(data) + if buf.read(8) != cls._get_packed_fingerprint(): + raise ValueError("Decode error") + return cls._decode_one(buf) + + @classmethod + def _decode_one(cls, buf): + self = cls() + __source_len = struct.unpack(">I", buf.read(4))[0] + self.source = buf.read(__source_len)[:-1].decode("utf-8", "replace") + ( + self.description_epoch, + self.resources_length, + self.interfaces_length, + self.command_profiles_length, + ) = struct.unpack(">qiii", buf.read(20)) + self.resources = [] + for i0 in range(self.resources_length): + self.resources.append(cls._get_field_type("resources")._decode_one(buf)) + self.interfaces = [] + for i0 in range(self.interfaces_length): + self.interfaces.append(cls._get_field_type("interfaces")._decode_one(buf)) + self.command_profiles = [] + for i0 in range(self.command_profiles_length): + self.command_profiles.append( + cls._get_field_type("command_profiles")._decode_one(buf) + ) + ( + self.expected_state_rate_hz, + self.state_stale_timeout_s, + self.command_watchdog_timeout_s, + self.activation_policy, + self.armed_idle_policy, + ) = struct.unpack(">dddbb", buf.read(26)) + __safe_stop_behavior_len = struct.unpack(">I", buf.read(4))[0] + self.safe_stop_behavior = buf.read(__safe_stop_behavior_len)[:-1].decode( + "utf-8", "replace" + ) + self.process_loss_classification = struct.unpack(">b", buf.read(1))[0] + __process_loss_evidence_len = struct.unpack(">I", buf.read(4))[0] + self.process_loss_evidence = buf.read(__process_loss_evidence_len)[:-1].decode( + "utf-8", "replace" + ) + return self + + @classmethod + def _get_field_type(cls, field_name): + """Get the type for a field from annotations.""" + annotation = cls.__annotations__.get(field_name) + if annotation is None: + return None + if isinstance(annotation, str): + module = sys.modules[cls.__module__] + if hasattr(module, annotation): + return getattr(module, annotation) + return None + return annotation + + @classmethod + def _get_hash_recursive(cls, parents): + if cls in parents: + return 0 + newparents = parents + [cls] + tmphash = ( + 0x31D30851F65C7D8C + + ResourceDescription._get_hash_recursive(newparents) + + InterfaceDescription._get_hash_recursive(newparents) + + CommandProfile._get_hash_recursive(newparents) + ) & 0xFFFFFFFFFFFFFFFF + tmphash = ( + ((tmphash << 1) & 0xFFFFFFFFFFFFFFFF) + (tmphash >> 63) + ) & 0xFFFFFFFFFFFFFFFF + return tmphash + + _packed_fingerprint = None + + @classmethod + def _get_packed_fingerprint(cls): + if cls._packed_fingerprint is None: + cls._packed_fingerprint = struct.pack(">Q", cls._get_hash_recursive([])) + return cls._packed_fingerprint + + def get_hash(self): + """Get the LCM hash of the struct""" + return struct.unpack(">Q", cls._get_packed_fingerprint())[0] diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ConnectionStatus.py b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ConnectionStatus.py new file mode 100644 index 0000000..f357d2d --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ConnectionStatus.py @@ -0,0 +1,182 @@ +"""LCM type definitions +This file automatically generated by lcm. +DO NOT MODIFY BY HAND!!!! +""" + +from io import BytesIO +import struct +import sys + + +class ConnectionStatus(object): + msg_name = "dimos_control_msgs.ConnectionStatus" + + __slots__ = [ + "source", + "source_ts", + "lifecycle_state", + "description_epoch", + "control_epoch", + "last_operation_id", + "last_operation", + "acknowledgement", + "fault", + ] + + __typenames__ = [ + "string", + "double", + "int8_t", + "int64_t", + "int64_t", + "int64_t", + "int8_t", + "int8_t", + "string", + ] + + __dimensions__ = [None, None, None, None, None, None, None, None, None] + + source: "string" + source_ts: "double" + lifecycle_state: "int8_t" + description_epoch: "int64_t" + control_epoch: "int64_t" + last_operation_id: "int64_t" + last_operation: "int8_t" + acknowledgement: "int8_t" + fault: "string" + + STANDBY = 1 + PREPARING = 2 + PREPARED = 3 + COMMITTING = 4 + ARMED = 5 + SAFE_STOPPED = 6 + ESTOPPED = 7 + NONE = 0 + PENDING = 1 + SUCCEEDED = 2 + REJECTED = 3 + + def __init__( + self, + source="", + source_ts=0.0, + lifecycle_state=0, + description_epoch=0, + control_epoch=0, + last_operation_id=0, + last_operation=0, + acknowledgement=0, + fault="", + ): + # LCM Type: string + self.source = source + # LCM Type: double + self.source_ts = source_ts + # LCM Type: int8_t + self.lifecycle_state = lifecycle_state + # LCM Type: int64_t + self.description_epoch = description_epoch + # LCM Type: int64_t + self.control_epoch = control_epoch + # LCM Type: int64_t + self.last_operation_id = last_operation_id + # LCM Type: int8_t + self.last_operation = last_operation + # LCM Type: int8_t + self.acknowledgement = acknowledgement + # LCM Type: string + self.fault = fault + + def lcm_encode(self): + buf = BytesIO() + buf.write(ConnectionStatus._get_packed_fingerprint()) + self._encode_one(buf) + return buf.getvalue() + + def _encode_one(self, buf): + __source_encoded = self.source.encode("utf-8") + buf.write(struct.pack(">I", len(__source_encoded) + 1)) + buf.write(__source_encoded) + buf.write(b"\0") + buf.write( + struct.pack( + ">dbqqqbb", + self.source_ts, + self.lifecycle_state, + self.description_epoch, + self.control_epoch, + self.last_operation_id, + self.last_operation, + self.acknowledgement, + ) + ) + __fault_encoded = self.fault.encode("utf-8") + buf.write(struct.pack(">I", len(__fault_encoded) + 1)) + buf.write(__fault_encoded) + buf.write(b"\0") + + @classmethod + def lcm_decode(cls, data: bytes): + if hasattr(data, "read"): + buf = data + else: + buf = BytesIO(data) + if buf.read(8) != cls._get_packed_fingerprint(): + raise ValueError("Decode error") + return cls._decode_one(buf) + + @classmethod + def _decode_one(cls, buf): + self = cls() + __source_len = struct.unpack(">I", buf.read(4))[0] + self.source = buf.read(__source_len)[:-1].decode("utf-8", "replace") + ( + self.source_ts, + self.lifecycle_state, + self.description_epoch, + self.control_epoch, + self.last_operation_id, + self.last_operation, + self.acknowledgement, + ) = struct.unpack(">dbqqqbb", buf.read(35)) + __fault_len = struct.unpack(">I", buf.read(4))[0] + self.fault = buf.read(__fault_len)[:-1].decode("utf-8", "replace") + return self + + @classmethod + def _get_field_type(cls, field_name): + """Get the type for a field from annotations.""" + annotation = cls.__annotations__.get(field_name) + if annotation is None: + return None + if isinstance(annotation, str): + module = sys.modules[cls.__module__] + if hasattr(module, annotation): + return getattr(module, annotation) + return None + return annotation + + @classmethod + def _get_hash_recursive(cls, parents): + if cls in parents: + return 0 + tmphash = (0xC90F95EBFAD6E276) & 0xFFFFFFFFFFFFFFFF + tmphash = ( + ((tmphash << 1) & 0xFFFFFFFFFFFFFFFF) + (tmphash >> 63) + ) & 0xFFFFFFFFFFFFFFFF + return tmphash + + _packed_fingerprint = None + + @classmethod + def _get_packed_fingerprint(cls): + if cls._packed_fingerprint is None: + cls._packed_fingerprint = struct.pack(">Q", cls._get_hash_recursive([])) + return cls._packed_fingerprint + + def get_hash(self): + """Get the LCM hash of the struct""" + return struct.unpack(">Q", cls._get_packed_fingerprint())[0] diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ControlValues.py b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ControlValues.py new file mode 100644 index 0000000..d183af5 --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ControlValues.py @@ -0,0 +1,180 @@ +"""LCM type definitions +This file automatically generated by lcm. +DO NOT MODIFY BY HAND!!!! +""" + +from io import BytesIO +import struct +import sys + + +class ControlValues(object): + msg_name = "dimos_control_msgs.ControlValues" + + __slots__ = [ + "source", + "source_ts", + "epoch", + "sequence", + "interface_names_length", + "values_length", + "interface_names", + "values", + ] + + __typenames__ = [ + "string", + "double", + "int64_t", + "int64_t", + "int32_t", + "int32_t", + "string", + "double", + ] + + __dimensions__ = [ + None, + None, + None, + None, + None, + None, + ["interface_names_length"], + ["values_length"], + ] + + source: "string" + source_ts: "double" + epoch: "int64_t" + sequence: "int64_t" + interface_names_length: "int32_t" + values_length: "int32_t" + interface_names: "string" + values: "double" + + def __init__( + self, + source="", + source_ts=0.0, + epoch=0, + sequence=0, + interface_names_length=0, + values_length=0, + interface_names=[], + values=[], + ): + # LCM Type: string + self.source = source + # LCM Type: double + self.source_ts = source_ts + # LCM Type: int64_t + self.epoch = epoch + # LCM Type: int64_t + self.sequence = sequence + # LCM Type: int32_t + self.interface_names_length = interface_names_length + # LCM Type: int32_t + self.values_length = values_length + # LCM Type: string[interface_names_length] + self.interface_names = interface_names + # LCM Type: double[values_length] + self.values = values + + def lcm_encode(self): + buf = BytesIO() + buf.write(ControlValues._get_packed_fingerprint()) + self._encode_one(buf) + return buf.getvalue() + + def _encode_one(self, buf): + __source_encoded = self.source.encode("utf-8") + buf.write(struct.pack(">I", len(__source_encoded) + 1)) + buf.write(__source_encoded) + buf.write(b"\0") + buf.write( + struct.pack( + ">dqqii", + self.source_ts, + self.epoch, + self.sequence, + self.interface_names_length, + self.values_length, + ) + ) + for i0 in range(self.interface_names_length): + __interface_names_encoded = self.interface_names[i0].encode("utf-8") + buf.write(struct.pack(">I", len(__interface_names_encoded) + 1)) + buf.write(__interface_names_encoded) + buf.write(b"\0") + buf.write( + struct.pack(">%dd" % self.values_length, *self.values[: self.values_length]) + ) + + @classmethod + def lcm_decode(cls, data: bytes): + if hasattr(data, "read"): + buf = data + else: + buf = BytesIO(data) + if buf.read(8) != cls._get_packed_fingerprint(): + raise ValueError("Decode error") + return cls._decode_one(buf) + + @classmethod + def _decode_one(cls, buf): + self = cls() + __source_len = struct.unpack(">I", buf.read(4))[0] + self.source = buf.read(__source_len)[:-1].decode("utf-8", "replace") + ( + self.source_ts, + self.epoch, + self.sequence, + self.interface_names_length, + self.values_length, + ) = struct.unpack(">dqqii", buf.read(32)) + self.interface_names = [] + for i0 in range(self.interface_names_length): + __interface_names_len = struct.unpack(">I", buf.read(4))[0] + self.interface_names.append( + buf.read(__interface_names_len)[:-1].decode("utf-8", "replace") + ) + self.values = struct.unpack( + ">%dd" % self.values_length, buf.read(self.values_length * 8) + ) + return self + + @classmethod + def _get_field_type(cls, field_name): + """Get the type for a field from annotations.""" + annotation = cls.__annotations__.get(field_name) + if annotation is None: + return None + if isinstance(annotation, str): + module = sys.modules[cls.__module__] + if hasattr(module, annotation): + return getattr(module, annotation) + return None + return annotation + + @classmethod + def _get_hash_recursive(cls, parents): + if cls in parents: + return 0 + tmphash = (0x98D9F64B18D5A4CF) & 0xFFFFFFFFFFFFFFFF + tmphash = ( + ((tmphash << 1) & 0xFFFFFFFFFFFFFFFF) + (tmphash >> 63) + ) & 0xFFFFFFFFFFFFFFFF + return tmphash + + _packed_fingerprint = None + + @classmethod + def _get_packed_fingerprint(cls): + if cls._packed_fingerprint is None: + cls._packed_fingerprint = struct.pack(">Q", cls._get_hash_recursive([])) + return cls._packed_fingerprint + + def get_hash(self): + """Get the LCM hash of the struct""" + return struct.unpack(">Q", cls._get_packed_fingerprint())[0] diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/InterfaceDescription.py b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/InterfaceDescription.py new file mode 100644 index 0000000..47dbba4 --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/InterfaceDescription.py @@ -0,0 +1,243 @@ +"""LCM type definitions +This file automatically generated by lcm. +DO NOT MODIFY BY HAND!!!! +""" + +from io import BytesIO +import struct +import sys + + +class InterfaceDescription(object): + msg_name = "dimos_control_msgs.InterfaceDescription" + + __slots__ = [ + "name", + "resource", + "field", + "unit", + "state", + "command", + "has_hard_min", + "hard_min", + "has_hard_max", + "hard_max", + "has_soft_min", + "soft_min", + "has_soft_max", + "soft_max", + "omission_policy", + ] + + __typenames__ = [ + "string", + "string", + "string", + "string", + "boolean", + "boolean", + "boolean", + "double", + "boolean", + "double", + "boolean", + "double", + "boolean", + "double", + "int8_t", + ] + + __dimensions__ = [ + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ] + + name: "string" + resource: "string" + field: "string" + unit: "string" + state: "boolean" + command: "boolean" + has_hard_min: "boolean" + hard_min: "double" + has_hard_max: "boolean" + hard_max: "double" + has_soft_min: "boolean" + soft_min: "double" + has_soft_max: "boolean" + soft_max: "double" + omission_policy: "int8_t" + + HOLD_LAST = 1 + ZERO = 2 + SAFE_STOP = 3 + + def __init__( + self, + name="", + resource="", + field="", + unit="", + state=False, + command=False, + has_hard_min=False, + hard_min=0.0, + has_hard_max=False, + hard_max=0.0, + has_soft_min=False, + soft_min=0.0, + has_soft_max=False, + soft_max=0.0, + omission_policy=0, + ): + # LCM Type: string + self.name = name + # LCM Type: string + self.resource = resource + # LCM Type: string + self.field = field + # LCM Type: string + self.unit = unit + # LCM Type: boolean + self.state = state + # LCM Type: boolean + self.command = command + # LCM Type: boolean + self.has_hard_min = has_hard_min + # LCM Type: double + self.hard_min = hard_min + # LCM Type: boolean + self.has_hard_max = has_hard_max + # LCM Type: double + self.hard_max = hard_max + # LCM Type: boolean + self.has_soft_min = has_soft_min + # LCM Type: double + self.soft_min = soft_min + # LCM Type: boolean + self.has_soft_max = has_soft_max + # LCM Type: double + self.soft_max = soft_max + # LCM Type: int8_t + self.omission_policy = omission_policy + + def lcm_encode(self): + buf = BytesIO() + buf.write(InterfaceDescription._get_packed_fingerprint()) + self._encode_one(buf) + return buf.getvalue() + + def _encode_one(self, buf): + __name_encoded = self.name.encode("utf-8") + buf.write(struct.pack(">I", len(__name_encoded) + 1)) + buf.write(__name_encoded) + buf.write(b"\0") + __resource_encoded = self.resource.encode("utf-8") + buf.write(struct.pack(">I", len(__resource_encoded) + 1)) + buf.write(__resource_encoded) + buf.write(b"\0") + __field_encoded = self.field.encode("utf-8") + buf.write(struct.pack(">I", len(__field_encoded) + 1)) + buf.write(__field_encoded) + buf.write(b"\0") + __unit_encoded = self.unit.encode("utf-8") + buf.write(struct.pack(">I", len(__unit_encoded) + 1)) + buf.write(__unit_encoded) + buf.write(b"\0") + buf.write( + struct.pack( + ">bbbdbdbdbdb", + self.state, + self.command, + self.has_hard_min, + self.hard_min, + self.has_hard_max, + self.hard_max, + self.has_soft_min, + self.soft_min, + self.has_soft_max, + self.soft_max, + self.omission_policy, + ) + ) + + @classmethod + def lcm_decode(cls, data: bytes): + if hasattr(data, "read"): + buf = data + else: + buf = BytesIO(data) + if buf.read(8) != cls._get_packed_fingerprint(): + raise ValueError("Decode error") + return cls._decode_one(buf) + + @classmethod + def _decode_one(cls, buf): + self = cls() + __name_len = struct.unpack(">I", buf.read(4))[0] + self.name = buf.read(__name_len)[:-1].decode("utf-8", "replace") + __resource_len = struct.unpack(">I", buf.read(4))[0] + self.resource = buf.read(__resource_len)[:-1].decode("utf-8", "replace") + __field_len = struct.unpack(">I", buf.read(4))[0] + self.field = buf.read(__field_len)[:-1].decode("utf-8", "replace") + __unit_len = struct.unpack(">I", buf.read(4))[0] + self.unit = buf.read(__unit_len)[:-1].decode("utf-8", "replace") + self.state = bool(struct.unpack("b", buf.read(1))[0]) + self.command = bool(struct.unpack("b", buf.read(1))[0]) + self.has_hard_min = bool(struct.unpack("b", buf.read(1))[0]) + self.hard_min = struct.unpack(">d", buf.read(8))[0] + self.has_hard_max = bool(struct.unpack("b", buf.read(1))[0]) + self.hard_max = struct.unpack(">d", buf.read(8))[0] + self.has_soft_min = bool(struct.unpack("b", buf.read(1))[0]) + self.soft_min = struct.unpack(">d", buf.read(8))[0] + self.has_soft_max = bool(struct.unpack("b", buf.read(1))[0]) + self.soft_max, self.omission_policy = struct.unpack(">db", buf.read(9)) + return self + + @classmethod + def _get_field_type(cls, field_name): + """Get the type for a field from annotations.""" + annotation = cls.__annotations__.get(field_name) + if annotation is None: + return None + if isinstance(annotation, str): + module = sys.modules[cls.__module__] + if hasattr(module, annotation): + return getattr(module, annotation) + return None + return annotation + + @classmethod + def _get_hash_recursive(cls, parents): + if cls in parents: + return 0 + tmphash = (0xBFB21E12C9A9BD0D) & 0xFFFFFFFFFFFFFFFF + tmphash = ( + ((tmphash << 1) & 0xFFFFFFFFFFFFFFFF) + (tmphash >> 63) + ) & 0xFFFFFFFFFFFFFFFF + return tmphash + + _packed_fingerprint = None + + @classmethod + def _get_packed_fingerprint(cls): + if cls._packed_fingerprint is None: + cls._packed_fingerprint = struct.pack(">Q", cls._get_hash_recursive([])) + return cls._packed_fingerprint + + def get_hash(self): + """Get the LCM hash of the struct""" + return struct.unpack(">Q", cls._get_packed_fingerprint())[0] diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ResourceDescription.py b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ResourceDescription.py new file mode 100644 index 0000000..c7438be --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/ResourceDescription.py @@ -0,0 +1,107 @@ +"""LCM type definitions +This file automatically generated by lcm. +DO NOT MODIFY BY HAND!!!! +""" + +from io import BytesIO +import struct +import sys + + +class ResourceDescription(object): + msg_name = "dimos_control_msgs.ResourceDescription" + + __slots__ = ["name", "resource_type", "group_name"] + + __typenames__ = ["string", "int8_t", "string"] + + __dimensions__ = [None, None, None] + + name: "string" + resource_type: "int8_t" + group_name: "string" + + JOINT = 1 + GRIPPER = 2 + BASE = 3 + IMU = 4 + + def __init__(self, name="", resource_type=0, group_name=""): + # LCM Type: string + self.name = name + # LCM Type: int8_t + self.resource_type = resource_type + # LCM Type: string + self.group_name = group_name + + def lcm_encode(self): + buf = BytesIO() + buf.write(ResourceDescription._get_packed_fingerprint()) + self._encode_one(buf) + return buf.getvalue() + + def _encode_one(self, buf): + __name_encoded = self.name.encode("utf-8") + buf.write(struct.pack(">I", len(__name_encoded) + 1)) + buf.write(__name_encoded) + buf.write(b"\0") + buf.write(struct.pack(">b", self.resource_type)) + __group_name_encoded = self.group_name.encode("utf-8") + buf.write(struct.pack(">I", len(__group_name_encoded) + 1)) + buf.write(__group_name_encoded) + buf.write(b"\0") + + @classmethod + def lcm_decode(cls, data: bytes): + if hasattr(data, "read"): + buf = data + else: + buf = BytesIO(data) + if buf.read(8) != cls._get_packed_fingerprint(): + raise ValueError("Decode error") + return cls._decode_one(buf) + + @classmethod + def _decode_one(cls, buf): + self = cls() + __name_len = struct.unpack(">I", buf.read(4))[0] + self.name = buf.read(__name_len)[:-1].decode("utf-8", "replace") + self.resource_type = struct.unpack(">b", buf.read(1))[0] + __group_name_len = struct.unpack(">I", buf.read(4))[0] + self.group_name = buf.read(__group_name_len)[:-1].decode("utf-8", "replace") + return self + + @classmethod + def _get_field_type(cls, field_name): + """Get the type for a field from annotations.""" + annotation = cls.__annotations__.get(field_name) + if annotation is None: + return None + if isinstance(annotation, str): + module = sys.modules[cls.__module__] + if hasattr(module, annotation): + return getattr(module, annotation) + return None + return annotation + + @classmethod + def _get_hash_recursive(cls, parents): + if cls in parents: + return 0 + tmphash = (0x802E2D1F1CD1DF73) & 0xFFFFFFFFFFFFFFFF + tmphash = ( + ((tmphash << 1) & 0xFFFFFFFFFFFFFFFF) + (tmphash >> 63) + ) & 0xFFFFFFFFFFFFFFFF + return tmphash + + _packed_fingerprint = None + + @classmethod + def _get_packed_fingerprint(cls): + if cls._packed_fingerprint is None: + cls._packed_fingerprint = struct.pack(">Q", cls._get_hash_recursive([])) + return cls._packed_fingerprint + + def get_hash(self): + """Get the LCM hash of the struct""" + return struct.unpack(">Q", cls._get_packed_fingerprint())[0] diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/__init__.py new file mode 100644 index 0000000..55c7dfd --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs/__init__.py @@ -0,0 +1,13 @@ +"""LCM package __init__.py file +This file automatically generated by lcm-gen. +DO NOT MODIFY BY HAND!!!! +lcm-gen 1.5.2 +""" + +from .ConnectionStatus import ConnectionStatus as ConnectionStatus +from .ConnectionControl import ConnectionControl as ConnectionControl +from .ConnectionDescription import ConnectionDescription as ConnectionDescription +from .CommandProfile import CommandProfile as CommandProfile +from .InterfaceDescription import InterfaceDescription as InterfaceDescription +from .ResourceDescription import ResourceDescription as ResourceDescription +from .ControlValues import ControlValues as ControlValues diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_core_msgs/ModuleReadiness.py b/generated/python_lcm_msgs/lcm_msgs/dimos_core_msgs/ModuleReadiness.py new file mode 100644 index 0000000..4f27a3a --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_core_msgs/ModuleReadiness.py @@ -0,0 +1,120 @@ +"""LCM type definitions +This file automatically generated by lcm. +DO NOT MODIFY BY HAND!!!! +""" + +from io import BytesIO +import struct +import sys + + +class ModuleReadiness(object): + msg_name = "dimos_core_msgs.ModuleReadiness" + + __slots__ = ["source", "generation", "sequence", "source_ts", "ready", "reason"] + + __typenames__ = ["string", "int64_t", "int64_t", "double", "boolean", "string"] + + __dimensions__ = [None, None, None, None, None, None] + + source: "string" + generation: "int64_t" + sequence: "int64_t" + source_ts: "double" + ready: "boolean" + reason: "string" + + def __init__( + self, source="", generation=0, sequence=0, source_ts=0.0, ready=False, reason="" + ): + # LCM Type: string + self.source = source + # LCM Type: int64_t + self.generation = generation + # LCM Type: int64_t + self.sequence = sequence + # LCM Type: double + self.source_ts = source_ts + # LCM Type: boolean + self.ready = ready + # LCM Type: string + self.reason = reason + + def lcm_encode(self): + buf = BytesIO() + buf.write(ModuleReadiness._get_packed_fingerprint()) + self._encode_one(buf) + return buf.getvalue() + + def _encode_one(self, buf): + __source_encoded = self.source.encode("utf-8") + buf.write(struct.pack(">I", len(__source_encoded) + 1)) + buf.write(__source_encoded) + buf.write(b"\0") + buf.write( + struct.pack( + ">qqdb", self.generation, self.sequence, self.source_ts, self.ready + ) + ) + __reason_encoded = self.reason.encode("utf-8") + buf.write(struct.pack(">I", len(__reason_encoded) + 1)) + buf.write(__reason_encoded) + buf.write(b"\0") + + @classmethod + def lcm_decode(cls, data: bytes): + if hasattr(data, "read"): + buf = data + else: + buf = BytesIO(data) + if buf.read(8) != cls._get_packed_fingerprint(): + raise ValueError("Decode error") + return cls._decode_one(buf) + + @classmethod + def _decode_one(cls, buf): + self = cls() + __source_len = struct.unpack(">I", buf.read(4))[0] + self.source = buf.read(__source_len)[:-1].decode("utf-8", "replace") + self.generation, self.sequence, self.source_ts = struct.unpack( + ">qqd", buf.read(24) + ) + self.ready = bool(struct.unpack("b", buf.read(1))[0]) + __reason_len = struct.unpack(">I", buf.read(4))[0] + self.reason = buf.read(__reason_len)[:-1].decode("utf-8", "replace") + return self + + @classmethod + def _get_field_type(cls, field_name): + """Get the type for a field from annotations.""" + annotation = cls.__annotations__.get(field_name) + if annotation is None: + return None + if isinstance(annotation, str): + module = sys.modules[cls.__module__] + if hasattr(module, annotation): + return getattr(module, annotation) + return None + return annotation + + @classmethod + def _get_hash_recursive(cls, parents): + if cls in parents: + return 0 + tmphash = (0x150D1BFA7D87808D) & 0xFFFFFFFFFFFFFFFF + tmphash = ( + ((tmphash << 1) & 0xFFFFFFFFFFFFFFFF) + (tmphash >> 63) + ) & 0xFFFFFFFFFFFFFFFF + return tmphash + + _packed_fingerprint = None + + @classmethod + def _get_packed_fingerprint(cls): + if cls._packed_fingerprint is None: + cls._packed_fingerprint = struct.pack(">Q", cls._get_hash_recursive([])) + return cls._packed_fingerprint + + def get_hash(self): + """Get the LCM hash of the struct""" + return struct.unpack(">Q", cls._get_packed_fingerprint())[0] diff --git a/generated/python_lcm_msgs/lcm_msgs/dimos_core_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/dimos_core_msgs/__init__.py new file mode 100644 index 0000000..c925e77 --- /dev/null +++ b/generated/python_lcm_msgs/lcm_msgs/dimos_core_msgs/__init__.py @@ -0,0 +1,7 @@ +"""LCM package __init__.py file +This file automatically generated by lcm-gen. +DO NOT MODIFY BY HAND!!!! +lcm-gen 1.5.2 +""" + +from .ModuleReadiness import ModuleReadiness as ModuleReadiness diff --git a/generated/python_lcm_msgs/lcm_msgs/foxglove_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/foxglove_msgs/__init__.py index c9d4bca..06c0c71 100644 --- a/generated/python_lcm_msgs/lcm_msgs/foxglove_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/foxglove_msgs/__init__.py @@ -4,38 +4,38 @@ lcm-gen 1.5.2 """ +from .Vector2 import Vector2 as Vector2 +from .TriangleListPrimitive import TriangleListPrimitive as TriangleListPrimitive +from .TextPrimitive import TextPrimitive as TextPrimitive +from .TextAnnotation import TextAnnotation as TextAnnotation from .SpherePrimitive import SpherePrimitive as SpherePrimitive -from .LinePrimitive import LinePrimitive as LinePrimitive +from .SceneUpdate import SceneUpdate as SceneUpdate +from .SceneEntityDeletion import SceneEntityDeletion as SceneEntityDeletion +from .SceneEntity import SceneEntity as SceneEntity +from .RawImage import RawImage as RawImage +from .RawAudio import RawAudio as RawAudio from .PosesInFrame import PosesInFrame as PosesInFrame -from .CompressedImage import CompressedImage as CompressedImage -from .Log import Log as Log +from .PoseInFrame import PoseInFrame as PoseInFrame +from .PointsAnnotation import PointsAnnotation as PointsAnnotation from .PointCloud import PointCloud as PointCloud -from .TextAnnotation import TextAnnotation as TextAnnotation -from .LaserScan import LaserScan as LaserScan -from .ArrowPrimitive import ArrowPrimitive as ArrowPrimitive -from .CompressedVideo import CompressedVideo as CompressedVideo -from .SceneUpdate import SceneUpdate as SceneUpdate -from .GeoJSON import GeoJSON as GeoJSON +from .Point2 import Point2 as Point2 from .PackedElementField import PackedElementField as PackedElementField -from .Grid import Grid as Grid -from .RawImage import RawImage as RawImage +from .ModelPrimitive import ModelPrimitive as ModelPrimitive +from .Log import Log as Log +from .LocationFix import LocationFix as LocationFix +from .LinePrimitive import LinePrimitive as LinePrimitive +from .LaserScan import LaserScan as LaserScan +from .KeyValuePair import KeyValuePair as KeyValuePair from .ImageAnnotations import ImageAnnotations as ImageAnnotations -from .CubePrimitive import CubePrimitive as CubePrimitive +from .Grid import Grid as Grid +from .GeoJSON import GeoJSON as GeoJSON from .FrameTransforms import FrameTransforms as FrameTransforms -from .SceneEntity import SceneEntity as SceneEntity -from .SceneEntityDeletion import SceneEntityDeletion as SceneEntityDeletion -from .PoseInFrame import PoseInFrame as PoseInFrame -from .PointsAnnotation import PointsAnnotation as PointsAnnotation from .FrameTransform import FrameTransform as FrameTransform -from .Vector2 import Vector2 as Vector2 -from .Color import Color as Color -from .TextPrimitive import TextPrimitive as TextPrimitive -from .CameraCalibration import CameraCalibration as CameraCalibration from .CylinderPrimitive import CylinderPrimitive as CylinderPrimitive +from .CubePrimitive import CubePrimitive as CubePrimitive +from .CompressedVideo import CompressedVideo as CompressedVideo +from .CompressedImage import CompressedImage as CompressedImage +from .Color import Color as Color from .CircleAnnotation import CircleAnnotation as CircleAnnotation -from .LocationFix import LocationFix as LocationFix -from .ModelPrimitive import ModelPrimitive as ModelPrimitive -from .KeyValuePair import KeyValuePair as KeyValuePair -from .TriangleListPrimitive import TriangleListPrimitive as TriangleListPrimitive -from .Point2 import Point2 as Point2 -from .RawAudio import RawAudio as RawAudio +from .CameraCalibration import CameraCalibration as CameraCalibration +from .ArrowPrimitive import ArrowPrimitive as ArrowPrimitive diff --git a/generated/python_lcm_msgs/lcm_msgs/geometry_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/geometry_msgs/__init__.py index db7d12c..3ea1639 100644 --- a/generated/python_lcm_msgs/lcm_msgs/geometry_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/geometry_msgs/__init__.py @@ -4,38 +4,38 @@ lcm-gen 1.5.2 """ -from .Point import Point as Point -from .Twist import Twist as Twist +from .WrenchStamped import WrenchStamped as WrenchStamped +from .Wrench import Wrench as Wrench +from .Vector3Stamped import Vector3Stamped as Vector3Stamped +from .Vector3 import Vector3 as Vector3 from .TwistWithCovarianceStamped import ( TwistWithCovarianceStamped as TwistWithCovarianceStamped, ) -from .PolygonStamped import PolygonStamped as PolygonStamped +from .TwistWithCovariance import TwistWithCovariance as TwistWithCovariance +from .TwistStamped import TwistStamped as TwistStamped +from .Twist import Twist as Twist from .TransformStamped import TransformStamped as TransformStamped -from .Accel import Accel as Accel -from .WrenchStamped import WrenchStamped as WrenchStamped -from .Point32 import Point32 as Point32 -from .Vector3Stamped import Vector3Stamped as Vector3Stamped -from .PoseWithCovariance import PoseWithCovariance as PoseWithCovariance -from .Pose2D import Pose2D as Pose2D -from .InertiaStamped import InertiaStamped as InertiaStamped -from .Vector3 import Vector3 as Vector3 +from .Transform import Transform as Transform +from .QuaternionStamped import QuaternionStamped as QuaternionStamped +from .Quaternion import Quaternion as Quaternion from .PoseWithCovarianceStamped import ( PoseWithCovarianceStamped as PoseWithCovarianceStamped, ) +from .PoseWithCovariance import PoseWithCovariance as PoseWithCovariance +from .PoseStamped import PoseStamped as PoseStamped from .PoseArray import PoseArray as PoseArray +from .Pose2D import Pose2D as Pose2D +from .Pose import Pose as Pose +from .PolygonStamped import PolygonStamped as PolygonStamped +from .Polygon import Polygon as Polygon +from .PointStamped import PointStamped as PointStamped +from .Point32 import Point32 as Point32 +from .Point import Point as Point +from .InertiaStamped import InertiaStamped as InertiaStamped +from .Inertia import Inertia as Inertia from .AccelWithCovarianceStamped import ( AccelWithCovarianceStamped as AccelWithCovarianceStamped, ) -from .Quaternion import Quaternion as Quaternion -from .PoseStamped import PoseStamped as PoseStamped -from .AccelStamped import AccelStamped as AccelStamped from .AccelWithCovariance import AccelWithCovariance as AccelWithCovariance -from .PointStamped import PointStamped as PointStamped -from .Polygon import Polygon as Polygon -from .Transform import Transform as Transform -from .TwistStamped import TwistStamped as TwistStamped -from .TwistWithCovariance import TwistWithCovariance as TwistWithCovariance -from .QuaternionStamped import QuaternionStamped as QuaternionStamped -from .Pose import Pose as Pose -from .Inertia import Inertia as Inertia -from .Wrench import Wrench as Wrench +from .AccelStamped import AccelStamped as AccelStamped +from .Accel import Accel as Accel diff --git a/generated/python_lcm_msgs/lcm_msgs/nav_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/nav_msgs/__init__.py index 46da229..6a321e4 100644 --- a/generated/python_lcm_msgs/lcm_msgs/nav_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/nav_msgs/__init__.py @@ -5,7 +5,7 @@ """ from .Path import Path as Path -from .OccupancyGrid import OccupancyGrid as OccupancyGrid from .Odometry import Odometry as Odometry -from .GridCells import GridCells as GridCells +from .OccupancyGrid import OccupancyGrid as OccupancyGrid from .MapMetaData import MapMetaData as MapMetaData +from .GridCells import GridCells as GridCells diff --git a/generated/python_lcm_msgs/lcm_msgs/sensor_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/sensor_msgs/__init__.py index 6e30d68..b9eaba0 100644 --- a/generated/python_lcm_msgs/lcm_msgs/sensor_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/sensor_msgs/__init__.py @@ -4,30 +4,30 @@ lcm-gen 1.5.2 """ -from .CameraInfo import CameraInfo as CameraInfo -from .Joy import Joy as Joy +from .TimeReference import TimeReference as TimeReference from .Temperature import Temperature as Temperature -from .MultiEchoLaserScan import MultiEchoLaserScan as MultiEchoLaserScan +from .RelativeHumidity import RelativeHumidity as RelativeHumidity from .RegionOfInterest import RegionOfInterest as RegionOfInterest -from .Illuminance import Illuminance as Illuminance -from .ChannelFloat32 import ChannelFloat32 as ChannelFloat32 -from .JoyFeedbackArray import JoyFeedbackArray as JoyFeedbackArray -from .FluidPressure import FluidPressure as FluidPressure +from .Range import Range as Range from .PointField import PointField as PointField -from .BatteryState import BatteryState as BatteryState +from .PointCloud2 import PointCloud2 as PointCloud2 +from .PointCloud import PointCloud as PointCloud from .NavSatStatus import NavSatStatus as NavSatStatus -from .JointState import JointState as JointState -from .LaserEcho import LaserEcho as LaserEcho -from .JoyFeedback import JoyFeedback as JoyFeedback +from .NavSatFix import NavSatFix as NavSatFix +from .MultiEchoLaserScan import MultiEchoLaserScan as MultiEchoLaserScan from .MultiDOFJointState import MultiDOFJointState as MultiDOFJointState -from .PointCloud import PointCloud as PointCloud -from .CompressedImage import CompressedImage as CompressedImage -from .PointCloud2 import PointCloud2 as PointCloud2 from .MagneticField import MagneticField as MagneticField -from .NavSatFix import NavSatFix as NavSatFix -from .TimeReference import TimeReference as TimeReference -from .Image import Image as Image from .LaserScan import LaserScan as LaserScan -from .Range import Range as Range +from .LaserEcho import LaserEcho as LaserEcho +from .JoyFeedbackArray import JoyFeedbackArray as JoyFeedbackArray +from .JoyFeedback import JoyFeedback as JoyFeedback +from .Joy import Joy as Joy +from .JointState import JointState as JointState from .Imu import Imu as Imu -from .RelativeHumidity import RelativeHumidity as RelativeHumidity +from .Image import Image as Image +from .Illuminance import Illuminance as Illuminance +from .FluidPressure import FluidPressure as FluidPressure +from .CompressedImage import CompressedImage as CompressedImage +from .ChannelFloat32 import ChannelFloat32 as ChannelFloat32 +from .CameraInfo import CameraInfo as CameraInfo +from .BatteryState import BatteryState as BatteryState diff --git a/generated/python_lcm_msgs/lcm_msgs/shape_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/shape_msgs/__init__.py index dd32da1..89e2c8f 100644 --- a/generated/python_lcm_msgs/lcm_msgs/shape_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/shape_msgs/__init__.py @@ -4,7 +4,7 @@ lcm-gen 1.5.2 """ -from .Plane import Plane as Plane from .SolidPrimitive import SolidPrimitive as SolidPrimitive +from .Plane import Plane as Plane from .MeshTriangle import MeshTriangle as MeshTriangle from .Mesh import Mesh as Mesh diff --git a/generated/python_lcm_msgs/lcm_msgs/std_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/std_msgs/__init__.py index 44b5734..7f9d5b2 100644 --- a/generated/python_lcm_msgs/lcm_msgs/std_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/std_msgs/__init__.py @@ -4,35 +4,35 @@ lcm-gen 1.5.2 """ -from .Int8MultiArray import Int8MultiArray as Int8MultiArray -from .Float32MultiArray import Float32MultiArray as Float32MultiArray -from .String import String as String -from .Bool import Bool as Bool from .UInt8MultiArray import UInt8MultiArray as UInt8MultiArray -from .Header import Header as Header -from .UInt64 import UInt64 as UInt64 -from .Int64MultiArray import Int64MultiArray as Int64MultiArray -from .ByteMultiArray import ByteMultiArray as ByteMultiArray -from .MultiArrayDimension import MultiArrayDimension as MultiArrayDimension -from .Float64MultiArray import Float64MultiArray as Float64MultiArray -from .UInt16MultiArray import UInt16MultiArray as UInt16MultiArray -from .Int64 import Int64 as Int64 -from .Empty import Empty as Empty -from .Duration import Duration as Duration -from .Byte import Byte as Byte -from .UInt16 import UInt16 as UInt16 -from .Float32 import Float32 as Float32 -from .Int16MultiArray import Int16MultiArray as Int16MultiArray -from .Char import Char as Char +from .UInt8 import UInt8 as UInt8 from .UInt64MultiArray import UInt64MultiArray as UInt64MultiArray -from .Int32MultiArray import Int32MultiArray as Int32MultiArray -from .MultiArrayLayout import MultiArrayLayout as MultiArrayLayout +from .UInt64 import UInt64 as UInt64 from .UInt32MultiArray import UInt32MultiArray as UInt32MultiArray -from .UInt8 import UInt8 as UInt8 -from .ColorRGBA import ColorRGBA as ColorRGBA -from .Int16 import Int16 as Int16 from .UInt32 import UInt32 as UInt32 -from .Float64 import Float64 as Float64 +from .UInt16MultiArray import UInt16MultiArray as UInt16MultiArray +from .UInt16 import UInt16 as UInt16 from .Time import Time as Time +from .String import String as String +from .MultiArrayLayout import MultiArrayLayout as MultiArrayLayout +from .MultiArrayDimension import MultiArrayDimension as MultiArrayDimension +from .Int8MultiArray import Int8MultiArray as Int8MultiArray from .Int8 import Int8 as Int8 +from .Int64MultiArray import Int64MultiArray as Int64MultiArray +from .Int64 import Int64 as Int64 +from .Int32MultiArray import Int32MultiArray as Int32MultiArray from .Int32 import Int32 as Int32 +from .Int16MultiArray import Int16MultiArray as Int16MultiArray +from .Int16 import Int16 as Int16 +from .Header import Header as Header +from .Float64MultiArray import Float64MultiArray as Float64MultiArray +from .Float64 import Float64 as Float64 +from .Float32MultiArray import Float32MultiArray as Float32MultiArray +from .Float32 import Float32 as Float32 +from .Empty import Empty as Empty +from .Duration import Duration as Duration +from .ColorRGBA import ColorRGBA as ColorRGBA +from .Char import Char as Char +from .ByteMultiArray import ByteMultiArray as ByteMultiArray +from .Byte import Byte as Byte +from .Bool import Bool as Bool diff --git a/generated/python_lcm_msgs/lcm_msgs/tf2_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/tf2_msgs/__init__.py index dc13e8f..7e43e78 100644 --- a/generated/python_lcm_msgs/lcm_msgs/tf2_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/tf2_msgs/__init__.py @@ -4,5 +4,5 @@ lcm-gen 1.5.2 """ -from .TF2Error import TF2Error as TF2Error from .TFMessage import TFMessage as TFMessage +from .TF2Error import TF2Error as TF2Error diff --git a/generated/python_lcm_msgs/lcm_msgs/trajectory_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/trajectory_msgs/__init__.py index 88f9d7d..ac6ab9d 100644 --- a/generated/python_lcm_msgs/lcm_msgs/trajectory_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/trajectory_msgs/__init__.py @@ -4,9 +4,9 @@ lcm-gen 1.5.2 """ -from .JointTrajectory import JointTrajectory as JointTrajectory from .MultiDOFJointTrajectoryPoint import ( MultiDOFJointTrajectoryPoint as MultiDOFJointTrajectoryPoint, ) from .MultiDOFJointTrajectory import MultiDOFJointTrajectory as MultiDOFJointTrajectory from .JointTrajectoryPoint import JointTrajectoryPoint as JointTrajectoryPoint +from .JointTrajectory import JointTrajectory as JointTrajectory diff --git a/generated/python_lcm_msgs/lcm_msgs/vision_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/vision_msgs/__init__.py index 05c5365..1941fa0 100644 --- a/generated/python_lcm_msgs/lcm_msgs/vision_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/vision_msgs/__init__.py @@ -4,21 +4,21 @@ lcm-gen 1.5.2 """ -from .BoundingBox2D import BoundingBox2D as BoundingBox2D +from .VisionInfo import VisionInfo as VisionInfo +from .VisionClass import VisionClass as VisionClass +from .Pose2D import Pose2D as Pose2D +from .Point2D import Point2D as Point2D from .ObjectHypothesisWithPose import ( ObjectHypothesisWithPose as ObjectHypothesisWithPose, ) -from .BoundingBox3DArray import BoundingBox3DArray as BoundingBox3DArray -from .Detection3D import Detection3D as Detection3D -from .Detection3DArray import Detection3DArray as Detection3DArray -from .LabelInfo import LabelInfo as LabelInfo -from .Point2D import Point2D as Point2D from .ObjectHypothesis import ObjectHypothesis as ObjectHypothesis +from .LabelInfo import LabelInfo as LabelInfo +from .Detection3DArray import Detection3DArray as Detection3DArray +from .Detection3D import Detection3D as Detection3D from .Detection2DArray import Detection2DArray as Detection2DArray -from .VisionInfo import VisionInfo as VisionInfo -from .BoundingBox2DArray import BoundingBox2DArray as BoundingBox2DArray -from .BoundingBox3D import BoundingBox3D as BoundingBox3D -from .Pose2D import Pose2D as Pose2D -from .VisionClass import VisionClass as VisionClass -from .Classification import Classification as Classification from .Detection2D import Detection2D as Detection2D +from .Classification import Classification as Classification +from .BoundingBox3DArray import BoundingBox3DArray as BoundingBox3DArray +from .BoundingBox3D import BoundingBox3D as BoundingBox3D +from .BoundingBox2DArray import BoundingBox2DArray as BoundingBox2DArray +from .BoundingBox2D import BoundingBox2D as BoundingBox2D diff --git a/generated/python_lcm_msgs/lcm_msgs/visualization_msgs/__init__.py b/generated/python_lcm_msgs/lcm_msgs/visualization_msgs/__init__.py index 4f7f3b9..e32d127 100644 --- a/generated/python_lcm_msgs/lcm_msgs/visualization_msgs/__init__.py +++ b/generated/python_lcm_msgs/lcm_msgs/visualization_msgs/__init__.py @@ -4,17 +4,17 @@ lcm-gen 1.5.2 """ +from .MenuEntry import MenuEntry as MenuEntry +from .MarkerArray import MarkerArray as MarkerArray +from .Marker import Marker as Marker +from .InteractiveMarkerUpdate import InteractiveMarkerUpdate as InteractiveMarkerUpdate +from .InteractiveMarkerPose import InteractiveMarkerPose as InteractiveMarkerPose +from .InteractiveMarkerInit import InteractiveMarkerInit as InteractiveMarkerInit from .InteractiveMarkerFeedback import ( InteractiveMarkerFeedback as InteractiveMarkerFeedback, ) -from .InteractiveMarkerPose import InteractiveMarkerPose as InteractiveMarkerPose -from .MarkerArray import MarkerArray as MarkerArray from .InteractiveMarkerControl import ( InteractiveMarkerControl as InteractiveMarkerControl, ) -from .InteractiveMarkerInit import InteractiveMarkerInit as InteractiveMarkerInit -from .InteractiveMarkerUpdate import InteractiveMarkerUpdate as InteractiveMarkerUpdate from .InteractiveMarker import InteractiveMarker as InteractiveMarker -from .Marker import Marker as Marker from .ImageMarker import ImageMarker as ImageMarker -from .MenuEntry import MenuEntry as MenuEntry diff --git a/generated/rust_lcm_msgs/src/dimos_control_msgs/command_profile.rs b/generated/rust_lcm_msgs/src/dimos_control_msgs/command_profile.rs new file mode 100644 index 0000000..3ed5893 --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_control_msgs/command_profile.rs @@ -0,0 +1,145 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use std::io::{self, Read, Write, Cursor}; +use std::sync::OnceLock; + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct CommandProfile { + pub name: std::string::String, + pub required_fields: Vec, + pub optional_fields: Vec, + pub uniform_across_resources: bool, +} + +impl CommandProfile { + pub const HASH: i64 = 0x38538E7A9D86EB4Au64 as i64; + pub const NAME: &str = "dimos_control_msgs.CommandProfile"; + + fn packed_fingerprint() -> u64 { + static CACHE: OnceLock = OnceLock::new(); + *CACHE.get_or_init(|| Self::hash_recursive(&mut Vec::new())) + } + + pub(crate) fn hash_recursive(parents: &mut Vec) -> u64 { + let self_hash = Self::HASH as u64; + if parents.contains(&self_hash) { + return 0; + } + parents.push(self_hash); + let tmphash = self_hash as u64; + parents.pop(); + // rotate left by 1 + tmphash << 1 | tmphash >> 63 + } + + pub fn encode(&self) -> Vec { + let mut buf = Vec::with_capacity(8 + self.encoded_size()); + buf.write_u64::(Self::packed_fingerprint()).unwrap(); + self.encode_one(&mut buf).unwrap(); + buf + } + + pub fn decode(data: &[u8]) -> io::Result { + let mut cursor = Cursor::new(data); + let hash = cursor.read_u64::()?; + let expected = Self::packed_fingerprint(); + if hash != expected { + return Err(io::Error::new(io::ErrorKind::InvalidData, + format!("Hash mismatch: expected {:016x}, got {:016x}", expected, hash))); + } + Self::decode_one(&mut cursor) + } + + pub fn encode_one(&self, buf: &mut W) -> io::Result<()> { + { + let bytes = self.name.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + buf.write_i32::(self.required_fields.len() as i32)?; + buf.write_i32::(self.optional_fields.len() as i32)?; + for v0 in self.required_fields.iter() { + { + let bytes = v0.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + } + for v0 in self.optional_fields.iter() { + { + let bytes = v0.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + } + buf.write_i8(if self.uniform_across_resources { 1 } else { 0 })?; + Ok(()) + } + + pub fn decode_one(buf: &mut R) -> io::Result { + let name = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let required_fields_length = buf.read_i32::()? as usize; + let optional_fields_length = buf.read_i32::()? as usize; + let required_fields = { + let mut v = Vec::with_capacity(required_fields_length); + for _ in 0..required_fields_length { + let _elem_0 = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + v.push(_elem_0); + } + v + }; + let optional_fields = { + let mut v = Vec::with_capacity(optional_fields_length); + for _ in 0..optional_fields_length { + let _elem_0 = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + v.push(_elem_0); + } + v + }; + let uniform_across_resources = buf.read_i8()? != 0; + Ok(Self { + name, + required_fields, + optional_fields, + uniform_across_resources, + }) + } + + pub fn encoded_size(&self) -> usize { + let mut size = 0usize; + size += 4 + self.name.len() + 1; + size += 4; + size += 4; + for s0 in self.required_fields.iter() { + size += 4 + s0.len() + 1; + } + for s0 in self.optional_fields.iter() { + size += 4 + s0.len() + 1; + } + size += 1; + size + } + +} diff --git a/generated/rust_lcm_msgs/src/dimos_control_msgs/connection_control.rs b/generated/rust_lcm_msgs/src/dimos_control_msgs/connection_control.rs new file mode 100644 index 0000000..8821f2a --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_control_msgs/connection_control.rs @@ -0,0 +1,133 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use std::io::{self, Read, Write, Cursor}; +use std::sync::OnceLock; + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct ConnectionControl { + pub target_sources: Vec, + pub operation_id: i64, + pub operation: i8, + pub proposed_control_epoch: i64, + pub reason: std::string::String, +} + +impl ConnectionControl { + pub const HASH: i64 = 0xB82D9643472F465Du64 as i64; + pub const NAME: &str = "dimos_control_msgs.ConnectionControl"; + + pub const PREPARE_ARM: i8 = 1; + pub const COMMIT_ARM: i8 = 2; + pub const ABORT_ARM: i8 = 3; + pub const SAFE_STOP: i8 = 4; + pub const CLEAR_SAFE_STOP: i8 = 5; + pub const ESTOP: i8 = 6; + pub const CLEAR_ESTOP: i8 = 7; + + fn packed_fingerprint() -> u64 { + static CACHE: OnceLock = OnceLock::new(); + *CACHE.get_or_init(|| Self::hash_recursive(&mut Vec::new())) + } + + pub(crate) fn hash_recursive(parents: &mut Vec) -> u64 { + let self_hash = Self::HASH as u64; + if parents.contains(&self_hash) { + return 0; + } + parents.push(self_hash); + let tmphash = self_hash as u64; + parents.pop(); + // rotate left by 1 + tmphash << 1 | tmphash >> 63 + } + + pub fn encode(&self) -> Vec { + let mut buf = Vec::with_capacity(8 + self.encoded_size()); + buf.write_u64::(Self::packed_fingerprint()).unwrap(); + self.encode_one(&mut buf).unwrap(); + buf + } + + pub fn decode(data: &[u8]) -> io::Result { + let mut cursor = Cursor::new(data); + let hash = cursor.read_u64::()?; + let expected = Self::packed_fingerprint(); + if hash != expected { + return Err(io::Error::new(io::ErrorKind::InvalidData, + format!("Hash mismatch: expected {:016x}, got {:016x}", expected, hash))); + } + Self::decode_one(&mut cursor) + } + + pub fn encode_one(&self, buf: &mut W) -> io::Result<()> { + buf.write_i32::(self.target_sources.len() as i32)?; + for v0 in self.target_sources.iter() { + { + let bytes = v0.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + } + buf.write_i64::(self.operation_id)?; + buf.write_i8(self.operation)?; + buf.write_i64::(self.proposed_control_epoch)?; + { + let bytes = self.reason.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + Ok(()) + } + + pub fn decode_one(buf: &mut R) -> io::Result { + let target_sources_length = buf.read_i32::()? as usize; + let target_sources = { + let mut v = Vec::with_capacity(target_sources_length); + for _ in 0..target_sources_length { + let _elem_0 = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + v.push(_elem_0); + } + v + }; + let operation_id = buf.read_i64::()?; + let operation = buf.read_i8()?; + let proposed_control_epoch = buf.read_i64::()?; + let reason = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + Ok(Self { + target_sources, + operation_id, + operation, + proposed_control_epoch, + reason, + }) + } + + pub fn encoded_size(&self) -> usize { + let mut size = 0usize; + size += 4; + for s0 in self.target_sources.iter() { + size += 4 + s0.len() + 1; + } + size += 8; + size += 1; + size += 8; + size += 4 + self.reason.len() + 1; + size + } + +} diff --git a/generated/rust_lcm_msgs/src/dimos_control_msgs/connection_description.rs b/generated/rust_lcm_msgs/src/dimos_control_msgs/connection_description.rs new file mode 100644 index 0000000..5639cfb --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_control_msgs/connection_description.rs @@ -0,0 +1,217 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use std::io::{self, Read, Write, Cursor}; +use std::sync::OnceLock; + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct ConnectionDescription { + pub source: std::string::String, + pub description_epoch: i64, + pub resources: Vec, + pub interfaces: Vec, + pub command_profiles: Vec, + pub expected_state_rate_hz: f64, + pub state_stale_timeout_s: f64, + pub command_watchdog_timeout_s: f64, + pub activation_policy: i8, + pub armed_idle_policy: i8, + pub safe_stop_behavior: std::string::String, + pub process_loss_classification: i8, + pub process_loss_evidence: std::string::String, +} + +impl ConnectionDescription { + pub const HASH: i64 = 0x31D30851F65C7D8Cu64 as i64; + pub const NAME: &str = "dimos_control_msgs.ConnectionDescription"; + + pub const DIRECT: i8 = 1; + pub const OPERATOR_CONFIRMED: i8 = 2; + pub const APPLY_OMISSION: i8 = 1; + pub const ARMED_IDLE_SAFE_STOP: i8 = 2; + pub const NATIVE_WATCHDOG: i8 = 1; + pub const EXTERNAL_SUPERVISOR: i8 = 2; + pub const INTRINSICALLY_SAFE: i8 = 3; + pub const SIMULATION: i8 = 4; + pub const UNPROTECTED: i8 = 5; + + fn packed_fingerprint() -> u64 { + static CACHE: OnceLock = OnceLock::new(); + *CACHE.get_or_init(|| Self::hash_recursive(&mut Vec::new())) + } + + pub(crate) fn hash_recursive(parents: &mut Vec) -> u64 { + let self_hash = Self::HASH as u64; + if parents.contains(&self_hash) { + return 0; + } + parents.push(self_hash); + let mut tmphash = self_hash as u64; + tmphash = tmphash.wrapping_add(crate::dimos_control_msgs::ResourceDescription::hash_recursive(parents)); + tmphash = tmphash.wrapping_add(crate::dimos_control_msgs::InterfaceDescription::hash_recursive(parents)); + tmphash = tmphash.wrapping_add(crate::dimos_control_msgs::CommandProfile::hash_recursive(parents)); + parents.pop(); + // rotate left by 1 + tmphash << 1 | tmphash >> 63 + } + + pub fn encode(&self) -> Vec { + let mut buf = Vec::with_capacity(8 + self.encoded_size()); + buf.write_u64::(Self::packed_fingerprint()).unwrap(); + self.encode_one(&mut buf).unwrap(); + buf + } + + pub fn decode(data: &[u8]) -> io::Result { + let mut cursor = Cursor::new(data); + let hash = cursor.read_u64::()?; + let expected = Self::packed_fingerprint(); + if hash != expected { + return Err(io::Error::new(io::ErrorKind::InvalidData, + format!("Hash mismatch: expected {:016x}, got {:016x}", expected, hash))); + } + Self::decode_one(&mut cursor) + } + + pub fn encode_one(&self, buf: &mut W) -> io::Result<()> { + { + let bytes = self.source.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + buf.write_i64::(self.description_epoch)?; + buf.write_i32::(self.resources.len() as i32)?; + buf.write_i32::(self.interfaces.len() as i32)?; + buf.write_i32::(self.command_profiles.len() as i32)?; + for v0 in self.resources.iter() { + v0.encode_one(buf)?; + } + for v0 in self.interfaces.iter() { + v0.encode_one(buf)?; + } + for v0 in self.command_profiles.iter() { + v0.encode_one(buf)?; + } + buf.write_f64::(self.expected_state_rate_hz)?; + buf.write_f64::(self.state_stale_timeout_s)?; + buf.write_f64::(self.command_watchdog_timeout_s)?; + buf.write_i8(self.activation_policy)?; + buf.write_i8(self.armed_idle_policy)?; + { + let bytes = self.safe_stop_behavior.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + buf.write_i8(self.process_loss_classification)?; + { + let bytes = self.process_loss_evidence.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + Ok(()) + } + + pub fn decode_one(buf: &mut R) -> io::Result { + let source = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let description_epoch = buf.read_i64::()?; + let resources_length = buf.read_i32::()? as usize; + let interfaces_length = buf.read_i32::()? as usize; + let command_profiles_length = buf.read_i32::()? as usize; + let resources = { + let mut v = Vec::with_capacity(resources_length); + for _ in 0..resources_length { + let _elem_0 = crate::dimos_control_msgs::ResourceDescription::decode_one(buf)?; + v.push(_elem_0); + } + v + }; + let interfaces = { + let mut v = Vec::with_capacity(interfaces_length); + for _ in 0..interfaces_length { + let _elem_0 = crate::dimos_control_msgs::InterfaceDescription::decode_one(buf)?; + v.push(_elem_0); + } + v + }; + let command_profiles = { + let mut v = Vec::with_capacity(command_profiles_length); + for _ in 0..command_profiles_length { + let _elem_0 = crate::dimos_control_msgs::CommandProfile::decode_one(buf)?; + v.push(_elem_0); + } + v + }; + let expected_state_rate_hz = buf.read_f64::()?; + let state_stale_timeout_s = buf.read_f64::()?; + let command_watchdog_timeout_s = buf.read_f64::()?; + let activation_policy = buf.read_i8()?; + let armed_idle_policy = buf.read_i8()?; + let safe_stop_behavior = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let process_loss_classification = buf.read_i8()?; + let process_loss_evidence = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + Ok(Self { + source, + description_epoch, + resources, + interfaces, + command_profiles, + expected_state_rate_hz, + state_stale_timeout_s, + command_watchdog_timeout_s, + activation_policy, + armed_idle_policy, + safe_stop_behavior, + process_loss_classification, + process_loss_evidence, + }) + } + + pub fn encoded_size(&self) -> usize { + let mut size = 0usize; + size += 4 + self.source.len() + 1; + size += 8; + size += 4; + size += 4; + size += 4; + for v0 in self.resources.iter() { + size += v0.encoded_size(); + } + for v0 in self.interfaces.iter() { + size += v0.encoded_size(); + } + for v0 in self.command_profiles.iter() { + size += v0.encoded_size(); + } + size += 8; + size += 8; + size += 8; + size += 1; + size += 1; + size += 4 + self.safe_stop_behavior.len() + 1; + size += 1; + size += 4 + self.process_loss_evidence.len() + 1; + size + } + +} diff --git a/generated/rust_lcm_msgs/src/dimos_control_msgs/connection_status.rs b/generated/rust_lcm_msgs/src/dimos_control_msgs/connection_status.rs new file mode 100644 index 0000000..c994d7e --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_control_msgs/connection_status.rs @@ -0,0 +1,143 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use std::io::{self, Read, Write, Cursor}; +use std::sync::OnceLock; + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct ConnectionStatus { + pub source: std::string::String, + pub source_ts: f64, + pub lifecycle_state: i8, + pub description_epoch: i64, + pub control_epoch: i64, + pub last_operation_id: i64, + pub last_operation: i8, + pub acknowledgement: i8, + pub fault: std::string::String, +} + +impl ConnectionStatus { + pub const HASH: i64 = 0xC90F95EBFAD6E276u64 as i64; + pub const NAME: &str = "dimos_control_msgs.ConnectionStatus"; + + pub const STANDBY: i8 = 1; + pub const PREPARING: i8 = 2; + pub const PREPARED: i8 = 3; + pub const COMMITTING: i8 = 4; + pub const ARMED: i8 = 5; + pub const SAFE_STOPPED: i8 = 6; + pub const ESTOPPED: i8 = 7; + pub const NONE: i8 = 0; + pub const PENDING: i8 = 1; + pub const SUCCEEDED: i8 = 2; + pub const REJECTED: i8 = 3; + + fn packed_fingerprint() -> u64 { + static CACHE: OnceLock = OnceLock::new(); + *CACHE.get_or_init(|| Self::hash_recursive(&mut Vec::new())) + } + + pub(crate) fn hash_recursive(parents: &mut Vec) -> u64 { + let self_hash = Self::HASH as u64; + if parents.contains(&self_hash) { + return 0; + } + parents.push(self_hash); + let tmphash = self_hash as u64; + parents.pop(); + // rotate left by 1 + tmphash << 1 | tmphash >> 63 + } + + pub fn encode(&self) -> Vec { + let mut buf = Vec::with_capacity(8 + self.encoded_size()); + buf.write_u64::(Self::packed_fingerprint()).unwrap(); + self.encode_one(&mut buf).unwrap(); + buf + } + + pub fn decode(data: &[u8]) -> io::Result { + let mut cursor = Cursor::new(data); + let hash = cursor.read_u64::()?; + let expected = Self::packed_fingerprint(); + if hash != expected { + return Err(io::Error::new(io::ErrorKind::InvalidData, + format!("Hash mismatch: expected {:016x}, got {:016x}", expected, hash))); + } + Self::decode_one(&mut cursor) + } + + pub fn encode_one(&self, buf: &mut W) -> io::Result<()> { + { + let bytes = self.source.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + buf.write_f64::(self.source_ts)?; + buf.write_i8(self.lifecycle_state)?; + buf.write_i64::(self.description_epoch)?; + buf.write_i64::(self.control_epoch)?; + buf.write_i64::(self.last_operation_id)?; + buf.write_i8(self.last_operation)?; + buf.write_i8(self.acknowledgement)?; + { + let bytes = self.fault.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + Ok(()) + } + + pub fn decode_one(buf: &mut R) -> io::Result { + let source = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let source_ts = buf.read_f64::()?; + let lifecycle_state = buf.read_i8()?; + let description_epoch = buf.read_i64::()?; + let control_epoch = buf.read_i64::()?; + let last_operation_id = buf.read_i64::()?; + let last_operation = buf.read_i8()?; + let acknowledgement = buf.read_i8()?; + let fault = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + Ok(Self { + source, + source_ts, + lifecycle_state, + description_epoch, + control_epoch, + last_operation_id, + last_operation, + acknowledgement, + fault, + }) + } + + pub fn encoded_size(&self) -> usize { + let mut size = 0usize; + size += 4 + self.source.len() + 1; + size += 8; + size += 1; + size += 8; + size += 8; + size += 8; + size += 1; + size += 1; + size += 4 + self.fault.len() + 1; + size + } + +} diff --git a/generated/rust_lcm_msgs/src/dimos_control_msgs/control_values.rs b/generated/rust_lcm_msgs/src/dimos_control_msgs/control_values.rs new file mode 100644 index 0000000..b11ab1f --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_control_msgs/control_values.rs @@ -0,0 +1,142 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use std::io::{self, Read, Write, Cursor}; +use std::sync::OnceLock; + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct ControlValues { + pub source: std::string::String, + pub source_ts: f64, + pub epoch: i64, + pub sequence: i64, + pub interface_names: Vec, + pub values: Vec, +} + +impl ControlValues { + pub const HASH: i64 = 0x98D9F64B18D5A4CFu64 as i64; + pub const NAME: &str = "dimos_control_msgs.ControlValues"; + + fn packed_fingerprint() -> u64 { + static CACHE: OnceLock = OnceLock::new(); + *CACHE.get_or_init(|| Self::hash_recursive(&mut Vec::new())) + } + + pub(crate) fn hash_recursive(parents: &mut Vec) -> u64 { + let self_hash = Self::HASH as u64; + if parents.contains(&self_hash) { + return 0; + } + parents.push(self_hash); + let tmphash = self_hash as u64; + parents.pop(); + // rotate left by 1 + tmphash << 1 | tmphash >> 63 + } + + pub fn encode(&self) -> Vec { + let mut buf = Vec::with_capacity(8 + self.encoded_size()); + buf.write_u64::(Self::packed_fingerprint()).unwrap(); + self.encode_one(&mut buf).unwrap(); + buf + } + + pub fn decode(data: &[u8]) -> io::Result { + let mut cursor = Cursor::new(data); + let hash = cursor.read_u64::()?; + let expected = Self::packed_fingerprint(); + if hash != expected { + return Err(io::Error::new(io::ErrorKind::InvalidData, + format!("Hash mismatch: expected {:016x}, got {:016x}", expected, hash))); + } + Self::decode_one(&mut cursor) + } + + pub fn encode_one(&self, buf: &mut W) -> io::Result<()> { + { + let bytes = self.source.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + buf.write_f64::(self.source_ts)?; + buf.write_i64::(self.epoch)?; + buf.write_i64::(self.sequence)?; + buf.write_i32::(self.interface_names.len() as i32)?; + buf.write_i32::(self.values.len() as i32)?; + for v0 in self.interface_names.iter() { + { + let bytes = v0.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + } + for v0 in self.values.iter() { + buf.write_f64::(*v0)?; + } + Ok(()) + } + + pub fn decode_one(buf: &mut R) -> io::Result { + let source = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let source_ts = buf.read_f64::()?; + let epoch = buf.read_i64::()?; + let sequence = buf.read_i64::()?; + let interface_names_length = buf.read_i32::()? as usize; + let values_length = buf.read_i32::()? as usize; + let interface_names = { + let mut v = Vec::with_capacity(interface_names_length); + for _ in 0..interface_names_length { + let _elem_0 = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + v.push(_elem_0); + } + v + }; + let values = { + let mut v = Vec::with_capacity(values_length); + for _ in 0..values_length { + let _elem_0 = buf.read_f64::()?; + v.push(_elem_0); + } + v + }; + Ok(Self { + source, + source_ts, + epoch, + sequence, + interface_names, + values, + }) + } + + pub fn encoded_size(&self) -> usize { + let mut size = 0usize; + size += 4 + self.source.len() + 1; + size += 8; + size += 8; + size += 8; + size += 4; + size += 4; + for s0 in self.interface_names.iter() { + size += 4 + s0.len() + 1; + } + size += self.values.len() * 8; + size + } + +} diff --git a/generated/rust_lcm_msgs/src/dimos_control_msgs/interface_description.rs b/generated/rust_lcm_msgs/src/dimos_control_msgs/interface_description.rs new file mode 100644 index 0000000..17841f2 --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_control_msgs/interface_description.rs @@ -0,0 +1,187 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use std::io::{self, Read, Write, Cursor}; +use std::sync::OnceLock; + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct InterfaceDescription { + pub name: std::string::String, + pub resource: std::string::String, + pub field: std::string::String, + pub unit: std::string::String, + pub state: bool, + pub command: bool, + pub has_hard_min: bool, + pub hard_min: f64, + pub has_hard_max: bool, + pub hard_max: f64, + pub has_soft_min: bool, + pub soft_min: f64, + pub has_soft_max: bool, + pub soft_max: f64, + pub omission_policy: i8, +} + +impl InterfaceDescription { + pub const HASH: i64 = 0xBFB21E12C9A9BD0Du64 as i64; + pub const NAME: &str = "dimos_control_msgs.InterfaceDescription"; + + pub const HOLD_LAST: i8 = 1; + pub const ZERO: i8 = 2; + pub const SAFE_STOP: i8 = 3; + + fn packed_fingerprint() -> u64 { + static CACHE: OnceLock = OnceLock::new(); + *CACHE.get_or_init(|| Self::hash_recursive(&mut Vec::new())) + } + + pub(crate) fn hash_recursive(parents: &mut Vec) -> u64 { + let self_hash = Self::HASH as u64; + if parents.contains(&self_hash) { + return 0; + } + parents.push(self_hash); + let tmphash = self_hash as u64; + parents.pop(); + // rotate left by 1 + tmphash << 1 | tmphash >> 63 + } + + pub fn encode(&self) -> Vec { + let mut buf = Vec::with_capacity(8 + self.encoded_size()); + buf.write_u64::(Self::packed_fingerprint()).unwrap(); + self.encode_one(&mut buf).unwrap(); + buf + } + + pub fn decode(data: &[u8]) -> io::Result { + let mut cursor = Cursor::new(data); + let hash = cursor.read_u64::()?; + let expected = Self::packed_fingerprint(); + if hash != expected { + return Err(io::Error::new(io::ErrorKind::InvalidData, + format!("Hash mismatch: expected {:016x}, got {:016x}", expected, hash))); + } + Self::decode_one(&mut cursor) + } + + pub fn encode_one(&self, buf: &mut W) -> io::Result<()> { + { + let bytes = self.name.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + { + let bytes = self.resource.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + { + let bytes = self.field.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + { + let bytes = self.unit.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + buf.write_i8(if self.state { 1 } else { 0 })?; + buf.write_i8(if self.command { 1 } else { 0 })?; + buf.write_i8(if self.has_hard_min { 1 } else { 0 })?; + buf.write_f64::(self.hard_min)?; + buf.write_i8(if self.has_hard_max { 1 } else { 0 })?; + buf.write_f64::(self.hard_max)?; + buf.write_i8(if self.has_soft_min { 1 } else { 0 })?; + buf.write_f64::(self.soft_min)?; + buf.write_i8(if self.has_soft_max { 1 } else { 0 })?; + buf.write_f64::(self.soft_max)?; + buf.write_i8(self.omission_policy)?; + Ok(()) + } + + pub fn decode_one(buf: &mut R) -> io::Result { + let name = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let resource = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let field = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let unit = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let state = buf.read_i8()? != 0; + let command = buf.read_i8()? != 0; + let has_hard_min = buf.read_i8()? != 0; + let hard_min = buf.read_f64::()?; + let has_hard_max = buf.read_i8()? != 0; + let hard_max = buf.read_f64::()?; + let has_soft_min = buf.read_i8()? != 0; + let soft_min = buf.read_f64::()?; + let has_soft_max = buf.read_i8()? != 0; + let soft_max = buf.read_f64::()?; + let omission_policy = buf.read_i8()?; + Ok(Self { + name, + resource, + field, + unit, + state, + command, + has_hard_min, + hard_min, + has_hard_max, + hard_max, + has_soft_min, + soft_min, + has_soft_max, + soft_max, + omission_policy, + }) + } + + pub fn encoded_size(&self) -> usize { + let mut size = 0usize; + size += 4 + self.name.len() + 1; + size += 4 + self.resource.len() + 1; + size += 4 + self.field.len() + 1; + size += 4 + self.unit.len() + 1; + size += 1; + size += 1; + size += 1; + size += 8; + size += 1; + size += 8; + size += 1; + size += 8; + size += 1; + size += 8; + size += 1; + size + } + +} diff --git a/generated/rust_lcm_msgs/src/dimos_control_msgs/mod.rs b/generated/rust_lcm_msgs/src/dimos_control_msgs/mod.rs new file mode 100644 index 0000000..e883470 --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_control_msgs/mod.rs @@ -0,0 +1,22 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +mod command_profile; +pub use command_profile::CommandProfile; + +mod connection_control; +pub use connection_control::ConnectionControl; + +mod connection_description; +pub use connection_description::ConnectionDescription; + +mod connection_status; +pub use connection_status::ConnectionStatus; + +mod control_values; +pub use control_values::ControlValues; + +mod interface_description; +pub use interface_description::InterfaceDescription; + +mod resource_description; +pub use resource_description::ResourceDescription; diff --git a/generated/rust_lcm_msgs/src/dimos_control_msgs/resource_description.rs b/generated/rust_lcm_msgs/src/dimos_control_msgs/resource_description.rs new file mode 100644 index 0000000..f469691 --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_control_msgs/resource_description.rs @@ -0,0 +1,106 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use std::io::{self, Read, Write, Cursor}; +use std::sync::OnceLock; + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct ResourceDescription { + pub name: std::string::String, + pub resource_type: i8, + pub group_name: std::string::String, +} + +impl ResourceDescription { + pub const HASH: i64 = 0x802E2D1F1CD1DF73u64 as i64; + pub const NAME: &str = "dimos_control_msgs.ResourceDescription"; + + pub const JOINT: i8 = 1; + pub const GRIPPER: i8 = 2; + pub const BASE: i8 = 3; + pub const IMU: i8 = 4; + + fn packed_fingerprint() -> u64 { + static CACHE: OnceLock = OnceLock::new(); + *CACHE.get_or_init(|| Self::hash_recursive(&mut Vec::new())) + } + + pub(crate) fn hash_recursive(parents: &mut Vec) -> u64 { + let self_hash = Self::HASH as u64; + if parents.contains(&self_hash) { + return 0; + } + parents.push(self_hash); + let tmphash = self_hash as u64; + parents.pop(); + // rotate left by 1 + tmphash << 1 | tmphash >> 63 + } + + pub fn encode(&self) -> Vec { + let mut buf = Vec::with_capacity(8 + self.encoded_size()); + buf.write_u64::(Self::packed_fingerprint()).unwrap(); + self.encode_one(&mut buf).unwrap(); + buf + } + + pub fn decode(data: &[u8]) -> io::Result { + let mut cursor = Cursor::new(data); + let hash = cursor.read_u64::()?; + let expected = Self::packed_fingerprint(); + if hash != expected { + return Err(io::Error::new(io::ErrorKind::InvalidData, + format!("Hash mismatch: expected {:016x}, got {:016x}", expected, hash))); + } + Self::decode_one(&mut cursor) + } + + pub fn encode_one(&self, buf: &mut W) -> io::Result<()> { + { + let bytes = self.name.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + buf.write_i8(self.resource_type)?; + { + let bytes = self.group_name.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + Ok(()) + } + + pub fn decode_one(buf: &mut R) -> io::Result { + let name = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let resource_type = buf.read_i8()?; + let group_name = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + Ok(Self { + name, + resource_type, + group_name, + }) + } + + pub fn encoded_size(&self) -> usize { + let mut size = 0usize; + size += 4 + self.name.len() + 1; + size += 1; + size += 4 + self.group_name.len() + 1; + size + } + +} diff --git a/generated/rust_lcm_msgs/src/dimos_core_msgs/mod.rs b/generated/rust_lcm_msgs/src/dimos_core_msgs/mod.rs new file mode 100644 index 0000000..6752b51 --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_core_msgs/mod.rs @@ -0,0 +1,4 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +mod module_readiness; +pub use module_readiness::ModuleReadiness; diff --git a/generated/rust_lcm_msgs/src/dimos_core_msgs/module_readiness.rs b/generated/rust_lcm_msgs/src/dimos_core_msgs/module_readiness.rs new file mode 100644 index 0000000..42ea519 --- /dev/null +++ b/generated/rust_lcm_msgs/src/dimos_core_msgs/module_readiness.rs @@ -0,0 +1,116 @@ +// Auto-generated by lcm-rust-gen. DO NOT EDIT. + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use std::io::{self, Read, Write, Cursor}; +use std::sync::OnceLock; + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct ModuleReadiness { + pub source: std::string::String, + pub generation: i64, + pub sequence: i64, + pub source_ts: f64, + pub ready: bool, + pub reason: std::string::String, +} + +impl ModuleReadiness { + pub const HASH: i64 = 0x150D1BFA7D87808Du64 as i64; + pub const NAME: &str = "dimos_core_msgs.ModuleReadiness"; + + fn packed_fingerprint() -> u64 { + static CACHE: OnceLock = OnceLock::new(); + *CACHE.get_or_init(|| Self::hash_recursive(&mut Vec::new())) + } + + pub(crate) fn hash_recursive(parents: &mut Vec) -> u64 { + let self_hash = Self::HASH as u64; + if parents.contains(&self_hash) { + return 0; + } + parents.push(self_hash); + let tmphash = self_hash as u64; + parents.pop(); + // rotate left by 1 + tmphash << 1 | tmphash >> 63 + } + + pub fn encode(&self) -> Vec { + let mut buf = Vec::with_capacity(8 + self.encoded_size()); + buf.write_u64::(Self::packed_fingerprint()).unwrap(); + self.encode_one(&mut buf).unwrap(); + buf + } + + pub fn decode(data: &[u8]) -> io::Result { + let mut cursor = Cursor::new(data); + let hash = cursor.read_u64::()?; + let expected = Self::packed_fingerprint(); + if hash != expected { + return Err(io::Error::new(io::ErrorKind::InvalidData, + format!("Hash mismatch: expected {:016x}, got {:016x}", expected, hash))); + } + Self::decode_one(&mut cursor) + } + + pub fn encode_one(&self, buf: &mut W) -> io::Result<()> { + { + let bytes = self.source.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + buf.write_i64::(self.generation)?; + buf.write_i64::(self.sequence)?; + buf.write_f64::(self.source_ts)?; + buf.write_i8(if self.ready { 1 } else { 0 })?; + { + let bytes = self.reason.as_bytes(); + buf.write_u32::((bytes.len() + 1) as u32)?; + buf.write_all(bytes)?; + buf.write_u8(0)?; + } + Ok(()) + } + + pub fn decode_one(buf: &mut R) -> io::Result { + let source = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + let generation = buf.read_i64::()?; + let sequence = buf.read_i64::()?; + let source_ts = buf.read_f64::()?; + let ready = buf.read_i8()? != 0; + let reason = { + let len = buf.read_u32::()? as usize; + let mut bytes = vec![0u8; len]; + buf.read_exact(&mut bytes)?; + std::string::String::from_utf8(bytes[..len - 1].to_vec()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))? + }; + Ok(Self { + source, + generation, + sequence, + source_ts, + ready, + reason, + }) + } + + pub fn encoded_size(&self) -> usize { + let mut size = 0usize; + size += 4 + self.source.len() + 1; + size += 8; + size += 8; + size += 8; + size += 1; + size += 4 + self.reason.len() + 1; + size + } + +} diff --git a/generated/rust_lcm_msgs/src/lib.rs b/generated/rust_lcm_msgs/src/lib.rs index 4ab6ab2..cb2891a 100644 --- a/generated/rust_lcm_msgs/src/lib.rs +++ b/generated/rust_lcm_msgs/src/lib.rs @@ -4,6 +4,8 @@ pub mod actionlib_msgs; pub mod builtin_interfaces; pub mod diagnostic_msgs; +pub mod dimos_control_msgs; +pub mod dimos_core_msgs; pub mod foxglove_msgs; pub mod geometry_msgs; pub mod nav_msgs; diff --git a/generated/ts_lcm_msgs/dimos_control_msgs/CommandProfile.ts b/generated/ts_lcm_msgs/dimos_control_msgs/CommandProfile.ts new file mode 100644 index 0000000..13dacb2 --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_control_msgs/CommandProfile.ts @@ -0,0 +1,160 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +export class CommandProfile { + static readonly _HASH = 0x38538e7a9d86eb4an; + static readonly _NAME = "dimos_control_msgs.CommandProfile"; + private static _packedFingerprint: bigint | null = null; + + name: string; + required_fields_length: number; + optional_fields_length: number; + required_fields: string[]; + optional_fields: string[]; + uniform_across_resources: boolean; + + constructor(init?: Partial) { + this.name = init?.name ?? ""; + this.required_fields_length = init?.required_fields_length ?? 0; + this.optional_fields_length = init?.optional_fields_length ?? 0; + this.required_fields = init?.required_fields ?? []; + this.optional_fields = init?.optional_fields ?? []; + this.uniform_across_resources = init?.uniform_across_resources ?? false; + } + + static decode(data: Uint8Array): CommandProfile { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + let offset = 0; + + // Verify fingerprint (recursive hash including nested types) + const hash = view.getBigUint64(offset, false); + offset += 8; + const expectedHash = CommandProfile._getPackedFingerprint(); + if (hash !== expectedHash) { + throw new Error(`Hash mismatch: expected ${expectedHash.toString(16)}, got ${hash.toString(16)}`); + } + + const result = new CommandProfile(); + ({ offset } = CommandProfile._decodeOne(view, offset, result)); + return result; + } + + static _decodeOne(view: DataView, offset: number, target: CommandProfile): { offset: number } { + { + const len = view.getUint32(offset, false); + offset += 4; + target.name = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + target.required_fields_length = view.getInt32(offset, false); + offset += 4; + target.optional_fields_length = view.getInt32(offset, false); + offset += 4; + target.required_fields = new Array(target.required_fields_length); + for (let i0 = 0; i0 < target.required_fields_length; i0++) { + { + const len = view.getUint32(offset, false); + offset += 4; + target.required_fields[i0] = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + } + target.optional_fields = new Array(target.optional_fields_length); + for (let i0 = 0; i0 < target.optional_fields_length; i0++) { + { + const len = view.getUint32(offset, false); + offset += 4; + target.optional_fields[i0] = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + } + target.uniform_across_resources = view.getInt8(offset) !== 0; + offset += 1; + return { offset }; + } + + encode(): Uint8Array { + const size = 8 + this._encodedSize(); + const data = new Uint8Array(size); + const view = new DataView(data.buffer); + let offset = 0; + + // Write fingerprint (recursive hash including nested types) + view.setBigUint64(offset, CommandProfile._getPackedFingerprint(), false); + offset += 8; + + offset = this._encodeOne(view, offset); + return data; + } + + _encodeOne(view: DataView, offset: number): number { + { + const encoded = new TextEncoder().encode(this.name); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + view.setInt32(offset, this.required_fields_length, false); + offset += 4; + view.setInt32(offset, this.optional_fields_length, false); + offset += 4; + for (let i0 = 0; i0 < this.required_fields_length; i0++) { + { + const encoded = new TextEncoder().encode(this.required_fields[i0]); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + } + for (let i0 = 0; i0 < this.optional_fields_length; i0++) { + { + const encoded = new TextEncoder().encode(this.optional_fields[i0]); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + } + view.setInt8(offset, this.uniform_across_resources ? 1 : 0); + offset += 1; + return offset; + } + + _encodedSize(): number { + let size = 0; + size += 4 + new TextEncoder().encode(this.name).length + 1; + size += 4; + size += 4; + for (let i0 = 0; i0 < this.required_fields_length; i0++) { + size += 4 + new TextEncoder().encode(this.required_fields[i0]).length + 1; + } + for (let i0 = 0; i0 < this.optional_fields_length; i0++) { + size += 4 + new TextEncoder().encode(this.optional_fields[i0]).length + 1; + } + size += 1; + return size; + } + + // deno-lint-ignore no-explicit-any + static _getHashRecursive(parents: any[]): bigint { + if (parents.includes(CommandProfile)) return 0n; + const newparents = [...parents, CommandProfile]; + let tmphash = CommandProfile._HASH; + tmphash = (((tmphash << 1n) & 0xffffffffffffffffn) + (tmphash >> 63n)) & 0xffffffffffffffffn; + return tmphash; + } + + static _getPackedFingerprint(): bigint { + if (CommandProfile._packedFingerprint === null) { + CommandProfile._packedFingerprint = CommandProfile._getHashRecursive([]); + } + return CommandProfile._packedFingerprint; + } +} diff --git a/generated/ts_lcm_msgs/dimos_control_msgs/ConnectionControl.ts b/generated/ts_lcm_msgs/dimos_control_msgs/ConnectionControl.ts new file mode 100644 index 0000000..8f674d2 --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_control_msgs/ConnectionControl.ts @@ -0,0 +1,150 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +export class ConnectionControl { + static readonly _HASH = 0xb82d9643472f465dn; + static readonly _NAME = "dimos_control_msgs.ConnectionControl"; + private static _packedFingerprint: bigint | null = null; + + static readonly PREPARE_ARM = 1; + static readonly COMMIT_ARM = 2; + static readonly ABORT_ARM = 3; + static readonly SAFE_STOP = 4; + static readonly CLEAR_SAFE_STOP = 5; + static readonly ESTOP = 6; + static readonly CLEAR_ESTOP = 7; + + target_sources_length: number; + target_sources: string[]; + operation_id: bigint; + operation: number; + proposed_control_epoch: bigint; + reason: string; + + constructor(init?: Partial) { + this.target_sources_length = init?.target_sources_length ?? 0; + this.target_sources = init?.target_sources ?? []; + this.operation_id = init?.operation_id ?? 0n; + this.operation = init?.operation ?? 0; + this.proposed_control_epoch = init?.proposed_control_epoch ?? 0n; + this.reason = init?.reason ?? ""; + } + + static decode(data: Uint8Array): ConnectionControl { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + let offset = 0; + + // Verify fingerprint (recursive hash including nested types) + const hash = view.getBigUint64(offset, false); + offset += 8; + const expectedHash = ConnectionControl._getPackedFingerprint(); + if (hash !== expectedHash) { + throw new Error(`Hash mismatch: expected ${expectedHash.toString(16)}, got ${hash.toString(16)}`); + } + + const result = new ConnectionControl(); + ({ offset } = ConnectionControl._decodeOne(view, offset, result)); + return result; + } + + static _decodeOne(view: DataView, offset: number, target: ConnectionControl): { offset: number } { + target.target_sources_length = view.getInt32(offset, false); + offset += 4; + target.target_sources = new Array(target.target_sources_length); + for (let i0 = 0; i0 < target.target_sources_length; i0++) { + { + const len = view.getUint32(offset, false); + offset += 4; + target.target_sources[i0] = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + } + target.operation_id = view.getBigInt64(offset, false); + offset += 8; + target.operation = view.getInt8(offset); + offset += 1; + target.proposed_control_epoch = view.getBigInt64(offset, false); + offset += 8; + { + const len = view.getUint32(offset, false); + offset += 4; + target.reason = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + return { offset }; + } + + encode(): Uint8Array { + const size = 8 + this._encodedSize(); + const data = new Uint8Array(size); + const view = new DataView(data.buffer); + let offset = 0; + + // Write fingerprint (recursive hash including nested types) + view.setBigUint64(offset, ConnectionControl._getPackedFingerprint(), false); + offset += 8; + + offset = this._encodeOne(view, offset); + return data; + } + + _encodeOne(view: DataView, offset: number): number { + view.setInt32(offset, this.target_sources_length, false); + offset += 4; + for (let i0 = 0; i0 < this.target_sources_length; i0++) { + { + const encoded = new TextEncoder().encode(this.target_sources[i0]); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + } + view.setBigInt64(offset, this.operation_id, false); + offset += 8; + view.setInt8(offset, this.operation); + offset += 1; + view.setBigInt64(offset, this.proposed_control_epoch, false); + offset += 8; + { + const encoded = new TextEncoder().encode(this.reason); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + return offset; + } + + _encodedSize(): number { + let size = 0; + size += 4; + for (let i0 = 0; i0 < this.target_sources_length; i0++) { + size += 4 + new TextEncoder().encode(this.target_sources[i0]).length + 1; + } + size += 8; + size += 1; + size += 8; + size += 4 + new TextEncoder().encode(this.reason).length + 1; + return size; + } + + // deno-lint-ignore no-explicit-any + static _getHashRecursive(parents: any[]): bigint { + if (parents.includes(ConnectionControl)) return 0n; + const newparents = [...parents, ConnectionControl]; + let tmphash = ConnectionControl._HASH; + tmphash = (((tmphash << 1n) & 0xffffffffffffffffn) + (tmphash >> 63n)) & 0xffffffffffffffffn; + return tmphash; + } + + static _getPackedFingerprint(): bigint { + if (ConnectionControl._packedFingerprint === null) { + ConnectionControl._packedFingerprint = ConnectionControl._getHashRecursive([]); + } + return ConnectionControl._packedFingerprint; + } +} diff --git a/generated/ts_lcm_msgs/dimos_control_msgs/ConnectionDescription.ts b/generated/ts_lcm_msgs/dimos_control_msgs/ConnectionDescription.ts new file mode 100644 index 0000000..6a05e24 --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_control_msgs/ConnectionDescription.ts @@ -0,0 +1,251 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +import { ResourceDescription } from "./ResourceDescription.ts"; +import { InterfaceDescription } from "./InterfaceDescription.ts"; +import { CommandProfile } from "./CommandProfile.ts"; + +export class ConnectionDescription { + static readonly _HASH = 0x31d30851f65c7d8cn; + static readonly _NAME = "dimos_control_msgs.ConnectionDescription"; + private static _packedFingerprint: bigint | null = null; + + static readonly DIRECT = 1; + static readonly OPERATOR_CONFIRMED = 2; + static readonly APPLY_OMISSION = 1; + static readonly ARMED_IDLE_SAFE_STOP = 2; + static readonly NATIVE_WATCHDOG = 1; + static readonly EXTERNAL_SUPERVISOR = 2; + static readonly INTRINSICALLY_SAFE = 3; + static readonly SIMULATION = 4; + static readonly UNPROTECTED = 5; + + source: string; + description_epoch: bigint; + resources_length: number; + interfaces_length: number; + command_profiles_length: number; + resources: ResourceDescription[]; + interfaces: InterfaceDescription[]; + command_profiles: CommandProfile[]; + expected_state_rate_hz: number; + state_stale_timeout_s: number; + command_watchdog_timeout_s: number; + activation_policy: number; + armed_idle_policy: number; + safe_stop_behavior: string; + process_loss_classification: number; + process_loss_evidence: string; + + constructor(init?: Partial) { + this.source = init?.source ?? ""; + this.description_epoch = init?.description_epoch ?? 0n; + this.resources_length = init?.resources_length ?? 0; + this.interfaces_length = init?.interfaces_length ?? 0; + this.command_profiles_length = init?.command_profiles_length ?? 0; + this.resources = init?.resources ?? []; + this.interfaces = init?.interfaces ?? []; + this.command_profiles = init?.command_profiles ?? []; + this.expected_state_rate_hz = init?.expected_state_rate_hz ?? 0; + this.state_stale_timeout_s = init?.state_stale_timeout_s ?? 0; + this.command_watchdog_timeout_s = init?.command_watchdog_timeout_s ?? 0; + this.activation_policy = init?.activation_policy ?? 0; + this.armed_idle_policy = init?.armed_idle_policy ?? 0; + this.safe_stop_behavior = init?.safe_stop_behavior ?? ""; + this.process_loss_classification = init?.process_loss_classification ?? 0; + this.process_loss_evidence = init?.process_loss_evidence ?? ""; + } + + static decode(data: Uint8Array): ConnectionDescription { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + let offset = 0; + + // Verify fingerprint (recursive hash including nested types) + const hash = view.getBigUint64(offset, false); + offset += 8; + const expectedHash = ConnectionDescription._getPackedFingerprint(); + if (hash !== expectedHash) { + throw new Error(`Hash mismatch: expected ${expectedHash.toString(16)}, got ${hash.toString(16)}`); + } + + const result = new ConnectionDescription(); + ({ offset } = ConnectionDescription._decodeOne(view, offset, result)); + return result; + } + + static _decodeOne(view: DataView, offset: number, target: ConnectionDescription): { offset: number } { + { + const len = view.getUint32(offset, false); + offset += 4; + target.source = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + target.description_epoch = view.getBigInt64(offset, false); + offset += 8; + target.resources_length = view.getInt32(offset, false); + offset += 4; + target.interfaces_length = view.getInt32(offset, false); + offset += 4; + target.command_profiles_length = view.getInt32(offset, false); + offset += 4; + target.resources = new Array(target.resources_length); + for (let i0 = 0; i0 < target.resources_length; i0++) { + target.resources[i0] = new ResourceDescription(); + ({ offset } = ResourceDescription._decodeOne(view, offset, target.resources[i0])); + } + target.interfaces = new Array(target.interfaces_length); + for (let i0 = 0; i0 < target.interfaces_length; i0++) { + target.interfaces[i0] = new InterfaceDescription(); + ({ offset } = InterfaceDescription._decodeOne(view, offset, target.interfaces[i0])); + } + target.command_profiles = new Array(target.command_profiles_length); + for (let i0 = 0; i0 < target.command_profiles_length; i0++) { + target.command_profiles[i0] = new CommandProfile(); + ({ offset } = CommandProfile._decodeOne(view, offset, target.command_profiles[i0])); + } + target.expected_state_rate_hz = view.getFloat64(offset, false); + offset += 8; + target.state_stale_timeout_s = view.getFloat64(offset, false); + offset += 8; + target.command_watchdog_timeout_s = view.getFloat64(offset, false); + offset += 8; + target.activation_policy = view.getInt8(offset); + offset += 1; + target.armed_idle_policy = view.getInt8(offset); + offset += 1; + { + const len = view.getUint32(offset, false); + offset += 4; + target.safe_stop_behavior = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + target.process_loss_classification = view.getInt8(offset); + offset += 1; + { + const len = view.getUint32(offset, false); + offset += 4; + target.process_loss_evidence = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + return { offset }; + } + + encode(): Uint8Array { + const size = 8 + this._encodedSize(); + const data = new Uint8Array(size); + const view = new DataView(data.buffer); + let offset = 0; + + // Write fingerprint (recursive hash including nested types) + view.setBigUint64(offset, ConnectionDescription._getPackedFingerprint(), false); + offset += 8; + + offset = this._encodeOne(view, offset); + return data; + } + + _encodeOne(view: DataView, offset: number): number { + { + const encoded = new TextEncoder().encode(this.source); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + view.setBigInt64(offset, this.description_epoch, false); + offset += 8; + view.setInt32(offset, this.resources_length, false); + offset += 4; + view.setInt32(offset, this.interfaces_length, false); + offset += 4; + view.setInt32(offset, this.command_profiles_length, false); + offset += 4; + for (let i0 = 0; i0 < this.resources_length; i0++) { + offset = this.resources[i0]._encodeOne(view, offset); + } + for (let i0 = 0; i0 < this.interfaces_length; i0++) { + offset = this.interfaces[i0]._encodeOne(view, offset); + } + for (let i0 = 0; i0 < this.command_profiles_length; i0++) { + offset = this.command_profiles[i0]._encodeOne(view, offset); + } + view.setFloat64(offset, this.expected_state_rate_hz, false); + offset += 8; + view.setFloat64(offset, this.state_stale_timeout_s, false); + offset += 8; + view.setFloat64(offset, this.command_watchdog_timeout_s, false); + offset += 8; + view.setInt8(offset, this.activation_policy); + offset += 1; + view.setInt8(offset, this.armed_idle_policy); + offset += 1; + { + const encoded = new TextEncoder().encode(this.safe_stop_behavior); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + view.setInt8(offset, this.process_loss_classification); + offset += 1; + { + const encoded = new TextEncoder().encode(this.process_loss_evidence); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + return offset; + } + + _encodedSize(): number { + let size = 0; + size += 4 + new TextEncoder().encode(this.source).length + 1; + size += 8; + size += 4; + size += 4; + size += 4; + for (let i0 = 0; i0 < this.resources_length; i0++) { + size += this.resources[i0]._encodedSize(); + } + for (let i0 = 0; i0 < this.interfaces_length; i0++) { + size += this.interfaces[i0]._encodedSize(); + } + for (let i0 = 0; i0 < this.command_profiles_length; i0++) { + size += this.command_profiles[i0]._encodedSize(); + } + size += 8; + size += 8; + size += 8; + size += 1; + size += 1; + size += 4 + new TextEncoder().encode(this.safe_stop_behavior).length + 1; + size += 1; + size += 4 + new TextEncoder().encode(this.process_loss_evidence).length + 1; + return size; + } + + // deno-lint-ignore no-explicit-any + static _getHashRecursive(parents: any[]): bigint { + if (parents.includes(ConnectionDescription)) return 0n; + const newparents = [...parents, ConnectionDescription]; + let tmphash = ConnectionDescription._HASH; + tmphash = (tmphash + ResourceDescription._getHashRecursive(newparents)) & 0xffffffffffffffffn; + tmphash = (tmphash + InterfaceDescription._getHashRecursive(newparents)) & 0xffffffffffffffffn; + tmphash = (tmphash + CommandProfile._getHashRecursive(newparents)) & 0xffffffffffffffffn; + tmphash = (((tmphash << 1n) & 0xffffffffffffffffn) + (tmphash >> 63n)) & 0xffffffffffffffffn; + return tmphash; + } + + static _getPackedFingerprint(): bigint { + if (ConnectionDescription._packedFingerprint === null) { + ConnectionDescription._packedFingerprint = ConnectionDescription._getHashRecursive([]); + } + return ConnectionDescription._packedFingerprint; + } +} diff --git a/generated/ts_lcm_msgs/dimos_control_msgs/ConnectionStatus.ts b/generated/ts_lcm_msgs/dimos_control_msgs/ConnectionStatus.ts new file mode 100644 index 0000000..d2b989f --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_control_msgs/ConnectionStatus.ts @@ -0,0 +1,168 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +export class ConnectionStatus { + static readonly _HASH = 0xc90f95ebfad6e276n; + static readonly _NAME = "dimos_control_msgs.ConnectionStatus"; + private static _packedFingerprint: bigint | null = null; + + static readonly STANDBY = 1; + static readonly PREPARING = 2; + static readonly PREPARED = 3; + static readonly COMMITTING = 4; + static readonly ARMED = 5; + static readonly SAFE_STOPPED = 6; + static readonly ESTOPPED = 7; + static readonly NONE = 0; + static readonly PENDING = 1; + static readonly SUCCEEDED = 2; + static readonly REJECTED = 3; + + source: string; + source_ts: number; + lifecycle_state: number; + description_epoch: bigint; + control_epoch: bigint; + last_operation_id: bigint; + last_operation: number; + acknowledgement: number; + fault: string; + + constructor(init?: Partial) { + this.source = init?.source ?? ""; + this.source_ts = init?.source_ts ?? 0; + this.lifecycle_state = init?.lifecycle_state ?? 0; + this.description_epoch = init?.description_epoch ?? 0n; + this.control_epoch = init?.control_epoch ?? 0n; + this.last_operation_id = init?.last_operation_id ?? 0n; + this.last_operation = init?.last_operation ?? 0; + this.acknowledgement = init?.acknowledgement ?? 0; + this.fault = init?.fault ?? ""; + } + + static decode(data: Uint8Array): ConnectionStatus { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + let offset = 0; + + // Verify fingerprint (recursive hash including nested types) + const hash = view.getBigUint64(offset, false); + offset += 8; + const expectedHash = ConnectionStatus._getPackedFingerprint(); + if (hash !== expectedHash) { + throw new Error(`Hash mismatch: expected ${expectedHash.toString(16)}, got ${hash.toString(16)}`); + } + + const result = new ConnectionStatus(); + ({ offset } = ConnectionStatus._decodeOne(view, offset, result)); + return result; + } + + static _decodeOne(view: DataView, offset: number, target: ConnectionStatus): { offset: number } { + { + const len = view.getUint32(offset, false); + offset += 4; + target.source = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + target.source_ts = view.getFloat64(offset, false); + offset += 8; + target.lifecycle_state = view.getInt8(offset); + offset += 1; + target.description_epoch = view.getBigInt64(offset, false); + offset += 8; + target.control_epoch = view.getBigInt64(offset, false); + offset += 8; + target.last_operation_id = view.getBigInt64(offset, false); + offset += 8; + target.last_operation = view.getInt8(offset); + offset += 1; + target.acknowledgement = view.getInt8(offset); + offset += 1; + { + const len = view.getUint32(offset, false); + offset += 4; + target.fault = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + return { offset }; + } + + encode(): Uint8Array { + const size = 8 + this._encodedSize(); + const data = new Uint8Array(size); + const view = new DataView(data.buffer); + let offset = 0; + + // Write fingerprint (recursive hash including nested types) + view.setBigUint64(offset, ConnectionStatus._getPackedFingerprint(), false); + offset += 8; + + offset = this._encodeOne(view, offset); + return data; + } + + _encodeOne(view: DataView, offset: number): number { + { + const encoded = new TextEncoder().encode(this.source); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + view.setFloat64(offset, this.source_ts, false); + offset += 8; + view.setInt8(offset, this.lifecycle_state); + offset += 1; + view.setBigInt64(offset, this.description_epoch, false); + offset += 8; + view.setBigInt64(offset, this.control_epoch, false); + offset += 8; + view.setBigInt64(offset, this.last_operation_id, false); + offset += 8; + view.setInt8(offset, this.last_operation); + offset += 1; + view.setInt8(offset, this.acknowledgement); + offset += 1; + { + const encoded = new TextEncoder().encode(this.fault); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + return offset; + } + + _encodedSize(): number { + let size = 0; + size += 4 + new TextEncoder().encode(this.source).length + 1; + size += 8; + size += 1; + size += 8; + size += 8; + size += 8; + size += 1; + size += 1; + size += 4 + new TextEncoder().encode(this.fault).length + 1; + return size; + } + + // deno-lint-ignore no-explicit-any + static _getHashRecursive(parents: any[]): bigint { + if (parents.includes(ConnectionStatus)) return 0n; + const newparents = [...parents, ConnectionStatus]; + let tmphash = ConnectionStatus._HASH; + tmphash = (((tmphash << 1n) & 0xffffffffffffffffn) + (tmphash >> 63n)) & 0xffffffffffffffffn; + return tmphash; + } + + static _getPackedFingerprint(): bigint { + if (ConnectionStatus._packedFingerprint === null) { + ConnectionStatus._packedFingerprint = ConnectionStatus._getHashRecursive([]); + } + return ConnectionStatus._packedFingerprint; + } +} diff --git a/generated/ts_lcm_msgs/dimos_control_msgs/ControlValues.ts b/generated/ts_lcm_msgs/dimos_control_msgs/ControlValues.ts new file mode 100644 index 0000000..d31fbd4 --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_control_msgs/ControlValues.ts @@ -0,0 +1,161 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +export class ControlValues { + static readonly _HASH = 0x98d9f64b18d5a4cfn; + static readonly _NAME = "dimos_control_msgs.ControlValues"; + private static _packedFingerprint: bigint | null = null; + + source: string; + source_ts: number; + epoch: bigint; + sequence: bigint; + interface_names_length: number; + values_length: number; + interface_names: string[]; + values: number[]; + + constructor(init?: Partial) { + this.source = init?.source ?? ""; + this.source_ts = init?.source_ts ?? 0; + this.epoch = init?.epoch ?? 0n; + this.sequence = init?.sequence ?? 0n; + this.interface_names_length = init?.interface_names_length ?? 0; + this.values_length = init?.values_length ?? 0; + this.interface_names = init?.interface_names ?? []; + this.values = init?.values ?? []; + } + + static decode(data: Uint8Array): ControlValues { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + let offset = 0; + + // Verify fingerprint (recursive hash including nested types) + const hash = view.getBigUint64(offset, false); + offset += 8; + const expectedHash = ControlValues._getPackedFingerprint(); + if (hash !== expectedHash) { + throw new Error(`Hash mismatch: expected ${expectedHash.toString(16)}, got ${hash.toString(16)}`); + } + + const result = new ControlValues(); + ({ offset } = ControlValues._decodeOne(view, offset, result)); + return result; + } + + static _decodeOne(view: DataView, offset: number, target: ControlValues): { offset: number } { + { + const len = view.getUint32(offset, false); + offset += 4; + target.source = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + target.source_ts = view.getFloat64(offset, false); + offset += 8; + target.epoch = view.getBigInt64(offset, false); + offset += 8; + target.sequence = view.getBigInt64(offset, false); + offset += 8; + target.interface_names_length = view.getInt32(offset, false); + offset += 4; + target.values_length = view.getInt32(offset, false); + offset += 4; + target.interface_names = new Array(target.interface_names_length); + for (let i0 = 0; i0 < target.interface_names_length; i0++) { + { + const len = view.getUint32(offset, false); + offset += 4; + target.interface_names[i0] = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + } + target.values = new Array(target.values_length); + for (let i0 = 0; i0 < target.values_length; i0++) { + target.values[i0] = view.getFloat64(offset, false); + offset += 8; + } + return { offset }; + } + + encode(): Uint8Array { + const size = 8 + this._encodedSize(); + const data = new Uint8Array(size); + const view = new DataView(data.buffer); + let offset = 0; + + // Write fingerprint (recursive hash including nested types) + view.setBigUint64(offset, ControlValues._getPackedFingerprint(), false); + offset += 8; + + offset = this._encodeOne(view, offset); + return data; + } + + _encodeOne(view: DataView, offset: number): number { + { + const encoded = new TextEncoder().encode(this.source); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + view.setFloat64(offset, this.source_ts, false); + offset += 8; + view.setBigInt64(offset, this.epoch, false); + offset += 8; + view.setBigInt64(offset, this.sequence, false); + offset += 8; + view.setInt32(offset, this.interface_names_length, false); + offset += 4; + view.setInt32(offset, this.values_length, false); + offset += 4; + for (let i0 = 0; i0 < this.interface_names_length; i0++) { + { + const encoded = new TextEncoder().encode(this.interface_names[i0]); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + } + for (let i0 = 0; i0 < this.values_length; i0++) { + view.setFloat64(offset, this.values[i0], false); + offset += 8; + } + return offset; + } + + _encodedSize(): number { + let size = 0; + size += 4 + new TextEncoder().encode(this.source).length + 1; + size += 8; + size += 8; + size += 8; + size += 4; + size += 4; + for (let i0 = 0; i0 < this.interface_names_length; i0++) { + size += 4 + new TextEncoder().encode(this.interface_names[i0]).length + 1; + } + size += this.values_length * 8; + return size; + } + + // deno-lint-ignore no-explicit-any + static _getHashRecursive(parents: any[]): bigint { + if (parents.includes(ControlValues)) return 0n; + const newparents = [...parents, ControlValues]; + let tmphash = ControlValues._HASH; + tmphash = (((tmphash << 1n) & 0xffffffffffffffffn) + (tmphash >> 63n)) & 0xffffffffffffffffn; + return tmphash; + } + + static _getPackedFingerprint(): bigint { + if (ControlValues._packedFingerprint === null) { + ControlValues._packedFingerprint = ControlValues._getHashRecursive([]); + } + return ControlValues._packedFingerprint; + } +} diff --git a/generated/ts_lcm_msgs/dimos_control_msgs/InterfaceDescription.ts b/generated/ts_lcm_msgs/dimos_control_msgs/InterfaceDescription.ts new file mode 100644 index 0000000..3487e76 --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_control_msgs/InterfaceDescription.ts @@ -0,0 +1,224 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +export class InterfaceDescription { + static readonly _HASH = 0xbfb21e12c9a9bd0dn; + static readonly _NAME = "dimos_control_msgs.InterfaceDescription"; + private static _packedFingerprint: bigint | null = null; + + static readonly HOLD_LAST = 1; + static readonly ZERO = 2; + static readonly SAFE_STOP = 3; + + name: string; + resource: string; + field: string; + unit: string; + state: boolean; + command: boolean; + has_hard_min: boolean; + hard_min: number; + has_hard_max: boolean; + hard_max: number; + has_soft_min: boolean; + soft_min: number; + has_soft_max: boolean; + soft_max: number; + omission_policy: number; + + constructor(init?: Partial) { + this.name = init?.name ?? ""; + this.resource = init?.resource ?? ""; + this.field = init?.field ?? ""; + this.unit = init?.unit ?? ""; + this.state = init?.state ?? false; + this.command = init?.command ?? false; + this.has_hard_min = init?.has_hard_min ?? false; + this.hard_min = init?.hard_min ?? 0; + this.has_hard_max = init?.has_hard_max ?? false; + this.hard_max = init?.hard_max ?? 0; + this.has_soft_min = init?.has_soft_min ?? false; + this.soft_min = init?.soft_min ?? 0; + this.has_soft_max = init?.has_soft_max ?? false; + this.soft_max = init?.soft_max ?? 0; + this.omission_policy = init?.omission_policy ?? 0; + } + + static decode(data: Uint8Array): InterfaceDescription { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + let offset = 0; + + // Verify fingerprint (recursive hash including nested types) + const hash = view.getBigUint64(offset, false); + offset += 8; + const expectedHash = InterfaceDescription._getPackedFingerprint(); + if (hash !== expectedHash) { + throw new Error(`Hash mismatch: expected ${expectedHash.toString(16)}, got ${hash.toString(16)}`); + } + + const result = new InterfaceDescription(); + ({ offset } = InterfaceDescription._decodeOne(view, offset, result)); + return result; + } + + static _decodeOne(view: DataView, offset: number, target: InterfaceDescription): { offset: number } { + { + const len = view.getUint32(offset, false); + offset += 4; + target.name = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + { + const len = view.getUint32(offset, false); + offset += 4; + target.resource = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + { + const len = view.getUint32(offset, false); + offset += 4; + target.field = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + { + const len = view.getUint32(offset, false); + offset += 4; + target.unit = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + target.state = view.getInt8(offset) !== 0; + offset += 1; + target.command = view.getInt8(offset) !== 0; + offset += 1; + target.has_hard_min = view.getInt8(offset) !== 0; + offset += 1; + target.hard_min = view.getFloat64(offset, false); + offset += 8; + target.has_hard_max = view.getInt8(offset) !== 0; + offset += 1; + target.hard_max = view.getFloat64(offset, false); + offset += 8; + target.has_soft_min = view.getInt8(offset) !== 0; + offset += 1; + target.soft_min = view.getFloat64(offset, false); + offset += 8; + target.has_soft_max = view.getInt8(offset) !== 0; + offset += 1; + target.soft_max = view.getFloat64(offset, false); + offset += 8; + target.omission_policy = view.getInt8(offset); + offset += 1; + return { offset }; + } + + encode(): Uint8Array { + const size = 8 + this._encodedSize(); + const data = new Uint8Array(size); + const view = new DataView(data.buffer); + let offset = 0; + + // Write fingerprint (recursive hash including nested types) + view.setBigUint64(offset, InterfaceDescription._getPackedFingerprint(), false); + offset += 8; + + offset = this._encodeOne(view, offset); + return data; + } + + _encodeOne(view: DataView, offset: number): number { + { + const encoded = new TextEncoder().encode(this.name); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + { + const encoded = new TextEncoder().encode(this.resource); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + { + const encoded = new TextEncoder().encode(this.field); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + { + const encoded = new TextEncoder().encode(this.unit); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + view.setInt8(offset, this.state ? 1 : 0); + offset += 1; + view.setInt8(offset, this.command ? 1 : 0); + offset += 1; + view.setInt8(offset, this.has_hard_min ? 1 : 0); + offset += 1; + view.setFloat64(offset, this.hard_min, false); + offset += 8; + view.setInt8(offset, this.has_hard_max ? 1 : 0); + offset += 1; + view.setFloat64(offset, this.hard_max, false); + offset += 8; + view.setInt8(offset, this.has_soft_min ? 1 : 0); + offset += 1; + view.setFloat64(offset, this.soft_min, false); + offset += 8; + view.setInt8(offset, this.has_soft_max ? 1 : 0); + offset += 1; + view.setFloat64(offset, this.soft_max, false); + offset += 8; + view.setInt8(offset, this.omission_policy); + offset += 1; + return offset; + } + + _encodedSize(): number { + let size = 0; + size += 4 + new TextEncoder().encode(this.name).length + 1; + size += 4 + new TextEncoder().encode(this.resource).length + 1; + size += 4 + new TextEncoder().encode(this.field).length + 1; + size += 4 + new TextEncoder().encode(this.unit).length + 1; + size += 1; + size += 1; + size += 1; + size += 8; + size += 1; + size += 8; + size += 1; + size += 8; + size += 1; + size += 8; + size += 1; + return size; + } + + // deno-lint-ignore no-explicit-any + static _getHashRecursive(parents: any[]): bigint { + if (parents.includes(InterfaceDescription)) return 0n; + const newparents = [...parents, InterfaceDescription]; + let tmphash = InterfaceDescription._HASH; + tmphash = (((tmphash << 1n) & 0xffffffffffffffffn) + (tmphash >> 63n)) & 0xffffffffffffffffn; + return tmphash; + } + + static _getPackedFingerprint(): bigint { + if (InterfaceDescription._packedFingerprint === null) { + InterfaceDescription._packedFingerprint = InterfaceDescription._getHashRecursive([]); + } + return InterfaceDescription._packedFingerprint; + } +} diff --git a/generated/ts_lcm_msgs/dimos_control_msgs/ResourceDescription.ts b/generated/ts_lcm_msgs/dimos_control_msgs/ResourceDescription.ts new file mode 100644 index 0000000..5114dcb --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_control_msgs/ResourceDescription.ts @@ -0,0 +1,119 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +export class ResourceDescription { + static readonly _HASH = 0x802e2d1f1cd1df73n; + static readonly _NAME = "dimos_control_msgs.ResourceDescription"; + private static _packedFingerprint: bigint | null = null; + + static readonly JOINT = 1; + static readonly GRIPPER = 2; + static readonly BASE = 3; + static readonly IMU = 4; + + name: string; + resource_type: number; + group_name: string; + + constructor(init?: Partial) { + this.name = init?.name ?? ""; + this.resource_type = init?.resource_type ?? 0; + this.group_name = init?.group_name ?? ""; + } + + static decode(data: Uint8Array): ResourceDescription { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + let offset = 0; + + // Verify fingerprint (recursive hash including nested types) + const hash = view.getBigUint64(offset, false); + offset += 8; + const expectedHash = ResourceDescription._getPackedFingerprint(); + if (hash !== expectedHash) { + throw new Error(`Hash mismatch: expected ${expectedHash.toString(16)}, got ${hash.toString(16)}`); + } + + const result = new ResourceDescription(); + ({ offset } = ResourceDescription._decodeOne(view, offset, result)); + return result; + } + + static _decodeOne(view: DataView, offset: number, target: ResourceDescription): { offset: number } { + { + const len = view.getUint32(offset, false); + offset += 4; + target.name = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + target.resource_type = view.getInt8(offset); + offset += 1; + { + const len = view.getUint32(offset, false); + offset += 4; + target.group_name = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + return { offset }; + } + + encode(): Uint8Array { + const size = 8 + this._encodedSize(); + const data = new Uint8Array(size); + const view = new DataView(data.buffer); + let offset = 0; + + // Write fingerprint (recursive hash including nested types) + view.setBigUint64(offset, ResourceDescription._getPackedFingerprint(), false); + offset += 8; + + offset = this._encodeOne(view, offset); + return data; + } + + _encodeOne(view: DataView, offset: number): number { + { + const encoded = new TextEncoder().encode(this.name); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + view.setInt8(offset, this.resource_type); + offset += 1; + { + const encoded = new TextEncoder().encode(this.group_name); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + return offset; + } + + _encodedSize(): number { + let size = 0; + size += 4 + new TextEncoder().encode(this.name).length + 1; + size += 1; + size += 4 + new TextEncoder().encode(this.group_name).length + 1; + return size; + } + + // deno-lint-ignore no-explicit-any + static _getHashRecursive(parents: any[]): bigint { + if (parents.includes(ResourceDescription)) return 0n; + const newparents = [...parents, ResourceDescription]; + let tmphash = ResourceDescription._HASH; + tmphash = (((tmphash << 1n) & 0xffffffffffffffffn) + (tmphash >> 63n)) & 0xffffffffffffffffn; + return tmphash; + } + + static _getPackedFingerprint(): bigint { + if (ResourceDescription._packedFingerprint === null) { + ResourceDescription._packedFingerprint = ResourceDescription._getHashRecursive([]); + } + return ResourceDescription._packedFingerprint; + } +} diff --git a/generated/ts_lcm_msgs/dimos_control_msgs/mod.ts b/generated/ts_lcm_msgs/dimos_control_msgs/mod.ts new file mode 100644 index 0000000..c4ed5c4 --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_control_msgs/mod.ts @@ -0,0 +1,9 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +export * from "./CommandProfile.ts"; +export * from "./ConnectionControl.ts"; +export * from "./ConnectionDescription.ts"; +export * from "./ConnectionStatus.ts"; +export * from "./ControlValues.ts"; +export * from "./InterfaceDescription.ts"; +export * from "./ResourceDescription.ts"; diff --git a/generated/ts_lcm_msgs/dimos_core_msgs/ModuleReadiness.ts b/generated/ts_lcm_msgs/dimos_core_msgs/ModuleReadiness.ts new file mode 100644 index 0000000..089dd5e --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_core_msgs/ModuleReadiness.ts @@ -0,0 +1,135 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +export class ModuleReadiness { + static readonly _HASH = 0x150d1bfa7d87808dn; + static readonly _NAME = "dimos_core_msgs.ModuleReadiness"; + private static _packedFingerprint: bigint | null = null; + + source: string; + generation: bigint; + sequence: bigint; + source_ts: number; + ready: boolean; + reason: string; + + constructor(init?: Partial) { + this.source = init?.source ?? ""; + this.generation = init?.generation ?? 0n; + this.sequence = init?.sequence ?? 0n; + this.source_ts = init?.source_ts ?? 0; + this.ready = init?.ready ?? false; + this.reason = init?.reason ?? ""; + } + + static decode(data: Uint8Array): ModuleReadiness { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + let offset = 0; + + // Verify fingerprint (recursive hash including nested types) + const hash = view.getBigUint64(offset, false); + offset += 8; + const expectedHash = ModuleReadiness._getPackedFingerprint(); + if (hash !== expectedHash) { + throw new Error(`Hash mismatch: expected ${expectedHash.toString(16)}, got ${hash.toString(16)}`); + } + + const result = new ModuleReadiness(); + ({ offset } = ModuleReadiness._decodeOne(view, offset, result)); + return result; + } + + static _decodeOne(view: DataView, offset: number, target: ModuleReadiness): { offset: number } { + { + const len = view.getUint32(offset, false); + offset += 4; + target.source = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + target.generation = view.getBigInt64(offset, false); + offset += 8; + target.sequence = view.getBigInt64(offset, false); + offset += 8; + target.source_ts = view.getFloat64(offset, false); + offset += 8; + target.ready = view.getInt8(offset) !== 0; + offset += 1; + { + const len = view.getUint32(offset, false); + offset += 4; + target.reason = new TextDecoder().decode(new Uint8Array(view.buffer, view.byteOffset + offset, len - 1)); + offset += len; + } + return { offset }; + } + + encode(): Uint8Array { + const size = 8 + this._encodedSize(); + const data = new Uint8Array(size); + const view = new DataView(data.buffer); + let offset = 0; + + // Write fingerprint (recursive hash including nested types) + view.setBigUint64(offset, ModuleReadiness._getPackedFingerprint(), false); + offset += 8; + + offset = this._encodeOne(view, offset); + return data; + } + + _encodeOne(view: DataView, offset: number): number { + { + const encoded = new TextEncoder().encode(this.source); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + view.setBigInt64(offset, this.generation, false); + offset += 8; + view.setBigInt64(offset, this.sequence, false); + offset += 8; + view.setFloat64(offset, this.source_ts, false); + offset += 8; + view.setInt8(offset, this.ready ? 1 : 0); + offset += 1; + { + const encoded = new TextEncoder().encode(this.reason); + view.setUint32(offset, encoded.length + 1, false); + offset += 4; + new Uint8Array(view.buffer, view.byteOffset + offset).set(encoded); + offset += encoded.length; + view.setUint8(offset, 0); // null terminator + offset += 1; + } + return offset; + } + + _encodedSize(): number { + let size = 0; + size += 4 + new TextEncoder().encode(this.source).length + 1; + size += 8; + size += 8; + size += 8; + size += 1; + size += 4 + new TextEncoder().encode(this.reason).length + 1; + return size; + } + + // deno-lint-ignore no-explicit-any + static _getHashRecursive(parents: any[]): bigint { + if (parents.includes(ModuleReadiness)) return 0n; + const newparents = [...parents, ModuleReadiness]; + let tmphash = ModuleReadiness._HASH; + tmphash = (((tmphash << 1n) & 0xffffffffffffffffn) + (tmphash >> 63n)) & 0xffffffffffffffffn; + return tmphash; + } + + static _getPackedFingerprint(): bigint { + if (ModuleReadiness._packedFingerprint === null) { + ModuleReadiness._packedFingerprint = ModuleReadiness._getHashRecursive([]); + } + return ModuleReadiness._packedFingerprint; + } +} diff --git a/generated/ts_lcm_msgs/dimos_core_msgs/mod.ts b/generated/ts_lcm_msgs/dimos_core_msgs/mod.ts new file mode 100644 index 0000000..44915da --- /dev/null +++ b/generated/ts_lcm_msgs/dimos_core_msgs/mod.ts @@ -0,0 +1,3 @@ +// Auto-generated by lcm-ts. DO NOT EDIT. + +export * from "./ModuleReadiness.ts"; diff --git a/lcm_types/dimos_control_msgs_CommandProfile.lcm b/lcm_types/dimos_control_msgs_CommandProfile.lcm new file mode 100644 index 0000000..fe51af6 --- /dev/null +++ b/lcm_types/dimos_control_msgs_CommandProfile.lcm @@ -0,0 +1,10 @@ +package dimos_control_msgs; + +struct CommandProfile { + string name; + int32_t required_fields_length; + int32_t optional_fields_length; + string required_fields[required_fields_length]; + string optional_fields[optional_fields_length]; + boolean uniform_across_resources; +} diff --git a/lcm_types/dimos_control_msgs_ConnectionControl.lcm b/lcm_types/dimos_control_msgs_ConnectionControl.lcm new file mode 100644 index 0000000..512e71f --- /dev/null +++ b/lcm_types/dimos_control_msgs_ConnectionControl.lcm @@ -0,0 +1,18 @@ +package dimos_control_msgs; + +struct ConnectionControl { + const int8_t PREPARE_ARM = 1; + const int8_t COMMIT_ARM = 2; + const int8_t ABORT_ARM = 3; + const int8_t SAFE_STOP = 4; + const int8_t CLEAR_SAFE_STOP = 5; + const int8_t ESTOP = 6; + const int8_t CLEAR_ESTOP = 7; + + int32_t target_sources_length; + string target_sources[target_sources_length]; + int64_t operation_id; + int8_t operation; + int64_t proposed_control_epoch; + string reason; +} diff --git a/lcm_types/dimos_control_msgs_ConnectionDescription.lcm b/lcm_types/dimos_control_msgs_ConnectionDescription.lcm new file mode 100644 index 0000000..5dabc04 --- /dev/null +++ b/lcm_types/dimos_control_msgs_ConnectionDescription.lcm @@ -0,0 +1,32 @@ +package dimos_control_msgs; + +struct ConnectionDescription { + const int8_t DIRECT = 1; + const int8_t OPERATOR_CONFIRMED = 2; + + const int8_t APPLY_OMISSION = 1; + const int8_t ARMED_IDLE_SAFE_STOP = 2; + + const int8_t NATIVE_WATCHDOG = 1; + const int8_t EXTERNAL_SUPERVISOR = 2; + const int8_t INTRINSICALLY_SAFE = 3; + const int8_t SIMULATION = 4; + const int8_t UNPROTECTED = 5; + + string source; + int64_t description_epoch; + int32_t resources_length; + int32_t interfaces_length; + int32_t command_profiles_length; + ResourceDescription resources[resources_length]; + InterfaceDescription interfaces[interfaces_length]; + CommandProfile command_profiles[command_profiles_length]; + double expected_state_rate_hz; + double state_stale_timeout_s; + double command_watchdog_timeout_s; + int8_t activation_policy; + int8_t armed_idle_policy; + string safe_stop_behavior; + int8_t process_loss_classification; + string process_loss_evidence; +} diff --git a/lcm_types/dimos_control_msgs_ConnectionStatus.lcm b/lcm_types/dimos_control_msgs_ConnectionStatus.lcm new file mode 100644 index 0000000..2be7e25 --- /dev/null +++ b/lcm_types/dimos_control_msgs_ConnectionStatus.lcm @@ -0,0 +1,26 @@ +package dimos_control_msgs; + +struct ConnectionStatus { + const int8_t STANDBY = 1; + const int8_t PREPARING = 2; + const int8_t PREPARED = 3; + const int8_t COMMITTING = 4; + const int8_t ARMED = 5; + const int8_t SAFE_STOPPED = 6; + const int8_t ESTOPPED = 7; + + const int8_t NONE = 0; + const int8_t PENDING = 1; + const int8_t SUCCEEDED = 2; + const int8_t REJECTED = 3; + + string source; + double source_ts; + int8_t lifecycle_state; + int64_t description_epoch; + int64_t control_epoch; + int64_t last_operation_id; + int8_t last_operation; + int8_t acknowledgement; + string fault; +} diff --git a/lcm_types/dimos_control_msgs_ControlValues.lcm b/lcm_types/dimos_control_msgs_ControlValues.lcm new file mode 100644 index 0000000..d60ea0e --- /dev/null +++ b/lcm_types/dimos_control_msgs_ControlValues.lcm @@ -0,0 +1,12 @@ +package dimos_control_msgs; + +struct ControlValues { + string source; + double source_ts; + int64_t epoch; + int64_t sequence; + int32_t interface_names_length; + int32_t values_length; + string interface_names[interface_names_length]; + double values[values_length]; +} diff --git a/lcm_types/dimos_control_msgs_InterfaceDescription.lcm b/lcm_types/dimos_control_msgs_InterfaceDescription.lcm new file mode 100644 index 0000000..e5596f2 --- /dev/null +++ b/lcm_types/dimos_control_msgs_InterfaceDescription.lcm @@ -0,0 +1,23 @@ +package dimos_control_msgs; + +struct InterfaceDescription { + const int8_t HOLD_LAST = 1; + const int8_t ZERO = 2; + const int8_t SAFE_STOP = 3; + + string name; + string resource; + string field; + string unit; + boolean state; + boolean command; + boolean has_hard_min; + double hard_min; + boolean has_hard_max; + double hard_max; + boolean has_soft_min; + double soft_min; + boolean has_soft_max; + double soft_max; + int8_t omission_policy; +} diff --git a/lcm_types/dimos_control_msgs_ResourceDescription.lcm b/lcm_types/dimos_control_msgs_ResourceDescription.lcm new file mode 100644 index 0000000..70fb714 --- /dev/null +++ b/lcm_types/dimos_control_msgs_ResourceDescription.lcm @@ -0,0 +1,12 @@ +package dimos_control_msgs; + +struct ResourceDescription { + const int8_t JOINT = 1; + const int8_t GRIPPER = 2; + const int8_t BASE = 3; + const int8_t IMU = 4; + + string name; + int8_t resource_type; + string group_name; +} diff --git a/lcm_types/dimos_core_msgs_ModuleReadiness.lcm b/lcm_types/dimos_core_msgs_ModuleReadiness.lcm new file mode 100644 index 0000000..272c45b --- /dev/null +++ b/lcm_types/dimos_core_msgs_ModuleReadiness.lcm @@ -0,0 +1,10 @@ +package dimos_core_msgs; + +struct ModuleReadiness { + string source; + int64_t generation; + int64_t sequence; + double source_ts; + boolean ready; + string reason; +} diff --git a/pyproject.toml b/pyproject.toml index a1e67eb..7dc55eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "dimos_lcm" -version = "0.1.3" +version = "0.1.4" description = "LCM-Foxglove bridge and message utilities for Dimensional Robotics" authors = [ {name = "Dimensional Team", email = "build@dimensionalOS.com"}, @@ -40,7 +40,9 @@ packages = [ "dimos_lcm.tf2_msgs", "dimos_lcm.trajectory_msgs", "dimos_lcm.vision_msgs", - "dimos_lcm.visualization_msgs" + "dimos_lcm.visualization_msgs", + "dimos_lcm.dimos_core_msgs", + "dimos_lcm.dimos_control_msgs" ] [tool.setuptools.package-dir] @@ -60,6 +62,8 @@ packages = [ "dimos_lcm.trajectory_msgs" = "generated/python_lcm_msgs/lcm_msgs/trajectory_msgs" "dimos_lcm.vision_msgs" = "generated/python_lcm_msgs/lcm_msgs/vision_msgs" "dimos_lcm.visualization_msgs" = "generated/python_lcm_msgs/lcm_msgs/visualization_msgs" +"dimos_lcm.dimos_core_msgs" = "generated/python_lcm_msgs/lcm_msgs/dimos_core_msgs" +"dimos_lcm.dimos_control_msgs" = "generated/python_lcm_msgs/lcm_msgs/dimos_control_msgs" [tool.setuptools.package-data] "dimos_lcm" = [ diff --git a/tests/test_control_contracts.py b/tests/test_control_contracts.py new file mode 100644 index 0000000..e244044 --- /dev/null +++ b/tests/test_control_contracts.py @@ -0,0 +1,156 @@ +import sys +from pathlib import Path +import unittest + + +sys.path.insert( + 0, + str(Path(__file__).parents[1] / "generated" / "python_lcm_msgs" / "lcm_msgs"), +) + +from dimos_control_msgs import ( # noqa: E402 + CommandProfile, + ConnectionControl, + ConnectionDescription, + ConnectionStatus, + ControlValues, + InterfaceDescription, + ResourceDescription, +) +from dimos_core_msgs import ModuleReadiness # noqa: E402 + + +class ControlContractTest(unittest.TestCase): + def assert_round_trip(self, message: object) -> object: + encoded = message.lcm_encode() + decoded = type(message).lcm_decode(encoded) + self.assertEqual(decoded.lcm_encode(), encoded) + return decoded + + def test_module_readiness_round_trip(self) -> None: + message = ModuleReadiness( + source="left", + generation=7, + sequence=11, + source_ts=123.5, + ready=True, + reason="prêt ✓", + ) + + decoded = self.assert_round_trip(message) + + self.assertEqual(decoded.source, "left") + self.assertEqual(decoded.reason, "prêt ✓") + + def test_control_values_round_trip(self) -> None: + message = ControlValues( + source="coordinator", + source_ts=123.5, + epoch=3, + sequence=4, + interface_names_length=2, + values_length=2, + interface_names=["left/j1/position", "left/j1/velocity"], + values=[1.25, -2.5], + ) + + decoded = self.assert_round_trip(message) + + self.assertEqual(decoded.interface_names, message.interface_names) + self.assertEqual(list(decoded.values), message.values) + + def test_description_and_nested_records_round_trip(self) -> None: + resource = ResourceDescription( + name="left/j1", + resource_type=ResourceDescription.JOINT, + group_name="left_arm", + ) + interface = InterfaceDescription( + name="left/j1/position", + resource="left/j1", + field="position", + unit="rad", + state=True, + command=True, + has_hard_min=True, + hard_min=-2.0, + has_hard_max=True, + hard_max=2.0, + has_soft_min=True, + soft_min=-1.5, + has_soft_max=True, + soft_max=1.5, + omission_policy=InterfaceDescription.HOLD_LAST, + ) + profile = CommandProfile( + name="position", + required_fields_length=1, + optional_fields_length=1, + required_fields=["position"], + optional_fields=["velocity"], + uniform_across_resources=True, + ) + for nested in (resource, interface, profile): + self.assert_round_trip(nested) + message = ConnectionDescription( + source="left", + description_epoch=1, + resources_length=1, + interfaces_length=1, + command_profiles_length=1, + resources=[resource], + interfaces=[interface], + command_profiles=[profile], + expected_state_rate_hz=100.0, + state_stale_timeout_s=0.1, + command_watchdog_timeout_s=0.05, + activation_policy=ConnectionDescription.DIRECT, + armed_idle_policy=ConnectionDescription.APPLY_OMISSION, + safe_stop_behavior="hold position", + process_loss_classification=ConnectionDescription.NATIVE_WATCHDOG, + process_loss_evidence="controller watchdog verified", + ) + + decoded = self.assert_round_trip(message) + + self.assertEqual(decoded.resources[0].name, "left/j1") + self.assertEqual(decoded.interfaces[0].unit, "rad") + self.assertEqual(decoded.command_profiles[0].required_fields, ["position"]) + + def test_lifecycle_messages_round_trip(self) -> None: + control = ConnectionControl( + target_sources_length=2, + target_sources=["left", "right"], + operation_id=72, + operation=ConnectionControl.PREPARE_ARM, + proposed_control_epoch=9, + reason="operator request", + ) + status = ConnectionStatus( + source="left", + source_ts=123.5, + lifecycle_state=ConnectionStatus.PREPARED, + description_epoch=1, + control_epoch=0, + last_operation_id=72, + last_operation=ConnectionControl.PREPARE_ARM, + acknowledgement=ConnectionStatus.SUCCEEDED, + fault="", + ) + + decoded_control = self.assert_round_trip(control) + decoded_status = self.assert_round_trip(status) + + self.assertEqual(decoded_control.target_sources, ["left", "right"]) + self.assertEqual(decoded_status.last_operation_id, 72) + + def test_bad_fingerprint_is_rejected(self) -> None: + encoded = bytearray(ControlValues().lcm_encode()) + encoded[0] ^= 0xFF + + with self.assertRaises(ValueError): + ControlValues.lcm_decode(bytes(encoded)) + + +if __name__ == "__main__": + unittest.main()