feat: 初始化 Go2 导航相关代码与配置
This commit is contained in:
54
unitree_sdk2/example/helloworld/HelloWorldData.cpp
Normal file
54
unitree_sdk2/example/helloworld/HelloWorldData.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/****************************************************************
|
||||
|
||||
Generated by Eclipse Cyclone DDS IDL to CXX Translator
|
||||
File name: HelloWorldData.idl
|
||||
Source: HelloWorldData.cpp
|
||||
Cyclone DDS: v0.10.2
|
||||
|
||||
*****************************************************************/
|
||||
#include "HelloWorldData.hpp"
|
||||
|
||||
namespace org{
|
||||
namespace eclipse{
|
||||
namespace cyclonedds{
|
||||
namespace core{
|
||||
namespace cdr{
|
||||
|
||||
template<>
|
||||
propvec &get_type_props<::HelloWorldData::Msg>() {
|
||||
static thread_local std::mutex mtx;
|
||||
static thread_local propvec props;
|
||||
static thread_local entity_properties_t *props_end = nullptr;
|
||||
static thread_local std::atomic_bool initialized {false};
|
||||
key_endpoint keylist;
|
||||
if (initialized.load(std::memory_order_relaxed)) {
|
||||
auto ptr = props.data();
|
||||
while (ptr < props_end)
|
||||
(ptr++)->is_present = false;
|
||||
return props;
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(mtx);
|
||||
if (initialized.load(std::memory_order_relaxed)) {
|
||||
auto ptr = props.data();
|
||||
while (ptr < props_end)
|
||||
(ptr++)->is_present = false;
|
||||
return props;
|
||||
}
|
||||
props.clear();
|
||||
|
||||
props.push_back(entity_properties_t(0, 0, false, bb_unset, extensibility::ext_final)); //root
|
||||
props.push_back(entity_properties_t(1, 0, false, get_bit_bound<int64_t>(), extensibility::ext_final, false)); //::userID
|
||||
props.push_back(entity_properties_t(1, 1, false, bb_unset, extensibility::ext_final, false)); //::message
|
||||
|
||||
entity_properties_t::finish(props, keylist);
|
||||
props_end = props.data() + props.size();
|
||||
initialized.store(true, std::memory_order_release);
|
||||
return props;
|
||||
}
|
||||
|
||||
} //namespace cdr
|
||||
} //namespace core
|
||||
} //namespace cyclonedds
|
||||
} //namespace eclipse
|
||||
} //namespace org
|
||||
|
||||
Reference in New Issue
Block a user