diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TContentFilteredTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TContentFilteredTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f04c99c267f040eaa0b3626f2a10c1daa2b60da5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TContentFilteredTopic.hpp @@ -0,0 +1,160 @@ +#ifndef OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ +#define OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include +#include +#include +#include + +#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + +namespace dds +{ +namespace topic +{ +template class DELEGATE> +class ContentFilteredTopic; +} +} + + +/** + * @brief + * ContentFilteredTopic is a specialization of TopicDescription that allows + * for content-based subscriptions. + * + * ContentFilteredTopic describes a more sophisticated subscription which + * indicates that the Subscriber does not necessarily want to see all values of each + * instance published under the Topic. Rather, it only wants to see the values whose + * contents satisfy certain criteria. Therefore this class must be used to request + * content-based subscriptions. + * + * The selection of the content is done using the SQL based filter with parameters to + * adapt the filter clause. + * + * Example + * @code{.cpp} + * // Default creation of a Topic + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * + * // Creation of a ContentFilteredTopic (assume Foo::Bar contains long_1 element). + * std::vector params; + * params.push_back("1"); + * dds::topic::Filter filter("long_1=%0", params); + * dds::topic::ContentFilteredTopic cfTopic(topic, + * "ContentFilteredTopicName", + * filter); + * + * // The ContentFilteredTopic can be used to create readers + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, cfTopic); + * @endcode + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template class DELEGATE> +class dds::topic::ContentFilteredTopic : public dds::topic::TTopicDescription< DELEGATE > +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC_T(ContentFilteredTopic, dds::topic::TTopicDescription, T, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(ContentFilteredTopic) + + /** + * Convenience typedef for the type of the data sample. + */ + typedef T DataType; + +public: + /** + * Creates a ContentFilteredTopic be used as to perform content-based + * subscriptions. + * + * The ContentFilteredTopic only relates to samples published under that + * Topic, filtered according to their content. The filtering is done by + * means of evaluating a logical expression that involves the values of + * some of the data-fields in the sample. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @param topic the related Topic + * @param name the name of the ContentFilteredTopic + * @param filter the filter expression + * @throw dds::core::Exception + */ + ContentFilteredTopic(const Topic& topic, const std::string& name, const dds::topic::Filter& filter); + + /** @cond */ + virtual ~ContentFilteredTopic(); + /** @endcond */ + +public: + /** + * Get the filter expression. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return the filter expression + */ + const std::string& filter_expression() const; + + /** + * Get the filter expression parameters. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return the filter parameters as a sequence + */ + const dds::core::StringSeq filter_parameters() const; + + /** + * Sets the query parameters. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @param begin Iterator pointing to the beginning of the parameters to set + * @param end Iterator pointing to the end of the parameters to set + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + template + void filter_parameters(const FWDIterator& begin, const FWDIterator& end); + + /** + * Return the associated Topic. + * + * @return the Topic + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + const dds::topic::Topic& topic() const; +}; + +#endif // OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + + +#endif /* OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TFilter.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TFilter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..96cf2b59d7bac8216091c83a1b882017106b815f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TFilter.hpp @@ -0,0 +1,186 @@ +#ifndef DDS_TOPIC_TFILTER__HPP_ +#define DDS_TOPIC_TFILTER__HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +namespace dds +{ +namespace topic +{ +template +class TFilter; +} +} + +/** + * @brief + * Filter objects contain SQL expressions that allow the application to specify + * a filter on the locally available data. + * + * A Filter is used to create a ContentFilteredTopic. + * + * @anchor anchor_dds_topic_filter_expression + * \par SQL Expression + * The SQL query string is set by expression which must be a subset of the + * SQL query language. In this query expression, parameters may be used, which must + * be set in the sequence of strings defined by the parameter query_parameters. A + * parameter is a string which can define an integer, float, string or enumeration. The + * number of values in query_parameters must be equal or greater than the highest + * referenced %n token in the query_expression (e.g. if %1 and %8 are used as + * parameters in the query_expression, the query_parameters should at least + * contain n+1 = 9 values).
+ * Look @ref DCPS_Queries_and_Filters "here" for the specific query expression syntax. + * + * @see dds::topic::ContentFilteredTopic + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template +class dds::topic::TFilter: public dds::core::Value +{ +public: + /** + * Iterator for the query expression parameters. + */ + typedef typename D::iterator iterator; + + /** + * Iterator for the query expression parameters. + */ + typedef typename D::const_iterator const_iterator; + +public: + /** + * Create a Filter based on a query expression. + * + * @param query_expression an @ref anchor_dds_topic_filter_expression "SQL expression" + * @throw dds::core::Exception + */ + TFilter(const std::string& query_expression); + + /** + * Create a Filter based on a query expression and an iterable parameter container. + * + * @param query_expression an @ref anchor_dds_topic_filter_expression "SQL expression" + * @param params_begin Iterator pointing to the beginning of the parameters to set + * @param params_end Iterator pointing to the end of the parameters to set + * @throw dds::core::Exception + */ + template + TFilter(const std::string& query_expression, const FWIterator& params_begin, + const FWIterator& params_end); + + /** + * Create a Filter based on a query expression and parameter vector. + * + * @param query_expression an @ref anchor_dds_topic_filter_expression "SQL expression" + * @param params Vector containing SQL expression parameters + * @throw dds::core::Exception + */ + TFilter(const std::string& query_expression, + const std::vector& params); + + /** + * Get the query expression. + * + * @return std::string The @ref anchor_dds_topic_filter_expression "SQL expression". + * @throw dds::core::Exception + */ + const std::string& expression() const; + + /** + * Provides the begin iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return dds::topic::Filter::const_iterator + * The begin iterator + * @throw dds::core::Exception + */ + const_iterator begin() const; + + /** + * The end iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return dds::topic::Filter::const_iterator + * The end iterator + * @throw dds::core::Exception + */ + const_iterator end() const; + + /** + * Provides the begin iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return dds::topic::Filter::iterator + * The begin iterator + * @throw dds::core::Exception + */ + iterator begin(); + + /** + * The end iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return dds::topic::Filter::iterator + * The end iterator + * @throw dds::core::Exception + */ + iterator end(); + + /** + * Sets the query parameters. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @param begin Iterator pointing to the beginning of the parameters to set + * @param end Iterator pointing to the end of the parameters to set + * @throw dds::core::Exception + */ + template + void parameters(const FWIterator& begin, const FWIterator end); + + /** + * Adds a parameter to the query. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @param param The parameter to add + * @throw dds::core::Exception + */ + void add_parameter(const std::string& param); + + /** + * Gets the number of parameters in the query of the filter. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return uint32_t The number of parameters in the query + * @throw dds::core::Exception + */ + uint32_t parameters_length() const; +}; + +#endif /* DDS_TOPIC_TFILTER__HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TMultiTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TMultiTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..08a529debb6c7240aa9891ea39a67db5cecfc62e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TMultiTopic.hpp @@ -0,0 +1,74 @@ +#ifndef OMG_DDS_T_TOPIC_MULTI_TOPIC_HPP_ +#define OMG_DDS_T_TOPIC_MULTI_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include +#include +#include + +namespace dds +{ +namespace topic +{ + +#ifdef OMG_DDS_MULTI_TOPIC_SUPPORT + +/** + * This operation is not yet implemented. It is scheduled for a future release. + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template class DELEGATE> +class MultiTopic : public TTopicDescription< DELEGATE > +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC_T(MultiTopic, dds::topic::TTopicDescription, T, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(MultiTopic) + +public: + template + MultiTopic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string expression, + const FWDIterator& params_begin, + const FWDIterator& params_end); + + virtual ~MultiTopic(); + +public: + const std::string expression() const; + + template + void expression_parameters(const FWDIterator& params_begin, + const FWDIterator& params_end); + + dds::core::StringSeq void expression_parameters() const; + +}; + +#endif // OMG_DDS_MULTI_TOPIC_SUPPORT + +} +} + + +#endif /* OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..63df2e6165b7059e7da9f04f0a4ed24eedf62d85 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopic.hpp @@ -0,0 +1,429 @@ +#ifndef OMG_DDS_TTOPIC_TOPIC_HPP_ +#define OMG_DDS_TTOPIC_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include + + +namespace dds +{ +namespace topic +{ +template class DELEGATE> +class Topic; + +template +class TopicListener; +} +} + + +/** + * @brief + * Topic is the most basic description of the data to be published and + * subscribed. + * + * A Topic is identified by its name, which must be unique in the whole Domain. + * In addition (by virtue of extending TopicDescription) it fully specifies the + * type of the data that can be communicated when publishing or subscribing to + * the Topic. + * + * Topic is the only TopicDescription that can be used for publications and + * therefore associated with a DataWriter. + * + * Example + * @code{.cpp} + * // Default creation of a Topic + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * + * // The Topic can be used to create readers and writers + * // DataReader + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * // DataWriter + * dds::pub::Publisher publisher(participant); + * dds::pub::DataWriter writer(publisher, topic); + * @endcode + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template class DELEGATE> +class dds::topic::Topic : public dds::topic::TAnyTopic< DELEGATE > +{ +public: + /** + * Convenience typedef for the type of the data sample. + */ + typedef T DataType; + + /** + * Local convenience typedef for dds::topic::TopicListener. + */ + typedef TopicListener Listener; + +public: + OMG_DDS_REF_TYPE_PROTECTED_DC_T(Topic, ::dds::topic::TAnyTopic, T, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(Topic) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(Topic) + +public: + + /** + * Create a new Topic. + * + * This operation creates a reference to a new or existing Topic under the given name, + * for a specific data type. + * + * QoS
+ * The Topic will be created with the QoS values specified on the last + * successful call to @link dds::domain::DomainParticipant::default_topic_qos(const ::dds::topic::qos::TopicQos& qos) + * dp.default_topic_qos(qos) @endlink or, if the call was never made, the + * @ref anchor_dds_topic_qos_defaults "default" values. + * + * Existing Topic Name
+ * Before creating a new Topic, this operation performs a + * lookup_topicdescription for the specified topic_name. When a Topic is + * found with the same name in the current domain, the QoS and type_name of the + * found Topic are matched against the parameters qos and type_name. When they + * are the same, no Topic is created but a new proxy of the existing Topic is returned. + * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. + * + * Local Proxy
+ * Since a Topic is a global concept in the system, access is provided through a local + * proxy. In other words, the reference returned is actually not a reference to a Topic + * but to a locally created proxy. The Data Distribution Service propagates Topics + * and makes remotely created Topics locally available through this proxy. The deletion + * of a Topic object will not delete the Topic from the domain, just the local proxy is + * deleted. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the name of the Topic to be created + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name); + + /** + * Create a new Topic. + * + * This operation creates a reference to a new or existing Topic under the given name, + * for a specific data type and type_name. + * + * QoS
+ * The Topic will be created with the QoS values specified on the last + * successful call to @link dds::domain::DomainParticipant::default_topic_qos(const ::dds::topic::qos::TopicQos& qos) + * dp.default_topic_qos(qos) @endlink or, if the call was never made, the + * @ref anchor_dds_topic_qos_defaults "default" values. + * + * Existing Topic Name
+ * Before creating a new Topic, this operation performs a + * lookup_topicdescription for the specified topic_name. When a Topic is + * found with the same name in the current domain, the QoS and type_name of the + * found Topic are matched against the parameters qos and type_name. When they + * are the same, no Topic is created but a new proxy of the existing Topic is returned. + * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. + * + * Local Proxy
+ * Since a Topic is a global concept in the system, access is provided through a local + * proxy. In other words, the reference returned is actually not a reference to a Topic + * but to a locally created proxy. The Data Distribution Service propagates Topics + * and makes remotely created Topics locally available through this proxy. The deletion + * of a Topic object will not delete the Topic from the domain, just the local proxy is + * deleted. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name + * @param type_name a local alias of the data type + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const std::string& type_name); + + /** + * Create a new Topic. + * + * This operation creates a reference to a new or existing Topic under the given name, + * for a specific data type. + * + * QoS
+ * A possible application pattern to construct the TopicQos for the + * Topic is to: + * @code{.cpp} + * // 1) Retrieve the QosPolicy settings on the associated DomainParticipant + * dds::topic::qos::TopicQos topicQos = participant.default_datareader_qos(); + * // 2) Selectively modify QosPolicy settings as desired. + * topicQos << dds::core::policy::Durability::Transient(); + * // 3) Use the resulting QoS to construct the DataReader. + * dds::topic::Topic topic(participant, "TopicName", topicQos); + * @endcode + * + * Existing Topic Name
+ * Before creating a new Topic, this operation performs a + * lookup_topicdescription for the specified topic_name. When a Topic is + * found with the same name in the current domain, the QoS and type_name of the + * found Topic are matched against the parameters qos and type_name. When they + * are the same, no Topic is created but a new proxy of the existing Topic is returned. + * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. + * + * Local Proxy
+ * Since a Topic is a global concept in the system, access is provided through a local + * proxy. In other words, the reference returned is actually not a reference to a Topic + * but to a locally created proxy. The Data Distribution Service propagates Topics + * and makes remotely created Topics locally available through this proxy. The deletion + * of a Topic object will not delete the Topic from the domain, just the local proxy is + * deleted. + * + * Listener
+ * The following statuses are applicable to the TopicListener: + * - dds::core::status::StatusMask::inconsistent_topic() + * + * See @ref DCPS_Modules_Infrastructure_Listener "listener concept", + * @ref anchor_dds_topic_listener_commstatus "communication status" and + * @ref anchor_dds_topic_listener_commpropagation "communication propagation" + * for more information. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name + * @param qos the topic listener + * @param listener the topic listener + * @param mask the listener event mask + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener = NULL, + const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none()); + + /** + * Create a new Topic. + * + * This operation creates a reference to a new or existing Topic under the given name, + * for a specific data type and type_name. + * + * QoS
+ * A possible application pattern to construct the TopicQos for the + * Topic is to: + * @code{.cpp} + * // 1) Retrieve the QosPolicy settings on the associated DomainParticipant + * dds::topic::qos::TopicQos topicQos = participant.default_datareader_qos(); + * // 2) Selectively modify QosPolicy settings as desired. + * topicQos << dds::core::policy::Durability::Transient(); + * // 3) Use the resulting QoS to construct the DataReader. + * dds::topic::Topic topic(participant, "TopicName", "TypeName", topicQos); + * @endcode + * + * Existing Topic Name
+ * Before creating a new Topic, this operation performs a + * lookup_topicdescription for the specified topic_name. When a Topic is + * found with the same name in the current domain, the QoS and type_name of the + * found Topic are matched against the parameters qos and type_name. When they + * are the same, no Topic is created but a new proxy of the existing Topic is returned. + * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. + * + * Local Proxy
+ * Since a Topic is a global concept in the system, access is provided through a local + * proxy. In other words, the reference returned is actually not a reference to a Topic + * but to a locally created proxy. The Data Distribution Service propagates Topics + * and makes remotely created Topics locally available through this proxy. The deletion + * of a Topic object will not delete the Topic from the domain, just the local proxy is + * deleted. + * + * Listener
+ * The following statuses are applicable to the TopicListener: + * - dds::core::status::StatusMask::inconsistent_topic() + * + * See @ref DCPS_Modules_Infrastructure_Listener "listener concept", + * @ref anchor_dds_topic_listener_commstatus "communication status" and + * @ref anchor_dds_topic_listener_commpropagation "communication propagation" + * for more information. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name + * @param type_name a local alias of the data type + * @param qos the topic listener + * @param listener the topic listener + * @param mask the listener event mask + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener = NULL, + const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none()); + + #if defined (OMG_DDS_X_TYPE_DYNAMIC_TYPES_SUPPORT) + /** + * Create a new topic with a dynamic type description. Notice that in this + * case the data type has to be DynamicData, so the Topic type will be + * Topic. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name. The QoS will be set to + * dp.default_topic_qos(). + * @param type the topic type + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::xtypes::DynamicType type); + + /** + * Create a new topic with a dynamic type description. Notice that in this + * case the data type has to be DynamicData, so the Topic type will be + * Topic. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name + * @param type the topic type + * @param qos the topic listener + * @param listener the topic listener + * @param mask the listener event mask + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::xtypes::DynamicType type + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener = NULL, + const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none()); + + #endif /* OMG_DDS_X_TYPE_DYNAMIC_TYPES_SUPPORT */ + +public: + /** + * Register a listener with the Topic. + * + * This operation attaches a TopicListener to the Topic. Only one + * TopicListener can be attached to each Topic. If a + * TopicListener was already attached, the operation will replace it with the + * new one. When the listener is the NULL pointer, it represents a listener that is + * treated as a NOOP for all statuses activated in the bit mask. + * + * Listener un-registration is performed by setting the listener to NULL and mask none(). + * + * @anchor anchor_dds_topic_listener_commstatus + * Communication Status
+ * For each communication status, the StatusChangedFlag flag is initially set to + * FALSE. It becomes TRUE whenever that communication status changes. For each + * communication status activated in the mask, the associated TopicListener + * operation is invoked and the communication status is reset to FALSE, as the listener + * implicitly accesses the status which is passed as a parameter to that operation. The + * status is reset prior to calling the listener, so if the application calls the + * get__status from inside the listener it will see the status + * already reset. An exception to this rule is the NULL listener, which does not reset the + * communication statuses for which it is invoked. + * + * The following statuses are applicable to the TopicListener: + * - dds::core::status::StatusMask::inconsistent_topic() + * + * Status bits are declared as a constant and can be used by the application in an OR + * operation to create a tailored mask. The special constant dds::core::status::StatusMask::none() + * can be used to indicate that the created entity should not respond to any of its available + * statuses. The DDS will therefore attempt to propagate these statuses to its factory. + * The special constant dds::core::status::StatusMask::all() can be used to select all applicable + * statuses specified in the “Data Distribution Service for Real-time Systems Version + * 1.2” specification which are applicable to the PublisherListener. + * + * @anchor anchor_dds_topic_listener_commpropagation + * Status Propagation
+ * In case a communication status is not activated in the mask of the + * TopicListener, the DomainParticipantListener of the containing DomainParticipant + * is invoked (if attached and activated for the status that occurred). This allows the + * application to set a default behaviour in the DomainParticipantListener of the containing + * DomainParticipant and a Topic specific behaviour when needed. In case the + * communication status is not activated in the mask of the DomainParticipantListener as + * well, the application is not notified of the change. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @param listener the listener + * @param event_mask the mask defining the events for which the listener + * will be notified. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * A status was selected that cannot be supported because + * the infrastructure does not maintain the required connectivity information. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void listener(Listener* listener, + const ::dds::core::status::StatusMask& event_mask); + + /** + * Get the listener of this Topic. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @return the listener + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + Listener* listener() const; + +}; + + +#endif /* OMG_DDS_TTOPIC_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopicDescription.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopicDescription.hpp new file mode 100644 index 0000000000000000000000000000000000000000..88dae2cc24d53ddab4869dedb37e16ff55f7c9d7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopicDescription.hpp @@ -0,0 +1,85 @@ +#ifndef OMG_DDS_T_TOPIC_TOPIC_DESCRIPTION_HPP_ +#define OMG_DDS_T_TOPIC_TOPIC_DESCRIPTION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +namespace dds +{ +namespace topic +{ +template +class TTopicDescription; +} +} + + +/** + * @brief + * This class is the base for Topic, ContentFilteredTopic and MultiTopic. + * + * The TopicDescription attribute type_name defines an unique data type that is + * made available to the Data Distribution Service when a Topic is created with + * that type.
+ * TopicDescription has also a name that allows it to be retrieved locally. + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template +class dds::topic::TTopicDescription : public virtual dds::core::Reference +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TTopicDescription, dds::core::Reference, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TTopicDescription) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TTopicDescription) + +public: + /** + * This operation returns the name used to create the TopicDescription. + * + * @return the TopicDescription name + */ + const std::string& name() const; + + /** + * This operation returns the registered name of the data type associated + * with the TopicDescription. + * + * @return the type_name + */ + const std::string& type_name() const; + + /** + * This operation returns the DomainParticipant associated with the + * TopicDescription. + * + * Note that there is exactly one DomainParticipant associated with + * each TopicDescription. + * + * @return the DomainParticipant + */ + const dds::domain::DomainParticipant& domain_participant() const; + +}; + + +#endif /* OMG_DDS_T_TOPIC_TOPIC_DESCRIPTION_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/Topic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/Topic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f64e3be890d9027a288ad88ab2f6bcd52758accc --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/Topic.hpp @@ -0,0 +1,41 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#ifndef OMG_DDS_TOPIC_TOPIC_HPP_ +#define OMG_DDS_TOPIC_TOPIC_HPP_ + +#include + +namespace dds +{ +namespace topic +{ +template class DELEGATE = dds::topic::detail::Topic> +class Topic; +} +} + +/** + * @todo RTF Issue - moved include + * @note This include was moved here as MSVC appears to ignore any + * attempt to 're-declare' a template class with a default argument like: + * dds/pub/detail/DataWriter.hpp(54): error C2976: 'dds::topic::Topic' : too few template arguments + * dds/topic/TTopic.hpp(50) : see declaration of 'dds::topic::Topic' + */ +#include + +#endif /* OMG_DDS_TOPIC_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicDescription.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicDescription.hpp new file mode 100644 index 0000000000000000000000000000000000000000..acd38f4a69cf18b6b20b8247db57744ac474122b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicDescription.hpp @@ -0,0 +1,33 @@ +#ifndef OMG_DDS_TOPIC_TOPIC_DESCRIPTION_HPP_ +#define OMG_DDS_TOPIC_TOPIC_DESCRIPTION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + + +namespace dds +{ +namespace topic +{ +typedef ::dds::topic::detail::TopicDescription TopicDescription; +} +} + +#endif /* OMG_DDS_TOPIC_TOPIC_DESCRIPTION_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicInstance.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicInstance.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f7ba654d281de03735b2c8336497191811a68852 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicInstance.hpp @@ -0,0 +1,116 @@ +#ifndef OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_ +#define OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +namespace dds +{ +namespace topic +{ +template +class TopicInstance; +} +} + +/** + * @brief + * A TopicInstance encapsulates a dds::sub::Sample and its associated + * dds::core::InstanceHandle. + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + * @see for more information: @ref dds::sub::Sample + * @see for more information: @ref dds::core::InstanceHandle + */ +template +class dds::topic::TopicInstance +{ +public: + /** + * Construct a TopicInstance. + */ + TopicInstance(); + + /** + * Construct a TopicInstance with an InstanceHandle. + * + * @param h the InstanceHandle + */ + explicit TopicInstance(const ::dds::core::InstanceHandle& h); + + /** + * Construct a TopicInstance with an InstanceHandle and a sample type. + * + * @param h the InstanceHandle + * @param sample the + */ + TopicInstance(const ::dds::core::InstanceHandle& h, const T& sample); + +public: + /** + * Conversion operator to get the InstanceHandle. + * + * @return the InstanceHandle for the TopicInstance + */ + operator const ::dds::core::InstanceHandle() const; + + /** + * Get the InstanceHandle. + * + * @return the InstanceHandle for the TopicInstance + */ + const ::dds::core::InstanceHandle handle() const; + + /** + * Set the InstanceHandle. + * + * @param h the InstanceHandle to set to the TopicInstance + */ + void handle(const ::dds::core::InstanceHandle& h); + + /** + * Get the data sample + * + * @return the sample for the TopicInstance + */ + const T& sample() const; + + /** + * Get the data sample + * + * @return the sample for the TopicInstance + */ + T& sample(); + + /** + * Set the data sample + * + * @param sample send a sample for this TopicInstance + */ + void sample(const T& sample); + +private: + ::dds::core::InstanceHandle h_; + T sample_; +}; + + +#endif /* OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c63ac9eefafe3fa3ee530780f676543f4b3afbe6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicListener.hpp @@ -0,0 +1,144 @@ +#ifndef OMG_DDS_TOPIC_TOPIC_LISTENER_HPP_ +#define OMG_DDS_TOPIC_TOPIC_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "dds/topic/Topic.hpp" + +namespace dds +{ +namespace topic +{ + +/** + * @brief + * Topic events Listener + * + * Since a Topic is an Entity, it has the ability to have a Listener + * associated with it. In this case, the associated Listener should be of type + * TopicListener. This interface must be implemented by the + * application. A user-defined class must be provided by the application which must + * extend from the TopicListener class. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * + * The TopicListener provides a generic mechanism (actually a + * callback function) for the Data Distribution Service to notify the application of + * relevant asynchronous status change events, such as a missed deadline, violation of + * a QosPolicy setting, etc. The TopicListener is related to + * changes in communication status StatusConditions. + * + * @code{.cpp} + * // Application example listener + * class ExampleListener : + * public virtual dds::topic::TopicListener + * { + * public: + * virtual void on_inconsistent_topic ( + * dds::topic::Topic& topic, + * const dds::core::status::InconsistentTopicStatus& status) + * { + * std::cout << "on_inconsistent_topic" << std::endl; + * } + * }; + * + * // Create Topic with the listener + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, + * "TopicName", + * participant.default_topic_qos(), + * new ExampleListener(), + * dds::core::status::StatusMask::all()); + * + * @endcode + * + * @see for more information: @ref DCPS_Modules_Topic "Topic" + * @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information" + */ +template +class TopicListener +{ +public: + /** @cond */ + virtual ~TopicListener() { } + /** @endcond */ + +public: + /** + * This operation is called by the Data Distribution Service when the + * InconsistentTopicStatus changes. + * + * The implementation may be left empty + * when this functionality is not needed. This operation will only be called when the + * relevant TopicListener is installed and enabled with the + * StatusMask::inconsistent_topic(). The InconsistentTopicStatus will change + * when another Topic exists with the same topic_name but different + * characteristics. + * + * @param topic contain a pointer to the Topic on which the conflict + * occurred (this is an input to the application). + * @param status contain the InconsistentTopicStatus object (this is + * an input to the application). + */ + virtual void on_inconsistent_topic( + Topic& topic, + const dds::core::status::InconsistentTopicStatus& status) = 0; +}; + + +/** + * @brief + * Topic events Listener + * + * This listener is just like TopicListener, except + * that the application doesn't have to implement all operations. + * + * @code{.cpp} + * class ExampleListener : public virtual dds::topic::NoOpTopicListener + * { + * // Not necessary to implement any Listener operations. + * }; + * @endcode + * + * @see dds::topic::TopicListener + */ +template +class NoOpTopicListener : public virtual TopicListener +{ +/** @cond + * All these functions have already been documented in the non-NoOp listener. + * Ignore these functions for the doxygen API documentation for clarity. + */ +public: + virtual ~NoOpTopicListener() { } + +public: + virtual void on_inconsistent_topic( + Topic&, + const dds::core::status::InconsistentTopicStatus&) { } +/** @endcond */ +}; + +} +} + +#endif /* OMG_DDS_TOPIC_TOPIC_LISTENER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicTraits.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicTraits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..db0e98dca0e1603b18f805bf69267662f450bdaa --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicTraits.hpp @@ -0,0 +1,92 @@ +#ifndef OMG_DDS_TOPIC_TOPIC_TRAITS_HPP_ +#define OMG_DDS_TOPIC_TOPIC_TRAITS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +//============================================================================== +namespace dds +{ +namespace topic +{ +template +struct is_topic_type; + +/** @cond */ +template +struct topic_type_support; +/** @endcond */ + +/** + * @brief + * Support functionality to get the default type_name of a Topic type. + * + * @code{.cpp} + * std::string typeName = dds::topic::topic_type_name::value(); + * @endcode + */ +template +struct topic_type_name +{ + static std::string value() + { + return "Undefined"; + } +}; + +} +} + +//============================================================================== +/** + * @brief + * Support functionality to check if a given object type is a Topic. + * + * @code{.cpp} + * if (dds::topic::is_topic_type::value) { + * // Foo::Bar type is considered a Topic + * } else { + * // Foo::Bar type is NOT considered a Topic + * } + * @endcode + */ +template +struct dds::topic::is_topic_type +{ + enum {value = 0 }; +}; + + +/** @cond + * IsoCpp doesn't know the TypeSupport concept. The type is automatically + * registered when an Topic is created. So, what does this function do? + */ +template +struct dds::topic::topic_type_support { }; +/** @endcond */ + + +#define REGISTER_TOPIC_TYPE(TOPIC_TYPE) \ + namespace dds { namespace topic { \ + template<> struct is_topic_type { \ + enum { value = 1 }; \ + }; } } + +#endif /* OMG_DDS_TOPIC_TOPIC_TRAITS_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/ddstopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/ddstopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..365a16725656d531049abd9339ad863d4eadb780 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/ddstopic.hpp @@ -0,0 +1,31 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#ifndef OMG_DDS_TOPIC_PACKAGE_INCLUDE_HPP_ +#define OMG_DDS_TOPIC_PACKAGE_INCLUDE_HPP_ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#endif /* OMG_DDS_TOPIC_PACKAGE_INCLUDE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/AnyTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/AnyTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..62886393d8b4887f041fca03ccb66cee77546aa1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/AnyTopic.hpp @@ -0,0 +1,30 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_TOPIC_DETAIL_ANY_TOPIC_HPP_ +#define OMG_DDS_TOPIC_DETAIL_ANY_TOPIC_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include + +namespace dds { namespace topic { namespace detail { + typedef dds::topic::TAnyTopic AnyTopic; +} } } + +// End of implementation + +#endif /* OMG_DDS_TOPIC_DETAIL_ANY_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f7b95585271b34af066d027751d068316ac359d7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopic.hpp @@ -0,0 +1,46 @@ +#ifndef OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_HPP_ +#define OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include + +namespace dds { namespace topic { namespace detail { + + typedef dds::topic::TParticipantBuiltinTopicData + ParticipantBuiltinTopicData; + + typedef dds::topic::TTopicBuiltinTopicData + TopicBuiltinTopicData; + + typedef dds::topic::TPublicationBuiltinTopicData + PublicationBuiltinTopicData; + + typedef dds::topic::TSubscriptionBuiltinTopicData + SubscriptionBuiltinTopicData; + +} } } + + + +#endif /* OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopicKey.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopicKey.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0e5a425a2a160aa706d8ee8ddae1f3ddac3e5912 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopicKey.hpp @@ -0,0 +1,29 @@ +#ifndef OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_KEY_HPP_ +#define OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_KEY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +namespace dds { namespace topic { namespace detail { + typedef dds::topic::TBuiltinTopicKey BuiltinTopicKey; +} } } + +#endif /* OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_KEY_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ContentFilteredTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ContentFilteredTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..57d807b5a7ccf12b7a610326a97da49e72ce9570 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ContentFilteredTopic.hpp @@ -0,0 +1,470 @@ +#ifndef OMG_DDS_TOPIC_DETAIL_CONTENTFILTEREDTOPIC_HPP_ +#define OMG_DDS_TOPIC_DETAIL_CONTENTFILTEREDTOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + +// Required for C++11 +#if __cplusplus == 201103L +#include +#endif + +// meta-programming helpers +namespace detail +{ +template +struct remove_first_from_tuple; + +template +struct remove_first_from_tuple> +{ + using type = std::tuple; +}; + +template +using remove_first_from_tuple_t = typename remove_first_from_tuple::type; + +template +struct callable_traits; + +template +struct callable_traits +{ + using return_type = R; + + static constexpr std::size_t Arity = sizeof...(Args); + + template < std::size_t N, std::enable_if_t * = nullptr> + struct argument + { + using type = typename std::tuple_element>::type; + }; + + using argument_tuple = std::tuple; +}; + +// function pointer +template +struct callable_traits + : public callable_traits {}; + +// member function pointer +template +struct callable_traits + : public callable_traits {}; + +// const member function pointer +template +struct callable_traits + : public callable_traits {}; + +// member object pointer +template +struct callable_traits + : public callable_traits {}; + +// functor +template +struct callable_traits +{ +private: + using call_type = callable_traits; + +public: + using return_type = typename call_type::return_type; + + static constexpr std::size_t Arity = call_type::Arity - 1; + + template < std::size_t N, std::enable_if_t * = nullptr> + struct argument + { + using type = typename call_type::template argument::type; + }; + + using argument_tuple = remove_first_from_tuple_t; +}; + +template +struct callable_traits + : public callable_traits {}; + +template +struct callable_traits + : public callable_traits {}; + +// Concepts of possible callbacks +template +using sample_only_t = std::enable_if_t>::Arity == 1 && + std::is_same>::template argument<0>::type, + const T &>::value && + std::is_same>::return_type, bool>::value +>; + +template +using sample_info_only_t = std::enable_if_t>::Arity == 1 && + std::is_same>::template argument<0>::type, + const dds::sub::SampleInfo &>::value && + std::is_same>::return_type, bool>::value +>; + +template +using sample_and_sample_info_t = std::enable_if_t>::Arity == 2 && + std::is_same>::template argument<0>::type, + const T &>::value && + std::is_same>::template argument<1>::type, + const dds::sub::SampleInfo &>::value && + std::is_same>::return_type, bool>::value +>; + +} // namespace detail + + +namespace dds { +namespace topic { +namespace detail { + +class FunctorHolderBase +{ +public: + FunctorHolderBase() = default; + virtual ~FunctorHolderBase() = default; + FunctorHolderBase(const FunctorHolderBase &) = default; + FunctorHolderBase & operator=(const FunctorHolderBase &) = default; + FunctorHolderBase(FunctorHolderBase &&) = default; + FunctorHolderBase & operator=(FunctorHolderBase &&) = default; + + virtual bool check_sample(const void * sample, const dds_sample_info_t * sample_info) = 0; + + static bool c99_check_sample(const void *sample, void *arg) + { + auto funcHolder = static_cast(arg); + return funcHolder->check_sample(sample, nullptr); + } + + static bool c99_check_sample_info(const dds_sample_info_t * sampleinfo, void * arg) + { + auto funcHolder = static_cast(arg); + return funcHolder->check_sample(nullptr, sampleinfo); + } + + static bool c99_check_sample_and_sample_info( + const void * sample, + const dds_sample_info_t * sampleinfo, void * arg) + { + auto funcHolder = static_cast(arg); + return funcHolder->check_sample(sample, sampleinfo); + } +}; + +template +class FunctorHolder; + +template +class FunctorHolder>: public FunctorHolderBase +{ +public: + /* Remove const to be able to call non-const functors. */ + FunctorHolder(FUN functor) + : myFunctor(std::move(functor)) {} + + bool check_sample(const void * sample, const dds_sample_info_t *) override + { + return myFunctor(*(reinterpret_cast(sample))); + } + +private: + FUN myFunctor; +}; + +template +class FunctorHolder>: public FunctorHolderBase +{ +public: + /* Remove const to be able to call non-const functors. */ + FunctorHolder(FUN functor) + : myFunctor(std::move(functor)) {} + + bool check_sample(const void *, const dds_sample_info_t * sampleinfo) override + { + dds::sub::SampleInfo cxxSampleInfo; + org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos( + *sampleinfo, + cxxSampleInfo); + return myFunctor(cxxSampleInfo); + } + +private: + FUN myFunctor; +}; + +template +class FunctorHolder>: public FunctorHolderBase +{ +public: + /* Remove const to be able to call non-const functors. */ + FunctorHolder(FUN functor) + : myFunctor(std::move(functor)) {} + + bool check_sample(const void * sample, const dds_sample_info_t * sampleinfo) override + { + dds::sub::SampleInfo cxxSampleInfo; + org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos(*sampleinfo, + cxxSampleInfo); + return myFunctor(*(reinterpret_cast(sample)), cxxSampleInfo); + } + +private: + FUN myFunctor; +}; + +template +class ContentFilteredTopic : + public virtual org::eclipse::cyclonedds::topic::TopicDescriptionDelegate, + public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + ContentFilteredTopic( + const dds::topic::Topic& topic, + const std::string& name, + const dds::topic::Filter& filter) + : org::eclipse::cyclonedds::core::DDScObjectDelegate(), + org::eclipse::cyclonedds::topic::TopicDescriptionDelegate(topic.domain_participant(), name, topic.type_name()), + myTopic(topic), + myFilter(filter), + myFunctor(nullptr) + { + topic.delegate()->incrNrDependents(); + this->myParticipant.delegate()->add_cfTopic(*this); + this->ser_type_ = topic->get_ser_type(); + } + + virtual ~ContentFilteredTopic() + { + if (!this->closed) { + try { + this->close(); + } catch (...) { + /* Empty: the exception throw should have already traced an error. */ + } + } + // delete the functor + delete myFunctor; + myFunctor = nullptr; + } + + virtual void close() + { + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + myTopic.delegate()->decrNrDependents(); + + // Remove the ContentFilteredTopic from the list of topics in its participant. + this->myParticipant.delegate()->remove_cfTopic(*this); + + org::eclipse::cyclonedds::core::ObjectDelegate::close(); + } + + void + init(org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type weak_ref) + { + /* Set weak_ref before passing ourselves to other isocpp objects. */ + this->set_weak_ref(weak_ref); + /* Register topic at participant. */ + this->myParticipant.delegate()->add_cfTopic(*this); + } + +private: +#if 0 + void validate_filter() + { + q_expr expr = NULL; + uint32_t length; + c_value *params; + + length = myFilter.parameters_length(); + if (length < 100) { + expr = q_parse(myFilter.expression().c_str()); + if (!expr ) { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "filter_expression '%s' is invalid", myFilter.expression().c_str()); + } + } else { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "Invalid number of filter_parameters '%d', maximum is 99", length); + } + + u_topic uTopic = (u_topic)(myTopic.delegate()->get_user_handle()); + + params = reader_parameters(); + if (!u_topicContentFilterValidate2(uTopic, expr, params)) { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "filter_expression '%s' is invalid.", myFilter.expression().c_str()); + } + q_dispose(expr); + os_free(params); + } +#endif +public: + std::string reader_expression() const + { + std::string rExpr; + + rExpr += "select * from "; + rExpr += myTopic.name(); + rExpr += " where "; + rExpr += myFilter.expression(); + return rExpr; + } +#if 0 + c_value *reader_parameters() const + { + c_value *params = NULL; + uint32_t n, length; + org::eclipse::cyclonedds::topic::FilterDelegate::const_iterator paramIterator; + + length = myFilter.parameters_length(); + params = (c_value *)os_malloc(length * sizeof(struct c_value)); + for (n = 0, paramIterator = myFilter.begin(); n < length; n++, paramIterator++) { + params[n] = c_stringValue(const_cast(paramIterator->c_str())); + } + return params; + } +#endif + /** + * @internal Accessor to return the topic filter. + * @return The dds::topic::Filter in effect on this topic. + */ + const dds::topic::Filter& filter() const + { + return myFilter; + } + + /** + * @internal Sets the filter parameters for this content filtered topic. + * @param begin The iterator holding the first string param + * @param end The last item in the string iteration + */ + template + void filter_parameters(const FWIterator& begin, const FWIterator& end) + { + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Changing of Filter parameters is currently not supported."); + myFilter.parameters(begin, end); + //@todo validate_filter(); + } + + const dds::topic::Topic& topic() const + { + return myTopic; + } + + const std::string& filter_expression() const + { + return myFilter.expression(); + } + + const dds::core::StringSeq filter_parameters() const + { + return dds::core::StringSeq(myFilter.begin(), myFilter.end()); + } +#if 0 + dds::topic::TTopicDescription clone() + { + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + typename dds::topic::ContentFilteredTopic::DELEGATE_REF_T ref( + new ContentFilteredTopic(this->myTopic, this->myTopicName, this->myFilter)); + ref->init(ref); + + return dds::topic::ContentFilteredTopic(ref); + } +#endif + + template * = nullptr> + void filter_function(Functor && func) + { + dds_topic_filter flt; + flt.mode = DDS_TOPIC_FILTER_SAMPLE_ARG; + flt.f.sample_arg = &FunctorHolderBase::c99_check_sample; + filter_function_internal(std::forward(func), &flt); + } + + template * = nullptr> + void filter_function(Functor && func) + { + dds_topic_filter flt; + flt.mode = DDS_TOPIC_FILTER_SAMPLEINFO_ARG; + flt.f.sampleinfo_arg = &FunctorHolderBase::c99_check_sample_info; + filter_function_internal(std::forward(func), &flt); + } + + template * = nullptr> + void filter_function(Functor && func) + { + dds_topic_filter flt; + flt.mode = DDS_TOPIC_FILTER_SAMPLE_SAMPLEINFO_ARG; + flt.f.sample_sampleinfo_arg = &FunctorHolderBase::c99_check_sample_and_sample_info; + filter_function_internal(std::forward(func), &flt); + } + +private: + template + void filter_function_internal(Functor && func, dds_topic_filter * flt) + { + /* Make a private copy of the topic so my filter doesn't bother the original topic. */ + dds_qos_t* ddsc_qos = myTopic.qos()->ddsc_qos(); + ddsi_sertype *st = org::eclipse::cyclonedds::topic::TopicTraits::getSerType(); + dds_entity_t cfTopic = dds_create_topic_sertype( + myTopic.domain_participant().delegate()->get_ddsc_entity(), myTopic.name().c_str(), &st, ddsc_qos, NULL, NULL); + dds_delete_qos(ddsc_qos); + this->set_ddsc_entity(cfTopic); + + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + if (this->myFunctor) + { + delete this->myFunctor; + } + myFunctor = new FunctorHolder(std::forward(func)); + flt->arg = myFunctor; + dds_set_topic_filter_extended(cfTopic, flt); + } + + dds::topic::Topic myTopic; + dds::topic::Filter myFilter; + FunctorHolderBase *myFunctor; +}; + +} +} +} + +#endif /* OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT */ + +#endif /* OMG_DDS_TOPIC_DETAIL_CONTENTFILTEREDTOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Filter.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Filter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0f6510db7fcf8b0c7e6ec74eb71969951ce8a1bf --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Filter.hpp @@ -0,0 +1,25 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDS_TOPIC_DETAIL_QUERY_HPP_ +#define DDS_TOPIC_DETAIL_QUERY_HPP_ + +#include +#include + +namespace dds { +namespace topic { +namespace detail { +typedef ::dds::topic::TFilter< ::org::eclipse::cyclonedds::topic::FilterDelegate > Filter; +} +} +} +#endif /* DDS_TOPIC_DETAIL_QUERY_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/MultiTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/MultiTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4e46c3ed8d5a8dc951da79f7fb7102674231de36 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/MultiTopic.hpp @@ -0,0 +1,135 @@ +#ifndef OMG_DDS_TOPIC_DETAIL_MULTI_TOPIC_HPP_ +#define OMG_DDS_TOPIC_DETAIL_MULTI_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include +#include +#include +#include + +#ifdef OMG_DDS_MULTI_TOPIC_SUPPORT + +namespace dds { namespace topic { namespace detail { + + +template +class MultiTopic : public org::eclipse::cyclonedds::topic::TopicDescriptionDelegate +{ +public: + MultiTopic( + const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string expression, + const FWDIterator& params_begin, + const FWDIterator& params_end) + : ::dds::core::Reference< DELEGATE >( + new dds::topic::detail::MultiTopic(dp, name, expression, params_begin, params_end)) + { + // Set the correct (IDL) type_name in the TopicDescription. + dds::topic::detail::TopicDescription::myTypeName = org::eclipse::cyclonedds::topic::TopicTraits::getTypeName(); + + //@todo validate_filter(); + } + + virtual ~MultiTopic() + { + // Assume destructor of Filter attribute cleans up itself. + } + +private: +#if 0 + void validate_filter() + { + q_expr expr = NULL; + uint32_t length; + c_value *params; + + length = myFilter.parameters_length(); + if (length < 100) { + expr = q_parse(myFilter.expression().c_str()); + if (!expr ) { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "filter_expression '%s' is invalid", myFilter.expression().c_str()); + } + } else { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "Invalid number of filter_parameters '%d', maximum is 99", length); + } + + params = reader_parameters(); + /* The function below does not exist yet, but probably a function like it will need to be developed. */ + if (!u_topicMultiExprValidate(dp.delegate()->get_user_handle(), myFilter.expression().c_str(), params)) { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "filter_expression '%s' is invalid.", myFilter.expression().c_str()); + } + q_dispose(expr); + os_free(params); + } +#endif +public: + std::string reader_expression() const + { + return myFilter.expression(); + } +#if 0 + c_value *reader_parameters() const + { + c_value *params = NULL; + uint32_t n, length; + org::eclipse::cyclonedds::topic::FilterDelegate::const_iterator paramIterator; + + length = myFilter.parameters_length(); + params = (c_value *)os_malloc(length * sizeof(struct c_value)); + for (n = 0, paramIterator = myFilter.begin(); n < length; n++, paramIterator++) { + params[n] = c_stringValue(const_cast(paramIterator->c_str())); + } + return params; + } +#endif + const std::string expression() const + { + return myFilter.expression(); + } + + template + void expression_parameters(const FWIterator& params_begin, const FWIterator& params_end) + { + myFilter.parameters(begin, end); + validate_filter(); + } + + const dds::core::StringSeq expression_parameters() const + { + return dds::core::StringSeq(myFilter.begin(), myFilter.end()); + } + +private: + dds::topic::Filter myFilter; +}; + +} +} +} +#endif /* OMG_DDS_MULTI_TOPIC_SUPPORT */ + +#endif /* OMG_DDS_TOPIC_DETAIL_MULTI_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TAnyTopicImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TAnyTopicImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..088eb613d3e83027ed0f60bc95dcbfa89cf282bb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TAnyTopicImpl.hpp @@ -0,0 +1,73 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TANYTOPIC_IMPL_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TANYTOPIC_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace topic +{ + +template +dds::topic::qos::TopicQos +TAnyTopic::qos() const +{ + return this->delegate()->qos(); +} + +template +void +TAnyTopic::qos(const dds::topic::qos::TopicQos& qos) +{ + this->delegate()->qos(qos); +} + +template +TAnyTopic& +TAnyTopic::operator << (const dds::topic::qos::TopicQos& qos) +{ + this->delegate()->qos(qos); + return *this; +} + +template +const TAnyTopic& +TAnyTopic::operator >> (dds::topic::qos::TopicQos& qos) const +{ + qos = this->delegate()->qos(); + return *this; +} + +template +dds::core::status::InconsistentTopicStatus +TAnyTopic::inconsistent_topic_status() const +{ + return this->delegate()->inconsistent_topic_status(); +} + + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TANYTOPIC_IMPL_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..77d859559d078ccf2f06211708623f767b6be44e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicImpl.hpp @@ -0,0 +1,580 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TBUILTINTOPIC_IMPL_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TBUILTINTOPIC_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace topic +{ + +//TParticipantBuiltinTopicData +template +const dds::topic::BuiltinTopicKey& TParticipantBuiltinTopicData::key() const +{ + return this->delegate().key(); +} + +template +const ::dds::core::policy::UserData& TParticipantBuiltinTopicData::user_data() const +{ + return this->delegate().user_data(); +} + +//TTopicBuiltinTopicData +template +const dds::topic::BuiltinTopicKey& TTopicBuiltinTopicData::key() const +{ + return this->delegate().key(); +} + +template +const std::string& TTopicBuiltinTopicData::name() const +{ + return this->delegate().name(); +} + +template +const std::string& TTopicBuiltinTopicData::type_name() const +{ + return this->delegate().type_name(); +} + +template +const ::dds::core::policy::Durability& TTopicBuiltinTopicData::durability() const +{ + return this->delegate().durability(); +} + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT +template +const ::dds::core::policy::DurabilityService& TTopicBuiltinTopicData::durability_service() const +{ + return this->delegate().durability_service(); +} + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + +template +const ::dds::core::policy::Deadline& TTopicBuiltinTopicData::deadline() const +{ + return this->delegate().deadline(); +} + +template +const ::dds::core::policy::LatencyBudget& TTopicBuiltinTopicData::latency_budget() const +{ + return this->delegate().latency_budget(); +} + +template +const ::dds::core::policy::Liveliness& TTopicBuiltinTopicData::liveliness() const +{ + return this->delegate().liveliness(); +} + +template +const ::dds::core::policy::Reliability& TTopicBuiltinTopicData::reliability() const +{ + return this->delegate().reliability(); +} + +template +const ::dds::core::policy::TransportPriority& TTopicBuiltinTopicData::transport_priority() const +{ + return this->delegate().transport_priority(); +} + +template +const ::dds::core::policy::Lifespan& TTopicBuiltinTopicData::lifespan() const +{ + return this->delegate().lifespan(); +} + +template +const ::dds::core::policy::DestinationOrder& TTopicBuiltinTopicData::destination_order() const +{ + return this->delegate().destination_order(); +} + +template +const ::dds::core::policy::History& TTopicBuiltinTopicData::history() const +{ + return this->delegate().history(); +} + +template +const ::dds::core::policy::ResourceLimits& TTopicBuiltinTopicData::resource_limits() const +{ + return this->delegate().resource_limits(); +} + +template +const ::dds::core::policy::Ownership& TTopicBuiltinTopicData::ownership() const +{ + return this->delegate().ownership(); +} + +template +const ::dds::core::policy::TopicData& TTopicBuiltinTopicData::topic_data() const +{ + return this->delegate().topic_data(); +} + +//TPublicationBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TPublicationBuiltinTopicData::key() const +{ + return this->delegate().key(); +} + +template +const dds::topic::BuiltinTopicKey& TPublicationBuiltinTopicData::participant_key() const +{ + return this->delegate().key(); +} + +template +const std::string& TPublicationBuiltinTopicData::topic_name() const +{ + return this->delegate().topic_name(); +} + +template +const std::string& TPublicationBuiltinTopicData::type_name() const +{ + return this->delegate().type_name(); +} + +template +const ::dds::core::policy::Durability& TPublicationBuiltinTopicData::durability() const +{ + return this->delegate().durability(); +} + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + +template +const ::dds::core::policy::DurabilityService& TPublicationBuiltinTopicData::durability_service() const +{ + return this->delegate().durability_service(); +} +#endif // OMG_DDS_PERSISTENCE_SUPPORT + +template +const ::dds::core::policy::Deadline& TPublicationBuiltinTopicData::deadline() const +{ + return this->delegate().deadline(); +} + +template +const ::dds::core::policy::LatencyBudget& TPublicationBuiltinTopicData::latency_budget() const +{ + return this->delegate().latency_budget(); +} + +template +const ::dds::core::policy::Liveliness& TPublicationBuiltinTopicData::liveliness() const +{ + return this->delegate().liveliness(); +} + +template +const ::dds::core::policy::Reliability& TPublicationBuiltinTopicData::reliability() const +{ + return this->delegate().reliability(); +} + + +template +const ::dds::core::policy::Lifespan& TPublicationBuiltinTopicData::lifespan() const +{ + return this->delegate().lifespan(); +} + +template +const ::dds::core::policy::UserData& TPublicationBuiltinTopicData::user_data() const +{ + return this->delegate().user_data(); +} + +template +const ::dds::core::policy::Ownership& TPublicationBuiltinTopicData::ownership() const +{ + return this->delegate().ownership(); +} + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + +template +const ::dds::core::policy::OwnershipStrength& TPublicationBuiltinTopicData::ownership_strength() const +{ + return this->delegate().ownership_strength(); +} +#endif // OMG_DDS_OWNERSHIP_SUPPORT + + +template +const ::dds::core::policy::DestinationOrder& TPublicationBuiltinTopicData::destination_order() const +{ + return this->delegate().destination_order(); +} + +template +const ::dds::core::policy::Presentation& TPublicationBuiltinTopicData::presentation() const +{ + return this->delegate().presentation(); +} + +template +const ::dds::core::policy::Partition& TPublicationBuiltinTopicData::partition() const +{ + return this->delegate().partition(); +} + +template +const ::dds::core::policy::TopicData& TPublicationBuiltinTopicData::topic_data() const +{ + return this->delegate().topic_data(); +} + +template +const ::dds::core::policy::GroupData& TPublicationBuiltinTopicData::group_data() const +{ + return this->delegate().group_data(); +} + + + +template +const dds::topic::BuiltinTopicKey& TSubscriptionBuiltinTopicData::key() const +{ + return this->delegate().key(); +} + +template +const dds::topic::BuiltinTopicKey& TSubscriptionBuiltinTopicData::participant_key() const +{ + return this->delegate().key(); +} + +template +const std::string& TSubscriptionBuiltinTopicData::topic_name() const +{ + return this->delegate().topic_name(); +} + +template +const std::string& TSubscriptionBuiltinTopicData::type_name() const +{ + return this->delegate().type_name(); +} + +template +const ::dds::core::policy::Durability& TSubscriptionBuiltinTopicData::durability() const +{ + return this->delegate().durability(); +} + +template +const ::dds::core::policy::Deadline& TSubscriptionBuiltinTopicData::deadline() const +{ + return this->delegate().deadline(); +} + +template +const ::dds::core::policy::LatencyBudget& TSubscriptionBuiltinTopicData::latency_budget() const +{ + return this->delegate().latency_budget(); +} + +template +const ::dds::core::policy::Liveliness& TSubscriptionBuiltinTopicData::liveliness() const +{ + return this->delegate().liveliness(); +} + +template +const ::dds::core::policy::Reliability& TSubscriptionBuiltinTopicData::reliability() const +{ + return this->delegate().reliability(); +} + +template +const ::dds::core::policy::Ownership& TSubscriptionBuiltinTopicData::ownership() const +{ + return this->delegate().ownership(); +} + +template +const ::dds::core::policy::DestinationOrder& TSubscriptionBuiltinTopicData::destination_order() const +{ + return this->delegate().destination_order(); +} + +template +const ::dds::core::policy::UserData& TSubscriptionBuiltinTopicData::user_data() const +{ + return this->delegate().user_data(); +} + +template +const ::dds::core::policy::TimeBasedFilter& TSubscriptionBuiltinTopicData::time_based_filter() const +{ + return this->delegate().time_based_filter(); +} + +template +const ::dds::core::policy::Presentation& TSubscriptionBuiltinTopicData::presentation() const +{ + return this->delegate().presentation(); +} + +template +const ::dds::core::policy::Partition& TSubscriptionBuiltinTopicData::partition() const +{ + return this->delegate().partition(); +} + +template +const ::dds::core::policy::TopicData& TSubscriptionBuiltinTopicData::topic_data() const +{ + return this->delegate().topic_data(); +} + +template +const ::dds::core::policy::GroupData& TSubscriptionBuiltinTopicData::group_data() const +{ + return this->delegate().group_data(); +} + +#if 0 + +//TCMParticipantBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMParticipantBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMParticipantBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +//TCMPublisherBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMPublisherBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMPublisherBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +template +const dds::topic::BuiltinTopicKey& TCMPublisherBuiltinTopicData::participant_key() const +{ + return ((D)this->delegate()).participant_key(); +} + +template +const std::string& TCMPublisherBuiltinTopicData::name() const +{ + return ((D)this->delegate()).name(); +} + +template +const ::dds::core::policy::EntityFactory& TCMPublisherBuiltinTopicData::entity_factory() const +{ + return ((D)this->delegate()).entity_factory(); +} + +template +const ::dds::core::policy::Partition& TCMPublisherBuiltinTopicData::partition() const +{ + return ((D)this->delegate()).partition(); +} + +//TCMSubscriberBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMSubscriberBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMSubscriberBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +template +const dds::topic::BuiltinTopicKey& TCMSubscriberBuiltinTopicData::participant_key() const +{ + return ((D)this->delegate()).participant_key(); +} + +template +const std::string& TCMSubscriberBuiltinTopicData::name() const +{ + return ((D)this->delegate()).name(); +} + +template +const ::dds::core::policy::EntityFactory& TCMSubscriberBuiltinTopicData::entity_factory() const +{ + return ((D)this->delegate()).entity_factory(); +} + +template +const ::dds::core::policy::Partition& TCMSubscriberBuiltinTopicData::partition() const +{ + return ((D)this->delegate()).partition(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::Share& TCMSubscriberBuiltinTopicData::share() const +{ + return ((D)this->delegate()).share(); +} + +//TCMDataWriterBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMDataWriterBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMDataWriterBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +template +const dds::topic::BuiltinTopicKey& TCMDataWriterBuiltinTopicData::publisher_key() const +{ + return ((D)this->delegate()).publisher_key(); +} + +template +const std::string& TCMDataWriterBuiltinTopicData::name() const +{ + return ((D)this->delegate()).name(); +} + +template +const ::dds::core::policy::History& TCMDataWriterBuiltinTopicData::history() const +{ + return ((D)this->delegate()).history(); +} + +template +const ::dds::core::policy::ResourceLimits& TCMDataWriterBuiltinTopicData::resource_limits() const +{ + return ((D)this->delegate()).resource_limits(); +} + +template +const ::dds::core::policy::WriterDataLifecycle& TCMDataWriterBuiltinTopicData::writer_data_lifecycle() const +{ + return ((D)this->delegate()).writer_data_lifecycle(); +} + +//TCMDataReaderBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMDataReaderBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMDataReaderBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +template +const dds::topic::BuiltinTopicKey& TCMDataReaderBuiltinTopicData::subscriber_key() const +{ + return ((D)this->delegate()).subscriber_key(); +} + +template +const std::string& TCMDataReaderBuiltinTopicData::name() const +{ + return ((D)this->delegate()).name(); +} + +template +const ::dds::core::policy::History& TCMDataReaderBuiltinTopicData::history() const +{ + return ((D)this->delegate()).history(); +} + +template +const ::dds::core::policy::ResourceLimits& TCMDataReaderBuiltinTopicData::resource_limits() const +{ + return ((D)this->delegate()).resource_limits(); +} + +template +const ::dds::core::policy::ReaderDataLifecycle& TCMDataReaderBuiltinTopicData::reader_data_lifecycle() const +{ + return ((D)this->delegate()).reader_data_lifecycle(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::SubscriptionKey& TCMDataReaderBuiltinTopicData::subscription_keys() const +{ + return ((D)this->delegate()).subscription_keys(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ReaderLifespan& TCMDataReaderBuiltinTopicData::reader_lifespan() const +{ + return ((D)this->delegate()).reader_lifespan(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::Share& TCMDataReaderBuiltinTopicData::share() const +{ + return ((D)this->delegate()).share(); +} +#endif + +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TBUILTINTOPIC_IMPL_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicKeyImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicKeyImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..476e75937502933aa5eb2466ab3ad00d0d56572d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicKeyImpl.hpp @@ -0,0 +1,48 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_TBUILTINTOPICKEY_IMPL_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_TBUILTINTOPICKEY_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ + +template +const int32_t* TBuiltinTopicKey::value() const +{ + return this->delegate().value(); +} + +template +void TBuiltinTopicKey::value(int32_t v[]) +{ + return this->delegate().value(v); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_TBUILTINTOPICKEY_IMPL_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TContentFilteredTopicImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TContentFilteredTopicImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..32a5786ab1ce6fc7100210dc00313ef7b1bab991 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TContentFilteredTopicImpl.hpp @@ -0,0 +1,77 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TCONTENTFILTEREDTOPIC_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TCONTENTFILTEREDTOPIC_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ +template class DELEGATE> +ContentFilteredTopic::ContentFilteredTopic(const Topic& topic, + const std::string& name, + const dds::topic::Filter& filter) : + ::dds::core::Reference< DELEGATE >( + new dds::topic::detail::ContentFilteredTopic(topic, name, filter)) +{ + this->delegate()->init(::dds::core::Reference< DELEGATE >::impl_); +} + +template class DELEGATE> +ContentFilteredTopic::~ContentFilteredTopic() +{ + // Nothing to be done yet.... +} + +template class DELEGATE> +const std::string& ContentFilteredTopic::filter_expression() const +{ + return this->delegate()->filter_expression(); +} + +template class DELEGATE> +const dds::core::StringSeq ContentFilteredTopic::filter_parameters() const +{ + return this->delegate()->filter_parameters(); +} + +template class DELEGATE> +template +void ContentFilteredTopic::filter_parameters(const FWDIterator& begin, const FWDIterator& end) +{ + this->delegate()->filter_parameters(begin, end); +} + +template class DELEGATE> +const dds::topic::Topic& ContentFilteredTopic::topic() const +{ + return this->delegate()->topic(); +} + + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TCONTENTFILTEREDTOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TFilterImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TFilterImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cab73a82d123cc85c1a1ee1464d30a39cd901498 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TFilterImpl.hpp @@ -0,0 +1,105 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TFILTER_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TFILTER_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ + +template +TFilter::TFilter(const std::string& query_expression) : + dds::core::Value(query_expression) +{ +} + +template +template +TFilter::TFilter(const std::string& query_expression, const FWIterator& params_begin, + const FWIterator& params_end) + : dds::core::Value(query_expression, params_begin, params_end) +{ } + +template +TFilter::TFilter(const std::string& query_expression, + const std::vector& params) : + dds::core::Value(query_expression, params.begin(), params.end()) +{ +} + +template +const std::string& TFilter::expression() const +{ + return this->delegate().expression(); +} + +template +typename TFilter::const_iterator TFilter::begin() const +{ + return this->delegate().begin(); +} + +template +typename TFilter::const_iterator TFilter::end() const +{ + return this->delegate().end(); +} + +template +typename TFilter::iterator TFilter::begin() +{ + return this->delegate().begin(); +} + +template +typename TFilter::iterator TFilter::end() +{ + return this->delegate().end(); +} + +template +template +void TFilter::parameters(const FWIterator& begin, const FWIterator end) +{ + this->delegate().parameters(begin, end); +} + +template +void TFilter::add_parameter(const std::string& param) +{ + this->delegate().add_parameter(param); +} + +template +uint32_t TFilter::parameters_length() const +{ + return this->delegate().parameters_length(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TFILTER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9b9719f9c8a6092cf2fdd77ef8dd590ab5e3fa90 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hpp @@ -0,0 +1,54 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TTOPICDESCRIPTION_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TTOPICDESCRIPTION_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ + +template +const std::string& TTopicDescription::name() const +{ + return this->delegate()->name(); +} + +template +const std::string& TTopicDescription::type_name() const +{ + return this->delegate()->type_name(); +} + +template +const dds::domain::DomainParticipant& TTopicDescription::domain_participant() const +{ + return this->delegate()->domain_participant(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TTOPICDESCRIPTION_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..90457a736d757b6503ccd3e87d73af937cd5fc56 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicImpl.hpp @@ -0,0 +1,395 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TTOPIC_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TTOPIC_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include "org/eclipse/cyclonedds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/TopicListener.hpp" + +#include +#include + +#define MAX_TOPIC_NAME_LEN 1024 + +// Implementation + +namespace dds +{ +namespace topic +{ + + +/*************************************************************************** + * + * dds/topic/Topic<> WRAPPER implementation. + * Declaration can be found in dds/topic/TTopic.hpp + * + ***************************************************************************/ + + +template class DELEGATE> +Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name) : + ::dds::core::Reference< DELEGATE >(new DELEGATE( + dp, + topic_name, + "", + dp.default_topic_qos(), + NULL, + dds::core::status::StatusMask::none())) +{ + this->delegate()->init(this->impl_); +} + +template class DELEGATE> +Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const std::string& type_name) : + ::dds::core::Reference< DELEGATE >(new DELEGATE( + dp, + topic_name, + type_name, + dp.default_topic_qos(), + NULL, + dds::core::status::StatusMask::none())), + ::dds::topic::TAnyTopic< DELEGATE >(::dds::core::Reference< DELEGATE >::delegate()) +{ + throw dds::core::UnsupportedError(std::string("Only Topics with default type_names are supported")); + /* this->delegate()->init(this->impl_); */ +} + +template class DELEGATE> +Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener, + const dds::core::status::StatusMask& mask) : + ::dds::core::Reference< DELEGATE >(new DELEGATE( + dp, + topic_name, + "", + qos, + listener, + mask)), + ::dds::topic::TAnyTopic< DELEGATE >(::dds::core::Reference< DELEGATE >::delegate()) +{ + this->delegate()->init(this->impl_); +} + +template class DELEGATE> +Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener, + const dds::core::status::StatusMask& mask) : + ::dds::core::Reference< DELEGATE >(new DELEGATE( + dp, + topic_name, + type_name, + qos, + listener, + mask)), + ::dds::topic::TAnyTopic< DELEGATE >(::dds::core::Reference< DELEGATE >::delegate()) +{ + throw dds::core::UnsupportedError(std::string("Only Topics with default type_names are supported")); + /* this->delegate()->init(this->impl_); */ +} + +/** @internal @todo Relates to OMG_DDS_X_TYPE_DYNAMIC_TYPE_SUPPORT OSPL-1736 no implementation */ +template class DELEGATE> +void Topic::listener(Listener* listener, + const ::dds::core::status::StatusMask& event_mask) +{ + this->delegate()->listener(listener, event_mask); +} + +/** @internal @todo Relates to OMG_DDS_X_TYPE_DYNAMIC_TYPE_SUPPORT OSPL-1736 no implementation */ +template class DELEGATE> +typename Topic::Listener* Topic::listener() const +{ + return this->delegate()->listener(); +} + + +} +} + + + + +/*************************************************************************** + * + * dds/topic/detail/Topic<> DELEGATE implementation. + * Declaration can be found in dds/topic/detail/Topic.hpp + * + * Implementation and declaration have been separated because some circular + * dependencies, like with TopicListener and AnyTopic. + * + ***************************************************************************/ + +#include +#include +#include +//#include +#include +#include + +#include "dds/ddsi/ddsi_sertype.h" + +template +dds::topic::detail::Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener, + const dds::core::status::StatusMask& mask) + : org::eclipse::cyclonedds::topic::TopicDescriptionDelegate(dp, name, type_name), + org::eclipse::cyclonedds::topic::AnyTopicDelegate(qos, dp, name, type_name) +{ + // Set the correct (IDL) type_name in the TopicDescription. + org::eclipse::cyclonedds::topic::TopicDescriptionDelegate::myTypeName = org::eclipse::cyclonedds::topic::TopicTraits::getTypeName(); + + // get and validate the ddsc qos + org::eclipse::cyclonedds::topic::qos::TopicQosDelegate tQos = qos.delegate(); + tQos.check(); + dds_qos_t* ddsc_qos = tQos.ddsc_qos(); + dds_entity_t ddsc_par = dp.delegate()->get_ddsc_entity(); + + ser_type_ = org::eclipse::cyclonedds::topic::TopicTraits::getSerType(); + + dds_entity_t ddsc_topic = dds_create_topic_sertype( + ddsc_par, name.c_str(), &ser_type_, ddsc_qos, NULL, NULL); + + dds_delete_qos(ddsc_qos); + + if (ddsc_topic < 0) { + ddsi_sertype_unref(ser_type_); + ISOCPP_DDSC_RESULT_CHECK_AND_THROW(ddsc_topic, "Could not create topic."); + } + + this->set_ddsc_entity(ddsc_topic); + + this->listener(listener, mask); + + this->AnyTopicDelegate::set_sample(&this->sample_); +} + +template +dds::topic::detail::Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds_entity_t ddsc_topic) + : org::eclipse::cyclonedds::topic::TopicDescriptionDelegate(dp, name, type_name), + org::eclipse::cyclonedds::topic::AnyTopicDelegate(qos, dp, name, type_name) +{ + this->set_ddsc_entity(ddsc_topic); + this->listener(NULL, dds::core::status::StatusMask::none()); + + this->AnyTopicDelegate::set_sample(&this->sample_); +} + + +template +dds::topic::detail::Topic::~Topic/**/() +{ + if (!closed) { + try { + close(); + } catch (...) { + + } + } +} + +template +void +dds::topic::detail::Topic::close() +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + if (this->hasDependents()) { + ISOCPP_THROW_EXCEPTION(ISOCPP_PRECONDITION_NOT_MET_ERROR, "Topic still has unclosed dependencies (e.g. Readers/Writers/ContentFilteredTopics)"); + } + + this->listener_set(NULL, dds::core::status::StatusMask::none()); + + this->myParticipant.delegate()->remove_topic(*this); + + org::eclipse::cyclonedds::core::EntityDelegate::close(); +} + +template +void +dds::topic::detail::Topic::init(ObjectDelegate::weak_ref_type weak_ref) +{ + /* Set weak_ref before passing ourselves to other isocpp objects. */ + this->set_weak_ref(weak_ref); + /* Add weak_ref to the map of entities */ + this->add_to_entity_map(weak_ref); + /* Register topic at participant. */ + this->myParticipant.delegate()->add_topic(*this); + + /* Enable when needed. */ + if (this->myParticipant.delegate()->is_auto_enable()) { + this->enable(); + } +} + + +template +void +dds::topic::detail::Topic::listener(TopicListener* listener, + const ::dds::core::status::StatusMask& mask) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->listener_set(listener, mask); + scopedLock.unlock(); +} + + +template +dds::topic::TopicListener* +dds::topic::detail::Topic::listener() +{ + this->check(); + return reinterpret_cast*>(this->listener_get()); +} + +template +dds::topic::Topic +dds::topic::detail::Topic::wrapper() +{ + + typename Topic::ref_type ref = + ::std::dynamic_pointer_cast >(this->get_strong_ref()); + dds::topic::Topic topic(ref); + + return topic; +} + +template +void +dds::topic::detail::Topic::listener_notify( + ObjectDelegate::ref_type source, + uint32_t triggerMask, + void *eventData, + void *l) +{ + (void)source; + (void)triggerMask; + (void)eventData; + (void)l; +} + +template +dds::topic::Topic +dds::topic::detail::Topic::discover_topic( + const dds::domain::DomainParticipant& dp, + const std::string& name, + const dds::core::Duration& timeout) +{ + dds::topic::Topic found = dds::core::null; + std::unique_ptr > + type_info(org::eclipse::cyclonedds::topic::TopicTraits::getTypeInfo(nullptr), + [](dds_typeinfo_t *ti) { static_cast(dds_free_typeinfo(ti)); }); + dds_entity_t ddsc_topic = dp.delegate()->lookup_topic(name, type_info.get(), timeout); + + if (ddsc_topic <= 0) { + return dds::core::null; + } + +#if 0 + /* Add type_name here when non-default ones are supported. */ + size_t slen = MAX_TOPIC_NAME_LEN; + char *ddsc_type_name; + ddsc_type_name = (char *)dds_alloc(slen); + dds_get_type_name(ddsc_topic, ddsc_type_name, slen); + std::string type_name = ddsc_type_name; + dds_free(ddsc_type_name); +#endif + + dds_return_t ret; + dds_qos_t* ddsc_qos = dds_create_qos(); + ret = dds_get_qos(ddsc_topic, ddsc_qos); + dds::topic::qos::TopicQos qos; + if (ret == DDS_RETCODE_OK) { + qos.delegate().ddsc_qos(ddsc_qos); + } + dds_delete_qos(ddsc_qos); + ISOCPP_DDSC_RESULT_CHECK_AND_THROW(ret, "Failed to get the qos from discovered topic"); + + /* + * The found topic could be of the wrong type. This will be indicated + * with a PreconditionNotMetError when we try to create it. + */ + try { + found = dds::topic::Topic(dp, name, qos); + } catch (dds::core::PreconditionNotMetError&) { + /* Ignore; just return dds::core::null */ + } + + return found; +} + + +template +void +dds::topic::detail::Topic::discover_topics( + const dds::domain::DomainParticipant& dp, + std::vector >& topics, + uint32_t max_size) +{ + (void)dp; + (void)topics; + std::vector ddsc_topics; + topics.clear(); + /* + * Unfortunately, DomainParticipantDelegate::lookup_topics() is not + * supported yet and will throw an exception. + */ + dp.delegate()->lookup_topics(topic_type_name::value(), ddsc_topics, max_size); +} + + +template +void dds::topic::detail::Topic::on_inconsistent_topic( + dds_entity_t topic, + org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate &sd ) +{ + dds::core::status::InconsistentTopicStatus s ; + s.delegate() = sd ; + (void)topic; + dds::topic::Topic t = wrapper() ; + + dds::topic::TopicListener *l = + reinterpret_cast *>(this->listener_get()); + if( (l != NULL) && + (this->get_listener_mask().to_ulong() & + dds::core::status::StatusMask::inconsistent_topic().to_ulong()) ) + { + l->on_inconsistent_topic( t, s ) ; + } +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TTOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Topic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Topic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2752d43a2ad1b9839db306015b323bfb2e7d822b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Topic.hpp @@ -0,0 +1,131 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_TOPIC_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_TOPIC_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +namespace dds +{ +namespace topic +{ +template +class TopicListener; + +} +} + +namespace dds +{ +namespace topic +{ +namespace detail +{ +template +class Topic; +} +} +} + + + +/*************************************************************************** + * + * dds/topic/detail/Topic<> DELEGATE declaration. + * Implementation can be found in dds/topic/detail/TTopicImpl.hpp + * + ***************************************************************************/ +template +class dds::topic::detail::Topic : public org::eclipse::cyclonedds::topic::AnyTopicDelegate +{ +public: + typedef typename ::dds::core::smart_ptr_traits< Topic >::ref_type ref_type; + typedef typename ::dds::core::smart_ptr_traits< Topic >::weak_ref_type weak_ref_type; + + Topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener, + const dds::core::status::StatusMask& mask); + + Topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds_entity_t ddsc_topic); + + virtual ~Topic(); + + virtual void close(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + dds::topic::Topic wrapper(); + + +public: + + void listener(dds::topic::TopicListener* listener, + const ::dds::core::status::StatusMask& mask); + + dds::topic::TopicListener* listener(); + + virtual void listener_notify(ObjectDelegate::ref_type source, + uint32_t triggerMask, + void *eventData, + void *listener); + + dds::topic::TTopicDescription clone(); + + static dds::topic::Topic + discover_topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const dds::core::Duration& timeout); + + static void + discover_topics(const dds::domain::DomainParticipant& dp, + std::vector >& topics, + uint32_t max_size); + + //using ::org::eclipse::cyclonedds::topic::AnyTopicDelegate::on_inconsistent_topic; + + void on_inconsistent_topic( + dds_entity_t topic, + org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate &s ) ; // !!! + +private: + T sample_; +}; + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicDescription.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicDescription.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5eb75dc2e01483e634607de67b2de09261e53fe9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicDescription.hpp @@ -0,0 +1,30 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_TOPICDESCRIPTION_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_TOPICDESCRIPTION_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include + +namespace dds { namespace topic { namespace detail { + typedef dds::topic::TTopicDescription TopicDescription; +} } } + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_TOPICDESCRIPTION_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicInstanceImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicInstanceImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7bb165d07757cea3939de0961f87a6744dde977c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicInstanceImpl.hpp @@ -0,0 +1,83 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TOPICINSTANCE_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TOPICINSTANCE_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ + +template +TopicInstance::TopicInstance() : h_(dds::core::null) {} + +template +TopicInstance::TopicInstance(const ::dds::core::InstanceHandle& h) + : h_(h), sample_() {} + +template +TopicInstance::TopicInstance(const ::dds::core::InstanceHandle& h, const T& sample) + : h_(h), sample_(sample) { } + +template +TopicInstance::operator const ::dds::core::InstanceHandle() const +{ + return h_; +} + +template +const ::dds::core::InstanceHandle TopicInstance::handle() const +{ + return h_; +} + +template +void TopicInstance::handle(const ::dds::core::InstanceHandle& h) +{ + h_ = h; +} + +template +const T& TopicInstance::sample() const +{ + return sample_; +} + +template +T& TopicInstance::sample() +{ + return sample_; +} + +template +void TopicInstance::sample(const T& sample) +{ + sample_ = sample; +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TOPICINSTANCE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ddstopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ddstopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..774ace974af063dd237b263c84a08add80969f12 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ddstopic.hpp @@ -0,0 +1,20 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_TOPIC_PACKAGE_DETAIL_INCLUDE_HPP_ +#define OMG_DDS_TOPIC_PACKAGE_DETAIL_INCLUDE_HPP_ + +#include "dds/topic/detail/TTopicDescriptionImpl.hpp" +#include "dds/topic/detail/TTopicImpl.hpp" +#include "dds/topic/detail/TopicInstanceImpl.hpp" +#include "dds/topic/detail/TContentFilteredTopicImpl.hpp" + +#endif /* OMG_DDS_TOPIC_PACKAGE_DETAIL_INCLUDE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/discovery.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/discovery.hpp new file mode 100644 index 0000000000000000000000000000000000000000..725d69280632b9c3a3e8bab3ec2d60c3ec7de056 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/discovery.hpp @@ -0,0 +1,100 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_DISCOVER_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_DISCOVER_HPP_ + +#include +#include +#include + +#include + + +namespace dds +{ +namespace topic +{ + +template +TOPIC +discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) +{ + TOPIC t = org::eclipse::cyclonedds::topic::lookup_topic::discover(dp, topic_name, timeout); + + return t; +} + + +template +uint32_t +discover( + const dds::domain::DomainParticipant& dp, + FwdIterator begin, + uint32_t max_size) +{ + std::vector list; + + org::eclipse::cyclonedds::topic::lookup_topic::discover(dp, list, max_size); + + FwdIterator fit = begin; + for (typename std::vector::const_iterator it = list.begin(); it != list.end(); ++it) { + *fit++ = *it; + } + + return static_cast(list.size()); +} + +template +uint32_t +discover_all( + const dds::domain::DomainParticipant& dp, + BinIterator begin) +{ + std::vector list; + + org::eclipse::cyclonedds::topic::lookup_topic::discover(dp, list, static_cast(dds::core::LENGTH_UNLIMITED)); + + BinIterator bit = begin; + for (typename std::vector::const_iterator it = list.begin(); it != list.end(); ++it) { + *bit++ = *it; + } + + return list.size(); +} + + +template +void +ignore( + const dds::domain::DomainParticipant& dp, + FwdIterator begin, FwdIterator end) +{ + (void)dp; + (void)begin; + (void)end; + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported"); +} + +} +} + + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_DISCOVER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/find.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/find.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d6a09d175f91ec39f7ca472bf68e1d5008a6598a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/find.hpp @@ -0,0 +1,46 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_FIND_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_FIND_HPP_ + + +#include + + +#include + + +namespace dds +{ +namespace topic +{ + +template +TOPIC +find(const dds::domain::DomainParticipant& dp, const std::string& topic_name) +{ + TOPIC t = org::eclipse::cyclonedds::topic::finder::find(dp, topic_name); + + return t; +} + + +} +} + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_FIND_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/discovery.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/discovery.hpp new file mode 100644 index 0000000000000000000000000000000000000000..42d38c5c1d6acb674a3ea426149aa3adcd430a01 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/discovery.hpp @@ -0,0 +1,153 @@ +#ifndef OMG_DDS_TOPIC_DISCOVER_HPP_ +#define OMG_DDS_TOPIC_DISCOVER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +namespace dds +{ +namespace topic +{ + +/** + * This operation gives access to an specific existing (or ready to exist) enabled + * Topic, ContentFilteredTopic, MultiTopic, AnyTopic or TopicDescription based + * on its topic_name. + * + * Topics that the application has indicated should be 'ignored' (by means of the + * dds::topic::ignore operation) will not appear in this list (note: the ignore + * feature is not yet supported). + * + * If a Topic of the same topic_name already exists, it gives access to this Topic. + * Otherwise it waits (blocks the caller) until another mechanism creates it. This other + * mechanism can be another thread, a configuration tool, or some other Data + * Distribution Service utility. If after the specified timeout the Topic can still not be + * found, the caller gets unblocked and the returned Topic will be dds::core::null. + * + * A Topic that is obtained by means of find_topic in a specific + * DomainParticipant can only be used to create DataReaders and + * DataWriters in that DomainParticipant. + * + * This operation usually results in network look-ups. + * + * For finding only locally created Topics, look + * @link find(const dds::domain::DomainParticipant& dp, const std::string& topic_name) + * here.@endlink + * + * @param dp the DomainParticipant + * @param name the topic name to discover + * @param timeout the time out + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The DomainParticipant was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The DomainParticipant has already been closed. + * @throws dds::core::NotEnabledError + * The DomainParticipant has not yet been enabled. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::TimeoutError + * No Topics of the given name found within the timeout. + */ +template +TOPIC discover(const dds::domain::DomainParticipant& dp, + const std::string& name, + const dds::core::Duration& timeout = dds::core::Duration::infinite()); + +/** + * This operation retrieves a list of Topics that have been discovered in the domain. + * + * If the max_size of the given list is large enough, all discovered Topics will be + * present in that list. Otherwise, a random sub-set of max_size elements is returned. + * + * Topics that the application has indicated should be 'ignored' (by means of the + * dds::topic::ignore operation) will not appear in this list (note: the ignore + * feature is not yet supported). + * + * Because Topics of various different kinds can be retrieved, the list contains + * AnyTopics. + * + * This operation usually results in network look-ups. + * + * @param dp the DomainParticipant + * @param begin a forward iterator pointing to the beginning of a container + * in which to insert the topics + * @param max_size the maximum number of topics to return + */ +template +uint32_t discover(const dds::domain::DomainParticipant& dp, FwdIterator begin, uint32_t max_size); + +/** + * This operation retrieves a list of all Topics that have been discovered in the domain. + * + * Topics that the application has indicated should be 'ignored' (by means of the + * dds::topic::ignore operation) will not appear in this list (note: the ignore + * feature is not yet supported). + * + * Because Topics of various different kinds can be retrieved, the list contains + * AnyTopics. + * + * This operation usually results in network look-ups. + * + * @param dp the DomainParticipant + * @param begin a back inserting iterator pointing to the beginning of a container + * in which to insert the topics + */ +template +uint32_t discover_all(const dds::domain::DomainParticipant& dp, BinIterator begin); + +/** + * This operation allows an application to instruct the Service to locally ignore + * a remote domain participant. From that point onwards the Service will locally + * behave as if the remote participant did not exist. This means it will ignore any + * Topic, publication, or subscription that originates on that domain participant. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant + * @param handle the handle of the DomainParticipant to ignore + */ +void OMG_DDS_API ignore(const dds::domain::DomainParticipant& dp, const dds::core::InstanceHandle& handle); + +/** + * This operation allows an application to instruct the Service to locally ignore + * a remote domain participant. From that point onwards the Service will locally + * behave as if the remote participant did not exist. This means it will ignore any + * Topic, publication, or subscription that originates on that domain participant. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant + * @param begin a forward iterator pointing to the beginning of a sequence of + * InstanceHandles to ignore + * @param end a forward iterator pointing to the end of a sequence of + * InstanceHandles to ignore + */ +template +void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end); + +} +} + +#include + +#endif /* OMG_DDS_TOPIC_DISCOVER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/find.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/find.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dc871efb6e07360fdaa327bf19cd37efb897a18b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/find.hpp @@ -0,0 +1,53 @@ +#ifndef OMG_DDS_TOPIC_FIND_HPP_ +#define OMG_DDS_TOPIC_FIND_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include + +namespace dds +{ +namespace topic +{ + +/** + * This operation gives access to a locally-created Topic, ContentFilteredTopic, + * MultiTopic, AnyTopic and TopicDescription with a matching name. + * + * dds::topic::find will never create a Topic but returns a reference to an + * Topic proxy that already exists locally. When no local proxy exists, the + * returned Topic will be a dds::core::null object. The operation never blocks. + * + * For discovering globally available Topics, look + * @link dds::topic::discover(const dds::domain::DomainParticipant&, const std::string&, const dds::core::Duration&) + * here.@endlink + * + * @param dp the DomainParticipant to find the topic on + * @param topic_name the topic name to find + */ +template +TOPIC +find(const dds::domain::DomainParticipant& dp, const std::string& topic_name); + +} +} + +#endif /* OMG_DDS_TOPIC_FIND_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/TopicQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/TopicQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bfd0a7b3fe6bd0bccbb0eae009c86e9d32f2642a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/TopicQos.hpp @@ -0,0 +1,36 @@ +#ifndef OMG_DDS_TOPIC_QOS_TOPIC_QOS_HPP_ +#define OMG_DDS_TOPIC_QOS_TOPIC_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +namespace dds +{ +namespace topic +{ +namespace qos +{ +typedef dds::topic::qos::detail::TopicQos TopicQos; +} +} +} + + +#endif /* OMG_DDS_TOPIC_QOS_TOPIC_QOS_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/detail/TopicQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/detail/TopicQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4e08b77e9825543128b7f281bbb30bc4adc38c97 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/detail/TopicQos.hpp @@ -0,0 +1,93 @@ +#ifndef OMG_DDS_TOPIC_QOS_DETAIL_TOPIC_QOS_HPP_ +#define OMG_DDS_TOPIC_QOS_DETAIL_TOPIC_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#ifdef DOXYGEN_FOR_ISOCPP +/* The above macro is never (and must never) be defined in normal compilation. + * + * The class below is just used to create informative API documentation. + * The predoxygen.py script will copy this over the QoS API header file. + */ +/** + * @brief + * This struct provides the basic mechanism for an application to specify Quality of + * Service attributes for a Topic. + * + * @par Attributes + * @anchor anchor_dds_topic_qos_defaults + * QosPolicy | Desciption | Default Value + * ------------------------------------ | -------------------------------------------------------------------------- | -------------------- + * dds::core::policy::TopicData | Additional information (@ref DCPS_QoS_TopicData "info") | TopicData::TopicData(empty) + * dds::core::policy::Durability | Data storage settings for late joiners (@ref DCPS_QoS_Durability "info") | Durability::Volatile() + * dds::core::policy::DurabilityService | Transient/persistent behaviour (@ref DCPS_QoS_DurabilityService "info") | DurabilityService::DurabilityService() + * dds::core::policy::Deadline | Period in which new sample is written (@ref DCPS_QoS_Deadline "info") | Deadline::Deadline(infinite) + * dds::core::policy::LatencyBudget | Used for optimization (@ref DCPS_QoS_LatencyBudget "info") | LatencyBudget::LatencyBudget(zero) + * dds::core::policy::Liveliness | Liveliness assertion mechanism (@ref DCPS_QoS_Liveliness "info") | Liveliness::Automatic() + * dds::core::policy::Reliability | Reliability settings (@ref DCPS_QoS_Reliability "info") | Reliability::Reliable() + * dds::core::policy::DestinationOrder | DataReader data order settings (@ref DCPS_QoS_DestinationOrder "info") | DestinationOrder::ReceptionTimestamp() + * dds::core::policy::History | Data storage settings (@ref DCPS_QoS_History "info") | History::KeepLast(depth 1) + * dds::core::policy::ResourceLimits | Maximum resource settings (@ref DCPS_QoS_ResourceLimits "info") | ResourceLimits::ResourceLimits(all unlimited) + * dds::core::policy::TransportPriority | Priority hint for transport layer (@ref DCPS_QoS_TransportPriority "info") | TransportPriority::TTransportPriority(0) + * dds::core::policy::Lifespan | Maximum duration of validity of data (@ref DCPS_QoS_Lifespan "info") | Lifespan::Lifespan(infinite) + * dds::core::policy::Ownership | Exclusive ownership or not (@ref DCPS_QoS_Ownership "info") | Ownership::Shared() + * dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1) + * dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION + * + * A QosPolicy can be set when the Topic is created or modified with the set + * qos operation. + * Both operations take the TopicQos object as a parameter. There may be cases + * where several policies are in conflict. Consistency checking is performed each time + * the policies are modified when they are being created and, in case they are already + * enabled, via the set qos operation. + * + * Some QosPolicy have "immutable" semantics meaning that they can only be + * specified either at Topic creation time or prior to calling the enable + * operation on the Topic. + * + * @see for more information: @ref DCPS_QoS + */ +class dds::topic::qos::TopicQos : public ::dds::core::EntityQos +{ +public: + /** + * Create @ref anchor_dds_topic_qos_defaults "default" QoS. + */ + TopicQos() {} + + /** + * Create copied QoS type. + * + * @param qos the QoS to copy policies from. + */ + TopicQos(const TopicQos& qos); +}; + +#else /* DOXYGEN_FOR_ISOCPP */ + +namespace dds { namespace topic { namespace qos { namespace detail { + typedef ::dds::core::TEntityQos< ::org::eclipse::cyclonedds::topic::qos::TopicQosDelegate > TopicQos; +} } } } + +#endif /* DOXYGEN_FOR_ISOCPP */ + +#endif /* OMG_DDS_TOPIC_QOS_DETAIL_TOPIC_QOS_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/ForwardDeclarations.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/ForwardDeclarations.hpp new file mode 100644 index 0000000000000000000000000000000000000000..209ad5c5b005c5625f3c42beb869d17adf2945b6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/ForwardDeclarations.hpp @@ -0,0 +1,120 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef LITE_FORWARD_DECLARATIONS_HPP_ +#define LITE_FORWARD_DECLARATIONS_HPP_ + +namespace dds +{ + namespace domain + { + class DomainParticipantListener; + + template + class TDomainParticipant; + } + + namespace sub + { + template class DELEGATE> + class DataReader; + + template + class DataReaderListener; + + class SubscriberListener; + + template + class TSubscriber; + + namespace detail + { + template + class DataReader; + + template + class LoanedSamplesHolder; + + template + class SamplesFWInteratorHolder; + + template + class SamplesBIIteratorHolder; + } + } + + namespace pub + { + class PublisherListener; + + template + class TPublisher; + } + + namespace topic + { + template + class TTopicDescription; + + template + class TopicListener; + + template class DELEGATE> + class Topic; + + template class DELEGATE> + class ContentFilteredTopic; + + namespace detail + { + template + class ContentFilteredTopic; + } + } +} + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ + + namespace domain { + class DomainParticipantDelegate; + } + + namespace sub { + class SubscriberDelegate; + } + + namespace pub { + class PublisherDelegate; + } + + namespace topic { + template + class TopicTraits; + + class TopicDescriptionDelegate; + } +} +} +} + +#endif /* LITE_FORWARD_DECLARATIONS_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/DDScObjectDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/DDScObjectDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a8214cdb4c385a8d286e3aca9ea60a83aca4f8d1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/DDScObjectDelegate.hpp @@ -0,0 +1,74 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_USEROBJECT_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_USEROBJECT_DELEGATE_HPP_ + +#include "dds/core/macros.hpp" +#include "dds/core/refmacros.hpp" +#include "org/eclipse/cyclonedds/core/Mutex.hpp" +#include "org/eclipse/cyclonedds/core/ObjectDelegate.hpp" + +#include + +#include "dds/dds.h" + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + +class OMG_DDS_API DDScObjectDelegate : public virtual org::eclipse::cyclonedds::core::ObjectDelegate +{ +public: + + typedef std::unordered_map entity_map_type; + + DDScObjectDelegate (); + virtual ~DDScObjectDelegate (); + + void close (); + dds_entity_t get_ddsc_entity (); + void set_ddsc_entity (dds_entity_t e); + void add_to_entity_map (org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type weak_ref); + +public: + static ObjectDelegate::ref_type extract_strong_ref(dds_entity_t e); + +protected: + dds_entity_t ddsc_entity; + +private: + void delete_from_entity_map(); + static org::eclipse::cyclonedds::core::DDScObjectDelegate::entity_map_type entity_map; + static Mutex entity_map_mutex; +}; + +DDSCXX_WARNING_MSVC_ON(4251) + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_USEROBJECT_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c883ff94831b12f9c73fdc398fdf56b951ddf6dc --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityDelegate.hpp @@ -0,0 +1,140 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_ENTITY_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_ENTITY_DELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class OMG_DDS_API EntityDelegate : + public virtual ::org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< EntityDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< EntityDelegate >::weak_ref_type weak_ref_type; + + EntityDelegate(); + virtual ~EntityDelegate(); + + /** + * @internal Enables this entity. + */ + void enable(); + + ::dds::core::status::StatusMask status_changes() const; + + ::dds::core::InstanceHandle instance_handle() const; + + bool contains_entity(const ::dds::core::InstanceHandle& handle); + + ObjectDelegate::ref_type get_statusCondition(); + + virtual void close(); + + virtual void retain(); + + void *listener_get() const; + +protected: + void listener_set(void *listener, + const dds::core::status::StatusMask& mask); + +public: + const dds::core::status::StatusMask get_listener_mask() const ; + + bool obtain_callback_lock() ; + void release_callback_lock() ; + + // Topic callback + virtual void on_inconsistent_topic(dds_entity_t topic, + org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate &) ; + + + // Writer callbacks + virtual void on_offered_deadline_missed(dds_entity_t writer, + org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate &) ; + + virtual void on_offered_incompatible_qos(dds_entity_t writer, + org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate &) ; + + virtual void on_liveliness_lost(dds_entity_t writer, + org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate &) ; + + virtual void on_publication_matched(dds_entity_t writer, + org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate &) ; + + + // Reader callbacks + virtual void on_requested_deadline_missed(dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate &); + + virtual void on_requested_incompatible_qos(dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate &); + + virtual void on_sample_rejected(dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate &); + + virtual void on_liveliness_changed(dds_entity_t reader, + org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate &); + + virtual void on_data_available(dds_entity_t reader); + + virtual void on_subscription_matched(dds_entity_t reader, + org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate &); + + virtual void on_sample_lost(dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleLostStatusDelegate &); + + + // Subscriber callback + virtual void on_data_readers(dds_entity_t subscriber); + +protected: + static volatile unsigned int entityID_; + bool enabled_; + dds::core::status::StatusMask listener_mask; + void prevent_callbacks(); + long callback_count; + dds_listener_t *listener_callbacks; + +private: + void *listener; + ObjectDelegate::weak_ref_type myStatusCondition; + void *callback_mutex; + void *callback_cond; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_ENTITY_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityRegistry.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityRegistry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f9bbc5eb9d3e9b40f35a4bc1b8232e1431d02853 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityRegistry.hpp @@ -0,0 +1,95 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_ENTITY_REGISTRY_HPP_ +#define CYCLONEDDS_CORE_ENTITY_REGISTRY_HPP_ + +#include +#include + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +template +class EntityRegistry +{ +public: + /** + * @internal Inserts a EntityDelegate key, dds::core::Entity value pair into the registry. + * @param key The org::eclipse::cyclonedds::core::Entity to use as a key + * @param val The dds::core::Entity that encapsulates the key + */ + void insert(T key, U& val) + { + mutex.lock(); + registry[key] = dds::core::WeakReference(val); + mutex.unlock(); + } + + /** + * @internal Removes a DDS::Entity from the registry + * @param key Entity to remove + */ + void remove(T key) + { + mutex.lock(); + registry.erase(key); + mutex.unlock(); + } + + /** + * @internal Checks the registry for a dds::core::Entity that wraps the supplied DDS::Entity + * and returns it. If no match is found dds::core::null is returned. + * @param key DDS::Entity to find an encapsulating dds::core:Entity for. + * @return dds::core::Entity if a match is found, dds::core::null if not. + */ + U get(T key) + { + typename std::map >::iterator it; + + mutex.lock(); + it = registry.find(key); + + U entity(dds::core::null); + if(it != registry.end()) + { + entity = it->second.lock(); + } + mutex.unlock(); + + return entity; + } + +private: + std::map > registry; + org::eclipse::cyclonedds::core::Mutex mutex; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_ENTITY_REGISTRY_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntitySet.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntitySet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d545941dce313d1189893c8b866006444bcb1fb7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntitySet.hpp @@ -0,0 +1,94 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_ENTITY_SET_HPP_ +#define CYCLONEDDS_CORE_ENTITY_SET_HPP_ + +#include + +#include +#include +#include + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class EntitySet +{ +public: + typedef std::vector::iterator vectorIterator; + typedef std::vector vector; + + /** + * @internal Inserts a EntityDelegate into the set. + * @param entity The org::eclipse::cyclonedds::core::EntityDelegate to store + */ + void insert(org::eclipse::cyclonedds::core::EntityDelegate& entity); + + /** + * @internal Erases a EntityDelegate from the set. + * @param entity The org::eclipse::cyclonedds::core::EntityDelegate to delete + */ + void erase(org::eclipse::cyclonedds::core::EntityDelegate& entity); + + /** + * @internal Check if Entity with specific handle is part of the set. + * @param handle The dds::core::InstanceHandle to search for + */ + bool contains(const dds::core::InstanceHandle& handle); + + /** + * @internal Call close() of all the Entities within the set (outside lock). + */ + void all_close(); + + /** + * @internal Call retain() of all the Entities within the set (outside lock). + */ + void all_retain(); + + /** + * @internal Call enable() of all the Entities within the set (outside lock). + */ + void all_enable(); + + /** + * @internal Copy internal set into a vector. + */ + vector copy(); + +private: + WeakReferenceSet::wset entities; + Mutex mutex; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_ENTITY_SET_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/InstanceHandleDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/InstanceHandleDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3516c28249886027a24beb7587f63fe907d90d70 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/InstanceHandleDelegate.hpp @@ -0,0 +1,71 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_INSTANCE_HANDLE_HPP_ +#define CYCLONEDDS_CORE_INSTANCE_HANDLE_HPP_ + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +class InstanceHandleDelegate; +} +} +} +} + +class OMG_DDS_API org::eclipse::cyclonedds::core::InstanceHandleDelegate +{ +public: + InstanceHandleDelegate(); + InstanceHandleDelegate(dds_instance_handle_t h); +public: + InstanceHandleDelegate(const dds::core::null_type& src); + +public: + bool operator==(const InstanceHandleDelegate& that) const; + + bool operator<(const InstanceHandleDelegate& that) const; + + bool operator>(const InstanceHandleDelegate& that) const; + + InstanceHandleDelegate& operator=(const dds::core::null_type& src); + bool is_nil() const; + +public: + dds_instance_handle_t handle() const; + +private: + dds_instance_handle_t handle_; +}; + +inline std::ostream& +operator << (std::ostream& os, + const org::eclipse::cyclonedds::core::InstanceHandleDelegate& h) +{ + os << h.handle(); + return os; +} +#endif /* CYCLONEDDS_CORE_INSTANCE_HANDLE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ListenerDispatcher.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ListenerDispatcher.hpp new file mode 100644 index 0000000000000000000000000000000000000000..12f012767b4893180f6662f5550e80c8f86c53d2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ListenerDispatcher.hpp @@ -0,0 +1,57 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_CORE_LISTENERDISPATCHER_H_ +#define CYCLONEDDS_CORE_LISTENERDISPATCHER_H_ + +#include "dds/dds.h" + +extern "C" +{ + extern OMG_DDS_API void callback_on_inconsistent_topic + (dds_entity_t topic, dds_inconsistent_topic_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_offered_deadline_missed + (dds_entity_t writer, dds_offered_deadline_missed_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_offered_incompatible_qos + (dds_entity_t writer, dds_offered_incompatible_qos_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_liveliness_lost + (dds_entity_t writer, dds_liveliness_lost_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_publication_matched + (dds_entity_t writer, dds_publication_matched_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_requested_deadline_missed + (dds_entity_t reader, dds_requested_deadline_missed_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_requested_incompatible_qos + (dds_entity_t reader, dds_requested_incompatible_qos_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_sample_rejected + (dds_entity_t reader, dds_sample_rejected_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_liveliness_changed + (dds_entity_t reader, dds_liveliness_changed_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_data_available (dds_entity_t reader, void* arg); + + extern OMG_DDS_API void callback_on_subscription_matched + (dds_entity_t reader, dds_subscription_matched_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_sample_lost + (dds_entity_t reader, dds_sample_lost_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_data_readers (dds_entity_t subscriber, void* arg); +} + +#endif /* CYCLONEDDS_CORE_LISTENERDISPATCHER_H_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/MiscUtils.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/MiscUtils.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c458dfeb0650bf0520f3c8c375a4e94fabb1e841 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/MiscUtils.hpp @@ -0,0 +1,90 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_MISC_UTILS_HPP_ +#define CYCLONEDDS_CORE_MISC_UTILS_HPP_ + +#include +#include +#include "dds/dds.h" + +#define STATUS_MASK_CONTAINS(mask,check) ((mask & check) == check) + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +void +convertByteSeq( + const dds::core::ByteSeq &from, + void*& to, + int32_t size); + +void +convertByteSeq( + const void* from, + const int32_t size, + dds::core::ByteSeq &to); + +void +convertStringSeq( + const dds::core::StringSeq &from, + char **&to); + +void +convertStringSeq( + char **from, + uint32_t size, + dds::core::StringSeq &to); + +dds::core::Duration +convertDuration( + const dds_duration_t &from); + +dds_duration_t +convertDuration( + const dds::core::Duration &from); + +dds::core::Time +convertTime( + const dds_time_t &from); + +dds_time_t +convertTime( + const dds::core::Time &from); + +dds::core::status::StatusMask +convertStatusMask( + const uint32_t from); + +uint32_t +convertStatusMask( + const dds::core::status::StatusMask &from); + +static Mutex gpb_mutex; + +} +} +} +} + +#endif //CYCLONEDDS_CORE_MISC_UTILS_HPP_ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp new file mode 100644 index 0000000000000000000000000000000000000000..17e05d25b4d9109e31883645e552a507ecdf19a3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp @@ -0,0 +1,36 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + + /** + * @file + */ + +#ifndef CYCLONEDDS_CORE_MISSING_HPP_ +#define CYCLONEDDS_CORE_MISSING_HPP_ + +//since these helpers are only introduced from c++14 onwards + +#if __cplusplus < 201402L +namespace std { + template< bool B, class T, class F > + using conditional_t = typename std::conditional::type; + + template + using enable_if_t = typename std::enable_if::type; + + template + using decay_t = typename std::decay::type; +} +#endif /* _cplusplus */ + +#endif /* CYCLONEDDS_CORE_MISSING_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Mutex.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Mutex.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a274d7bcbf848f88ef7b749dbee6da75563dda18 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Mutex.hpp @@ -0,0 +1,51 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_MUTEX_HPP_ +#define CYCLONEDDS_CORE_MUTEX_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class OMG_DDS_API Mutex +{ +public: + Mutex(); + virtual ~Mutex(); + + void lock() const; + bool try_lock() const; + void unlock() const; +private: + void* mtx; +}; + +} +} +} +} + + +#endif /* CYCLONEDDS_CORE_MUTEX_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..efb32b7afdd9528f8e66b18180890ed877c5b471 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectDelegate.hpp @@ -0,0 +1,71 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_OBJECT_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_OBJECT_DELEGATE_HPP_ + +#include "dds/core/macros.hpp" +#include "dds/core/refmacros.hpp" +#include "org/eclipse/cyclonedds/core/Mutex.hpp" + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + +class OMG_DDS_API ObjectDelegate +{ +public: + + typedef ::dds::core::smart_ptr_traits< ObjectDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< ObjectDelegate >::weak_ref_type weak_ref_type; + + ObjectDelegate (); + virtual ~ObjectDelegate (); + + virtual void close (); + void lock() const; + void unlock() const; + + virtual void init (ObjectDelegate::weak_ref_type weak_ref) = 0; + ObjectDelegate::weak_ref_type get_weak_ref () const; + ObjectDelegate::ref_type get_strong_ref () const; + +protected: + + void check () const; + void set_weak_ref (ObjectDelegate::weak_ref_type weak_ref); + + Mutex mutex; + bool closed; + ObjectDelegate::weak_ref_type myself; +}; + +DDSCXX_WARNING_MSVC_ON(4251) + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_OBJECT_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectSet.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectSet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..47377f53a464e8091874ecee3fa8023c15c0ab6c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectSet.hpp @@ -0,0 +1,80 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_OBJECT_SET_HPP_ +#define CYCLONEDDS_CORE_OBJECT_SET_HPP_ + +#include + +#include +#include +#include + +#include +#include +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class ObjectSet +{ +public: + typedef std::set::iterator setIterator; + typedef std::vector::iterator vectorIterator; + typedef std::vector vector; + + /** + * @internal Inserts a EntityDelegate into the set. + * @param obj The org::eclipse::cyclonedds::core::ObjectDelegate to store + */ + void insert(org::eclipse::cyclonedds::core::ObjectDelegate& obj); + + /** + * @internal Erases a EntityDelegate from the set. + * @param obj The org::eclipse::cyclonedds::core::ObjectDelegate to delete + */ + void erase(org::eclipse::cyclonedds::core::ObjectDelegate& obj); + + /** + * @internal Call close() of all the Objects within the set (outside lock). + */ + void all_close(); + + /** + * @internal Copy internal set into a vector. + */ + vector copy(); + +private: + WeakReferenceSet::wset objects; + Mutex mutex; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_OBJECT_SET_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/QosProviderDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/QosProviderDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cef4cfe0b78a6850c205651af8f510025317a0b7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/QosProviderDelegate.hpp @@ -0,0 +1,81 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_QOSPROVIDERDELEGATE_HPP_ +#define CYCLONEDDS_CORE_QOSPROVIDERDELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include + +#if 0 +C_CLASS(cmn_qosProvider); +C_CLASS(cmn_qosProviderInputAttr); +#endif + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +class QosProviderDelegate; +} +} +} +} + +class OMG_DDS_API org::eclipse::cyclonedds::core::QosProviderDelegate +{ +public: + QosProviderDelegate(const std::string& uri, const std::string& id = ""); + + ~QosProviderDelegate(); + + dds::domain::qos::DomainParticipantQos + participant_qos(const char* id); + + dds::topic::qos::TopicQos + topic_qos(const char* id); + + dds::sub::qos::SubscriberQos + subscriber_qos(const char* id); + + dds::sub::qos::DataReaderQos + datareader_qos(const char* id); + + dds::pub::qos::PublisherQos + publisher_qos(const char* id); + + dds::pub::qos::DataWriterQos + datawriter_qos(const char* id); + +private: + template + static void named_qos__copyOut(void *from, void *to); +#if 0 + cmn_qosProvider qosProvider; + static const C_STRUCT(cmn_qosProviderInputAttr) qosProviderAttr; +#endif +}; + +#endif /* CYCLONEDDS_CORE_QOSPROVIDERDELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ReportUtils.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ReportUtils.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7f0a37a3428974792e38b6cea0ea3979ed5f62a2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ReportUtils.hpp @@ -0,0 +1,191 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_REPORT_UTILS_HPP_ +#define CYCLONEDDS_CORE_REPORT_UTILS_HPP_ + +#include +#include +#include +#include +#include +#include +#include + +//#define _OS_WARNING 2 +//#define _OS_ERROR 4 + +#define ISOCPP_ERROR org::eclipse::cyclonedds::core::utils::error_code +#define ISOCPP_UNSUPPORTED_ERROR org::eclipse::cyclonedds::core::utils::unsupported_error_code +#define ISOCPP_INVALID_ARGUMENT_ERROR org::eclipse::cyclonedds::core::utils::invalid_argument_code +#define ISOCPP_PRECONDITION_NOT_MET_ERROR org::eclipse::cyclonedds::core::utils::precondition_not_met_error_code +#define ISOCPP_OUT_OF_RESOURCES_ERROR org::eclipse::cyclonedds::core::utils::out_of_resources_error_code +#define ISOCPP_NOT_ENABLED_ERROR org::eclipse::cyclonedds::core::utils::not_enabled_error_code +#define ISOCPP_IMMUTABLE_POLICY_ERROR org::eclipse::cyclonedds::core::utils::immutable_policy_error_code +#define ISOCPP_INCONSISTENT_POLICY_ERROR org::eclipse::cyclonedds::core::utils::inconsistent_policy_error_code +#define ISOCPP_ALREADY_CLOSED_ERROR org::eclipse::cyclonedds::core::utils::already_closed_error_code +#define ISOCPP_TIMEOUT_ERROR org::eclipse::cyclonedds::core::utils::timeout_error_code +#define ISOCPP_NO_DATA_ERROR org::eclipse::cyclonedds::core::utils::no_data_error_code +#define ISOCPP_ILLEGAL_OPERATION_ERROR org::eclipse::cyclonedds::core::utils::illegal_operation_error_code +#define ISOCPP_NULL_REFERENCE_ERROR org::eclipse::cyclonedds::core::utils::null_reference_error_code + +/* \brief OS_FUNCTION provides undecorated function name of current function + * + * Behavior of OS_FUNCTION outside a function is undefined. Note that + * implementations differ across compilers and compiler versions. It might be + * implemented as either a string literal or a constant variable. + */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) +# define OS_FUNCTION __func__ +#elif defined(__cplusplus) && (__cplusplus >= 201103) +# define OS_FUNCTION __func__ +#elif defined(__GNUC__) +# define OS_FUNCTION __FUNCTION__ +#elif defined(__clang__) +# define OS_FUNCTION __FUNCTION__ +#elif defined(__ghs__) +# define OS_FUNCTION __FUNCTION__ +#elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC)) +/* Solaris Studio had support for __func__ before it supported __FUNCTION__. + Compiler flag -features=extensions is required on older versions. */ +# define OS_FUNCTION __func__ +#elif defined(__FUNCTION__) +/* Visual Studio */ +# define OS_FUNCTION __FUNCTION__ +#elif defined(__vxworks) +/* At least versions 2.9.6 and 3.3.4 of the GNU C Preprocessor only define + __GNUC__ if the entire GNU C compiler is in use. VxWorks 5.5 targets invoke + the preprocessor separately resulting in __GNUC__ not being defined. */ +# define OS_FUNCTION __FUNCTION__ +#else +# warning "OS_FUNCTION is not supported" +#endif + +/* \brief OS_PRETTY_FUNCTION provides function signature of current function + * + * See comments on OS_FUNCTION for details. + */ +#if defined(__GNUC__) +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__clang__) +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__ghs__) +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif (defined(__SUNPRO_C) && __SUNPRO_C >= 0x5100) +/* Solaris Studio supports __PRETTY_FUNCTION__ in C since version 12.1 */ +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5120) +/* Solaris Studio supports __PRETTY_FUNCTION__ in C++ since version 12.3 */ +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__FUNCSIG__) +/* Visual Studio */ +# define OS_PRETTY_FUNCTION __FUNCSIG__ +#elif defined(__vxworks) +/* See comments on __vxworks macro above. */ +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#else +/* Do not warn user about OS_PRETTY_FUNCTION falling back to OS_FUNCTION. +# warning "OS_PRETTY_FUNCTION is not supported, using OS_FUNCTION" +*/ +# define OS_PRETTY_FUNCTION OS_FUNCTION +#endif + +#define ISOCPP_DDSC_RESULT_CHECK_AND_THROW(code, ...) \ + org::eclipse::cyclonedds::core::utils::check_ddsc_result_and_throw_exception( \ + static_cast(code), \ + __FILE__, \ + __LINE__, \ + OS_PRETTY_FUNCTION, \ + __VA_ARGS__) \ + +#define ISOCPP_THROW_EXCEPTION(code, ...) \ + org::eclipse::cyclonedds::core::utils::throw_exception( \ + (code), \ + __FILE__, \ + __LINE__, \ + OS_PRETTY_FUNCTION, \ + __VA_ARGS__) \ + +#define ISOCPP_BOOL_CHECK_AND_THROW(test, code, ...) \ + if (!(test)) { \ + ISOCPP_THROW_EXCEPTION(code, __VA_ARGS__); \ + } + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace utils +{ + +const int32_t error_code = 1; +const int32_t unsupported_error_code = 2; +const int32_t invalid_argument_code = 3; +const int32_t precondition_not_met_error_code = 4; +const int32_t out_of_resources_error_code = 5; +const int32_t not_enabled_error_code = 6; +const int32_t immutable_policy_error_code = 7; +const int32_t inconsistent_policy_error_code = 8; +const int32_t already_closed_error_code = 9; +const int32_t timeout_error_code = 10; +const int32_t no_data_error_code = 11; +const int32_t illegal_operation_error_code = 12; +const int32_t null_reference_error_code = 13; + + + +OMG_DDS_API void +report( + int32_t code, + int32_t reportType, + const char *file, + int32_t line, + const char *signature, + const char *format, + ...); + +OMG_DDS_API void +throw_exception( + int32_t code, + const char *file, + int32_t line, + const char *signature, + const char *format, + ...); + +OMG_DDS_API void +check_ddsc_result_and_throw_exception( + dds_return_t code, + const char *file, + int32_t line, + const char *signature, + const char *format, + ...); + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_REPORT_UTILS_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ScopedLock.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ScopedLock.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8d7e03ae7f527a9b358a8094a9183293ed378c1f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ScopedLock.hpp @@ -0,0 +1,103 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_SCOPEDLOCK_HPP_ +#define CYCLONEDDS_CORE_SCOPEDLOCK_HPP_ + +#include +#include + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +template +class OMG_DDS_API ScopedLock +{ +public: + ScopedLock(const LOCKABLE& obj, bool lock = true) + : lockable(obj), + owner(lock) + { + if (lock) { + lockable.lock(); + } + } + + virtual ~ScopedLock() + { + if (owner) { + try { + lockable.unlock(); + } catch (...) { + /* Don't know what to do anymore (it should have never failed)... */ + assert(false); + } + } + } + + void lock() + { + assert(!owner); + lockable.lock(); + owner = true; + } + + bool try_lock() + { + bool locked; + locked = lockable.try_lock(); + if (locked) { + owner = true; + } + return locked; + } + + void unlock() + { + assert(owner); + owner = false; + lockable.unlock(); + } + + bool own() const + { + return owner; + } + +private: + const LOCKABLE& lockable; + bool owner; +}; + +typedef ScopedLock ScopedMutexLock; +typedef ScopedLock ScopedObjectLock; + +} +} +} +} + + +#endif /* CYCLONEDDS_CORE_SCOPEDLOCK_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/TimeHelper.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/TimeHelper.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4f72fe5d4210fbed5551419e41d26fba452eeed5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/TimeHelper.hpp @@ -0,0 +1,91 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + * + * Unfortunately, we need this because we can not change the Duration.hpp and Time.hpp + * and we don't want this piece of code repeated in every function within their + * implementation files. + */ + +#ifndef CYCLONEDDS_CORE_TIME_HELPER_HPP_ +#define CYCLONEDDS_CORE_TIME_HELPER_HPP_ + +#include +#include +#include + +#define MS 1000 +#define MiS 1000000 +#define NS 1000000000 + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace timehelper +{ + + +/** +* Check if the TIMEISH value supplied is at all suitable for arithmetic jiggery +* pokery. Invalidity encompasses (but is not restricted to) a -1 seconds part +* an 'infinity' Duration, an 'invalid' Time (or Duration). +* @param t the TIMEISH thing to check +* @return true if the argument is not suitable for doing sums with. +*/ +template +bool is_valid_for_arithmetic(const TIMEISH& t) +{ + return (t.sec() != -1 // Invalid + && t.sec() != 0x7FFFFFFF // Infinity + && t.nanosec() < 1000000000); // Invalid & infinity are > 10^9 +} + +/** +* Check a TIMEISH is valid for doing sums with. +* @param t the TIMEISH thing to check +* @param context Some sort of clue to the receiver about what was +* called or what you were trying to do. Must be a literal or c_str. +* Defaults to "". +* @param function String to be concateneated onto context. +* Must be a literal or c_str. Defaults to "". +* @throws a dds::core::InvalidDataError if not valid. +* @see OSPL_CONTEXT_LITERAL +* @see is_valid_for_arithmetic +*/ +template +void validate(const TIMEISH& t, const char* context = "timehelper", const char* function = "validate") +{ + if(! is_valid_for_arithmetic(t)) + { + std::stringstream message("dds::core::InvalidDataError"); + message << "Value invalid for arithmetic operations" << context << function + << " seconds=" << t.sec() << " (" << std::hex << t.sec() + << ") nanoseconds=" << t.nanosec() << " (" << std::hex << t.nanosec() << ")"; + ISOCPP_THROW_EXCEPTION(ISOCPP_ILLEGAL_OPERATION_ERROR, message.str().c_str()); + } +} + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_TIME_HELPER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/WeakReferenceSet.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/WeakReferenceSet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..59fbc58e0d184e8eafe8a626ac017baba6a0ed68 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/WeakReferenceSet.hpp @@ -0,0 +1,47 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_WEAK_REFERENCE_SET_HPP_ +#define CYCLONEDDS_CORE_WEAK_REFERENCE_SET_HPP_ + +#include + +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +template +struct WeakReferenceSet +{ + typedef typename std::set > wset; + typedef typename std::set >::iterator iterator; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_WEAK_REFERENCE_SET_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2e2dbb4eeb87e5787385b43b352b1917d0078dcd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp @@ -0,0 +1,122 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef BASIC_CDR_SERIALIZATION_HPP_ +#define BASIC_CDR_SERIALIZATION_HPP_ + +#include "cdr_stream.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Implementation of the basic cdr stream. + * + * This type of cdr stream has a maximum alignment of 8 bytes. + */ +class OMG_DDS_API basic_cdr_stream : public cdr_stream { +public: + /** + * @brief + * Constructor. + * + * Basically a pass through for the cdr_stream base class. + * + * @param[in] end The endianness to set for the data stream, default to the local system endianness. + * @param[in] ignore_faults Bitmask for ignoring faults, can be composed of bit fields from the serialization_status enumerator. + */ + basic_cdr_stream(endianness end = native_endianness(), uint64_t ignore_faults = 0x0) : cdr_stream(end, 8, ignore_faults) { ; } + + /** + * @brief + * Start a new struct. + * + * This function is called by the generated streaming functions, and will start a parameter list, if that is relevant for it. + * + * @param[in, out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the operation was completed succesfully. + */ + bool start_struct(entity_properties_t &props); + +}; + +/** + * @brief + * Enumerated type stream manipulation functions. + * Since enumerated types are represented by a uint32_t in basic CDR streams + * they just loop through to writing uint32_t versions of the enum. + * + * These are "endpoints" for write functions, since compound + * (sequence/array/constructed type) functions will decay to these + * calls. + */ + +/** + * @brief + * Reads the value of the enum from the stream. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read into. + * @param[in] N The number of entities to read. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool read(basic_cdr_stream& str, T& toread, size_t N = 1) { + return read_enum_impl(str, toread, N); +} + +/** + * @brief + * Writes the value of the enum to the stream. + * + * @param[in, out] str The stream which is written to. + * @param[in] towrite The variable to write. + * @param[in] N The number of entities to write. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool write(basic_cdr_stream& str, const T& towrite, size_t N = 1) { + return write_enum_impl(str, towrite, N); +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities to move. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool move(basic_cdr_stream& str, const T&, size_t N = 1) { + return move(str, uint32_t(0), N); +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up (maximum size version). + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities at most to move. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool max(basic_cdr_stream& str, const T&, size_t N = 1) { + return max(str, uint32_t(0), N); +} + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp new file mode 100644 index 0000000000000000000000000000000000000000..60686eb96bbbb247479d093c8965ea9d4004bfe1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp @@ -0,0 +1,64 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CDR_ENUMS_HPP_ +#define CDR_ENUMS_HPP_ + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Entity extensibility descriptors. + * + * @enum extensibility Describes the extensibility of entities. + * + * This value is set for entities and their parents. + * + * @var extensibility::ext_final The entity representation is complete, no fields can be added or removed. + * @var extensibility::ext_appendable The entity representation can be extended, no fields can be removed. + * @var extensibility::ext_mutable The entity representation can be modified, fields can be removed or added. + */ +enum class extensibility { + ext_final, + ext_appendable, + ext_mutable +}; + +/** + * @brief + * Encoding version descriptors. + * + * @enum encoding_version Describes the CDR encoding version of entities. + * + * @var encoding_version::basic_cdr Basic CDR encoding, does not support any xtypes functionality. + * @xml encoding_version::xml XML encoding. + * @var encoding_version::xcdr_v1 Version 1 Xtypes CDR encoding (deprecated). + * @var encoding_version::xcdr_v2 Version 2 XTypes CDR encoding. + */ +enum class encoding_version { + basic_cdr, + xml, + xcdr_v1, + xcdr_v2 +}; + +typedef uint32_t allowable_encodings_t; + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2d0da370c113589087b38424f1547a716b3eab74 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp @@ -0,0 +1,935 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CDR_STREAM_HPP_ +#define CDR_STREAM_HPP_ + +#include "dds/ddsrt/endian.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Custom stack implementation. + */ +template +class custom_stack { + static_assert(N > 0, "Stack capacity must be larger than 0"); + T data[N]; + size_t sz = 0; + public: + custom_stack() = default; + custom_stack(const T &in) {data[0] = in; sz = 1;} + T &top() {return data[sz-1];} + const T& top() const {return data[sz-1];} + void pop() {sz--;} + void push(const T &in) {data[sz++] = in;} + void reset() {sz = 0;} + size_t size() const {return sz;} +}; + +/** + * @brief + * Enum conversion and validation function template forward declaration. + * + * This function is generated for each enumerated class encountered in the parsed .idl files. + * Converts an integer value to the corresponding enum class value, or its default value + * if there is no enum equivalent to the int. + * + * @param[in] in The integer to convert to the enumerated class. + * + * @return The enumerator representation of in. + */ +template +E enum_conversion(uint32_t in); + +/** + * @brief + * Byte swapping function, is only enabled for arithmetic (base) types. + * + * Determines the number of bytes to swap by the size of the template parameter. + * + * @param[in, out] toswap The entity whose bytes will be swapped. + */ +template::value> > +void byte_swap(T& toswap) { + union { T a; uint16_t u2; uint32_t u4; uint64_t u8; } u; + u.a = toswap; + DDSCXX_WARNING_MSVC_OFF(6326) + switch (sizeof(T)) { + case 1: + break; + case 2: + u.u2 = static_cast((u.u2 & 0xFF00) >> 8) + | static_cast((u.u2 & 0x00FF) << 8); + break; + case 4: + u.u4 = static_cast((u.u4 & 0xFFFF0000) >> 16) + | static_cast((u.u4 & 0x0000FFFF) << 16); + u.u4 = static_cast((u.u4 & 0xFF00FF00) >> 8) + | static_cast((u.u4 & 0x00FF00FF) << 8); + break; + case 8: + u.u8 = static_cast((u.u8 & 0xFFFFFFFF00000000) >> 32) + | static_cast((u.u8 & 0x00000000FFFFFFFF) << 32); + u.u8 = static_cast((u.u8 & 0xFFFF0000FFFF0000) >> 16) + | static_cast((u.u8 & 0x0000FFFF0000FFFF) << 16); + u.u8 = static_cast((u.u8 & 0xFF00FF00FF00FF00) >> 8) + | static_cast((u.u8 & 0x00FF00FF00FF00FF) << 8); + break; + default: + throw std::invalid_argument(std::string("attempted byteswap on variable of invalid size: ") + std::to_string(sizeof(T))); + } + DDSCXX_WARNING_MSVC_ON(6326) + toswap = u.a; +} + +/** + * @brief + * Endianness types. + * + * @enum endianness C++ implementation of cyclonedds's DDSRT_ENDIAN endianness defines + * + * @var endianness::little_endian Little endianness. + * @var endianness::big_endian Big endianness. + */ +enum class endianness { + little_endian = DDSRT_LITTLE_ENDIAN, + big_endian = DDSRT_BIG_ENDIAN +}; + +/** + * @brief + * Returns the endianness of the local system. + * + * Takes the value from the DDSRT_ENDIAN definition and converts it to the c++ enum class value. + * + * @retval little_endian If the system is little endian. + * @retval big_endian If the system is big endian. + */ +constexpr endianness native_endianness() { return endianness(DDSRT_ENDIAN); } + +/** + * @brief + * Serialization status bitmasks. + * + * @enum serialization_status Describes the serialization status of a cdr stream. + * + * These are stored as an bitfields in an int in cdr streams, since more than one serialization fault can be encountered. + * + * @var serialization_status::move_bound_exceeded The serialization has encountered a field which has exceeded the bounds set for it. + * @var serialization_status::write_bound_exceeded The serialization has encountered a field which has exceeded the bounds set for it. + * @var serialization_status::read_bound_exceeded The serialization has encountered a field which has exceeded the bounds set for it. + * @var serialization_status::illegal_field_value The serialization has encountered a field with a value which should never occur in a valid CDR stream. + * @var serialization_status::invalid_pl_entry The serialization has encountered a parameter list id which is illegal (not extended id in reserved for OMG space). + * @var serialization_status::unsupported_xtypes A streamer has attempted to stream a struct requiring xtypes but not supporting it itself. + * @var serialization_status::must_understand_fail A struct being read contains a field that must be understood but does not recognize or have. + */ +enum serialization_status : uint64_t { + move_bound_exceeded = 0x1 << 0, + write_bound_exceeded = 0x1 << 1, + read_bound_exceeded = 0x1 << 2, + invalid_pl_entry = 0x1 << 3, + illegal_field_value = 0x1 << 4, + unsupported_xtypes = 0x1 << 5, + must_understand_fail = 0x1 << 6 +}; + +/** + * @brief + * Base cdr_stream class. + * + * This class implements the base functions which all "real" cdr stream implementations will use. + */ +class OMG_DDS_API cdr_stream { +public: + /** + * @brief + * Constructor. + * + * Sets the stream endianness to end, and maximum alignment to max_align. + * + * @param[in] end The endianness to set for the data stream, default to the local system endianness. + * @param[in] max_align The maximum size that the stream will align CDR primitives to. + * @param[in] ignore_faults Bitmask for ignoring faults, can be composed of bit fields from the serialization_status enumerator. + */ + cdr_stream(endianness end, size_t max_align, uint64_t ignore_faults = 0x0) : m_stream_endianness(end), m_max_alignment(max_align), m_fault_mask(~ignore_faults), m_swap(native_endianness() != m_stream_endianness) { ; } + + /** + * @brief + * Returns the current stream alignment. + * + * @return The current stream alignment. + */ + size_t alignment() const { return m_current_alignment; } + + /** + * @brief + * Sets the new stream alignment. + * + * Also returns the value the alignment has been set to. + * + * @param[in] newalignment The new alignment to set. + * + * @return The value the alignment has been set to. + */ + size_t alignment(size_t newalignment) { return m_current_alignment = newalignment; } + + /** + * @brief + * Checks whether a delimited cdr stream is not being read out of bounds. + * + * This function will return true if N bytes can be read from the stream. + * + * @param[in] N The number of bytes requested. + * @param[in] peek Whether this is true access, or just a "peek". + * + * @return Whether enough bytes are available for another header. + */ + bool bytes_available(size_t N = 1, bool peek = false); + + /** + * @brief + * Returns the current cursor offset. + * + * @retval SIZE_MAX In this case, a maximum size calculation was being done, and the maximum size was determined to be unbounded. + * @return The current cursor offset. + */ + inline size_t position() const { return m_position; } + + /** + * @brief + * Sets the new cursor offset. + * + * Also returs the value the offset has been set to. + * + * @param[in] newposition The new offset to set. + * + * @return The value the offset has been set to. + */ + size_t position(size_t newposition) { return m_position = newposition; } + + /** + * @brief + * Cursor move function. + * + * Moves the current position offset by incr_by if it is not at SIZE_MAX. + * Returns the position value after this operation. + * + * @param[in] incr_by The amount to move the cursor position by. + * + * @return The cursor position after this operation. + */ + size_t incr_position(size_t incr_by) { if (m_position != SIZE_MAX) m_position += incr_by; return m_position; } + + /** + * @brief + * Resets the state of the stream as before streaming began. + * + * Will set the current offset, alignment to 0, clear the stack and fault status. + * Will retain the buffer pointer and size. + */ + virtual void reset(); + + /** + * @brief + * Buffer set function. + * + * Sets the buffer pointer to toset. + * As a side effect, the current position and alignment are reset, since these are not associated with the new buffer. + * + * @param[in] toset The new pointer of the buffer to set. + * @param[in] buffer_size The size of the buffer being set. + */ + void set_buffer(void* toset, size_t buffer_size = SIZE_MAX); + + /** + * @brief + * Gets the current cursor pointer. + * + * If the current position is SIZE_MAX or the buffer pointer is not set, it returns nullptr. + * + * @retval nullptr If the current buffer is not set, or if the cursor offset is not valid. + * @return The current cursor pointer. + */ + inline char* get_cursor() const { return m_buffer + m_position; } + + /** + * @brief + * Const stream endianness getter (const). + * + * This is used to determine whether the data read or written from the stream needs to have their bytes swapped. + * + * @return The stream endianness. + */ + const endianness& stream_endianness() const { return m_stream_endianness; } + + /** + * @brief + * Determines whether the local and stream endianness are the same. + * + * This is used to determine whether the data read or written from the stream needs to have their bytes swapped. + * + * @retval false If the stream endianness DOES match the local endianness. + * @retval true If the stream endianness DOES NOT match the local endianness. + */ + bool swap_endianness() const { return m_swap; } + + /** + * @brief + * Aligns the current stream to a new alignment. + * + * Aligns the current stream to newalignment, moves the cursor be at newalignment. + * Aligns to maximum m_max_alignment (which is stream-type specific). + * Zeroes the bytes the cursor is moved if add_zeroes is true. + * Nothing happens if the stream is already aligned to newalignment. + * + * @param[in] newalignment The new alignment to align the stream to. + * @param[in] add_zeroes Whether the bytes that the cursor moves need to be zeroed. + * + * @return Whether the cursor could be moved by the required amount. + */ + bool align(size_t newalignment, bool add_zeroes); + + /** + * @brief + * Returns the current status of serialization. + * + * Can be a composition of multiple bit fields from serialization_status. + * + * @return The current status of serialization. + */ + uint64_t status() const { return m_status; } + + /** + * @brief + * Serialization status update function. + * + * Adds to the current status of serialization and returns whether abort status has been reached. + * + * @param[in] toadd The serialization status error to add. + * + * @retval false If the serialization status of the stream HAS NOT YET reached one of the serialization errors which it is not set to ignore. + * @retval true If the serialization status of the stream HAS reached one of the serialization errors which it is not set to ignore. + */ + bool status(serialization_status toadd) { m_status |= static_cast(toadd); return abort_status(); } + + /** + * @brief + * Returns true when the stream has encountered an error which it is not set to ignore. + * + * All streaming functions should become NOOPs after this status is encountered. + * + * @retval false If the serialization status of the stream HAS NOT YET reached one of the serialization errors which it is not set to ignore. + * @retval true If the serialization status of the stream HAS reached one of the serialization errors which it is not set to ignore. + */ + inline bool abort_status() const { return m_status & m_fault_mask; } + + /** + * @brief + * Type of streaming operation to be done. + * + * @var stream_mode::unset The stream mode is not set. + * @var stream_mode::read Reads from the stream into an instance. + * @var stream_mode::write Writes from the instance to the stream. + * @var stream_mode::move Moves the cursor by the same amount as would has been done through stream_mode::write, without copying any data to the stream. + * @var stream_mode::max Same as stream_mode::move, but by the maximum amount possible for an entity of that type. + */ + enum class stream_mode { + unset, + read, + write, + move, + max + }; + + /** + * @brief + * Returns whether the streaming is done only over the key values. + * + * @return Whether the streaming is done only over the key values. + */ + inline bool is_key() const {return m_key;} + + /** + * @brief + * Function which sets the current streaming mode. + * + * This will impact which entities will be retrieved from the entity properties list. + * This will also reset the current cursor position. + * + * @param[in] mode The streaming mode to set for the stream. + * @param[in] key The key mode to set for the stream. + */ + void set_mode(stream_mode mode, bool key) {m_mode = mode; m_key = key; reset();} + + /** + * @brief + * Function declaration for starting a new member. + * + * This function is called by next_entity for each entity which is iterated over. + * Depending on the implementation and mode headers may be read from/written to the stream. + * This function can be overridden in cdr streaming implementations. + * + * @param[in] prop Properties of the entity to start. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + virtual bool start_member(entity_properties_t &prop, bool is_set = true) { prop.is_present = is_set; return true;} + + /** + * @brief + * Function declaration for finishing an existing member. + * + * This function is called by next_entity for each entity which is iterated over. + * Depending on the implementation and mode header length fields may be completed. + * This function can be overridden in cdr streaming implementations. + * + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + virtual bool finish_member(entity_properties_t &, bool is_set = true) { (void) is_set; return true;} + + /** + * @brief + * Function declaration for retrieving the next entity to be operated on by the streamer. + * + * This function is called by the instance implementation switchbox and will return the next entity to operate on by calling next_prop. + * This will also call the implementation specific push/pop entity functions to write/finish headers where necessary. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The next entity to be processed, or the final entity if the current tree level does not hold more entities. + */ + virtual entity_properties_t* next_entity(entity_properties_t *prop); + + /** + * @brief + * Returns the first entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The first entity to be processed, or a nullptr if the current tree level does not hold any entities that match this tree. + */ + virtual entity_properties_t* first_entity(entity_properties_t *prop); + + /** + * @brief + * Function declaration for starting a parameter list. + * + * This function is called by the generated functions for the entity, and will trigger the necessary actions on starting a new struct. + * I.E. starting a new parameter list, writing headers. + * + * @param[in,out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the operation was completed succesfully. + */ + virtual bool start_struct(entity_properties_t &props); + + /** + * @brief + * Function declaration for finishing a parameter list. + * + * This function is called by the generated functions for the entity, and will trigger the necessary actions on finishing the current struct. + * I.E. finishing headers, writing length fields. + * + * @param[in,out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the struct is complete and correct. + */ + virtual bool finish_struct(entity_properties_t &props); + + /** + * @brief + * Function declaration for starting an array or sequence of non-primitive types. + * + * This function is used to keep track of whether delimiters need to be and have been written to the stream. + * This function is an effective no-op for all streamers except xcdr_v2. + * + * @param[in] is_array True when the consecutive entries is an array, false when it is a sequence. + * @param[in] primitive Whether the consecutive entities are primitives (base types, not enums, strings, typedefs and arrays are resolved though) + * + * @return Always true. + */ + virtual bool start_consecutive(bool is_array, bool primitive) { (void) is_array; (void) primitive; return true;} + + /** + * @brief + * Function declaration for finishing an array or sequence of non-primitive types. + * + * This function is an effective no-op for all streamers except xcdr_v2. + * + * @return Always true. + */ + virtual bool finish_consecutive() {return true;} + +protected: + + /** + * @brief Implementation for starting the recording the size and starting offset of a member. + */ + inline void push_member_start() { m_e_sz.push(0); m_e_off.push(static_cast(position())); } + + /** + * @brief Implementation for finishing the recording the size and starting offset of a member. + */ + inline void pop_member_start() { m_e_sz.pop(); m_e_off.pop(); } + + /** + * @brief + * Checks the struct for completeness. + * + * Checks whether all fields which must be understood are present. + * + * @param[in,out] props The struct whose start is recorded. + */ + void check_struct_completeness(entity_properties_t &props); + + /** + * @brief + * Returns the previous entity at the current level (if any). + * + * @param[in] prop Entity to the current entity. + * + * @return Pointer to the previous entity, or nullptr if there is any. + */ + entity_properties_t* previous_entity(entity_properties_t *prop); + + static const size_t m_maximum_depth = 32; /**< the maximum depth of structures in the streamer*/ + + endianness m_stream_endianness; /**< the endianness of the stream*/ + size_t m_position = 0, /**< the current offset position in the stream*/ + m_max_alignment, /**< the maximum bytes that can be aligned to*/ + m_current_alignment = 1, /**< the current alignment*/ + m_buffer_size = 0; /**< the size of the current buffer*/ + char* m_buffer = nullptr; /**< the current buffer in use*/ + uint64_t m_status = 0, /**< the current status of streaming*/ + m_fault_mask; /**< the mask for statuses that will cause streaming + to be aborted*/ + stream_mode m_mode = stream_mode::unset; /**< the current streaming mode*/ + bool m_key = false; /**< the current key mode*/ + bool m_swap = false; /**< whether to swap endianness*/ + + DDSCXX_WARNING_MSVC_OFF(4251) + custom_stack m_buffer_end; /**< the end of reading at the current level*/ + custom_stack m_e_off, /**< the offset of the entity at the current level*/ + m_e_sz; /**< the size of the entity at the current level*/ + DDSCXX_WARNING_MSVC_ON(4251) +}; + +/** + * @brief + * Primitive type stream manipulation functions. + * + * These are "endpoints" for write functions, since composit + * (sequence/array/constructed type) functions will decay to these + * calls. + */ + +/** + * @brief + * Primitive type read function. + * + * Aligns the stream to the alignment of type T. + * Reads the value from the current position of the stream str into + * toread, will swap bytes if necessary. + * Moves the cursor of the stream by the size of T. + * This function is only enabled for arithmetic types and enums. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read into. + * @param[in] N The number of entities to read. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && !std::is_enum::value + && std::is_base_of::value, bool> = true > +bool read(S &str, T& toread, size_t N = 1) +{ + if (str.position() == SIZE_MAX + || !str.align(sizeof(T), false) + || !str.bytes_available(sizeof(T)*N)) + return false; + + auto from = reinterpret_cast(str.get_cursor()); + T *to = &toread; + + assert(from); + + if (N == 1) { + toread = *from; + if (str.swap_endianness()) + byte_swap(toread); + } else { + memcpy(to,from,sizeof(T)*N); + if (str.swap_endianness()) { + for (size_t i = 0; i < N; i++, to++) + byte_swap(*to); + } + } + + str.incr_position(sizeof(T)*N); + + return true; +} + +/** + * @brief + * Enum type read function implementation. + * + * Uses the template parameter I to determine the stream-end read type, + * this type is determined by the stream implementation. + * Reads the enums as type I from the stream. + * Each read entity is verified by the enum's conversion version. + * This function is only enabled for enum types. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read. + * @param[in] N The number of entities to read. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && std::is_enum::value + && std::is_base_of::value, bool> = true> +bool read_enum_impl(S& str, T& toread, size_t N) +{ + T *ptr = &toread; + I holder = 0; + for (size_t i = 0; i < N; i++, ptr++) + { + if (!read(str, holder)) + return false; + *ptr = enum_conversion(holder); + } + return true; +} + +/** + * @brief + * Primitive type write function. + * + * Aligns str to the type to be written. + * Writes towrite to str. + * Swaps bytes written to str if the endiannesses do not match up. + * Moves the cursor of str by the size of towrite. + * This function is only enabled for arithmetic types. + * + * @param[in, out] str The stream which is written to. + * @param[in] towrite The variable to write. + * @param[in] N The number of entities to write. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && !std::is_enum::value + && std::is_base_of::value, bool> = true > +bool write(S& str, const T& towrite, size_t N = 1) +{ + if (str.position() == SIZE_MAX + || !str.align(sizeof(T), true) + || !str.bytes_available(sizeof(T)*N)) + return false; + + auto to = reinterpret_cast(str.get_cursor()); + + assert(to); + + if (N == 1) { + *to = towrite; + if (str.swap_endianness()) + byte_swap(*to); + } else { + const T *from = &towrite; + memcpy(to,from,sizeof(T)*N); + if (str.swap_endianness()) { + for (size_t i = 0; i < N; i++, to++) + byte_swap(*to); + } + } + + str.incr_position(sizeof(T)*N); + + return true; +} + +/** + * @brief + * Enum type write function implementation. + * + * Uses the template parameter I to determine the stream-end write type, + * this type is determined by the stream implementation. + * Writes the enums as type I to the stream. + * If the enums have the same size as the integer stream type, they are written + * as a block, otherwise they are copied one by one. + * This function is only enabled for enum types. + * + * @param[in, out] str The stream which is written to. + * @param[in] towrite The variable to write. + * @param[in] N The number of entities to write. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && std::is_enum::value + && std::is_base_of::value, bool> = true> +bool write_enum_impl(S& str, const T& towrite, size_t N) +{ + const T *ptr = &towrite; + if (sizeof(T) == sizeof(I)) { + if (!write(str, *reinterpret_cast(ptr), N)) + return false; + } else { + for (size_t i = 0; i < N; i++, ptr++) + if (!write(str, *reinterpret_cast(ptr))) + return false; + } + return true; +} + +/** + * @brief + * Primitive type cursor move function. + * + * Used in determining the size of a type when written to the stream. + * Aligns str to the size of toincr. + * Moves the cursor of str by the size of toincr. + * This function is only enabled for arithmetic types. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && !std::is_enum::value + && std::is_base_of::value, bool> = true > +bool move(S& str, const T&, size_t N = 1) +{ + if (str.position() == SIZE_MAX) + return true; + + if (!str.align(sizeof(T), false)) + return false; + + str.incr_position(sizeof(T)*N); + + return true; +} + +/** + * @brief + * Primitive type max stream move function. + * + * Used in determining the maximum stream size of a constructed type. + * Moves the cursor to the maximum position it could occupy after + * writing max_sz to the stream. + * Is in essence the same as the primitive type cursor move function, + * but additionally checks for whether the cursor it at the "end", + * which may happen if unbounded members (strings/sequences/...) + * are part of the constructed type. + * This function is only enabled for arithmetic types. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] max_sz The variable to move the cursor by, no contents of this variable are used, it is just used to determine the template. + * @param[in] N The number of entities at most to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && !std::is_enum::value + && std::is_base_of::value, bool> = true > +bool max(S& str, const T& max_sz, size_t N = 1) +{ + return move(str, max_sz, N); +} + + /** + * @brief + * String type stream manipulation functions + * + * These are "endpoints" for write functions, since compound + * (sequence/array/constructed type) functions will decay to these + * calls. + */ + +/** + * @brief + * Bounded string read function. + * + * Reads the length from str, but then initializes toread with at most N characters from it. + * It does move the cursor by length read, since that is the number of characters in the stream. + * If N is 0, then the string is taken to be unbounded. + * + * @param[in, out] str The stream to read from. + * @param[out] toread The string to read to. + * @param[in] N The maximum number of characters to read from the stream. + * + * @return Whether the operation was completed succesfully. + */ +template::value, bool> = true > +bool read_string(S& str, T& toread, size_t N) +{ + if (str.position() == SIZE_MAX) + return false; + + uint32_t string_length = 0; + + if (!read(str, string_length) + || !str.bytes_available(string_length)) + return false; + + if (string_length == 0 + && str.status(serialization_status::illegal_field_value)) + return false; + + if (N && string_length > N + 1) + return false; + + auto cursor = str.get_cursor(); + toread.assign(cursor, cursor + std::min(string_length - 1, N ? N : SIZE_MAX)); //remove 1 for terminating NULL + + str.incr_position(string_length); + + //aligned to chars + str.alignment(1); + + return true; +} + +/** + * @brief + * Bounded string write function. + * + * Attempts to write the length of towrite to str, where the bound is checked. + * Then writes the contents of towrite to str. + * If N is 0, then the string is taken to be unbounded. + * + * @param[in, out] str The stream to write to. + * @param[in] towrite The string to write. + * @param[in] N The maximum number of characters to write to the stream. + * + * @return Whether the operation was completed succesfully. + */ +template::value, bool> = true > +bool write_string(S& str, const T& towrite, size_t N) +{ + if (str.position() == SIZE_MAX) + return false; + + size_t string_length = towrite.length() + 1; //add 1 extra for terminating NULL + + if (N + && string_length > N + 1 + && str.status(serialization_status::write_bound_exceeded)) + return false; + + if (!write(str, uint32_t(string_length)) + || !str.bytes_available(string_length)) + return false; + + memcpy(str.get_cursor(), towrite.c_str(), string_length); + + str.incr_position(string_length); + + //aligned to chars + str.alignment(1); + + return true; +} + +/** + * @brief + * Bounded string cursor move function. + * + * Attempts to move the cursor for the length field, where the bound is checked. + * Then moves the cursor for the length of the string. + * If N is 0, then the string is taken to be unbounded. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] toincr The string used to move the cursor. + * @param[in] N The maximum number of characters in the string which the stream is moved by. + * + * @return Whether the operation was completed succesfully. + */ +template::value, bool> = true > +bool move_string(S& str, const T& toincr, size_t N) +{ + if (str.position() == SIZE_MAX) + return true; + + size_t string_length = toincr.length() + 1; //add 1 extra for terminating NULL + + if (N + && string_length > N + 1 + && str.status(serialization_status::move_bound_exceeded)) + return false; + + if (!move(str, uint32_t())) + return false; + + str.incr_position(string_length); + + //aligned to chars + str.alignment(1); + + return true; +} + +/** + * @brief + * Bounded string cursor max move function. + * + * Similar to the string move function, with the additional checks that no move + * is done if the cursor is already at its maximum position, and that the cursor + * is set to its maximum position if the bound is equal to 0 (unbounded). + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] max_sz The string used to move the cursor. + * @param[in] N The maximum number of characters in the string which the stream is at most moved by. + * + * @return Whether the operation was completed succesfully. + */ +template::value, bool> = true > +bool max_string(S& str, const T& max_sz, size_t N) +{ + if (N == 0) + str.position(SIZE_MAX); //unbounded string, theoretical length unlimited + else + return move_string(str, max_sz, N); + + return true; +} + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e9c8c80472d119f10c98f2d72beefbbf1fc6783d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp @@ -0,0 +1,265 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef ENTITY_PROPERTIES_HPP_ +#define ENTITY_PROPERTIES_HPP_ + +#include +#include +#include +#include +#include +#include +#include + +#if DDSCXX_USE_BOOST +#include +#define DDSCXX_STD_IMPL boost +#else +#include +#define DDSCXX_STD_IMPL std +#endif + +#include "cdr_enums.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +#define decl_ref_type(x) DDSCXX_STD_IMPL::remove_cv_t> + +/** + * @brief + * Bit bound descriptors. + * + * @enum bit_bound Describes the minimal bit width for enum and bitmask types. + * + * This value is unset for anything other than enums and bitmasks. + * It describes the smallest piece of memory which is able to represent the entire range of values. + * + * @var bit_bound::bb_unset The bit width of the entity is unset. + * @var bit_bound::bb_8_bits The bit width of the entity is at most 8 bits (1 byte). + * @var bit_bound::bb_16_bits The bit width of the entity is at most 16 bits (2 bytes). + * @var bit_bound::bb_32_bits The bit width of the entity is at most 32 bits (4 bytes). + * @var bit_bound::bb_64_bits The bit width of the entity is at most 64 bits (8 bytes). + */ +enum bit_bound { + bb_unset = 0, + bb_8_bits = 1, + bb_16_bits = 2, + bb_32_bits = 4, + bb_64_bits = 8 +}; + +/** + * @brief + * Helper struct to keep track of key endpoints of the a struct + */ +DDSCXX_WARNING_MSVC_OFF(4251) +class OMG_DDS_API key_endpoint: public std::map { +DDSCXX_WARNING_MSVC_ON(4251) + public: + void add_key_endpoint(const std::list &key_indices); + operator bool() const {return !empty();} +}; + +/** + * @brief + * Primitive type/enum get_bit_bound function. + * + * Returns a bb_unset for all primitive types and enums. + * This function will be implemented for all enums with a manually defined bit_bound. + * + * @return The bit bound for the primitive type. + */ +template::value || std::is_enum::value, bool> = true > +bit_bound get_bit_bound() { + switch (sizeof(T)) { + case 1: + return bb_8_bits; + break; + case 2: + return bb_16_bits; + break; + case 4: + return bb_32_bits; + break; + case 8: + return bb_64_bits; + break; + default: + return bb_unset; + } +} + +/** + * @brief + * Generic get_bit_bound fallback function. + * + * Returns a bb_unset for all non-primitive, non-enum types. + * + * @return bb_unset always. + */ +template::value && !std::is_arithmetic::value, bool> = true > +constexpr bit_bound get_bit_bound() { return bb_unset;} + +typedef struct entity_properties entity_properties_t; +typedef std::vector propvec; + +/** + * @brief + * Entity properties struct. + * + * This is a container for data fields inside message classes, both as a representation passed for writing + * as well as headers taken from streams when reading in the appropriate manner. + * Normally these are not used by the end-user, and the streaming functions all interact with these objects + * through the get_type_props function, which is generated for all user supplied message types. + */ +struct OMG_DDS_API entity_properties +{ + entity_properties( + uint32_t _depth = 0, + uint32_t _m_id = 0, + bool _is_optional = false, + bit_bound _bb = bb_unset, + extensibility _ext = extensibility::ext_final, + bool _must_understand = true): + e_ext(_ext), + m_id(_m_id), + depth(_depth), + must_understand(_must_understand), + xtypes_necessary(_ext != extensibility::ext_final || _is_optional), + is_optional(_is_optional), + e_bb(_bb) {;} + + extensibility e_ext = extensibility::ext_final; /**< The extensibility of the entity itself. */ + extensibility p_ext = extensibility::ext_final; /**< The extensibility of the entity's parent. */ + uint32_t m_id = 0; /**< The member id of the entity, it is the global field by which the entity is identified. */ + uint32_t depth = 0; /**< The depth of this entity.*/ + bool must_understand = false; /**< If the reading end cannot parse a field with this header, it must discard the entire object.*/ + bool xtypes_necessary = false; /**< Is set if any of the members of this entity require xtypes support.*/ + bool implementation_extension = false; /**< Can be set in XCDR_v1 stream parameter list headers.*/ + bool ignore = false; /**< Indicates that this field must be ignored.*/ + bool is_optional = false; /**< Indicates that this field can be empty (length 0) for reading/writing purposes.*/ + bool is_key = false; /**< Indicates that this field is a key field.*/ + bool is_present = false; /**< Indicates that this entity is present in the read stream.*/ + bit_bound e_bb = bb_unset; /**< The minimum number of bytes necessary to represent this entity/bitmask.*/ + + entity_properties_t *next_on_level = nullptr, /**< Pointer to the next entity on the same level.*/ + *prev_on_level = nullptr, /**< Pointer to the previous entity on the same level.*/ + *parent = nullptr, /**< Pointer to the parent of this entity.*/ + *first_member = nullptr; /**< Pointer to the first entity which is a member of this entity.*/ + + /** + * @brief + * Reset function. + * + * This function will reset the fields that may have been set through streaming (is_present). + */ + void reset(); + + /** + * @brief + * Print function. + * + * This function write the contents (id, is_key, is_optional, must_understand, xtypes_necessary) of this entity to std::cout. + */ + void print() const; + + /** + * @brief + * Checks whether this entity is not keyless. + * + * This function will check all members (if any) and if any of them has the is_key flag set, this will return true. + * If none have this flag set, it will return false. + * Used in the finish function to finish the entire entity_properties_t tree. + * + * @return true if any of the members have a key, false otherwise. + */ + bool has_keys() const; + + /** + * @brief + * Sets is_key flags on members. + * + * This function will set is_key flags on all members if the entity is keyless + * and will recursively call this on all members with the is_key flag set. + * Used in the finish function to finish the entire entity_properties_t tree. + */ + void set_key_values(); + + /** + * @brief + * Removes all is_key flags from members. + * + * This function will set all is_key flags of members of this entity to false. + * Used in the finish function to finish the entire entity_properties_t tree. + */ + void erase_key_values(); + + /** + * @brief + * Finishes a tree representing an entire datamodel. + * + * This function will set the next_on_level and prev_on_level pointers to create a sub linked list + * of the members of the entity at that level. Also it will set the parent pointer of member entities + * and the first_member pointer of entities which have sub entities (members). + * When all this is done, it will take the key information in the key_endpoint map to (un)set the is_key + * flags on all members. + * + * @param[in, out] props The list of entities representing the datamodel. + * @param[in] keys The map of key indices. + */ + static void finish(propvec &props, const key_endpoint &keys); + + /** + * @brief + * Appends a sub tree to the current tree as a member. + * + * This function will take the contents of toappend, insert them at the end of appendto and increase the + * depth of all entities added. It is used to add a constructed type as a member of another constructed type. + * + * @param[in, out] appendto The tree to append to. + * @param[in] toappend The sub tree to append. + */ + static void append_struct_contents(propvec &appendto, const propvec &toappend); + + /** + * @brief + * Prints the contents of a tree representing a datatype to the screen. + * + * @param[in] in The tree to print. + */ + static void print(const propvec &in); +}; + +/** + * @brief + * Forward declaration for type properties getter function. + * + * This template function is replaced/implemented by the types implemented through IDL generation. + * It generates a static container which is initialized the first time the function is called, + * this is then returned. + * + * @return propvec "Tree" representing the type. + */ +template +propvec& get_type_props(); + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ + +#endif diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp new file mode 100644 index 0000000000000000000000000000000000000000..25071eb37eb9f74b3dc3ff955c3be49f1e9c0546 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp @@ -0,0 +1,344 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef EXTENDED_CDR_SERIALIZATION_V1_HPP_ +#define EXTENDED_CDR_SERIALIZATION_V1_HPP_ + +#include "cdr_stream.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Implementation of the extended cdr version1 stream. + * + * This type of cdr stream has a maximum alignment of 8 bytes. + */ +class OMG_DDS_API xcdr_v1_stream : public cdr_stream { +public: + /** + * @brief + * Constructor. + * + * Basically a pass through for the cdr_stream base class. + * + * @param[in] end The endianness to set for the data stream, default to the local system endianness. + * @param[in] ignore_faults Bitmask for ignoring faults, can be composed of bit fields from the serialization_status enumerator. + */ + xcdr_v1_stream(endianness end = native_endianness(), uint64_t ignore_faults = 0x0) : cdr_stream(end, 8, ignore_faults) { ; } + + /** + * @brief + * Starts a new member. + * + * Determines whether a header is necessary for this entity through header_necessary, and if it is, handles the header. + * + * @param[in, out] prop Properties of the member to start. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + bool start_member(entity_properties_t &prop, bool is_set = true); + + /** + * @brief + * Finishes a member. + * + * Determines whether a header is necessary for this entity through header_necessary, and if it is, completes the previous header. + * + * @param[in, out] prop Properties of the member to finish. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + bool finish_member(entity_properties_t &prop, bool is_set = true); + + /** + * @brief + * Returns the next entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The next entity to be processed, or a nullptr if the current tree level does not hold more entities that match this tree. + */ + entity_properties_t* next_entity(entity_properties_t *prop); + + /** + * @brief + * Returns the first entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The first entity to be processed, or a nullptr if the current tree level does not hold any entities that match this tree. + */ + entity_properties_t *first_entity(entity_properties_t *prop); + + /** + * @brief + * Finishes the current struct. + * + * Adds the final parameter list entry if necessary when writing to the stream. + * + * @param[in, out] props The property tree to get the next entity from. + * + * @return Whether the struct is complete and correct. + */ + bool finish_struct(entity_properties_t &props); + +private: + + static const uint16_t pid_mask; /**< the mask for non-extended parameter list ids*/ + static const uint16_t pid_extended; /**< indicating an extended entry*/ + static const uint16_t pid_list_end; /**< guardian entry indicating end of parameter list*/ + static const uint16_t pid_ignore; /**< ignore this entry*/ + static const uint16_t pid_flag_impl_extension; /**< bit flag indicating implementation specific extension*/ + static const uint16_t pid_flag_must_understand; /**< bit flag indicating that this entry must be parsed successfully or the entire sample must be discarded*/ + static const uint32_t pl_extended_mask; /**< mask for extended parameter list ids*/ + static const uint32_t pl_extended_flag_impl_extension; /**< bit flag indicating implementation specific extension*/ + static const uint32_t pl_extended_flag_must_understand; /**< bit flag indicating that this entry must be parsed successfully or the entire sample must be discarded*/ + + /** + * @brief + * Returns the next entity to be processed. + * + * For optional members and members of mutable structures, a parameter list header field is necessary preceding + * the field contents itself. + * + * @param[in] props The properties of the entity. + * + * @return Whether a header is necessary for the entity. + */ + bool header_necessary(const entity_properties_t &props); + + /** + * @brief + * Determines whether a parameter list is necessary. + * + * @param[in] props The entity whose members might be represented by a parameter list. + * + * @return Whether a parameter list is necessary for the entity. + */ + bool list_necessary(const entity_properties_t &props); + + /** + * @brief + * Reads a header field from the stream. + * + * If header_necessary returns true for a field, then this function needs to be called first to read the + * header from stream and to allow the streamer to determine what to do with the field. + * + * @param[out] out The header to read into. + * @param[out] is_final Whether the final field has been read. + * + * @return Whether the header was read succesfully. + */ + bool read_header(entity_properties_t &out, bool &is_final); + + /** + * @brief + * Writes a header field to the stream. + * + * If header_necessary returns true for a field, then this function needs to be called first to write the + * header to the stream before the contents of the field are written. + * + * @param[in, out] props The properties of the entity. + * + * @return Whether the header was read succesfully. + */ + bool write_header(entity_properties_t &props); + + /** + * @brief + * Finishes a header field in the stream. + * + * Goes back to the offset of the length field that was unfinished in + * + * @param[in, out] props The properties of the entity. + * + * @return Whether the header was read succesfully. + */ + bool finish_write_header(entity_properties_t &props); + + /** + * @brief + * Writes the terminating entry in a parameter list. + * + * @return Whether the header was read succesfully. + */ + bool write_final_list_entry(); + + /** + * @brief + * Moves the cursor as if writing the terminating entry in a parameter list. + * + * @return Whether the header was read succesfully. + */ + bool move_final_list_entry(); + + /** + * @brief + * Moves the stream offset by the amount that would have been written by write_header. + * + * This function needs to be called first to move the stream by the same amount the header would + * have taken up, if it would have been written. + * + * @param[in] props The entity to move the cursor by. + * + * @return Whether the header was read succesfully. + */ + bool move_header(const entity_properties_t &props); + + /** + * @brief + * Determines whether to use extended format header. + * + * An extended header is necessary for entities with a size larger than 65535 bytes or entities with + * a member id larger than 16128. + * + * @param[in] props The entity to check. + * + * @return Whether an extended format header is necessary. + */ + static bool extended_header(const entity_properties_t &props); +}; + +/** + * @brief + * Enumerated type stream manipulation functions. + * Depending on the number coverage of the enum, it will be written + * to the stream as an uint8_t, an uint16_t or a uint32_t. + * + * These are "endpoints" for write functions, since compound + * (sequence/array/constructed type) functions will decay to these + * calls. + */ + +/** + * @brief + * Reads the value of the enum from the stream. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read into. + * @param[in] N The number of entities to read. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool read(xcdr_v1_stream& str, T& toread, size_t N = 1) +{ + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return read_enum_impl(str, toread, N); + break; + case bb_16_bits: + return read_enum_impl(str, toread, N); + break; + case bb_32_bits: + return read_enum_impl(str, toread, N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Writes the value of the enum to the stream. + * + * @param[in, out] str The stream which is written to. + * @param[in] towrite The variable to write. + * @param[in] N The number of entities to write. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool write(xcdr_v1_stream& str, const T& towrite, size_t N = 1) +{ + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return write_enum_impl(str, towrite, N); + break; + case bb_16_bits: + return write_enum_impl(str, towrite, N); + break; + case bb_32_bits: + return write_enum_impl(str, towrite, N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool move(xcdr_v1_stream& str, const T&, size_t N = 1) +{ + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return move(str, int8_t(0), N); + break; + case bb_16_bits: + return move(str, int16_t(0), N); + break; + case bb_32_bits: + return move(str, int32_t(0), N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up (maximum size version). + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] max_sz The variable to move the cursor by, no contents of this variable are used, it is just used to determine the template. + * @param[in] N The number of entities at most to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool max(xcdr_v1_stream& str, const T& max_sz, size_t N = 1) +{ + return move(str, max_sz, N); +} + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ea5715c195c88b29123a026ad9e2e5eaad8a7f5d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp @@ -0,0 +1,409 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef EXTENDED_CDR_SERIALIZATION_V2_HPP_ +#define EXTENDED_CDR_SERIALIZATION_V2_HPP_ + +#include "cdr_stream.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Implementation of the extended cdr version1 stream. + * + * This type of cdr stream has a maximum alignment of 8 bytes. + */ +class OMG_DDS_API xcdr_v2_stream : public cdr_stream { +public: + /** + * @brief + * Constructor. + * + * Basically a pass through for the cdr_stream base class. + * + * @param[in] end The endianness to set for the data stream, default to the local system endianness. + * @param[in] ignore_faults Bitmask for ignoring faults, can be composed of bit fields from the serialization_status enumerator. + */ + xcdr_v2_stream(endianness end = native_endianness(), uint64_t ignore_faults = 0x0) : cdr_stream(end, 4, ignore_faults) { ; } + + /** + * @brief + * Resets the state of the stream as before streaming began. + * + * Will reset the stack of delimiters in addition to what is reset by cdr_stream::reset. + */ + void reset(); + + /** + * @brief + * Starts a new member. + * + * Determines whether a header is necessary for this entity through em_header_necessary, and if it is, handles the header. + * + * @param[in, out] prop Properties of the member to start. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + */ + bool start_member(entity_properties_t &prop, bool is_set = true); + + /** + * @brief + * Finishes a member. + * + * Determines whether a header is necessary for this entity through em_header_necessary, and if it is, completes the previous header. + * + * @param[in, out] prop Properties of the member to finish. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + bool finish_member(entity_properties_t &prop, bool is_set = true); + + /** + * @brief + * Returns the next entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The next entity to be processed, or a nullptr if the current tree level does not hold more entities that match this tree. + */ + entity_properties_t* next_entity(entity_properties_t *prop); + + /** + * @brief + * Returns the first entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The first entity to be processed, or a nullptr if the current tree level does not hold any entities that match this tree. + */ + entity_properties_t *first_entity(entity_properties_t *prop); + + /** + * @brief + * Start a new struct. + * + * This function is called by the generated streaming functions, and will start a parameter list, if that is relevant for it. + * + * @param[in, out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the operation was completed succesfully. + */ + bool start_struct(entity_properties_t &props); + + /** + * @brief + * Finish the current struct. + * + * This function is called by the generated streaming functions, and will finish the current parameter list, if that is relevant for it. + * + * @param[in, out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the struct is complete and correct. + */ + bool finish_struct(entity_properties_t &props); + + /** + * @brief + * Function declaration for starting an array or sequence of non-primitive types. + * + * This function inserts a d-header placeholder before the start of the consecutive objects. + * + *@param[in] is_array True when the consecutive entries is an array, false when it is a sequence. + *@param[in] primitive Whether the consecutive entities are primitives (base types, not enums, strings, typedefs and arrays are resolved though) + * + * @return Whether the d-header was inserted correctly. + */ + bool start_consecutive(bool is_array, bool primitive); + + /** + * @brief + * Function declaration for finishing an array or sequence of non-primitive types. + * + * This function finishes the d-header placeholder. + * + * @return Whether the d-header was finished correctly. + */ + bool finish_consecutive(); + +private: + typedef struct consecutives { + consecutives(bool is_array = false, bool d_header_present = false) : is_array(is_array), d_header_present(d_header_present) {} + bool is_array; + bool d_header_present; + } consecutives_t; + + static const uint32_t bytes_1; /**< length field code indicating length is 1 byte*/ + static const uint32_t bytes_2; /**< length field code indicating length is 2 bytes*/ + static const uint32_t bytes_4; /**< length field code indicating length is 4 bytes*/ + static const uint32_t bytes_8; /**< length field code indicating length is 8 bytes*/ + static const uint32_t nextint; /**< length field code indicating length is the next integer field*/ + static const uint32_t nextint_times_1; /**< same as nextint*/ + static const uint32_t nextint_times_4; /**< length field code indicating length is the next integer field times 4*/ + static const uint32_t nextint_times_8; /**< length field code indicating length is the next integer field times 8*/ + static const uint32_t lc_mask; /**< mask for length field codes*/ + static const uint32_t id_mask; /**< mask for member ids*/ + static const uint32_t must_understand; /**< must understand member field flag*/ + + DDSCXX_WARNING_MSVC_OFF(4251) + custom_stack m_consecutives; /**< stack of consecutive entries, uses to determine whether or not to finish a d_header*/ + custom_stack m_delimiters; /**< locations of sequence delimiters */ + DDSCXX_WARNING_MSVC_ON(4251) + + /** + * @brief + * Reads a D-header from the stream. + * + * Will put the entity size into the streams m_buffer_end stack + * + * @return Whether the read was succesful. + */ + bool read_d_header(); + + /** + * @brief + * Reads an EM-header from the stream. + * + * @param[out] props The entity to read the EM-header into. + * + * @return Whether the read was succesful. + */ + bool read_em_header(entity_properties_t &props); + + /** + * @brief + * Writes a D-header placeholder to the stream. + * + * This will be filled with the value through the function finish_d_header when the struct is completed. + * + * @return Whether the write was succesful. + */ + bool write_d_header(); + + /** + * @brief + * Adds an optional flag to the stream. + * + * In the case of an optional field, but not a parameter list, the xcdrv2 spec states that this field should + * preceded by a single boolean, indicating its presence or absence. + * + * @param[in] is_set Whether the entity represented by prop is present. + * + * @return Whether the read was succesful. + */ + bool write_optional_tag(bool is_set); + + /** + * @brief + * Moves the stream cursor by the amount of an optional flag. + * + * In the case of an optional field, but not a parameter list, the xcdrv2 spec states that this field should + * preceded by a single boolean, indicating its presence or absence. + * + * @return Whether the read was succesful. + */ + bool move_optional_tag(); + + /** + * @brief + * Writes an EM-header to the stream. + * + * @param[in, out] prop The entity to write the EM-header for. + * + * @return Whether the header was read succesfully. + */ + bool write_em_header(entity_properties_t &prop); + + /** + * @brief + * Moves the stream's position by the amount that it would after writing the D-header. + * + * Moves the cursor by a 4 byte int. + * + * @return Whether the operation was completed succesfully. + */ + bool move_d_header() {return move(*this, uint32_t(0));} + + /** + * @brief + * Moves the stream's position by the amount that it would after writing the EM-header. + * + * @return Whether the header was read succesfully. + */ + bool move_em_header(); + + /** + * @brief + * Finishes the write operation of the D-header. + * + * @return Whether the header was read succesfully. + */ + bool finish_d_header(); + + /** + * @brief + * Finishes the write operation of the EM-header. + * + * @return Whether the header was read succesfully. + */ + bool finish_em_header(); + + /** + * @brief + * Checks whether a D-header is necessary for the indicated entity. + * + * @param[in] props The entity whose properties to check. + * + * @return Whether the entity props needs a D-header + */ + bool d_header_necessary(const entity_properties_t &props); + + /** + * @brief + * Checks whether a EM-header is necessary for the indicated entity. + * + * @param[in] props The entity whose properties to check. + * + * @return Whether the entity props needs a EM-header + */ + bool em_header_necessary(const entity_properties_t &props); + + /** + * @brief + * Determines whether a parameter list is necessary. + * + * This function is called by the next_entity function, to determine whether or not + * to read em headers from the stream. + * + * @param[in] props The entity whose members might be represented by a parameter list. + * + * @return Whether a list is necessary for this entity. + */ + bool list_necessary(const entity_properties_t &props); +}; + +/** + * @brief + * Reads the value of the enum from the stream. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read into. + * @param[in] N The number of entities to read. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool read(xcdr_v2_stream& str, T& toread, size_t N = 1) { + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return read_enum_impl(str, toread, N); + break; + case bb_16_bits: + return read_enum_impl(str, toread, N); + break; + case bb_32_bits: + return read_enum_impl(str, toread, N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Writes the value of the enum to the stream. + * + * @param [in, out] str The stream which is written to. + * @param [in] towrite The variable to write. + * @param[in] N The number of entities to write. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool write(xcdr_v2_stream& str, const T& towrite, size_t N = 1) { + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return write_enum_impl(str, towrite, N); + break; + case bb_16_bits: + return write_enum_impl(str, towrite, N); + break; + case bb_32_bits: + return write_enum_impl(str, towrite, N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool move(xcdr_v2_stream& str, const T&, size_t N = 1) { + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return move(str, int8_t(0), N); + break; + case bb_16_bits: + return move(str, int16_t(0), N); + break; + case bb_32_bits: + return move(str, int32_t(0), N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up (maximum size version). + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] max_sz The variable to move the cursor by, no contents of this variable are used, it is just used to determine the template. + * @param[in] N The number of entities at most to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool max(xcdr_v2_stream& str, const T& max_sz, size_t N = 1) { + return move(str, max_sz, N); +} + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif \ No newline at end of file diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8d72111374362fd839b1f612318aead5a02b8584 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp @@ -0,0 +1,27 @@ +/* + * Copyright(c) 2022 ZettaScale Technology + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CDR_SERIALIZATION_FRAGCHAIN_HPP_ +#define CDR_SERIALIZATION_FRAGCHAIN_HPP_ + +#include //size_t +#include + +// unfortunate namespace pollution from C +struct nn_rdata; + +namespace org { namespace eclipse { namespace cyclone { namespace core { namespace cdr { + +OMG_DDS_API void serdata_from_ser_copyin_fragchain (unsigned char * __restrict cursor, const struct nn_rdata* fragchain, size_t size); + +} } } } } + +#endif diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/ConditionDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/ConditionDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8215c4541111a224d46b13d52134f2d54f98e3a7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/ConditionDelegate.hpp @@ -0,0 +1,117 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_COND_CONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_COND_CONDITION_DELEGATE_HPP_ + +#include +#include +#include +#include +#include + +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +template class TCondition; +} +} +} + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + +class WaitSetDelegate; + +class OMG_DDS_API ConditionDelegate : + public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< ConditionDelegate >::ref_type + ref_type; + typedef ::dds::core::smart_ptr_traits< ConditionDelegate >::weak_ref_type + weak_ref_type; + + ConditionDelegate(); + + ~ConditionDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + virtual bool trigger_value() const = 0; + + template + void set_handler(FUN functor) + { + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + if (this->myFunctor) + { + delete this->myFunctor; + } + myFunctor = + new org::eclipse::cyclonedds::core::cond::FunctorHolder(functor); + } + + void reset_handler(); + + virtual void dispatch(); + + virtual void add_waitset( + const dds::core::cond::TCondition & cond, + org::eclipse::cyclonedds::core::cond::WaitSetDelegate *waitset); + + virtual bool remove_waitset( + org::eclipse::cyclonedds::core::cond::WaitSetDelegate *waitset); + + virtual void detach_from_waitset(const dds_entity_t entity_handle); + virtual void detach_and_close(const dds_entity_t entity_handle); + + dds::core::cond::TCondition wrapper(); + +private: + std::set waitSetList; + org::eclipse::cyclonedds::core::Mutex waitSetListUpdateMutex; + org::eclipse::cyclonedds::core::cond::FunctorHolderBase *myFunctor; +}; + +DDSCXX_WARNING_MSVC_ON(4251) + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_COND_CONDITION_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/FunctorHolder.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/FunctorHolder.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4ee6769f0e335e76749b6e3d88795bcd58a373d5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/FunctorHolder.hpp @@ -0,0 +1,80 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_COND_FUNCTOR_HOLDER_HPP_ +#define CYCLONEDDS_CORE_COND_FUNCTOR_HOLDER_HPP_ + +namespace dds +{ +namespace core +{ +namespace cond +{ +template class TCondition; +} +} +} + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +class ConditionDelegate; + +class FunctorHolderBase +{ +public: + FunctorHolderBase() { }; + + virtual ~FunctorHolderBase() { }; + + virtual void dispatch(dds::core::cond::TCondition &condition) = 0; +}; + +template +class FunctorHolder : public FunctorHolderBase +{ +public: + FunctorHolder(FUN functor) : myFunctor(functor) + { + } + + virtual ~FunctorHolder() { }; + + void dispatch(dds::core::cond::TCondition &condition) + { + myFunctor(condition); + } + +private: + FUN myFunctor; +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_COND_FUNCTOR_HOLDER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/GuardConditionDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/GuardConditionDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c9f0b86b842a2ab14a32caa41e907b057fe24b9e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/GuardConditionDelegate.hpp @@ -0,0 +1,55 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_GUARD_CONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_GUARD_CONDITION_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +class OMG_DDS_API GuardConditionDelegate : + public org::eclipse::cyclonedds::core::cond::ConditionDelegate +{ +public: + GuardConditionDelegate(); + + ~GuardConditionDelegate(); + + void close(); + + virtual bool trigger_value() const; + + void trigger_value(bool value); +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_GUARD_CONDITION_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/ShadowParticipant.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/ShadowParticipant.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1f16a4b7b8e5672cd74b7d9dfd13615ab1037917 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/ShadowParticipant.hpp @@ -0,0 +1,81 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_COND_SHADOW_PARTICIPANT_HPP_ +#define CYCLONEDDS_CORE_COND_SHADOW_PARTICIPANT_HPP_ + +#include "dds/dds.h" + +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + class ShadowParticipant { + public: + static ShadowParticipant& getInstance() + { + org::eclipse::cyclonedds::core::ScopedMutexLock scopedLock(mutex_); + + if (!instance_) { + // Create shadow participant that is used as parent entity for all waitsets + dds_entity_t ddsc_part = dds_create_participant(DDS_DOMAIN_DEFAULT, NULL, NULL); + instance_ = new ShadowParticipant(ddsc_part); + } + return *instance_; + } + + dds_entity_t get_participant() + { + return ddsc_participant_; + } + + private: + ShadowParticipant(dds_entity_t ddsc_participant) + { + this->ddsc_participant_ = ddsc_participant; + } + + ~ShadowParticipant() + { + dds_delete(this->ddsc_participant_); + } + ShadowParticipant(const ShadowParticipant&); + ShadowParticipant& operator=(const ShadowParticipant&); + + static ShadowParticipant* instance_; + static org::eclipse::cyclonedds::core::Mutex mutex_; + dds_entity_t ddsc_participant_; + }; + +} +} +} +} +} + + +#endif /* CYCLONEDDS_CORE_COND_SHADOW_PARTICIPANT_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/StatusConditionDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/StatusConditionDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..567d53eddf7bf95aeb614cf9b115ed2207cca18a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/StatusConditionDelegate.hpp @@ -0,0 +1,87 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_STATUS_CONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_STATUS_CONDITION_DELEGATE_HPP_ + +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +template class TStatusCondition; +} +} +} + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +class OMG_DDS_API StatusConditionDelegate : + public org::eclipse::cyclonedds::core::cond::ConditionDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits::ref_type + ref_type; + typedef + ::dds::core::smart_ptr_traits::weak_ref_type + weak_ref_type; + + StatusConditionDelegate( + const org::eclipse::cyclonedds::core::EntityDelegate *entity, + dds_entity_t uEntity); + + ~StatusConditionDelegate(); + + virtual void close(); + + void init(org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type weak_ref); + + void enabled_statuses(const dds::core::status::StatusMask& status); + + dds::core::status::StatusMask enabled_statuses() const; + + dds::core::Entity& entity(); + + virtual bool trigger_value() const; + + dds::core::cond::TStatusCondition wrapper(); + +private: + dds::core::Entity myEntity; +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_STATUS_CONDITION_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/WaitSetDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/WaitSetDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b642d4022b869c01296fa528c843fd62cd11266b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/cond/WaitSetDelegate.hpp @@ -0,0 +1,102 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_COND_WAITSET_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_COND_WAITSET_DELEGATE_HPP_ + +#include +#include + +#include +#include +#include +#include + +namespace dds +{ + namespace core + { + namespace cond + { + template class TWaitSet; + } + } +} + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + + class OMG_DDS_API WaitSetDelegate : + public org::eclipse::cyclonedds::core::DDScObjectDelegate + { + public: + + typedef ::dds::core::smart_ptr_traits< WaitSetDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< WaitSetDelegate >::weak_ref_type weak_ref_type; + typedef std::vector ConditionSeq; + typedef std::map ConditionMap; + + typedef std::map::iterator ConditionIterator; + + typedef std::map::const_iterator ConstConditionIterator; + + typedef std::pair ConditionEntry; + + WaitSetDelegate (); + virtual ~WaitSetDelegate (); + + void init (ObjectDelegate::weak_ref_type weak_ref); + void close (); + + ConditionSeq& wait (ConditionSeq& triggered, const dds::core::Duration& timeout); + + void dispatch (const dds::core::Duration & timeout); + + void attach_condition (const dds::core::cond::Condition & cond); + bool detach_condition (org::eclipse::cyclonedds::core::cond::ConditionDelegate * cond); + void add_condition_locked(const dds::core::cond::Condition& cond); + void remove_condition_locked(org::eclipse::cyclonedds::core::cond::ConditionDelegate *cond, + const dds_entity_t entity_handle = DDS_HANDLE_NIL); + + ConditionSeq & conditions (ConditionSeq & conds) const; + + private: + ConditionMap conditions_; + }; + +DDSCXX_WARNING_MSVC_ON(4251) + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_COND_WAITSET_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/config.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/config.hpp new file mode 100644 index 0000000000000000000000000000000000000000..23493e93b7ba6ea215823c137a8ff44695162c9d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/config.hpp @@ -0,0 +1,24 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_CONFIG_HPP_ +#define CYCLONEDDS_CORE_CONFIG_HPP_ + +#include +#include + +#endif /* CYCLONEDDS_CORE_CONFIG_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/Policy.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/Policy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..570c99913236a51713a2ed1b90c6c835031af1d0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/Policy.hpp @@ -0,0 +1,62 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_POLICY_HPP_ +#define CYCLONEDDS_CORE_POLICY_POLICY_HPP_ + + +/****************************************************************************** + * + * PROPRIETARY POLICIES + * + ******************************************************************************/ + +#include +#include + + +/* Use same macro as in dds/core/policy/CorePolicy.hpp, called OMG_DDS_POLICY_TRAITS */ +#define LITE_POLICY_TRAITS(POLICY, ID) \ + template <> \ + class policy_id { \ + public: \ + static const dds::core::policy::QosPolicyId value = ID; \ + };\ + template <> \ + class policy_name { \ + public:\ + static const std::string& name(); \ + }; + +namespace dds +{ +namespace core +{ +namespace policy +{ +template +class policy_id; +template +class policy_name; +} +} +} + + +#undef LITE_POLICY_TRAITS + +#endif /* CYCLONEDDS_CORE_POLICY_POLICY_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2e0756ec70b798076861ff001d9711ba397a64fa --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp @@ -0,0 +1,983 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_POLICY_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_POLICY_POLICY_DELEGATE_HPP_ + +#ifdef _WIN32 +#pragma warning( push ) +#pragma warning( disable : 4251 ) +#endif + +#include +#include +#include +#include +#include + +#include + +//============================================================================== +/* + * Unfortunately, there isn't an ddsc or builtin SubscriptionKey policy that + * is alligned the same as the idl representation. To be able to translate it + * as well, we have to seperately mention it... + */ +struct _DDS_SubscriptionKeyQosPolicy; + + +//============================================================================== +// DDS Policy Classes +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace policy +{ + +//============================================================================== + +class OMG_DDS_API TimeBasedFilterDelegate; + +/** + * @internal This policy is useful for cases where a Topic is expected to have each + * instance updated periodically. On the publishing side this setting + * establishes a contract that the application must meet. On the subscribing + * side the setting establishes a minimum requirement for the remote publishers + * that are expected to supply the data values. When the Service matches a + * DataWriter and a DataReader it checks whether the settings are compatible + * (i.e., offered deadline period<= requested deadline period) if they are not, + * the two entities are informed (via the listener or condition mechanism) + * of the incompatibility of the QoS settings and communication will not occur. + * Assuming that the reader and writer ends have compatible settings, the + * fulfillment of this contract is monitored by the Service and the application + * is informed of any violations by means of the proper listener or condition. + * The value offered is considered compatible with the value requested if and + * only if the inequality offered deadline period <= requested deadline period + * evaluates to TRUE. The setting of the DEADLINE policy must be set + * consistently with that of the TIME_BASED_FILTER. + * For these two policies to be consistent the settings must be such that + * deadline period>= minimum_separation. + */ +class OMG_DDS_API DeadlineDelegate +{ +public: + DeadlineDelegate(const DeadlineDelegate& other); + explicit DeadlineDelegate(const dds::core::Duration& d); + + DeadlineDelegate& operator=(const DeadlineDelegate& other) = default; + + void period(const dds::core::Duration& d); + dds::core::Duration period() const; + + bool operator ==(const DeadlineDelegate& other) const; + + void check() const; + void check_against(const org::eclipse::cyclonedds::core::policy::TimeBasedFilterDelegate& filter) const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration period_; +}; + +//============================================================================== + +class OMG_DDS_API DestinationOrderDelegate +{ + +public: + DestinationOrderDelegate(const DestinationOrderDelegate& other); + explicit DestinationOrderDelegate(dds::core::policy::DestinationOrderKind::Type kind); + + DestinationOrderDelegate& operator=(const DestinationOrderDelegate& other) = default; + + void kind(dds::core::policy::DestinationOrderKind::Type kind); + dds::core::policy::DestinationOrderKind::Type kind() const; + + bool operator ==(const DestinationOrderDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::DestinationOrderKind::Type kind_; +}; + +//============================================================================== + +class OMG_DDS_API DurabilityDelegate +{ +public: + DurabilityDelegate(const DurabilityDelegate& other); + explicit DurabilityDelegate(dds::core::policy::DurabilityKind::Type kind); + + DurabilityDelegate& operator=(const DurabilityDelegate& other) = default; + + void kind(dds::core::policy::DurabilityKind::Type kind); + dds::core::policy::DurabilityKind::Type kind() const; + + bool operator ==(const DurabilityDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +public: + dds::core::policy::DurabilityKind::Type kind_; +}; + +//============================================================================== + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + +class OMG_DDS_API DurabilityServiceDelegate +{ +public: + DurabilityServiceDelegate(const DurabilityServiceDelegate& other); + DurabilityServiceDelegate(const dds::core::Duration& service_cleanup_delay, + dds::core::policy::HistoryKind::Type history_kind, + int32_t history_depth, + int32_t max_samples, + int32_t max_instances, + int32_t max_samples_per_instance); + + DurabilityServiceDelegate& operator=(const DurabilityServiceDelegate& other) = default; + + void service_cleanup_delay(const dds::core::Duration& d); + const dds::core::Duration service_cleanup_delay() const; + + void history_kind(dds::core::policy::HistoryKind::Type kind); + dds::core::policy::HistoryKind::Type history_kind() const; + + void history_depth(int32_t depth); + int32_t history_depth() const; + + void max_samples(int32_t max_samples); + int32_t max_samples() const; + + void max_instances(int32_t max_instances); + int32_t max_instances() const; + + void max_samples_per_instance(int32_t max_samples_per_instance); + int32_t max_samples_per_instance() const; + + bool operator ==(const DurabilityServiceDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration cleanup_delay_; + dds::core::policy::HistoryKind::Type history_kind_; + int32_t history_depth_; + int32_t max_samples_; + int32_t max_instances_; + int32_t max_samples_per_instance_; +}; + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + +//============================================================================== + +/** + * @internal This policy controls the behavior of the Entity as a factory for other + * entities. This policy concerns only DomainParticipant (as factory for + * Publisher, Subscriber, and Topic), Publisher (as factory for DataWriter), + * and Subscriber (as factory for DataReader). This policy is mutable. + * A change in the policy affects only the entities created after the change; + * not the previously created entities. + * The setting of autoenable_created_entities to TRUE indicates that the + * newly created object will be enabled by default. + * A setting of FALSE indicates that the Entity will not be automatically + * enabled. The application will need to enable it explicitly by means of the + * enable operation (see Section 7.1.2.1.1.7, enable). The default setting + * of autoenable_created_entities = TRUE means that, by default, it is not + * necessary to explicitly call enable on newly created entities. + */ +class OMG_DDS_API EntityFactoryDelegate +{ +public: + EntityFactoryDelegate(const EntityFactoryDelegate& other); + explicit EntityFactoryDelegate(bool auto_enable); + + void auto_enable(bool on); + bool auto_enable() const; + + bool operator ==(const EntityFactoryDelegate& other) const; + + EntityFactoryDelegate& operator =(const EntityFactoryDelegate& other) = default; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + bool auto_enable_; +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to allow the application to attach additional + * information to the created Publisher or Subscriber. + * The value of the GROUP_DATA is available to the application on the + * DataReader and DataWriter entities and is propagated by means of the + * built-in topics. This QoS can be used by an application combination with + * the DataReaderListener and DataWriterListener to implement matching policies + * similar to those of the PARTITION QoS except the decision can be made based + * on an application-defined policy. + */ +class OMG_DDS_API GroupDataDelegate +{ +public: + /** + * @internal Create a GroupData instance. + */ + GroupDataDelegate(); + + /** + * @internal Create a GroupData instance. + * + * @param other the group data to copy + */ + GroupDataDelegate(const GroupDataDelegate& other); + + /** + * @internal Copies a GroupData instance. + * + * @param other the group data to copy + * + * @return reference to the instance which was copied to + */ + GroupDataDelegate& operator=(const GroupDataDelegate& other) = default; + + /** + * @internal Create a GroupData instance. + * + * @param seq the group data value + */ + explicit GroupDataDelegate(const dds::core::ByteSeq& seq); + + /** + * @internal Set the value for this GroupData + * + * @param seq the group data value + */ + void value(const dds::core::ByteSeq& seq); + + /** + * @internal Get the value for this GroupData + * + * @return the group data value + */ + const dds::core::ByteSeq& value() const; + + bool operator ==(const GroupDataDelegate& other) const; + + /** + * @internal Check if policy is consistent. + */ + void check() const; + + /** + * @internal Set internals by the ddsc policy. + * + * @param qos the ddsc policy + */ + void set_iso_policy(const dds_qos_t* qos); + /** + * @internal Set internals by the ddsc policy. + * + * @param the ddsc policy + */ + //@todo void v_policy(const v_builtinGroupDataPolicy& policy); + + /** + * @internal Get the ddsc policy representation. + * + * @param qos the ddsc policy + */ + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::ByteSeq value_; +}; + +//============================================================================== + +class OMG_DDS_API ResourceLimitsDelegate; + +class OMG_DDS_API HistoryDelegate +{ +public: + HistoryDelegate(const HistoryDelegate& other); + HistoryDelegate(dds::core::policy::HistoryKind::Type kind, int32_t depth); + + HistoryDelegate& operator=(const HistoryDelegate& other) = default; + + dds::core::policy::HistoryKind::Type kind() const; + void kind(dds::core::policy::HistoryKind::Type kind); + + int32_t depth() const; + void depth(int32_t depth); + + bool operator ==(const HistoryDelegate& other) const; + + void check() const; + void check_against(const org::eclipse::cyclonedds::core::policy::ResourceLimitsDelegate& limits) const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::HistoryKind::Type kind_; + int32_t depth_; +}; + +//============================================================================== + +class OMG_DDS_API LatencyBudgetDelegate +{ +public: + LatencyBudgetDelegate(const LatencyBudgetDelegate& other); + explicit LatencyBudgetDelegate(const dds::core::Duration& d); + + LatencyBudgetDelegate& operator=(const LatencyBudgetDelegate& other) = default; + + void duration(const dds::core::Duration& d); + const dds::core::Duration duration() const; + + bool operator ==(const LatencyBudgetDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration duration_; +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to avoid delivering stale data to the + * application. Each data sample written by the DataWriter has an associated + * expiration time beyond which the data should not be delivered to any + * application. Once the sample expires, the data will be removed from the + * DataReader caches as well as from the transient and persistent + * information caches. The expiration time of each sample is computed by + * adding the duration specified by the LIFESPAN QoS to the source timestamp. + * As described in Section 7.1.2.4.2.11, write and Section 7.1.2.4.2.12, + * write_w_timestamp the source timestamp is either automatically computed by + * the Service each time the DataWriter write operation is called, or else + * supplied by the application by means of the write_w_timestamp operation. + * + * This QoS relies on the sender and receiving applications having their clocks + * sufficiently synchronized. If this is not the case and the Service can + * detect it, the DataReader is allowed to use the reception timestamp instead + * of the source timestamp in its computation of the expiration time. + */ +class OMG_DDS_API LifespanDelegate +{ +public: + LifespanDelegate(const LifespanDelegate& other); + explicit LifespanDelegate(const dds::core::Duration& d); + LifespanDelegate& operator=(const LifespanDelegate& other) = default; + + void duration(const dds::core::Duration& d); + const dds::core::Duration duration() const; + + bool operator ==(const LifespanDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration duration_; +}; + +//============================================================================== + +class OMG_DDS_API LivelinessDelegate +{ +public: +public: + LivelinessDelegate(const LivelinessDelegate& other); + LivelinessDelegate(dds::core::policy::LivelinessKind::Type kind, + dds::core::Duration lease_duration); + + LivelinessDelegate& operator=(const LivelinessDelegate& other) = default; + + void kind(dds::core::policy::LivelinessKind::Type kind); + dds::core::policy::LivelinessKind::Type kind() const; + + void lease_duration(const dds::core::Duration& lease_duration); + const dds::core::Duration lease_duration() const; + + bool operator ==(const LivelinessDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::LivelinessKind::Type kind_; + dds::core::Duration lease_duration_; +}; + +//============================================================================== + +class OMG_DDS_API OwnershipDelegate +{ +public: + OwnershipDelegate(const OwnershipDelegate& other); + explicit OwnershipDelegate(dds::core::policy::OwnershipKind::Type kind); + OwnershipDelegate& operator=(const OwnershipDelegate& other) = default; + + void kind(dds::core::policy::OwnershipKind::Type kind); + dds::core::policy::OwnershipKind::Type kind() const; + + bool operator ==(const OwnershipDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::OwnershipKind::Type kind_; +}; + +//============================================================================== + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + +class OMG_DDS_API OwnershipStrengthDelegate +{ +public: + OwnershipStrengthDelegate(const OwnershipStrengthDelegate& other); + explicit OwnershipStrengthDelegate(int32_t s); + + OwnershipStrengthDelegate& operator=(const OwnershipStrengthDelegate& other) = default; + + int32_t strength() const; + void strength(int32_t s); + + bool operator ==(const OwnershipStrengthDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + int32_t strength_; +}; + +#endif // OMG_DDS_OWNERSHIP_SUPPORT + +//============================================================================== + +class OMG_DDS_API PartitionDelegate +{ +public: + PartitionDelegate(const PartitionDelegate& other); + explicit PartitionDelegate(const std::string& partition); + explicit PartitionDelegate(const dds::core::StringSeq& partitions); + + PartitionDelegate& operator=(const PartitionDelegate& other) = default; + + void name(const std::string& partition); + void name(const dds::core::StringSeq& partitions); + const dds::core::StringSeq& name() const; + + bool operator ==(const PartitionDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + //@todo void v_policy(const v_builtinPartitionPolicy& policy); + + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::StringSeq name_; +}; + +//============================================================================== + +class OMG_DDS_API PresentationDelegate +{ +public: + PresentationDelegate(const PresentationDelegate& other); + PresentationDelegate(dds::core::policy::PresentationAccessScopeKind::Type access_scope, + bool coherent_access, + bool ordered_access); + PresentationDelegate& operator=(const PresentationDelegate& other) = default; + + void access_scope(dds::core::policy::PresentationAccessScopeKind::Type as); + dds::core::policy::PresentationAccessScopeKind::Type access_scope() const; + + void coherent_access(bool on); + bool coherent_access() const; + + void ordered_access(bool on); + bool ordered_access() const; + + bool operator ==(const PresentationDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::PresentationAccessScopeKind::Type access_scope_; + bool coherent_access_; + bool ordered_access_; +}; + +//============================================================================== + +class OMG_DDS_API ReaderDataLifecycleDelegate +{ +public: + ReaderDataLifecycleDelegate(const ReaderDataLifecycleDelegate& other); + ReaderDataLifecycleDelegate(const dds::core::Duration& nowriter_delay, + const dds::core::Duration& disposed_samples_delay); + + const dds::core::Duration autopurge_nowriter_samples_delay() const; + void autopurge_nowriter_samples_delay(const dds::core::Duration& d); + + const dds::core::Duration autopurge_disposed_samples_delay() const; + void autopurge_disposed_samples_delay(const dds::core::Duration& d); + + bool operator ==(const ReaderDataLifecycleDelegate& other) const; + + ReaderDataLifecycleDelegate& operator =(const ReaderDataLifecycleDelegate& other) = default; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration autopurge_nowriter_samples_delay_; + dds::core::Duration autopurge_disposed_samples_delay_; +}; + +//============================================================================== + +class OMG_DDS_API ReaderLifespanDelegate +{ +public: + ReaderLifespanDelegate(const ReaderLifespanDelegate& other); + explicit ReaderLifespanDelegate(bool used, + const dds::core::Duration& d); + + void duration(const dds::core::Duration& d); + const dds::core::Duration duration() const; + + void used(bool v); + bool used() const; + + bool operator ==(const ReaderLifespanDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + bool used_; + dds::core::Duration duration_; +}; + +//============================================================================== + +class OMG_DDS_API ReliabilityDelegate +{ +public: +public: + ReliabilityDelegate(const ReliabilityDelegate& other); + ReliabilityDelegate(dds::core::policy::ReliabilityKind::Type kind, + const dds::core::Duration& max_blocking_time); + + ReliabilityDelegate& operator=(const ReliabilityDelegate& other) = default; + + void kind(dds::core::policy::ReliabilityKind::Type kind); + dds::core::policy::ReliabilityKind::Type kind() const; + + void max_blocking_time(const dds::core::Duration& d); + const dds::core::Duration max_blocking_time() const; + + bool operator ==(const ReliabilityDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::ReliabilityKind::Type kind_; + dds::core::Duration max_blocking_time_; +}; + +//============================================================================== + +class OMG_DDS_API ResourceLimitsDelegate +{ +public: + ResourceLimitsDelegate(const ResourceLimitsDelegate& other); + ResourceLimitsDelegate(int32_t max_samples, + int32_t max_instances, + int32_t max_samples_per_instance); + + ResourceLimitsDelegate& operator=(const ResourceLimitsDelegate& other) = default; + + void max_samples(int32_t samples); + int32_t max_samples() const; + + void max_instances(int32_t max_instances); + int32_t max_instances() const; + + void max_samples_per_instance(int32_t max_samples_per_instance); + int32_t max_samples_per_instance() const; + + bool operator ==(const ResourceLimitsDelegate& other) const; + + void check() const; + void check_against(const org::eclipse::cyclonedds::core::policy::HistoryDelegate& history) const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + int32_t max_samples_; + int32_t max_instances_; + int32_t max_samples_per_instance_; +}; + +//============================================================================== + +class OMG_DDS_API TimeBasedFilterDelegate +{ +public: + TimeBasedFilterDelegate(const TimeBasedFilterDelegate& other); + explicit TimeBasedFilterDelegate(const dds::core::Duration& min_separation); + TimeBasedFilterDelegate& operator=(const TimeBasedFilterDelegate& other) = default; + + void min_separation(const dds::core::Duration& ms); + const dds::core::Duration min_separation() const; + + bool operator ==(const TimeBasedFilterDelegate& other) const; + + void check() const; + void check_against(const org::eclipse::cyclonedds::core::policy::DeadlineDelegate& deadline) const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration min_sep_; +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to allow the application to attach additional + * information to the created Topic such that when a remote application + * discovers their existence it can examine the information and use it in + * an application-defined way. In combination with the listeners on the + * DataReader and DataWriter as well as by means of operations such as + * ignore_topic, these QoS can assist an application to extend the provided QoS. + */ +class OMG_DDS_API TopicDataDelegate +{ +public: + TopicDataDelegate(); + TopicDataDelegate(const TopicDataDelegate& other); + explicit TopicDataDelegate(const dds::core::ByteSeq& seq); + + TopicDataDelegate& operator=(const TopicDataDelegate& other) = default; + + void value(const dds::core::ByteSeq& seq); + const dds::core::ByteSeq& value() const; + + bool operator ==(const TopicDataDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + //@todo void v_policy(const v_builtinTopicDataPolicy& policy); + + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::ByteSeq value_; + +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to allow the application to take advantage of + * transports capable of sending messages with different priorities. + * This policy is considered a hint. The policy depends on the ability of the + * underlying transports to set a priority on the messages they send. + * Any value within the range of a 32-bit signed integer may be chosen; + * higher values indicate higher priority. However, any further interpretation + * of this policy is specific to a particular transport and a particular + * implementation of the Service. For example, a particular transport is + * permitted to treat a range of priority values as equivalent to one another. + * It is expected that during transport configuration the application would + * provide a mapping between the values of the TRANSPORT_PRIORITY set on + * DataWriter and the values meaningful to each transport. This mapping would + * then be used by the infrastructure when propagating the data written by + * the DataWriter. + */ +class OMG_DDS_API TransportPriorityDelegate +{ +public: + TransportPriorityDelegate(const TransportPriorityDelegate& other); + TransportPriorityDelegate& operator=(const TransportPriorityDelegate& other) = default; + explicit TransportPriorityDelegate(int32_t prio); + + void value(int32_t prio); + int32_t value() const; + + bool operator ==(const TransportPriorityDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + int32_t value_; +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to allow the application to attach additional + * information to the created Entity objects such that when a remote application + * discovers their existence it can access that information and use it for its + * own purposes. One possible use of this QoS is to attach security credentials + * or some other information that can be used by the remote application to + * authenticate the source. In combination with operations such as + * ignore_participant, ignore_publication, ignore_subscription, + * and ignore_topic these QoS can assist an application to define and enforce + * its own security policies. The use of this QoS is not limited to security, + * rather it offers a simple, yet flexible extensibility mechanism. + */ +class OMG_DDS_API UserDataDelegate +{ +public: + /** + * @internal Create a UserData instance with an empty user data. + */ + UserDataDelegate(); + + /** + * @internal Create a UserData instance. + * + * @param other the user data to copy + */ + UserDataDelegate(const UserDataDelegate& other); + + /** + * @internal Copies a UserData instance. + * + * @param other the user data to copy + * + * @return reference to the instance that was copied to + */ + UserDataDelegate& operator=(const UserDataDelegate& other) = default; + + /** + * @internal Create a UserData instance. + * + * @param seq the sequence of octet representing the user data + */ + explicit UserDataDelegate(const dds::core::ByteSeq& seq); + + /** + * @internal Set the value for the user data. + * + * @param seq a sequence of octet representing the user data. + */ + void value(const dds::core::ByteSeq& seq); + + /** + * @internal Get the user data. + * + * @return the sequence of octet representing the user data + */ + const dds::core::ByteSeq value() const; + + bool operator ==(const UserDataDelegate& other) const; + + /** + * @internal Check if policy is consistent. + */ + void check() const; + + /** + * @internal Set internals by the ddsc policy. + * + * @param qos the ddsc policy + */ + void set_iso_policy(const dds_qos_t* qos); + /** + * @internal Set internals by the ddsc policy. + * + * @param the ddsc policy + */ + //@todo void v_policy(const v_builtinUserDataPolicy& policy); + /** + * @internal Get the ddsc policy representation. + */ + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::ByteSeq value_; +}; + +//============================================================================== + +class OMG_DDS_API WriterDataLifecycleDelegate +{ +public: + WriterDataLifecycleDelegate(const WriterDataLifecycleDelegate& other); + explicit WriterDataLifecycleDelegate(bool autodispose); + + bool autodispose() const; + void autodispose(bool b); + + bool operator ==(const WriterDataLifecycleDelegate& other) const; + + WriterDataLifecycleDelegate& operator =(const WriterDataLifecycleDelegate& other) = default; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + bool autodispose_; +}; + + + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +class OMG_DDS_API DataRepresentationDelegate +{ +public: + DataRepresentationDelegate(const DataRepresentationDelegate& other); + explicit DataRepresentationDelegate(const dds::core::policy::DataRepresentationIdSeq& value); + DataRepresentationDelegate& operator=(const DataRepresentationDelegate& other) = default; + + void value(const dds::core::policy::DataRepresentationIdSeq &value); + const dds::core::policy::DataRepresentationIdSeq& value() const; + + bool operator ==(const DataRepresentationDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::DataRepresentationIdSeq value_; +}; + +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +class OMG_DDS_API TypeConsistencyEnforcementDelegate { +public: + TypeConsistencyEnforcementDelegate(const TypeConsistencyEnforcementDelegate& other); + explicit TypeConsistencyEnforcementDelegate(dds::core::policy::TypeConsistencyKind kind, + bool ignore_sequence_bounds, + bool ignore_string_bounds, + bool ignore_member_names, + bool prevent_type_widening, + bool force_type_validation); + TypeConsistencyEnforcementDelegate& operator=(const TypeConsistencyEnforcementDelegate& other) = default; + + void kind(dds::core::policy::TypeConsistencyKind kind); + dds::core::policy::TypeConsistencyKind kind() const; + + void ignore_sequence_bounds(bool ignore_sequence_bounds); + bool ignore_sequence_bounds() const; + + void ignore_string_bounds(bool ignore_string_bounds); + bool ignore_string_bounds() const; + + void ignore_member_names(bool ignore_member_names); + bool ignore_member_names() const; + + void prevent_type_widening(bool prevent_type_widening); + bool prevent_type_widening() const; + + void force_type_validation(bool force_type_validation); + bool force_type_validation() const; + + bool operator ==(const TypeConsistencyEnforcementDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::TypeConsistencyKind kind_; + bool ignore_sequence_bounds_; + bool ignore_string_bounds_; + bool ignore_member_names_; + bool prevent_type_widening_; + bool force_type_validation_; +}; + +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +} +} +} +} +} // namespace org::eclipse::cyclonedds::core::policy + +#endif /* CYCLONEDDS_CORE_POLICY_POLICY_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/ProprietaryPolicyKind.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/ProprietaryPolicyKind.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bfdb9b18f96ea1d1367cb7e5e62e5e739a0b2048 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/ProprietaryPolicyKind.hpp @@ -0,0 +1,76 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_PROPRIETARYPOLICYKIND_HPP_ +#define CYCLONEDDS_CORE_POLICY_PROPRIETARYPOLICYKIND_HPP_ + + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace policy +{ + +/* + * Proprietary policy values + */ +struct InvalidSampleVisibility_def +{ + enum Type + { + NO_INVALID_SAMPLES, + MINIMUM_INVALID_SAMPLES, + ALL_INVALID_SAMPLES + }; +}; +typedef dds::core::safe_enum InvalidSampleVisibility; + +struct SchedulingKind_def +{ + enum Type + { + SCHEDULE_DEFAULT, + SCHEDULE_TIMESHARING, + SCHEDULE_REALTIME + }; +}; +typedef dds::core::safe_enum SchedulingKind; + +struct SchedulingPriorityKind_def +{ + enum Type + { + PRIORITY_RELATIVE, + PRIORITY_ABSOLUTE + }; +}; +typedef dds::core::safe_enum SchedulingPriorityKind; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_POLICY_PROPRIETARYPOLICYKIND_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/QosPolicyCountDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/QosPolicyCountDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8a6e333d1ad6f45537fa26253aeef5d2278e98e5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/QosPolicyCountDelegate.hpp @@ -0,0 +1,86 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_QOS_POLICY_COUNT_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_POLICY_QOS_POLICY_COUNT_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace policy +{ + +class QosPolicyCountDelegate +{ +public: + QosPolicyCountDelegate(dds::core::policy::QosPolicyId id, int32_t count) + : policy_id_(id), + count_(count) + { } + + QosPolicyCountDelegate(const QosPolicyCountDelegate& other) + : policy_id_(other.policy_id()), + count_(other.count()) + { } + + QosPolicyCountDelegate& operator=(const QosPolicyCountDelegate& other) = default; + +public: + dds::core::policy::QosPolicyId policy_id() const + { + return policy_id_; + } + void policy_id(dds::core::policy::QosPolicyId id) + { + policy_id_ = id; + } + + int32_t count() const + { + return count_; + } + void count(int32_t c) + { + count_ = c; + } + + bool operator ==(const QosPolicyCountDelegate& other) const + { + return other.policy_id_ == policy_id_ && + other.count_ == count_; + } + + +private: + dds::core::policy::QosPolicyId policy_id_; + int32_t count_; +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_POLICY_QOS_POLICY_COUNT_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/TPolicy.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/TPolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..897b607f3aa285cc3301ae5e0be216a677c9fab4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/policy/TPolicy.hpp @@ -0,0 +1,468 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_TPOLICY_HPP_ +#define CYCLONEDDS_CORE_POLICY_TPOLICY_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace policy +{ + + +/** + */ +template +class TShare : public dds::core::Value +{ +public: + /** + * Creates a Share QoS instance + */ + TShare() { } + + /** + * Creates a Share QoS instance + * + * @param name the name + * @param enable state + */ + TShare(const std::string& name, bool enable) : dds::core::Value(name, enable) { } + + /** + * Copies a Share QoS instance + * + * @param other the TShare QoS instance to copy + */ + TShare(const TShare& other) : dds::core::Value(other.delegate()) { } + +public: + /** + * Sets the name + * + * @param name the name + */ + TShare& name(const std::string& name) + { + this->delegate().name(name); + return *this; + } + + /** + * Gets the name + * + * @return the name + */ + std::string name() const + { + return this->delegate().name(); + } + + /** + * Sets enable state + * + * @param enable state + */ + TShare& enable(bool enable) + { + this->delegate().enable(enable); + return *this; + } + + /** + * Gets enable state + * + * @return enable state + */ + bool enable() const + { + return this->delegate().enable(); + } +}; + + + + +template +class TProductData : public dds::core::Value +{ +public: + /** + * Creates a ProductData QoS instance + */ + TProductData() { } + + /** + * Creates a ProductData QoS instance + * + * @param name the name + */ + TProductData(const std::string& name) : dds::core::Value(name) { } + + /** + * Copies a ProductData QoS instance + * + * @param other the TProductData QoS instance to copy + */ + TProductData(const TProductData& other) : dds::core::Value(other.delegate()) { } + +public: + /** + * Sets the name + * + * @param name the name to set + */ + TProductData& name(const std::string& name) + { + this->delegate().name(name); + return *this; + } + + /** + * Gets the name + * + * @return the name + */ + std::string name() const + { + return this->delegate().name(); + } +}; + + +template +class TSubscriptionKey : public dds::core::Value +{ +public: + /** + * Creates a SubscriptionKey QoS instance + */ + TSubscriptionKey() { } + + /** + * Creates a SubscriptionKey QoS instance + * + * @param use_key_list use the key list or not + * @param key a single key + */ + explicit TSubscriptionKey(bool use_key_list, const std::string& key) : + dds::core::Value(use_key_list, key) { } + + /** + * Creates a SubscriptionKey QoS instance + * + * @param use_key_list use the key list or not + * @param keys a sequence containing multiple keys + */ + explicit TSubscriptionKey(bool use_key_list, const dds::core::StringSeq& keys) : + dds::core::Value(use_key_list, keys) { } + + + /** + * Copies a SubscriptionKey QoS instance + * + * @param other the TSubscriptionKey QoS instance to copy + */ + TSubscriptionKey(const TSubscriptionKey& other) : + dds::core::Value(other.delegate()) { } + +public: + /** + * Sets the key + * + * @param key the key + */ + TSubscriptionKey& key(const std::string& key) + { + this->delegate().key(key); + return *this; + } + + /** + * Sets multiple keys + * + * @param keys a sequence containing multiple keys + */ + TSubscriptionKey& key(const dds::core::StringSeq& keys) + { + this->delegate().key(keys); + return *this; + } + + /** + * Gets the keys + * + * @return a sequence containing the keys + */ + const dds::core::StringSeq key() const + { + return this->delegate().key(); + } + + /** + * Sets use_key_list state + * + * @param use_key_list state + */ + TSubscriptionKey& use_key_list(bool use_key_list) + { + this->delegate().use_key_list(use_key_list); + return *this; + } + + /** + * Gets use_key_list state + * + * @return use_key_list state + */ + bool use_key_list() const + { + return this->delegate().use_key_list(); + } +}; + +template +class TReaderLifespan : public dds::core::Value +{ +public: + /** + * Creates a ReaderLifespan QoS instance + */ + TReaderLifespan() { } + + /** + * Creates a ReaderLifespan QoS instance + * + * @param used Indicates ReaderLifespan is used + * @param duration ReaderLifespan expiration duration + */ + explicit TReaderLifespan(bool used, const dds::core::Duration& duration) : + dds::core::Value(used, duration) { } + + /** + * Copies a Lifespan QoS instance + * + * @param other the Lifespan QoS instance to copy + */ + TReaderLifespan(const TReaderLifespan& other) : + dds::core::Value(other.delegate()) { } + + +public: + /** + * Sets the used flag + * + * @param used the state of the flag to set + */ + TReaderLifespan& used(bool used) + { + this->delegate().used(used); + return *this; + } + + /** + * Gets the used flag + * + * @return true if used + */ + bool used() const + { + return this->delegate().used(); + } + + /** + * Sets the expiration duration + * + * @param duration expiration duration + */ + TReaderLifespan& duration(const dds::core::Duration& duration) + { + this->delegate().duration(duration); + return *this; + } + + /** + * Gets the expiration duration + * + * @return expiration duration + */ + const dds::core::Duration duration() const + { + return this->delegate().duration(); + } +}; + + + + +/** + * Base scheduling class + */ +template +class TScheduling : public dds::core::Value +{ +public: + /** + * Creates a Scheduling QoS instance + */ + TScheduling() { } + + /** + * Creates a Scheduling QoS instance + * + * @param scheduling_kind the scheduling kind + * @param scheduling_priority_kind the scheduling priority kind + * @param scheduling_priority the scheduling priority + */ + TScheduling(const org::eclipse::cyclonedds::core::policy::SchedulingKind::Type& scheduling_kind, + const org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind, + int32_t scheduling_priority) + : dds::core::Value(scheduling_kind, scheduling_priority_kind, scheduling_priority) + { + } + + /** + * Copies a Scheduling QoS instance + * + * @param other the TProductData QoS instance to copy + */ + TScheduling(const TScheduling& other) + : dds::core::Value(other.delegate()) + { + } + +public: + /** + * Sets the scheduling kind + * + * @param scheduling_kind the scheduling_kind + */ + TScheduling& scheduling_kind(const org::eclipse::cyclonedds::core::policy::SchedulingKind::Type& scheduling_kind) + { + this->delegate().scheduling_kind(scheduling_kind); + return *this; + } + + /** + * Gets the scheduling kind + * + * @return the scheduling_kind + */ + org::eclipse::cyclonedds::core::policy::SchedulingKind::Type scheduling_kind() const + { + return this->delegate().scheduling_kind(); + } + + /** + * Sets the scheduling priority kind + * + * @param scheduling_priority_kind the scheduling_priority_kind + */ + TScheduling& scheduling_kind(const org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind) + { + this->delegate().scheduling_priority_kind(scheduling_priority_kind); + return *this; + } + + /** + * Gets the scheduling priority kind + * + * @return the scheduling_priority_kind + */ + org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type scheduling_priority_kind() const + { + return this->delegate().scheduling_priority_kind(); + } + + /** + * Sets the scheduling priority + * + * @param scheduling_priority the scheduling_priority + */ + TScheduling& scheduling_priority(int32_t scheduling_priority) + { + this->delegate().scheduling_priority(scheduling_priority); + return *this; + } + + /** + * Gets the scheduling priority + * + * @return the scheduling_priority + */ + int32_t scheduling_priority() const + { + return this->delegate().scheduling_priority(); + } +}; + + +/** + * Listener specific scheduling class + */ +template +class TListenerScheduling : public org::eclipse::cyclonedds::core::policy::TScheduling +{ +public: + /** + * Creates a ListenerScheduling QoS instance + */ + TListenerScheduling() { } + explicit TListenerScheduling(const org::eclipse::cyclonedds::core::policy::SchedulingKind::Type& scheduling_kind, + const org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind, + int32_t scheduling_priority) + : org::eclipse::cyclonedds::core::policy::TScheduling(scheduling_kind, scheduling_priority_kind, scheduling_priority) + { + } +}; + + +/** + * Watchdog specific scheduling class + */ +template +class TWatchdogScheduling : public org::eclipse::cyclonedds::core::policy::TScheduling +{ +public: + /** + * Creates a WatchdogScheduling QoS instance + */ + TWatchdogScheduling() { } + explicit TWatchdogScheduling(const org::eclipse::cyclonedds::core::policy::SchedulingKind::Type& scheduling_kind, + const org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind, + int32_t scheduling_priority) + : org::eclipse::cyclonedds::core::policy::TScheduling(scheduling_kind, scheduling_priority_kind, scheduling_priority) + { + } +}; + + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_POLICY_TPOLICY_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/status/StatusDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/status/StatusDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4c399c3e63798f7c9e76a089a9fd8bebfb53c502 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/status/StatusDelegate.hpp @@ -0,0 +1,813 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_STATUS_STATUS_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_STATUS_STATUS_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class InconsistentTopicStatusDelegate +{ +public: + InconsistentTopicStatusDelegate() : total_count_(0), total_count_change_(0) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + bool operator ==(const InconsistentTopicStatusDelegate& other) const + { + return other.total_count() == total_count_ ; + } + +public: + void ddsc_status(const dds_inconsistent_topic_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + } + +protected: + int32_t total_count_; + int32_t total_count_change_; +}; + + +class SampleLostStatusDelegate +{ +public: + SampleLostStatusDelegate() : total_count_(0), total_count_change_(0) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + bool operator ==(const SampleLostStatusDelegate& other) const + { + return other.total_count() == total_count_; + } + +public: + void ddsc_status(const dds_sample_lost_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + } + +protected: + int32_t total_count_; + int32_t total_count_change_; +}; + +class SampleRejectedStatusDelegate +{ +public: + SampleRejectedStatusDelegate() + : total_count_(0), + total_count_change_(0), + last_reason_(dds::core::status::SampleRejectedState::not_rejected()), + last_instance_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + dds::core::status::SampleRejectedState last_reason() const + { + return last_reason_; + } + + const dds::core::InstanceHandle last_instance_handle() const + { + return last_instance_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_reason(dds::core::status::SampleRejectedState last_reason) + { + last_reason_ = last_reason; + } + + void last_instance_handle(dds::core::InstanceHandle last_instance_handle) + { + last_instance_handle_ = last_instance_handle; + } + + bool operator ==(const SampleRejectedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_reason() == last_reason_ && + other.last_instance_handle() == last_instance_handle_; + } + +public: + void ddsc_status(const dds_sample_rejected_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + switch (from->last_reason) { + case DDS_NOT_REJECTED: + last_reason_ = dds::core::status::SampleRejectedState::not_rejected(); + break; + case DDS_REJECTED_BY_INSTANCES_LIMIT: + last_reason_ = dds::core::status::SampleRejectedState::rejected_by_instances_limit(); + break; + case DDS_REJECTED_BY_SAMPLES_LIMIT: + last_reason_ = dds::core::status::SampleRejectedState::rejected_by_samples_limit(); + break; + case DDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT: + last_reason_ = dds::core::status::SampleRejectedState::rejected_by_samples_per_instance_limit(); + break; + default: + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Invalid SampleRejectedStatus::last_reason from ddsc"); + break; + } + last_instance_handle_ = dds::core::InstanceHandle(from->last_instance_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::status::SampleRejectedState last_reason_; + dds::core::InstanceHandle last_instance_handle_; +}; + + +class LivelinessLostStatusDelegate +{ +public: + LivelinessLostStatusDelegate() : total_count_(0), total_count_change_(0) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + bool operator ==(const LivelinessLostStatusDelegate& other) const + { + return other.total_count() == total_count_; + } + +public: + void ddsc_status(const dds_liveliness_lost_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + } + +protected: + int32_t total_count_; + int32_t total_count_change_; +}; + + +class LivelinessChangedStatusDelegate +{ +public: + LivelinessChangedStatusDelegate() : + alive_count_(0), + not_alive_count_(0), + alive_count_change_(0), + not_alive_count_change_(0), + last_publication_handle_(dds::core::null) { } + +public: + + int32_t alive_count() const + { + return alive_count_; + } + + int32_t not_alive_count() const + { + return not_alive_count_; + } + + int32_t alive_count_change() const + { + return alive_count_change_; + } + + int32_t not_alive_count_change() const + { + return not_alive_count_change_; + } + + void alive_count(int32_t alive_count) + { + alive_count_ = alive_count; + } + + void not_alive_count(int32_t not_alive_count) + { + not_alive_count_ = not_alive_count; + } + + void alive_count_change(int32_t alive_count_change) + { + alive_count_change_ = alive_count_change; + } + + void not_alive_count_change(int32_t not_alive_count_change) + { + not_alive_count_change_ = not_alive_count_change; + } + + void last_publication_handle(dds::core::InstanceHandle last_publication_handle) + { + last_publication_handle_ = last_publication_handle; + } + + dds::core::InstanceHandle last_publication_handle() const + { + return last_publication_handle_; + } + + bool operator ==(const LivelinessChangedStatusDelegate& other) const + { + return other.alive_count() == alive_count_ && + other.not_alive_count() == not_alive_count_; + } + +public: + void ddsc_status(const dds_liveliness_changed_status_t* from) + { + alive_count_ = static_cast(from->alive_count); + not_alive_count_ = static_cast(from->not_alive_count); + alive_count_change_ = from->alive_count_change; + not_alive_count_change_ = from->not_alive_count_change; + last_publication_handle_ = dds::core::InstanceHandle(from->last_publication_handle); + } + +protected: + int32_t alive_count_; + int32_t not_alive_count_; + int32_t alive_count_change_; + int32_t not_alive_count_change_; + dds::core::InstanceHandle last_publication_handle_; + +}; + +class OfferedDeadlineMissedStatusDelegate +{ +public: + OfferedDeadlineMissedStatusDelegate() : + total_count_(0), + total_count_change_(0), + last_instance_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + const dds::core::InstanceHandle last_instance_handle() const + { + return last_instance_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_instance_handle(dds::core::InstanceHandle last_instance_handle) + { + last_instance_handle_ = last_instance_handle; + } + + bool operator ==(const OfferedDeadlineMissedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_instance_handle() == last_instance_handle_; + } + +public: + void ddsc_status(const dds_offered_deadline_missed_status* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + last_instance_handle_ = dds::core::InstanceHandle(from->last_instance_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::InstanceHandle last_instance_handle_; +}; + +class RequestedDeadlineMissedStatusDelegate +{ +public: + RequestedDeadlineMissedStatusDelegate() : + total_count_(0), + total_count_change_(0), + last_instance_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + const dds::core::InstanceHandle last_instance_handle() const + { + return last_instance_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_instance_handle(dds::core::InstanceHandle last_instance_handle) + { + last_instance_handle_ = last_instance_handle; + } + + bool operator ==(const RequestedDeadlineMissedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_instance_handle() == last_instance_handle_; + } + +public: + void ddsc_status(const dds_requested_deadline_missed_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + last_instance_handle_ = dds::core::InstanceHandle(from->last_instance_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::InstanceHandle last_instance_handle_; +}; + + +class OfferedIncompatibleQosStatusDelegate +{ +public: + OfferedIncompatibleQosStatusDelegate() : + total_count_(0), + total_count_change_(0), + last_policy_id_(0) { } + +public : + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + dds::core::policy::QosPolicyId last_policy_id() const + { + return last_policy_id_; + } + + const dds::core::policy::QosPolicyCountSeq policies() const + { + return policies_; + } + + const dds::core::policy::QosPolicyCountSeq& policies(dds::core::policy::QosPolicyCountSeq& dst) const + { + dst = policies_; + return dst; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_policy_id(dds::core::policy::QosPolicyId last_policy_id) + { + last_policy_id_ = last_policy_id; + } + + void set_policies(dds::core::policy::QosPolicyCountSeq policies) + { + policies_ = policies; + } + + bool operator ==(const OfferedIncompatibleQosStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_policy_id() == last_policy_id_ && + other.policies() == policies_; + } + +public: + void ddsc_status(const dds_offered_incompatible_qos_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + last_policy_id_ = from->last_policy_id; + policies_.clear(); +#if 0 //@todo + for (c_long i = 0; (i < V_POLICY_ID_COUNT) && (i < from->totalCount); i++) + { + if (((c_long*)(from->policyCount))[i] != 0) { + dds::core::policy::QosPolicyCount policy(i, ((c_long*)(from->policyCount))[i]); + policies_->push_back(policy); + } + } +#endif + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::policy::QosPolicyId last_policy_id_; + dds::core::policy::QosPolicyCountSeq policies_; +}; + +class RequestedIncompatibleQosStatusDelegate +{ +public: + RequestedIncompatibleQosStatusDelegate() : + total_count_(0), + total_count_change_(0), + last_policy_id_(0) { } + +public : + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + dds::core::policy::QosPolicyId last_policy_id() const + { + return last_policy_id_; + } + + const dds::core::policy::QosPolicyCountSeq policies() const + { + return policies_; + } + + const dds::core::policy::QosPolicyCountSeq& policies(dds::core::policy::QosPolicyCountSeq& dst) const + { + dst = policies_; + return dst; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_policy_id(dds::core::policy::QosPolicyId last_policy_id) + { + last_policy_id_ = last_policy_id; + } + + void set_policies(dds::core::policy::QosPolicyCountSeq policies) + { + policies_ = policies; + } + + bool operator ==(const RequestedIncompatibleQosStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_policy_id() == last_policy_id_ && + other.policies() == policies_; + } + +public: + void ddsc_status(const dds_requested_incompatible_qos_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + last_policy_id_ = from->last_policy_id; + policies_.clear(); +#if 0 //@todo + for (c_long i = 0; (i < V_POLICY_ID_COUNT) && (i < from->totalCount); i++) + { + if (((c_long*)(from->policyCount))[i] != 0) { + dds::core::policy::QosPolicyCount policy(i, ((c_long*)(from->policyCount))[i]); + policies_.push_back(policy); + } + } +#endif + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::policy::QosPolicyId last_policy_id_; + dds::core::policy::QosPolicyCountSeq policies_; + +}; + + +class PublicationMatchedStatusDelegate +{ +public: + PublicationMatchedStatusDelegate() : + total_count_(0), + total_count_change_(0), + current_count_(0), + current_count_change_(0), + last_subscription_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + int32_t current_count() const + { + return current_count_; + } + + int32_t current_count_change() const + { + return current_count_change_; + } + + const dds::core::InstanceHandle last_subscription_handle() const + { + return last_subscription_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void current_count(int32_t current_count) + { + current_count_ = current_count; + } + + void current_count_change(int32_t current_count_change) + { + current_count_change_ = current_count_change; + } + + void last_subscription_handle(dds::core::InstanceHandle last_subscription_handle) + { + last_subscription_handle_ = last_subscription_handle; + } + + bool operator ==(const PublicationMatchedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.current_count() == current_count_ && + other.last_subscription_handle() == last_subscription_handle_; + } + +public: + void ddsc_status(const dds_publication_matched_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + current_count_ = static_cast(from->current_count); + current_count_change_ = from->current_count_change; + last_subscription_handle_ = dds::core::InstanceHandle(from->last_subscription_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + int32_t current_count_; + int32_t current_count_change_; + dds::core::InstanceHandle last_subscription_handle_; +}; + +class SubscriptionMatchedStatusDelegate +{ +public: + SubscriptionMatchedStatusDelegate() : + total_count_(0), + total_count_change_(0), + current_count_(0), + current_count_change_(0), + last_publication_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + int32_t current_count() const + { + return current_count_; + } + + int32_t current_count_change() const + { + return current_count_change_; + } + + const dds::core::InstanceHandle last_publication_handle() const + { + return last_publication_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void current_count(int32_t current_count) + { + current_count_ = current_count; + } + + void current_count_change(int32_t current_count_change) + { + current_count_change_ = current_count_change; + } + + void last_publication_handle(dds::core::InstanceHandle last_publication_handle) + { + last_publication_handle_ = last_publication_handle; + } + + bool operator ==(const SubscriptionMatchedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.current_count() == current_count_ && + other.last_publication_handle() == last_publication_handle_; + } + +public: + void ddsc_status(const dds_subscription_matched_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + current_count_ = static_cast(from->current_count); + current_count_change_ = from->current_count_change; + last_publication_handle_ = dds::core::InstanceHandle(from->last_publication_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + int32_t current_count_; + int32_t current_count_change_; + dds::core::InstanceHandle last_publication_handle_; + +}; + +} +} +} +} /* namespace org::eclipse::cyclonedds::core */ + +#endif /* CYCLONEDDS_CORE_STATUS_STATUS_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..674aa74f9aa394d22aed5e60ae2f72ced09dabb3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp @@ -0,0 +1,63 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + + /** + * @file + */ + +#ifndef CYCLONEDDS_CORE_TYPE_HELPERS_HPP_ +#define CYCLONEDDS_CORE_TYPE_HELPERS_HPP_ + +#include + +//for c++ < 14 +#if __cplusplus == 201103L +#include +#endif + +//check template for whether a class is a template specification of another +template class Ref> +struct is_specialization : std::false_type {}; + +template class Ref, typename... Args> +struct is_specialization, Ref> : std::true_type {}; + +//check template for whether a class is an STL container +template +struct is_container : std::false_type {}; + +template +struct is_container_helper {}; + +template +struct is_container< + T, + std::conditional_t< + false, + is_container_helper< + typename T::value_type, + typename T::size_type, + typename T::allocator_type, + typename T::iterator, + typename T::const_iterator, + decltype(std::declval().size()), + decltype(std::declval().begin()), + decltype(std::declval().end()), + decltype(std::declval().cbegin()), + decltype(std::declval().cend()) + >, + void + > +> : public std::true_type{}; + +#endif diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/Domain.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/Domain.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b487713c0bde395dca7c99f2a6ca0fe4dda6ebe1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/Domain.hpp @@ -0,0 +1,39 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_DOMAIN_HPP_ +#define CYCLONEDDS_DOMAIN_DOMAIN_HPP_ + +#include "dds/core/types.hpp" + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ +OMG_DDS_API uint32_t any_id(); + +OMG_DDS_API uint32_t default_id(); +} +} +} +} + +#endif /* CYCLONEDDS_DOMAIN_DOMAIN_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..040c698ce10e20e77020d84097785f8fdefcae22 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantDelegate.hpp @@ -0,0 +1,187 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_PARTICIPANT_DELEGATE_HPP_ +#define CYCLONEDDS_DOMAIN_PARTICIPANT_DELEGATE_HPP_ + + +// DDS-PSM-Cxx Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Delegate Includes +#include +#include +#include +#include +#include +#include "org/eclipse/cyclonedds/domain/Domain.hpp" +#include "org/eclipse/cyclonedds/domain/DomainWrap.hpp" + +class OMG_DDS_API org::eclipse::cyclonedds::domain::DomainParticipantDelegate : + public ::org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< DomainParticipantDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< DomainParticipantDelegate >::weak_ref_type weak_ref_type; + + DomainParticipantDelegate(uint32_t id, + const dds::domain::qos::DomainParticipantQos& qos, + dds::domain::DomainParticipantListener *listener, + const dds::core::status::StatusMask& mask, + const std::string& config); + + DomainParticipantDelegate(uint32_t id, + const dds::domain::qos::DomainParticipantQos& qos, + dds::domain::DomainParticipantListener *listener, + const dds::core::status::StatusMask& mask, + const ddsi_config& config); + + virtual ~DomainParticipantDelegate(); + +public: + void init(ObjectDelegate::weak_ref_type weak_ref); + + void listener(dds::domain::DomainParticipantListener *listener, + const ::dds::core::status::StatusMask& mask); + dds::domain::DomainParticipantListener* listener() const; + + const dds::domain::qos::DomainParticipantQos& qos() const; + + void qos(const dds::domain::qos::DomainParticipantQos& qos); + + uint32_t domain_id(); + + void assert_liveliness(); + + bool contains_entity(const ::dds::core::InstanceHandle& handle); + + void close(); + + dds::core::Time current_time() const; + + dds::topic::qos::TopicQos default_topic_qos() const; + void default_topic_qos(const dds::topic::qos::TopicQos& qos); + + dds::pub::qos::PublisherQos default_publisher_qos() const; + void default_publisher_qos(const ::dds::pub::qos::PublisherQos& qos); + + dds::sub::qos::SubscriberQos default_subscriber_qos() const; + void default_subscriber_qos(const ::dds::sub::qos::SubscriberQos& qos); + + static dds::domain::qos::DomainParticipantQos default_participant_qos(); + static void default_participant_qos(const ::dds::domain::qos::DomainParticipantQos& qos); + + static void add_participant(org::eclipse::cyclonedds::core::EntityDelegate& participant); + static void remove_participant(org::eclipse::cyclonedds::core::EntityDelegate& participant); + + void add_publisher(org::eclipse::cyclonedds::core::EntityDelegate& publisher); + void remove_publisher(org::eclipse::cyclonedds::core::EntityDelegate& publisher); + + void add_subscriber(org::eclipse::cyclonedds::core::EntityDelegate& subscriber); + void remove_subscriber(org::eclipse::cyclonedds::core::EntityDelegate& subscriber); + + void add_topic(org::eclipse::cyclonedds::core::EntityDelegate& topic); + void remove_topic(org::eclipse::cyclonedds::core::EntityDelegate& topic); + + void add_cfTopic(org::eclipse::cyclonedds::core::ObjectDelegate& cfTopic); + void remove_cfTopic(org::eclipse::cyclonedds::core::ObjectDelegate& cfTopic); + + org::eclipse::cyclonedds::core::EntityDelegate::ref_type + find_topic(const std::string& topic_name); + + org::eclipse::cyclonedds::core::ObjectDelegate::ref_type + find_cfTopic(const std::string& topic_name); + + dds_entity_t + lookup_topic(const std::string& topic_name, + const dds_typeinfo_t *type_info, + const dds::core::Duration& timeout); + + void + lookup_topics(const std::string& type_name, + std::vector& topics, + uint32_t max_size); + + static org::eclipse::cyclonedds::domain::DomainParticipantDelegate::ref_type + lookup_participant(uint32_t domain_id); + + dds::domain::TDomainParticipant + wrapper(); + + bool is_auto_enable() const; + + void ignore_participant(const ::dds::core::InstanceHandle& handle); + + virtual void + listener_notify(ObjectDelegate::ref_type source, + uint32_t triggerMask, + void *eventData, + void *listener); + + org::eclipse::cyclonedds::core::EntityDelegate::ref_type + builtin_subscriber(); + + void + builtin_subscriber(const org::eclipse::cyclonedds::core::EntityDelegate::ref_type subscriber); + + // Subscriber events + virtual void on_data_readers(dds_entity_t subscriber); + + // Reader events + void on_requested_deadline_missed(dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate &sd); + void on_requested_incompatible_qos(dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate &sd); + void on_sample_rejected(dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate &sd); + void on_liveliness_changed(dds_entity_t reader, + org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate &sd); + void on_data_available(dds_entity_t reader); + void on_subscription_matched(dds_entity_t reader, + org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate &sd); + void on_sample_lost(dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleLostStatusDelegate &sd); + + +private: + static org::eclipse::cyclonedds::core::EntitySet participants; + static dds::domain::qos::DomainParticipantQos default_participant_qos_; + static org::eclipse::cyclonedds::core::Mutex global_participants_lock_; + static org::eclipse::cyclonedds::domain::DomainWrap::map_ref_type domain_registry_; + uint32_t domain_id_; + dds::domain::qos::DomainParticipantQos qos_; + dds::topic::qos::TopicQos default_topic_qos_; + dds::pub::qos::PublisherQos default_pub_qos_; + dds::sub::qos::SubscriberQos default_sub_qos_; + org::eclipse::cyclonedds::core::EntitySet publishers; + org::eclipse::cyclonedds::core::EntitySet subscribers; + org::eclipse::cyclonedds::core::EntitySet topics; + org::eclipse::cyclonedds::core::ObjectSet cfTopics; + org::eclipse::cyclonedds::core::EntityDelegate::weak_ref_type builtin_subscriber_; + org::eclipse::cyclonedds::domain::DomainWrap::ref_type domain_ref_; +}; + +#endif /* CYCLONEDDS_DOMAIN_PARTICIPANT_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..97532638583103f8a4cee6761e5be6f4c2a0255e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantListener.hpp @@ -0,0 +1,60 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_DOMAINPARTICIPANT_LISTENER_HPP_ +#define CYCLONEDDS_DOMAIN_DOMAINPARTICIPANT_LISTENER_HPP_ + +#include +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ + +DDSCXX_WARNING_MSVC_OFF(4250) + +class OMG_DDS_API DomainParticipantListener : + public virtual dds::domain::DomainParticipantListener, + public virtual org::eclipse::cyclonedds::topic::AnyTopicListener +{ +public: + virtual ~DomainParticipantListener() { } +}; + + +class OMG_DDS_API NoOpDomainParticipantListener : + public virtual dds::domain::NoOpDomainParticipantListener, + public virtual org::eclipse::cyclonedds::topic::NoOpAnyTopicListener +{ +public: + virtual ~NoOpDomainParticipantListener() { } +}; + +DDSCXX_WARNING_MSVC_ON(4250) + +} +} +} +} + +#endif /* CYCLONEDDS_DOMAIN_DOMAINPARTICIPANT_LISTENER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantRegistry.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantRegistry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..205b0072a5192042a00cb8c629dc3d742b52bebd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantRegistry.hpp @@ -0,0 +1,52 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_PARTICIPANT_REGISTRY_HPP_ +#define CYCLONEDDS_DOMAIN_PARTICIPANT_REGISTRY_HPP_ + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ + +class OMG_DDS_API DomainParticipantRegistry { +public: + + static void insert(dds::domain::TDomainParticipant& participant); + + static void remove(org::eclipse::cyclonedds::domain::DomainParticipantDelegate *delegate); + +private: + static org::eclipse::cyclonedds::core::EntityRegistry + > registry; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_DOMAIN_PARTICIPANT_REGISTRY_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainWrap.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainWrap.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e2d8ea17a9baf4e145d6c571d8986b26c98a2020 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/DomainWrap.hpp @@ -0,0 +1,70 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_WRAP_HPP_ +#define CYCLONEDDS_DOMAIN_WRAP_HPP_ + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ + +/* + * In cyclonedds, you can now create a domain explicitly. A participant will + * attach to that domain automatically if the ids match. If the participant + * can not find a domain, then it'll create one implicitly. + * + * The explicit creation is needed for the 'config by string' feature. + * + * To be able to use that feature in C++, this small 'domain' wrapper class + * is introduced. + * + * It should be created for every new domain (detected during participant + * creation) and should be deleted when the last participant is closed that + * uses the related domain. + * + * Either, this wrapper contains an explicitly created domain or not. + * When not, it's basically just a placeholder. + * When yes, it'll delete the explicitly created domain in its destructor. + */ +class DomainWrap +{ +public: + typedef ::dds::core::smart_ptr_traits< DomainWrap >::ref_type ref_type; + typedef ::std::map map_ref_type; + typedef map_ref_type::iterator map_ref_iter; + +public: + DomainWrap(dds_domainid_t id, const std::string& config); + DomainWrap(dds_domainid_t id, const ddsi_config& config); + ~DomainWrap(); + +private: + dds_entity_t ddsc_domain; +}; + +}}}} /* namespaced */ + +#endif /* CYCLONEDDS_DOMAIN_WRAP_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/qos/DomainParticipantQosDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/qos/DomainParticipantQosDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cd727c30d9c0c13bf80c97b5d9bfdfb354bd1fa3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/domain/qos/DomainParticipantQosDelegate.hpp @@ -0,0 +1,104 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_QOS_DOMAIN_PARTICIPANT_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_DOMAIN_QOS_DOMAIN_PARTICIPANT_QOS_DELEGATE_HPP_ + +#include + +struct _DDS_NamedDomainParticipantQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ +namespace qos +{ + +class OMG_DDS_API DomainParticipantQosDelegate +{ +public: + DomainParticipantQosDelegate(); + DomainParticipantQosDelegate(const DomainParticipantQosDelegate& other); + + ~DomainParticipantQosDelegate(); + + void policy(const dds::core::policy::UserData& ud); + void policy(const dds::core::policy::EntityFactory& efp); + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedDomainParticipantQos &qos); + + void check() const; + + bool operator ==(const DomainParticipantQosDelegate& other) const; + DomainParticipantQosDelegate& operator =(const DomainParticipantQosDelegate& other); + +private: + dds::core::policy::UserData user_data_; + dds::core::policy::EntityFactory entity_factory_; +}; + + + +//============================================================================== + + +template<> +inline const dds::core::policy::UserData& +DomainParticipantQosDelegate::policy () const +{ + return user_data_; +} +template<> +inline dds::core::policy::UserData& +DomainParticipantQosDelegate::policy () +{ + return user_data_; +} + + +template<> +inline const dds::core::policy::EntityFactory& +DomainParticipantQosDelegate::policy () const +{ + return entity_factory_; +} +template<> +inline dds::core::policy::EntityFactory& +DomainParticipantQosDelegate::policy () +{ + return entity_factory_; +} + +} +} +} +} +} + +#endif /* CYCLONEDDS_DOMAIN_QOS_DOMAIN_PARTICIPANT_QOS_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ced366118928d77eef285e550803789dd0a616e0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp @@ -0,0 +1,203 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_ANYDATAWRITERDELEGATE_HPP_ +#define CYCLONEDDS_PUB_ANYDATAWRITERDELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace dds { namespace pub { +template +class TAnyDataWriter; +} } + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ + +class OMG_DDS_API AnyDataWriterDelegate : public org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< AnyDataWriterDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< AnyDataWriterDelegate >::weak_ref_type weak_ref_type; + + virtual ~AnyDataWriterDelegate(); + + void close(); + +public: + /* DDS API mirror. */ + dds::pub::qos::DataWriterQos qos() const; + void qos(const dds::pub::qos::DataWriterQos& qos); + + /* Let DataWriter implement the publisher handling to circumvent circular dependencies. */ + virtual const dds::pub::TPublisher& publisher() const = 0; + + const dds::topic::TopicDescription& topic_description() const; + + void wait_for_acknowledgments(const dds::core::Duration& timeout); + + const ::dds::core::status::LivelinessLostStatus liveliness_lost_status(); + + const ::dds::core::status::OfferedDeadlineMissedStatus offered_deadline_missed_status(); + + const ::dds::core::status::OfferedIncompatibleQosStatus offered_incompatible_qos_status(); + + const ::dds::core::status::PublicationMatchedStatus publication_matched_status(); + + ::dds::core::InstanceHandleSeq + matched_subscriptions(); + + template + uint32_t + matched_subscriptions(FwdIterator begin, uint32_t max_size) + { + ::dds::core::InstanceHandleSeq handleSeq = matched_subscriptions(); + uint32_t seq_size = static_cast(handleSeq.size()); + uint32_t size = (seq_size < max_size ? seq_size : max_size); + for (uint32_t i = 0; i < size; i++, begin++) { + *begin = handleSeq[i]; + } + return size; + } + + const dds::topic::SubscriptionBuiltinTopicData + matched_subscription_data(const ::dds::core::InstanceHandle& h); + + void assert_liveliness(); + +public: + dds::pub::TAnyDataWriter wrapper_to_any(); + void write_flush(); + void set_batch(bool); + +private: + void + write_cdr(dds_entity_t writer, + const org::eclipse::cyclonedds::topic::CDRBlob *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp, + uint32_t statusinfo); + +protected: + AnyDataWriterDelegate(const dds::pub::qos::DataWriterQos& qos, + const dds::topic::TopicDescription& td); + + void + write_cdr(dds_entity_t writer, + const org::eclipse::cyclonedds::topic::CDRBlob *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + dispose_cdr(dds_entity_t writer, + const org::eclipse::cyclonedds::topic::CDRBlob *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + unregister_instance_cdr(dds_entity_t writer, + const org::eclipse::cyclonedds::topic::CDRBlob *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + bool + is_loan_supported(const dds_entity_t writer); + + void + loan_sample(dds_entity_t writer, + void **sample); + + void + return_loan(dds_entity_t writer, + void *sample); + + void + write(dds_entity_t writer, + const void *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + writedispose(dds_entity_t writer, + const void *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + dds_instance_handle_t + register_instance(dds_entity_t writer, + const void *data, + const dds::core::Time& timestamp); + + void + unregister_instance(dds_entity_t writer, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + unregister_instance(dds_entity_t writer, + const void *data, + const dds::core::Time& timestamp); + + void + dispose_instance(dds_entity_t writer, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + dispose_instance(dds_entity_t writer, + const void *data, + const dds::core::Time& timestamp); + + void + get_key_value(dds_entity_t writer, + void *data, + const dds::core::InstanceHandle& handle); + + dds_instance_handle_t + lookup_instance(dds_entity_t writer, + const void *data); + +private: + dds::pub::qos::DataWriterQos qos_; + dds::topic::TopicDescription td_; + + //@todo static bool copy_data(c_type t, void *data, void *to); +}; + +} +} +} +} + +#endif /* CYCLONEDDS_PUB_ANYDATAWRITERDELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/CoherentSetDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/CoherentSetDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..895f8e64d17d6fb80023c4d29f02fcadddc7733a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/CoherentSetDelegate.hpp @@ -0,0 +1,54 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_COHERENT_SET_DELEGATE_HPP_ +#define CYCLONEDDS_PUB_COHERENT_SET_DELEGATE_HPP_ + +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ + + +class OMG_DDS_API CoherentSetDelegate +{ +public: + CoherentSetDelegate(const dds::pub::Publisher& pub); + ~CoherentSetDelegate(); + + void end(); + + bool operator ==(const CoherentSetDelegate& other) const; + +private: + dds::pub::Publisher pub; + bool ended; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_PUB_COHERENT_SET_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/PublisherDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/PublisherDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..271e056c27b70b5cfa5724b14227b16e884056a8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/PublisherDelegate.hpp @@ -0,0 +1,116 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef OMG_IDDS_PUB_PUBLISHER_DELEGATE_HPP_ +#define OMG_IDDS_PUB_PUBLISHER_DELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ + +class OMG_DDS_API PublisherDelegate : public org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< PublisherDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< PublisherDelegate >::weak_ref_type weak_ref_type; + + PublisherDelegate(const dds::domain::DomainParticipant& dp, + const dds::pub::qos::PublisherQos& qos, + dds::pub::PublisherListener* listener, + const dds::core::status::StatusMask& event_mask); + + virtual ~PublisherDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + const dds::pub::qos::PublisherQos& qos() const; + void qos(const dds::pub::qos::PublisherQos& pqos); + + void default_datawriter_qos(const dds::pub::qos::DataWriterQos& dwqos); + dds::pub::qos::DataWriterQos default_datawriter_qos() const; + + void suspend_publications(); + void resume_publications(); + + void begin_coherent_changes(); + void end_coherent_changes(); + + void wait_for_acknowledgments(const dds::core::Duration& max_wait); + + void listener(dds::pub::PublisherListener* listener, + const ::dds::core::status::StatusMask& mask); + dds::pub::PublisherListener* listener() const; + + const dds::domain::DomainParticipant& participant() const; + + bool contains_entity(const ::dds::core::InstanceHandle& handle); + + void add_datawriter(org::eclipse::cyclonedds::core::EntityDelegate& datawriter); + void remove_datawriter(org::eclipse::cyclonedds::core::EntityDelegate& datawriter); + org::eclipse::cyclonedds::pub::AnyDataWriterDelegate::ref_type find_datawriter(const std::string& topic_name); + + dds::pub::TPublisher + wrapper(); + + bool is_auto_enable() const; + + void on_offered_deadline_missed(dds_entity_t writer, + org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate &sd); + + void on_offered_incompatible_qos(dds_entity_t writer, + org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate &sd); + + void on_liveliness_lost(dds_entity_t writer, + org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate &sd); + + void on_publication_matched(dds_entity_t writer, + org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate &sd); + +private: + dds::domain::DomainParticipant dp_; + dds::pub::qos::PublisherQos qos_; + dds::pub::qos::DataWriterQos default_dwqos_; + + org::eclipse::cyclonedds::core::EntitySet writers; +}; + +} +} +} +} + +#endif /* OMG_IDDS_PUB_PUBLISHER_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/SuspendedPublicationDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/SuspendedPublicationDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7da10545b9271304a89808a641fd44713b17aace --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/SuspendedPublicationDelegate.hpp @@ -0,0 +1,55 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_SUSPENDED_PUBBLICATIONS_DELEGATE_HPP_ +#define CYCLONEDDS_PUB_SUSPENDED_PUBBLICATIONS_DELEGATE_HPP_ + +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ + + +//class OMG_DDS_API SuspendedPublicationDelegate +class SuspendedPublicationDelegate +{ +public: + SuspendedPublicationDelegate(const dds::pub::Publisher& pub); + ~SuspendedPublicationDelegate(); + + void resume(); + + bool operator ==(const SuspendedPublicationDelegate& other) const; + +private: + dds::pub::Publisher pub; + bool resumed; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_PUB_SUSPENDED_PUBBLICATIONS_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dc3d91833719dd2cf85d50f3de4218b1c6b8a891 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp @@ -0,0 +1,305 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_QOS_DATA_WRITER_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_PUB_QOS_DATA_WRITER_QOS_DELEGATE_HPP_ + +#include +#include + +struct _DDS_NamedDataWriterQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ +namespace qos +{ + +class OMG_DDS_API DataWriterQosDelegate +{ +public: + DataWriterQosDelegate(); + DataWriterQosDelegate(const org::eclipse::cyclonedds::topic::qos::TopicQosDelegate& tqos); + + void policy(const dds::core::policy::UserData& user_data); + void policy(const dds::core::policy::Durability& durability); + void policy(const dds::core::policy::Deadline& deadline); + void policy(const dds::core::policy::LatencyBudget& budget); + void policy(const dds::core::policy::Liveliness& liveliness); + void policy(const dds::core::policy::Reliability& reliability); + void policy(const dds::core::policy::DestinationOrder& order); + void policy(const dds::core::policy::History& history); + void policy(const dds::core::policy::ResourceLimits& resources); + void policy(const dds::core::policy::TransportPriority& priority); + void policy(const dds::core::policy::Lifespan& lifespan); + void policy(const dds::core::policy::Ownership& ownership); +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + void policy(const dds::core::policy::OwnershipStrength& strength); +#endif // OMG_DDS_OWNERSHIP_SUPPORT + void policy(const dds::core::policy::WriterDataLifecycle& lifecycle); +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + void policy(const dds::core::policy::DataRepresentation& datarepresentation); + void policy(const dds::core::policy::TypeConsistencyEnforcement& typeconsistencyenforcement); +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedDataWriterQos &qos); + + void check() const; + + bool operator ==(const DataWriterQosDelegate& other) const; + DataWriterQosDelegate& operator =(const org::eclipse::cyclonedds::topic::qos::TopicQosDelegate& tqos); + +private: + dds::core::policy::UserData user_data_; + dds::core::policy::Durability durability_; + dds::core::policy::Deadline deadline_; + dds::core::policy::LatencyBudget budget_; + dds::core::policy::Liveliness liveliness_; + dds::core::policy::Reliability reliability_; + dds::core::policy::DestinationOrder order_; + dds::core::policy::History history_; + dds::core::policy::ResourceLimits resources_; + dds::core::policy::TransportPriority priority_; + dds::core::policy::Lifespan lifespan_; + dds::core::policy::Ownership ownership_; +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + dds::core::policy::OwnershipStrength strength_; +#endif // OMG_DDS_OWNERSHIP_SUPPORT + dds::core::policy::WriterDataLifecycle lifecycle_; +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + dds::core::policy::DataRepresentation datarepresentation_; + dds::core::policy::TypeConsistencyEnforcement typeconsistencyenforcement_; +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +}; + + + +//============================================================================== + + +template<> inline const dds::core::policy::UserData& +DataWriterQosDelegate::policy() const +{ + return user_data_; +} +template<> inline dds::core::policy::UserData& +DataWriterQosDelegate::policy() +{ + return user_data_; +} + + +template<> inline const dds::core::policy::Durability& +DataWriterQosDelegate::policy() const +{ + return durability_; +} +template<> inline dds::core::policy::Durability& +DataWriterQosDelegate::policy() +{ + return durability_; +} + + +template<> inline const dds::core::policy::Deadline& +DataWriterQosDelegate::policy() const +{ + return deadline_; +} +template<> inline dds::core::policy::Deadline& +DataWriterQosDelegate::policy() +{ + return deadline_; +} + + +template<> inline const dds::core::policy::LatencyBudget& +DataWriterQosDelegate::policy() const +{ + return budget_; +} +template<> inline dds::core::policy::LatencyBudget& +DataWriterQosDelegate::policy() +{ + return budget_; +} + + +template<> inline const dds::core::policy::Liveliness& +DataWriterQosDelegate::policy() const +{ + return liveliness_; +} +template<> inline dds::core::policy::Liveliness& +DataWriterQosDelegate::policy() +{ + return liveliness_; +} + + +template<> inline const dds::core::policy::Reliability& +DataWriterQosDelegate::policy() const +{ + return reliability_; +} +template<> inline dds::core::policy::Reliability& +DataWriterQosDelegate::policy() +{ + return reliability_; +} + + +template<> inline const dds::core::policy::DestinationOrder& +DataWriterQosDelegate::policy() const +{ + return order_; +} +template<> inline dds::core::policy::DestinationOrder& +DataWriterQosDelegate::policy() +{ + return order_; +} + + +template<> inline const dds::core::policy::History& +DataWriterQosDelegate::policy() const +{ + return history_; +} +template<> inline dds::core::policy::History& +DataWriterQosDelegate::policy() +{ + return history_; +} + + +template<> inline const dds::core::policy::ResourceLimits& +DataWriterQosDelegate::policy() const +{ + return resources_; +} +template<> inline dds::core::policy::ResourceLimits& +DataWriterQosDelegate::policy() +{ + return resources_; +} + + +template<> inline const dds::core::policy::TransportPriority& +DataWriterQosDelegate::policy() const +{ + return priority_; +} +template<> inline dds::core::policy::TransportPriority& +DataWriterQosDelegate::policy() +{ + return priority_; +} + + +template<> inline const dds::core::policy::Lifespan& +DataWriterQosDelegate::policy() const +{ + return lifespan_; +} +template<> inline dds::core::policy::Lifespan& +DataWriterQosDelegate::policy() +{ + return lifespan_; +} + + +template<> inline const dds::core::policy::Ownership& +DataWriterQosDelegate::policy() const +{ + return ownership_; +} +template<> inline dds::core::policy::Ownership& +DataWriterQosDelegate::policy() +{ + return ownership_; +} + + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT +template<> inline const dds::core::policy::OwnershipStrength& +DataWriterQosDelegate::policy() const +{ + return strength_; +} +template<> inline dds::core::policy::OwnershipStrength& +DataWriterQosDelegate::policy() +{ + return strength_; +} +#endif // OMG_DDS_OWNERSHIP_SUPPORT + + +template<> inline const dds::core::policy::WriterDataLifecycle& +DataWriterQosDelegate::policy() const +{ + return lifecycle_; +} +template<> inline dds::core::policy::WriterDataLifecycle& +DataWriterQosDelegate::policy() +{ + return lifecycle_; +} + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +template<> inline const dds::core::policy::DataRepresentation& +DataWriterQosDelegate::policy() const +{ + return datarepresentation_; +} +template<> inline dds::core::policy::DataRepresentation& +DataWriterQosDelegate::policy() +{ + return datarepresentation_; +} + +template<> inline const dds::core::policy::TypeConsistencyEnforcement& +DataWriterQosDelegate::policy() const +{ + return typeconsistencyenforcement_; +} +template<> inline dds::core::policy::TypeConsistencyEnforcement& +DataWriterQosDelegate::policy() +{ + return typeconsistencyenforcement_; +} +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +} +} +} +} +} + +#endif /* CYCLONEDDS_PUB_QOS_DATA_WRITER_QOS_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/qos/PublisherQosDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/qos/PublisherQosDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eee5a640c8b9e5643c0eaa50cc60517fe3c33868 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/pub/qos/PublisherQosDelegate.hpp @@ -0,0 +1,136 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_QOS_PUBLISHER_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_PUB_QOS_PUBLISHER_QOS_DELEGATE_HPP_ + +#include + +struct _DDS_NamedPublisherQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ +namespace qos +{ + +class OMG_DDS_API PublisherQosDelegate +{ +public: + PublisherQosDelegate(); + PublisherQosDelegate(const PublisherQosDelegate& other); + + ~PublisherQosDelegate(); + + void policy(const dds::core::policy::Presentation& presentation); + void policy(const dds::core::policy::Partition& partition); + void policy(const dds::core::policy::GroupData& gdata); + void policy(const dds::core::policy::EntityFactory& factory_policy); + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedPublisherQos &qos); + + void check() const; + + bool operator ==(const PublisherQosDelegate& other) const; + PublisherQosDelegate& operator =(const PublisherQosDelegate& other); + +private: + dds::core::policy::Presentation presentation_; + dds::core::policy::Partition partition_; + dds::core::policy::GroupData gdata_; + dds::core::policy::EntityFactory factory_policy_; +}; + + + +//============================================================================== + + +template<> +inline const dds::core::policy::Presentation& +PublisherQosDelegate::policy() const +{ + return presentation_; +} +template<> +inline dds::core::policy::Presentation& +PublisherQosDelegate::policy() +{ + return presentation_; +} + + +template<> +inline const dds::core::policy::Partition& +PublisherQosDelegate::policy() const +{ + return partition_; +} +template<> +inline dds::core::policy::Partition& +PublisherQosDelegate::policy() +{ + return partition_; +} + + +template<> +inline const dds::core::policy::GroupData& +PublisherQosDelegate::policy() const +{ + return gdata_; +} +template<> +inline dds::core::policy::GroupData& +PublisherQosDelegate::policy() +{ + return gdata_; +} + + +template<> +inline const dds::core::policy::EntityFactory& +PublisherQosDelegate::policy() const +{ + return factory_policy_; +} +template<> +inline dds::core::policy::EntityFactory& +PublisherQosDelegate::policy() +{ + return factory_policy_; +} + +} +} +} +} +} + +#endif /* CYCLONEDDS_PUB_QOS_PUBLISHER_QOS_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/AnyDataReaderDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/AnyDataReaderDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a80c7578bbdc3c3a82f9946f3e73d3948850dcad --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/AnyDataReaderDelegate.hpp @@ -0,0 +1,303 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_ANY_DATA_READER_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_ANY_DATA_READER_DELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +namespace dds { namespace sub { +template +class TAnyDataReader; +} } + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +class QueryContainer; +} +} +} +} + +namespace dds +{ +namespace sub +{ +namespace detail +{ + +class SamplesHolder +{ +public: + SamplesHolder() {} + virtual ~SamplesHolder() {} + + virtual void set_length(uint32_t len) = 0; + virtual uint32_t get_length() const = 0; + virtual SamplesHolder& operator++(int) = 0; + virtual void *data() = 0; + virtual detail::SampleInfo& info() = 0; + virtual void **cpp_sample_pointers(size_t length) = 0; + virtual dds_sample_info_t *cpp_info_pointers(size_t length) = 0; + virtual void set_sample_contents(void** c_sample_pointers, dds_sample_info_t *info) = 0; + virtual void fini_samples_buffers(void**& c_sample_pointers, dds_sample_info_t*& c_sample_infos) = 0; +}; + +} +} +} + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + +class QueryDelegate; + +class OMG_DDS_API AnyDataReaderDelegate : public org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< AnyDataReaderDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< AnyDataReaderDelegate >::weak_ref_type weak_ref_type; + + AnyDataReaderDelegate(const dds::sub::qos::DataReaderQos& qos, + const dds::topic::TopicDescription& td); + virtual ~AnyDataReaderDelegate(); + + static void copy_sample_infos( + const dds_sample_info_t &from, + dds::sub::SampleInfo &to); + +public: + /* DDS API mirror. */ + dds::sub::qos::DataReaderQos qos() const; + void qos(const dds::sub::qos::DataReaderQos& qos); + + /* Let DataReader implement the subscriber handling to circumvent circular dependencies. */ + virtual const dds::sub::TSubscriber& subscriber() const = 0; + const dds::topic::TopicDescription& topic_description() const; + + void wait_for_historical_data(const dds::core::Duration& timeout); + + dds::core::status::LivelinessChangedStatus + liveliness_changed_status(); + dds::core::status::SampleRejectedStatus + sample_rejected_status(); + dds::core::status::SampleLostStatus + sample_lost_status(); + dds::core::status::RequestedDeadlineMissedStatus + requested_deadline_missed_status(); + dds::core::status::RequestedIncompatibleQosStatus + requested_incompatible_qos_status(); + dds::core::status::SubscriptionMatchedStatus + subscription_matched_status(); + + ::dds::core::InstanceHandleSeq + matched_publications(); + + template + uint32_t + matched_publications(FwdIterator begin, uint32_t max_size) + { + ::dds::core::InstanceHandleSeq handleSeq = matched_publications(); + uint32_t seq_size = static_cast(handleSeq.size()); + uint32_t size = (seq_size < max_size ? seq_size : max_size); + for (uint32_t i = 0; i < size; i++, begin++) { + *begin = handleSeq[i]; + } + return size; + } + + const dds::topic::PublicationBuiltinTopicData + matched_publication_data(const ::dds::core::InstanceHandle& h); + +public: + /* Internal API. */ + dds::sub::TAnyDataReader wrapper_to_any(); + + static uint32_t get_ddsc_state_mask(const dds::sub::status::DataState& state); + + void reset_data_available(); + + void add_query(org::eclipse::cyclonedds::sub::QueryDelegate& query); + void remove_query(org::eclipse::cyclonedds::sub::QueryDelegate& query); + + void setSample(void* sample); + void* getSample() const; + + bool is_loan_supported(const dds_entity_t reader) const; + + void read_cdr( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void take_cdr( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_read( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_take( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_read_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_take_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_read_next_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_take_next_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void read( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void take( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void read_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void take_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void read_next_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void take_next_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void get_key_value( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + void *key); + + dds_instance_handle_t lookup_instance( + const dds_entity_t reader, + const void *key) const; + + void close(); + +private: + bool init_samples_buffers( + const uint32_t requested_max_samples, + uint32_t& samples_to_read_cnt, + size_t& c_sample_pointers_size, + dds::sub::detail::SamplesHolder& samples, + void**& c_sample_pointers, + dds_sample_info_t*& c_sample_infos); + + void fini_samples_buffers( + void**& c_sample_pointers, + dds_sample_info_t*& c_sample_infos); + +protected: + org::eclipse::cyclonedds::core::ObjectSet queries; + dds::sub::qos::DataReaderQos qos_; + dds::topic::TopicDescription td_; + + void *sample_; + +}; + + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_ANY_DATA_READER_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/BuiltinSubscriberDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/BuiltinSubscriberDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ad52f1f408028bb6a8fa21ebd5ed07f68ccaf3c7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/BuiltinSubscriberDelegate.hpp @@ -0,0 +1,69 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_BUILTIN_SUBSCRIBER_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_BUILTIN_SUBSCRIBER_DELEGATE_HPP_ + +#include +#include + +#include +#include +#include +#include + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + +class OMG_DDS_API BuiltinSubscriberDelegate : public org::eclipse::cyclonedds::sub::SubscriberDelegate +{ +public: + BuiltinSubscriberDelegate( + const dds::domain::DomainParticipant& dp, + const dds::sub::qos::SubscriberQos& qos); + + virtual ~BuiltinSubscriberDelegate() {}; + + std::vector + find_datareaders(const std::string& topic_name); + +public: + static SubscriberDelegate::ref_type + get_builtin_subscriber(const dds::domain::DomainParticipant& dp); + + static AnyDataReaderDelegate::ref_type + get_builtin_reader(SubscriberDelegate& subscriber, const std::string& topic_name); + +private: + static org::eclipse::cyclonedds::core::Mutex builtinLock; + +}; + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_BUILTIN_SUBSCRIBER_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/CoherentAccessDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/CoherentAccessDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cb7035cc1276572b423d342e32adf7d130338086 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/CoherentAccessDelegate.hpp @@ -0,0 +1,52 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_COHERENT_ACCESS_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_COHERENT_ACCESS_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + +class OMG_DDS_API CoherentAccessDelegate +{ +public: + CoherentAccessDelegate(const dds::sub::Subscriber sub); + ~CoherentAccessDelegate(); + + void end(); + + bool operator==(const CoherentAccessDelegate& other) const; + +private: + dds::sub::Subscriber sub; + bool ended; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_COHERENT_ACCESS_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/GenerationCountImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/GenerationCountImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..903b266c6059aa2793f2f72b3ceb99e79a7a2ecc --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/GenerationCountImpl.hpp @@ -0,0 +1,72 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_GENERATION_COUNT_IMPL_HPP_ +#define CYCLONEDDS_SUB_GENERATION_COUNT_IMPL_HPP_ + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +class GenerationCountImpl; +} +} +} +} + +class org::eclipse::cyclonedds::sub::GenerationCountImpl +{ +public: + GenerationCountImpl() : d_(0), nw_(0) { } + GenerationCountImpl(int32_t d, int32_t nw) : d_(d), nw_(nw) { } + +public: + inline int32_t disposed() const + { + return d_; + } + + inline void disposed(int32_t d) + { + this->d_ = d; + } + + inline int32_t no_writers() const + { + return nw_; + } + + inline void no_writers(int32_t nw) + { + this->nw_ = nw; + } + + + bool operator ==(const GenerationCountImpl& other) const + { + return other.d_ == d_ && other.nw_ == nw_; + } + +private: + int32_t d_, nw_; +}; + +#endif /* CYCLONEDDS_SUB_GENERATION_COUNT_IMPL_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/QueryDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/QueryDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..30e6aee2871df462cf66faf22e8fc60b19152bed --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/QueryDelegate.hpp @@ -0,0 +1,119 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_SUB_QUERY_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_QUERY_DELEGATE_HPP_ + +/** + * @file + */ + +#include +#include +#include + +#include +#include + + +#include +#include + + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + + +class OMG_DDS_API QueryDelegate : public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; + typedef ::dds::core::smart_ptr_traits::ref_type Ref; + typedef ::dds::core::smart_ptr_traits::weak_ref_type WeakRef; + +public: + QueryDelegate(const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& state_filter = dds::sub::status::DataState::any()); + + QueryDelegate(const dds::sub::AnyDataReader& dr, + const std::string& query_expression, + const dds::sub::status::DataState& state_filter = dds::sub::status::DataState::any()); + + QueryDelegate(const dds::sub::AnyDataReader& dr, + const std::string& query_expression, + const std::vector& params, + const dds::sub::status::DataState& state_filter = dds::sub::status::DataState::any()); + + virtual ~QueryDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + const std::string& expression() const; + + void expression(const std::string& expr); + + iterator begin(); + + iterator end(); + + const_iterator begin() const; + + const_iterator end() const; + + void add_parameter(const std::string& param); + + uint32_t parameters_length() const; + + void parameters(const std::vector& params); + + std::vector parameters(); + + void clear_parameters(); + + const dds::sub::AnyDataReader& data_reader() const; + + virtual void state_filter(dds::sub::status::DataState& s); + + virtual dds::sub::status::DataState state_filter(); + + virtual bool modify_state_filter(dds::sub::status::DataState& s); + + bool state_filter_equal(dds::sub::status::DataState& s); + +protected: + void deinit(); + +private: + dds::sub::AnyDataReader reader_; + std::string expression_; + std::vector params_; + dds::sub::status::DataState state_filter_; + bool modified_; +}; + + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_QUERY_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/RankImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/RankImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..84cff654a5923f96cfe21ae4f8d9a0d7fa854f3d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/RankImpl.hpp @@ -0,0 +1,68 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_RANK_IMPL_HPP_ +#define CYCLONEDDS_SUB_RANK_IMPL_HPP_ + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +class RankImpl; +} +} +} +} + +class org::eclipse::cyclonedds::sub::RankImpl +{ +public: + RankImpl() : s_(0), g_(0), ag_(0) { } + RankImpl(int32_t s, int32_t g, int32_t ag) : s_(s), g_(g), ag_(ag) { } + +public: + inline int32_t absolute_generation() const + { + return ag_; + } + + inline int32_t generation() const + { + return g_; + } + + inline int32_t sample() const + { + return s_; + } + + bool operator ==(const RankImpl& other) const + { + return other.s_ == s_ && other.g_ == g_ && other.ag_; + } +private: + int32_t s_; + int32_t g_; + int32_t ag_; +}; + + +#endif /* CYCLONEDDS_SUB_RANK_IMPL_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/SampleInfoImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/SampleInfoImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..215c0e20702f00c3df193052965043d410e5ab2b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/SampleInfoImpl.hpp @@ -0,0 +1,150 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_SAMPLE_INFO_IMPL_HPP_ +#define CYCLONEDDS_SUB_SAMPLE_INFO_IMPL_HPP_ + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +class SampleInfoImpl; +} +} +} +} + + +class org::eclipse::cyclonedds::sub::SampleInfoImpl +{ +public: + SampleInfoImpl() : valid_(false) { } +public: + + inline const dds::core::Time timestamp() const + { + return this->source_timestamp_; + } + + inline void timestamp(const dds::core::Time& t) + { + this->source_timestamp_ = t; + } + + inline const dds::sub::status::DataState state() const + { + return this->state_; + } + + inline void state(const dds::sub::status::DataState& s) + { + this->state_ = s; + } + + inline dds::sub::GenerationCount generation_count() const + { + return this->generation_count_; + } + + inline void generation_count(dds::sub::GenerationCount& c) + { + this->generation_count_ = c; + } + + inline dds::sub::Rank rank() const + { + return this->rank_; + } + + inline void rank(dds::sub::Rank& r) + { + this->rank_ = r; + } + + inline bool valid() const + { + return this->valid_; + } + + inline void valid(bool v) + { + this->valid_ = v; + } + + inline dds::core::InstanceHandle instance_handle() const + { + return this->instance_handle_; + } + + inline void instance_handle(dds::core::InstanceHandle& h) + { + this->instance_handle_ = h; + } + + inline dds::core::InstanceHandle publication_handle() const + { + return this->publication_handle_; + } + + inline void publication_handle(dds::core::InstanceHandle& h) + { + this->publication_handle_ = h; + } + + bool operator==(const SampleInfoImpl& other) const + { + return this->source_timestamp_ == other.timestamp() + && state_is_equal(this->state_, other.state()) + && this->generation_count_ == other.generation_count() + && this->rank_ == other.rank() + && this->valid_ == other.valid() + && this->instance_handle_ == other.instance_handle() + && this->publication_handle_ == other.publication_handle(); + } + + +private: + static bool state_is_equal( + const dds::sub::status::DataState& s1, + const dds::sub::status::DataState& s2) + { + return s1.instance_state() == s1.instance_state() + && s1.view_state() == s2.view_state() + && s1.sample_state() == s2.sample_state(); + } + +private: + dds::core::Time source_timestamp_; + dds::sub::status::DataState state_; + dds::sub::GenerationCount generation_count_; + dds::sub::Rank rank_; + bool valid_; + dds::core::InstanceHandle instance_handle_; + dds::core::InstanceHandle publication_handle_; + +}; + + +#endif /* CYCLONEDDS_SUB_SAMPLE_INFO_IMPL_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/SubscriberDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/SubscriberDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f059c0ed6c85f6a86ed923304703a7566d0f821a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/SubscriberDelegate.hpp @@ -0,0 +1,149 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_SUBSCRIBER_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_SUBSCRIBER_DELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + +class OMG_DDS_API SubscriberDelegate : public org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< SubscriberDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< SubscriberDelegate >::weak_ref_type weak_ref_type; + + SubscriberDelegate(const dds::domain::DomainParticipant& dp, + const dds::sub::qos::SubscriberQos& qos, + dds::sub::SubscriberListener* listener, + const dds::core::status::StatusMask& event_mask); + + virtual ~SubscriberDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + const dds::sub::qos::SubscriberQos& qos() const; + void qos(const dds::sub::qos::SubscriberQos& sqos); + + void default_datareader_qos(const dds::sub::qos::DataReaderQos& qos); + dds::sub::qos::DataReaderQos default_datareader_qos() const; + + void begin_coherent_access(); + void end_coherent_access(); + + /** + * @internal This function initialises the delegate as the built in subscriber + */ + //void init_builtin(DDS::Subscriber_ptr sub); + + void listener(dds::sub::SubscriberListener* listener, + const ::dds::core::status::StatusMask& mask); + dds::sub::SubscriberListener* listener() const; + + const dds::domain::DomainParticipant& participant() const; + + /** @internal @todo OSPL-1944 Subscriber Listener should return list of affected DataReaders (on_data_on_readers) **/ + //dds::sub::AnyDataReader get_datareaders(); /* TODO: OSPL-1944? */ + + bool contains_entity( + const ::dds::core::InstanceHandle& handle); + + void add_datareader( + org::eclipse::cyclonedds::core::EntityDelegate& datareader); + + void remove_datareader( + org::eclipse::cyclonedds::core::EntityDelegate& datareader); + + virtual std::vector + find_datareaders( + const std::string& topic_name); + + std::vector + get_datareaders( + const dds::sub::status::DataState& mask); + + void notify_datareaders(); + + dds::sub::TSubscriber + wrapper(); + + bool is_auto_enable() const; + + void reset_data_on_readers(); + + // Subscriber events + void on_data_readers( + dds_entity_t); + + // Reader events + void on_requested_deadline_missed( + dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate &sd); + void on_requested_incompatible_qos( + dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate &sd); + void on_sample_rejected( + dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate &sd); + void on_liveliness_changed( + dds_entity_t reader, + org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate &sd); + void on_data_available( + dds_entity_t reader); + void on_subscription_matched( + dds_entity_t reader, + org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate &sd); + void on_sample_lost( + dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleLostStatusDelegate &sd); + +private: + dds::domain::DomainParticipant dp_; + dds::sub::qos::SubscriberQos qos_; + dds::sub::qos::DataReaderQos default_dr_qos_; + + org::eclipse::cyclonedds::core::EntitySet readers; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_SUBSCRIBER_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/cond/QueryConditionDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/cond/QueryConditionDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f7f64ad237f3fe48adec6c054a0a9fa5d1610623 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/cond/QueryConditionDelegate.hpp @@ -0,0 +1,79 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_COND_QUERYCONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_COND_QUERYCONDITION_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace cond +{ + +class OMG_DDS_API QueryConditionDelegate : + public org::eclipse::cyclonedds::sub::cond::ReadConditionDelegate +{ +public: + + typedef QueryDelegate::iterator iterator; + typedef QueryDelegate::const_iterator const_iterator; + +public: + QueryConditionDelegate( + const dds::sub::AnyDataReader& dr, + const std::string& query_expression, + const dds::sub::status::DataState& state_filter); + + QueryConditionDelegate( + const dds::sub::AnyDataReader& dr, + const std::string& expression, + const std::vector& params, + const dds::sub::status::DataState& data_state); + + QueryConditionDelegate( + const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& data_state); + + ~QueryConditionDelegate(); + + typedef bool (*Filter_fn) (const void * sample); + + void set_filter(Filter_fn filter); + + Filter_fn get_filter(); + + void init(ObjectDelegate::weak_ref_type weak_ref); +protected: + Filter_fn cpp_filter; + + static bool trans_filter(const void *csample, const void *ctx); +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_SUB_COND_QUERYCONDITION_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/cond/ReadConditionDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/cond/ReadConditionDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b1911dac118cdf40d166e295a9b6a9d2d79fc00a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/cond/ReadConditionDelegate.hpp @@ -0,0 +1,64 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_COND_READCONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_COND_READCONDITION_DELEGATE_HPP_ + +#include + +#include +#include + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace cond +{ + + +class OMG_DDS_API ReadConditionDelegate : + public virtual org::eclipse::cyclonedds::core::cond::ConditionDelegate, + public virtual org::eclipse::cyclonedds::sub::QueryDelegate +{ +public: + ReadConditionDelegate( + const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& state_filter); + + ~ReadConditionDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + virtual bool trigger_value() const; +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_SUB_COND_READCONDITION_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b4998e75a19bd307fa41d1997df35949e0014a8b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp @@ -0,0 +1,285 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_QOS_DATA_READER_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_QOS_DATA_READER_QOS_DELEGATE_HPP_ + +#include +#include + +struct _DDS_NamedDataReaderQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace qos +{ + +class OMG_DDS_API DataReaderQosDelegate +{ +public: + DataReaderQosDelegate(); + DataReaderQosDelegate(const org::eclipse::cyclonedds::topic::qos::TopicQosDelegate& tqos); + + void policy(const dds::core::policy::UserData& user_data); + void policy(const dds::core::policy::Durability& durability); + void policy(const dds::core::policy::Deadline& deadline); + void policy(const dds::core::policy::LatencyBudget& budget); + void policy(const dds::core::policy::Liveliness& liveliness); + void policy(const dds::core::policy::Reliability& reliability); + void policy(const dds::core::policy::DestinationOrder& order); + void policy(const dds::core::policy::History& history); + void policy(const dds::core::policy::ResourceLimits& resources); + void policy(const dds::core::policy::Ownership& ownership); + void policy(const dds::core::policy::TimeBasedFilter& tfilter); + void policy(const dds::core::policy::ReaderDataLifecycle& lifecycle); +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + void policy(const dds::core::policy::DataRepresentation& datarepresentation); + void policy(const dds::core::policy::TypeConsistencyEnforcement& typeconsistencyenforcement); +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedDataReaderQos &qos); + + void check() const; + + bool operator==(const DataReaderQosDelegate& other) const; + DataReaderQosDelegate& operator =(const org::eclipse::cyclonedds::topic::qos::TopicQosDelegate& tqos); + +private: + dds::core::policy::UserData user_data_; + dds::core::policy::Durability durability_; + dds::core::policy::Deadline deadline_; + dds::core::policy::LatencyBudget budget_; + dds::core::policy::Liveliness liveliness_; + dds::core::policy::Reliability reliability_; + dds::core::policy::DestinationOrder order_; + dds::core::policy::History history_; + dds::core::policy::ResourceLimits resources_; + dds::core::policy::Ownership ownership_; + dds::core::policy::TimeBasedFilter tfilter_; + dds::core::policy::ReaderDataLifecycle lifecycle_; +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + dds::core::policy::DataRepresentation datarepresentation_; + dds::core::policy::TypeConsistencyEnforcement typeconsistencyenforcement_; +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +}; + + + +//============================================================================== + + +template<> +inline const dds::core::policy::Durability& +DataReaderQosDelegate::policy() const +{ + return durability_; +} +template<> +inline dds::core::policy::Durability& +DataReaderQosDelegate::policy() +{ + return durability_; +} + + +template<> +inline const dds::core::policy::UserData& +DataReaderQosDelegate::policy() const +{ + return user_data_; +} +template<> +inline dds::core::policy::UserData& +DataReaderQosDelegate::policy() +{ + return user_data_; +} + + +template<> inline const dds::core::policy::Deadline& +DataReaderQosDelegate::policy() const +{ + return deadline_; +} +template<> +inline dds::core::policy::Deadline& +DataReaderQosDelegate::policy() +{ + return deadline_; +} + + +template<> inline const dds::core::policy::LatencyBudget& +DataReaderQosDelegate::policy() const +{ + return budget_; +} +template<> +inline dds::core::policy::LatencyBudget& +DataReaderQosDelegate::policy() +{ + return budget_; +} + + +template<> inline const dds::core::policy::Liveliness& +DataReaderQosDelegate::policy() const +{ + return liveliness_; +} +template<> +inline dds::core::policy::Liveliness& +DataReaderQosDelegate::policy() +{ + return liveliness_; +} + + +template<> inline const dds::core::policy::Reliability& +DataReaderQosDelegate::policy() const +{ + return reliability_; +} +template<> +inline dds::core::policy::Reliability& +DataReaderQosDelegate::policy() +{ + return reliability_; +} + + +template<> inline const dds::core::policy::DestinationOrder& +DataReaderQosDelegate::policy() const +{ + return order_; +} +template<> +inline dds::core::policy::DestinationOrder& +DataReaderQosDelegate::policy() +{ + return order_; +} + + +template<> inline const dds::core::policy::History& +DataReaderQosDelegate::policy() const +{ + return history_; +} +template<> +inline dds::core::policy::History& +DataReaderQosDelegate::policy() +{ + return history_; +} + + +template<> inline const dds::core::policy::ResourceLimits& +DataReaderQosDelegate::policy() const +{ + return resources_; +} +template<> +inline dds::core::policy::ResourceLimits& +DataReaderQosDelegate::policy() +{ + return resources_; +} + + +template<> inline const dds::core::policy::Ownership& +DataReaderQosDelegate::policy() const +{ + return ownership_; +} +template<> +inline dds::core::policy::Ownership& +DataReaderQosDelegate::policy() +{ + return ownership_; +} + + +template<> inline const dds::core::policy::TimeBasedFilter& +DataReaderQosDelegate::policy() const +{ + return tfilter_; +} +template<> +inline dds::core::policy::TimeBasedFilter& +DataReaderQosDelegate::policy() +{ + return tfilter_; +} + + +template<> inline const dds::core::policy::ReaderDataLifecycle& +DataReaderQosDelegate::policy() const +{ + return lifecycle_; +} +template<> +inline dds::core::policy::ReaderDataLifecycle& +DataReaderQosDelegate::policy() +{ + return lifecycle_; +} + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +template<> inline const dds::core::policy::DataRepresentation& +DataReaderQosDelegate::policy() const +{ + return datarepresentation_; +} +template<> inline dds::core::policy::DataRepresentation& +DataReaderQosDelegate::policy() +{ + return datarepresentation_; +} + +template<> inline const dds::core::policy::TypeConsistencyEnforcement& +DataReaderQosDelegate::policy() const +{ + return typeconsistencyenforcement_; +} +template<> inline dds::core::policy::TypeConsistencyEnforcement& +DataReaderQosDelegate::policy() +{ + return typeconsistencyenforcement_; +} +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +} +} +} +} +} + +#endif /* CYCLONEDDS_SUB_QOS_DATA_READER_QOS_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/qos/SubscriberQosDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/qos/SubscriberQosDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..19638d562b534c465b713e67b76375c17f706b5f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/sub/qos/SubscriberQosDelegate.hpp @@ -0,0 +1,136 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_QOS_SUBSCRIBER_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_QOS_SUBSCRIBER_QOS_DELEGATE_HPP_ + +#include + +struct _DDS_NamedSubscriberQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace qos +{ + +class OMG_DDS_API SubscriberQosDelegate +{ +public: + SubscriberQosDelegate(); + SubscriberQosDelegate(const SubscriberQosDelegate& other); + + ~SubscriberQosDelegate(); + + void policy(const dds::core::policy::Presentation& presentation); + void policy(const dds::core::policy::Partition& partition); + void policy(const dds::core::policy::GroupData& grout_data); + void policy(const dds::core::policy::EntityFactory& entity_factory); + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedSubscriberQos &qos); + + void check() const; + + bool operator ==(const SubscriberQosDelegate& other) const; + SubscriberQosDelegate& operator =(const SubscriberQosDelegate& other); + +private: + dds::core::policy::Presentation presentation_; + dds::core::policy::Partition partition_; + dds::core::policy::GroupData group_data_; + dds::core::policy::EntityFactory entity_factory_; +}; + + + +//============================================================================== + + +template<> +inline const dds::core::policy::Presentation& +SubscriberQosDelegate::policy() const +{ + return presentation_; +} +template<> +inline dds::core::policy::Presentation& +SubscriberQosDelegate::policy() +{ + return presentation_; +} + + +template<> +inline const dds::core::policy::Partition& +SubscriberQosDelegate::policy() const +{ + return partition_; +} +template<> +inline dds::core::policy::Partition& +SubscriberQosDelegate::policy() +{ + return partition_; +} + + +template<> +inline const dds::core::policy::GroupData& +SubscriberQosDelegate::policy() const +{ + return group_data_; +} +template<> +inline dds::core::policy::GroupData& +SubscriberQosDelegate::policy() +{ + return group_data_; +} + + +template<> +inline const dds::core::policy::EntityFactory& +SubscriberQosDelegate::policy() const +{ + return entity_factory_; +} +template<> +inline dds::core::policy::EntityFactory& +SubscriberQosDelegate::policy() +{ + return entity_factory_; +} + +} +} +} +} +} + +#endif /* CYCLONEDDS_SUB_QOS_SUBSCRIBER_QOS_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..064facee0231cab82b4bb3996e769504171bc037 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicDelegate.hpp @@ -0,0 +1,113 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_ANYTOPICDELEGATE_HPP_ +#define CYCLONEDDS_TOPIC_ANYTOPICDELEGATE_HPP_ + + +#include +#include +#include +#include + + +namespace dds { namespace topic { +template +class TAnyTopic; +} } + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +DDSCXX_WARNING_MSVC_OFF(4250) + +class OMG_DDS_API AnyTopicDelegate : + public virtual org::eclipse::cyclonedds::core::EntityDelegate, + public virtual org::eclipse::cyclonedds::topic::TopicDescriptionDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< AnyTopicDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< AnyTopicDelegate >::weak_ref_type weak_ref_type; + + AnyTopicDelegate(const dds::topic::qos::TopicQos& qos, + const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + dds_entity_t ddsc_topic); + + virtual ~AnyTopicDelegate(); + +public: + /* DDS API mirror. */ + dds::topic::qos::TopicQos qos() const; + void qos(const dds::topic::qos::TopicQos& qos); + + ::dds::core::status::InconsistentTopicStatus inconsistent_topic_status() const; + + std::string reader_expression() const; + + TEMP_TYPE reader_parameters() const; + //@todo c_value *reader_parameters() const; + +public: + dds::topic::TAnyTopic wrapper_to_any(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void listener_notify(ObjectDelegate::ref_type, + uint32_t, + void *, + void *) {} + + static dds::topic::TAnyTopic + discover_topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const dds::core::Duration& timeout); + + static void + discover_topics(const dds::domain::DomainParticipant& dp, + std::vector >& topics, + uint32_t max_size); + + void set_sample(void* sample); + void* get_sample(); + +protected: + AnyTopicDelegate(const dds::topic::qos::TopicQos& qos, + const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name); + + dds::topic::qos::TopicQos qos_; + void* sample_; +}; + +DDSCXX_WARNING_MSVC_ON(4250) + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_ANYTOPICDELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..95dca9273fea856ab05cdee0432f20ab567b30b1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicListener.hpp @@ -0,0 +1,47 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +#ifndef CYCLONEDDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ +#define CYCLONEDDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ + + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +class OMG_DDS_API AnyTopicListener +{ +public: + virtual ~AnyTopicListener() { } +}; + + +class OMG_DDS_API NoOpAnyTopicListener : public virtual AnyTopicListener +{ +public: + virtual ~NoOpAnyTopicListener() { } +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ef6a34fe23ef287ecb3532ee9df43cae32d52567 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopic.hpp @@ -0,0 +1,50 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_HPP_ +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_HPP_ + + +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +typedef TCMParticipantBuiltinTopicData +CMParticipantBuiltinTopicData; + +typedef TCMPublisherBuiltinTopicData +CMPublisherBuiltinTopicData; + +typedef TCMSubscriberBuiltinTopicData +CMSubscriberBuiltinTopicData; + +typedef TCMDataWriterBuiltinTopicData +CMDataWriterBuiltinTopicData; + +typedef TCMDataReaderBuiltinTopicData +CMDataReaderBuiltinTopicData; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicCopy.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicCopy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..528c8c391a3eeb824bb8d8004d362c6e6e2738be --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicCopy.hpp @@ -0,0 +1,19 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_COPY_HPP_ +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_COPY_HPP_ + +/* TODO: add builtin topic copyin copyout function declarations. */ + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_COPY_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f05a6e29875f1186c1315b0a0f9ff9a6a4c1f88b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicDelegate.hpp @@ -0,0 +1,1122 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_DELEGATE_HPP +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_DELEGATE_HPP + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ +class ParticipantBuiltinTopicDataDelegate; +class TopicBuiltinTopicDataDelegate; +class PublicationBuiltinTopicDataDelegate; +class SubscriptionBuiltinTopicDataDelegate; +class CMParticipantBuiltinTopicDataDelegate; +class CMPublisherBuiltinTopicDataDelegate; +class CMSubscriberBuiltinTopicDataDelegate; +class CMDataWriterBuiltinTopicDataDelegate; +class CMDataReaderBuiltinTopicDataDelegate; +} +} +} +} + +//============================================================================== +// ParticipantBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::ParticipantBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const ::dds::core::policy::UserData& user_data() const + { + return user_data_; + } + + void user_data(const dds_qos_t* policy) + { + user_data_.delegate().set_iso_policy(policy); + } + + bool operator ==(const ParticipantBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ && other.user_data_ == user_data_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + ::dds::core::policy::UserData user_data_; +}; + +class org::eclipse::cyclonedds::topic::TopicBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const std::string& type_name() const + { + return type_name_; + } + + void type_name(const char *name) + { + type_name_ = name; + } + + const ::dds::core::policy::Durability& durability() const + { + return durability_; + } + + void durability(const dds_qos_t* policy) + { + durability_.delegate().set_iso_policy(policy); + } + + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + + const ::dds::core::policy::DurabilityService& durability_service() const + { + return durability_service_; + } + + void durability_service(const dds_qos_t* policy) + { + durability_service_.delegate().set_iso_policy(policy); + } + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + + const ::dds::core::policy::Deadline& deadline() const + { + return deadline_; + } + + void deadline(const dds_qos_t* policy) + { + deadline_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::LatencyBudget& latency_budget() const + { + return latency_budget_; + } + + void latency_budget(const dds_qos_t* policy) + { + latency_budget_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Liveliness& liveliness() const + { + return liveliness_; + } + + void liveliness(const dds_qos_t* policy) + { + liveliness_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Reliability& reliability() const + { + return reliability_; + } + + void reliability(const dds_qos_t* policy) + { + reliability_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TransportPriority& transport_priority() const + { + return transport_priority_; + } + + void transport_priority(const dds_qos_t* policy) + { + transport_priority_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Lifespan& lifespan() const + { + return lifespan_; + } + + void lifespan(const dds_qos_t* policy) + { + lifespan_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::DestinationOrder& destination_order() const + { + return destination_order_; + } + + void destination_order(const dds_qos_t* policy) + { + destination_order_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::History& history() const + { + return history_; + } + + void history(const dds_qos_t* policy) + { + history_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return resource_limits_; + } + + void resource_limits(const dds_qos_t* policy) + { + resource_limits_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Ownership& ownership() const + { + return ownership_; + } + + void ownership(const dds_qos_t* policy) + { + ownership_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TopicData& topic_data() const + { + return topic_data_; + } + + void topic_data(const dds_qos_t* policy) + { + topic_data_.delegate().set_iso_policy(policy); + } + + bool operator ==(const TopicBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.name_ == name_ + && other.type_name_ == type_name_ + && other.durability_ == durability_ +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + && other.durability_service_ == durability_service_ +#endif // OMG_DDS_PERSISTENCE_SUPPORT + && other.deadline_ == deadline_ + && other.latency_budget_ == latency_budget_ + && other.liveliness_ == liveliness_ + && other.reliability_ == reliability_ + && other.transport_priority_ == transport_priority_ + && other.lifespan_ == lifespan_ + && other.destination_order_ == destination_order_ + && other.history_ == history_ + && other.resource_limits_ == resource_limits_ + && other.ownership_ == ownership_ + && other.topic_data_ == topic_data_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + std::string name_; + std::string type_name_; + ::dds::core::policy::Durability durability_; + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + ::dds::core::policy::DurabilityService durability_service_; +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + ::dds::core::policy::Deadline deadline_; + ::dds::core::policy::LatencyBudget latency_budget_; + ::dds::core::policy::Liveliness liveliness_; + ::dds::core::policy::Reliability reliability_; + ::dds::core::policy::TransportPriority transport_priority_; + ::dds::core::policy::Lifespan lifespan_; + ::dds::core::policy::DestinationOrder destination_order_; + ::dds::core::policy::History history_; + ::dds::core::policy::ResourceLimits resource_limits_; + ::dds::core::policy::Ownership ownership_; + ::dds::core::policy::TopicData topic_data_; +}; + +//============================================================================== +// PublicationBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::PublicationBuiltinTopicDataDelegate +{ +public: + PublicationBuiltinTopicDataDelegate() : ownership_strength_(0) { } + + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& participant_key() const + { + return participant_key_; + } + + void participant_key(const int32_t* key) + { + participant_key_.delegate().value(const_cast(key)); + } + + const std::string& topic_name() const + { + return topic_name_; + } + + void topic_name(const char *name) + { + topic_name_ = name; + } + + const std::string& type_name() const + { + return type_name_; + } + + void type_name(const char *name) + { + type_name_ = name; + } + + const ::dds::core::policy::Durability& durability() const + { + return durability_; + } + + void durability(const dds_qos_t* policy) + { + durability_.delegate().set_iso_policy(policy); + } + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + + const ::dds::core::policy::DurabilityService& durability_service() const + { + return durability_service_; + } + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + + const ::dds::core::policy::Deadline& deadline() const + { + return deadline_; + } + + void deadline(const dds_qos_t* policy) + { + deadline_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::LatencyBudget& latency_budget() const + { + return latency_budget_; + } + + void latency_budget(const dds_qos_t* policy) + { + latency_budget_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Liveliness& liveliness() const + { + return liveliness_; + } + + void liveliness(const dds_qos_t* policy) + { + liveliness_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Reliability& reliability() const + { + return reliability_; + } + + void reliability(const dds_qos_t* policy) + { + reliability_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Lifespan& lifespan() const + { + return lifespan_; + } + + void lifespan(const dds_qos_t* policy) + { + lifespan_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::DestinationOrder& destination_order() const + { + return destination_order_; + } + + void destination_order(const dds_qos_t* policy) + { + destination_order_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Ownership& ownership() const + { + return ownership_; + } + + void ownership(const dds_qos_t* policy) + { + ownership_.delegate().set_iso_policy(policy); + } + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + + const ::dds::core::policy::OwnershipStrength& ownership_strength() const + { + return ownership_strength_; + } + + void ownership_strength(const dds_qos_t* policy) + { + ownership_strength_.delegate().set_iso_policy(policy); + } + +#endif // OMG_DDS_OWNERSHIP_SUPPORT + + + const ::dds::core::policy::Partition& partition() const + { + return partition_; + } + + void partition(const dds_qos_t* policy) + { + partition_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Presentation& presentation() const + { + return presentation_; + } + + void presentation(const dds_qos_t* policy) + { + presentation_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TopicData& topic_data() const + { + return topic_data_; + } + + void topic_data(const dds_qos_t* policy) + { + topic_data_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::UserData& user_data() const + { + return user_data_; + } + + void user_data(const dds_qos_t* policy) + { + user_data_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::GroupData& group_data() const + { + return group_data_; + } + + void group_data(const dds_qos_t* policy) + { + group_data_.delegate().set_iso_policy(policy); + } + + + bool operator ==(const PublicationBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.participant_key_ == participant_key_ + && other.topic_name_ == topic_name_ + && other.type_name_ == type_name_ + && other.durability_ == durability_ +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + && other.durability_service_ == durability_service_ +#endif // OMG_DDS_PERSISTENCE_SUPPORT + && other.deadline_ == deadline_ + && other.latency_budget_ == latency_budget_ + && other.liveliness_ == liveliness_ + && other.reliability_ == reliability_ + && other.lifespan_ == lifespan_ + && other.user_data_ == user_data_ + && other.ownership_ == ownership_ +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + && other.ownership_strength_ == ownership_strength_ +#endif // OMG_DDS_OWNERSHIP_SUPPORT + && other.destination_order_ == destination_order_ + && other.topic_data_ == topic_data_ + && other.group_data_ == group_data_; + } + +public: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey participant_key_; + std::string topic_name_; + std::string type_name_; + ::dds::core::policy::Durability durability_; + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + ::dds::core::policy::DurabilityService durability_service_; +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + ::dds::core::policy::Deadline deadline_; + ::dds::core::policy::LatencyBudget latency_budget_; + ::dds::core::policy::Liveliness liveliness_; + ::dds::core::policy::Reliability reliability_; + ::dds::core::policy::Lifespan lifespan_; + ::dds::core::policy::UserData user_data_; + ::dds::core::policy::Ownership ownership_; + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + ::dds::core::policy::OwnershipStrength ownership_strength_; +#endif // OMG_DDS_OWNERSHIP_SUPPORT + + ::dds::core::policy::DestinationOrder destination_order_; + ::dds::core::policy::Presentation presentation_; + ::dds::core::policy::Partition partition_; + ::dds::core::policy::TopicData topic_data_; + ::dds::core::policy::GroupData group_data_; +}; + +//============================================================================== +// SubscriptionBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::SubscriptionBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& participant_key() const + { + return participant_key_; + } + + void participant_key(const int32_t* key) + { + participant_key_.delegate().value(const_cast(key)); + } + + const std::string& topic_name() const + { + return topic_name_; + } + + void topic_name(const char *name) + { + topic_name_ = name; + } + + const std::string& type_name() const + { + return type_name_; + } + + void type_name(const char *name) + { + type_name_ = name; + } + + const ::dds::core::policy::Durability& durability() const + { + return durability_; + } + + void durability(const dds_qos_t* policy) + { + durability_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Deadline& deadline() const + { + return deadline_; + } + + void deadline(const dds_qos_t* policy) + { + deadline_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::LatencyBudget& latency_budget() const + { + return latency_budget_; + } + + void latency_budget(const dds_qos_t* policy) + { + latency_budget_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Liveliness& liveliness() const + { + return liveliness_; + } + + void liveliness(const dds_qos_t* policy) + { + liveliness_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Reliability& reliability() const + { + return reliability_; + } + + void reliability(const dds_qos_t* policy) + { + reliability_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::DestinationOrder& destination_order() const + { + return destination_order_; + } + + void destination_order(const dds_qos_t* policy) + { + destination_order_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TimeBasedFilter& time_based_filter() const + { + return time_based_filter_; + } + + void time_based_filter(const dds_qos_t* policy) + { + time_based_filter_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Ownership& ownership() const + { + return ownership_; + } + + void ownership(const dds_qos_t* policy) + { + ownership_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TopicData& topic_data() const + { + return topic_data_; + } + + void topic_data(const dds_qos_t* policy) + { + topic_data_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Partition& partition() const + { + return partition_; + } + + void partition(const dds_qos_t* policy) + { + partition_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Presentation& presentation() const + { + return presentation_; + } + + void presentation(const dds_qos_t* policy) + { + presentation_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::UserData& user_data() const + { + return user_data_; + } + + void user_data(const dds_qos_t* policy) + { + user_data_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::GroupData& group_data() const + { + return group_data_; + } + + void group_data(const dds_qos_t* policy) + { + group_data_.delegate().set_iso_policy(policy); + } + + bool operator ==(const SubscriptionBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.participant_key_ == participant_key_ + && other.topic_name_ == topic_name_ + && other.type_name_ == type_name_ + && other.durability_ == durability_ + && other.deadline_ == deadline_ + && other.latency_budget_ == latency_budget_ + && other.liveliness_ == liveliness_ + && other.reliability_ == reliability_ + && other.ownership_ == ownership_ + && other.destination_order_ == destination_order_ + && other.user_data_ == user_data_ + && other.time_based_filter_ == time_based_filter_ + && other.presentation_ == presentation_ + && other.partition_ == partition_ + && other.topic_data_ == topic_data_ + && other.group_data_ == group_data_; + } + +public: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey participant_key_; + std::string topic_name_; + std::string type_name_; + ::dds::core::policy::Durability durability_; + ::dds::core::policy::Deadline deadline_; + ::dds::core::policy::LatencyBudget latency_budget_; + ::dds::core::policy::Liveliness liveliness_; + ::dds::core::policy::Reliability reliability_; + ::dds::core::policy::Ownership ownership_; + ::dds::core::policy::DestinationOrder destination_order_; + ::dds::core::policy::UserData user_data_; + ::dds::core::policy::TimeBasedFilter time_based_filter_; + ::dds::core::policy::Presentation presentation_; + ::dds::core::policy::Partition partition_; + ::dds::core::policy::TopicData topic_data_; + ::dds::core::policy::GroupData group_data_; +}; + +//============================================================================== +// CMParticipantBuiltinTopicData +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMParticipantBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + bool operator ==(const CMParticipantBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_; + } + +protected: + dds::topic::BuiltinTopicKey key_; +}; + +//============================================================================== +// CMPublisherBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMPublisherBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& participant_key() const + { + return participant_key_; + } + + void participant_key(const int32_t* key) + { + participant_key_.delegate().value(const_cast(key)); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const ::dds::core::policy::EntityFactory& entity_factory() const + { + return entity_factory_; + } + + void entity_factory(const dds_qos_t* policy) + { + entity_factory_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Partition& partition() const + { + return partition_; + } + + void partition(const dds_qos_t* policy) + { + partition_.delegate().set_iso_policy(policy); + } + + bool operator ==(const CMPublisherBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.participant_key_ == participant_key_ + && other.name_ == name_ + && other.entity_factory_ == entity_factory_ + && other.partition_ == partition_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey participant_key_; + std::string name_; + ::dds::core::policy::EntityFactory entity_factory_; + ::dds::core::policy::Partition partition_; +}; + +//============================================================================== +// CMSubscriberBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMSubscriberBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& participant_key() const + { + return participant_key_; + } + + void participant_key(const int32_t* key) + { + participant_key_.delegate().value(const_cast(key)); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const ::dds::core::policy::EntityFactory& entity_factory() const + { + return entity_factory_; + } + + void entity_factory(const dds_qos_t* policy) + { + entity_factory_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Partition& partition() const + { + return partition_; + } + + void partition(const dds_qos_t* policy) + { + partition_.delegate().set_iso_policy(policy); + } + + bool operator ==(const CMSubscriberBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.participant_key_ == participant_key_ + && other.name_ == name_ + && other.entity_factory_ == entity_factory_ + && other.partition_ == partition_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey participant_key_; + std::string name_; + ::dds::core::policy::EntityFactory entity_factory_; + ::dds::core::policy::Partition partition_; +}; + +//============================================================================== +// CMDataWriterBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMDataWriterBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const dds_qos_t* key) + { + key_.delegate().value(const_cast(reinterpret_cast(key))); + } + + const dds::topic::BuiltinTopicKey& publisher_key() const + { + return publisher_key_; + } + + void publisher_key(const dds_qos_t* key) + { + publisher_key_.delegate().value(const_cast(reinterpret_cast(key))); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const ::dds::core::policy::History& history() const + { + return history_; + } + + void history(const dds_qos_t* policy) + { + history_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return resource_limits_; + } + + void resource_limits(const dds_qos_t* policy) + { + resource_limits_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::WriterDataLifecycle& writer_data_lifecycle() const + { + return writer_data_lifecycle_; + } + + void writer_data_lifecycle(const dds_qos_t* policy) + { + writer_data_lifecycle_.delegate().set_iso_policy(policy); + } + + bool operator ==(const CMDataWriterBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.publisher_key_ == publisher_key_ + && other.name_ == name_ + && other.history_ == history_ + && other.resource_limits_ == resource_limits_ + && other.writer_data_lifecycle_ == writer_data_lifecycle_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey publisher_key_; + std::string name_; + ::dds::core::policy::History history_; + ::dds::core::policy::ResourceLimits resource_limits_; + ::dds::core::policy::WriterDataLifecycle writer_data_lifecycle_; +}; + +//============================================================================== +// CMDataReaderBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMDataReaderBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& subscriber_key() const + { + return subscriber_key_; + } + + void subscriber_key(const int32_t* key) + { + subscriber_key_.delegate().value(const_cast(key)); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const ::dds::core::policy::History& history() const + { + return history_; + } + + void history(const dds_qos_t* policy) + { + history_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return resource_limits_; + } + + void resource_limits(const dds_qos_t* policy) + { + resource_limits_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::ReaderDataLifecycle& reader_data_lifecycle() const + { + return reader_data_lifecycle_; + } + + void reader_data_lifecycle(const dds_qos_t* policy) + { + reader_data_lifecycle_.delegate().set_iso_policy(policy); + } + + bool operator ==(const CMDataReaderBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.subscriber_key_ == subscriber_key_ + && other.name_ == name_ + && other.history_ == history_ + && other.resource_limits_ == resource_limits_ + && other.reader_data_lifecycle_ == reader_data_lifecycle_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey subscriber_key_; + std::string name_; + ::dds::core::policy::History history_; + ::dds::core::policy::ResourceLimits resource_limits_; + ::dds::core::policy::ReaderDataLifecycle reader_data_lifecycle_; +}; + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_DELEGATE_HPP */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicKeyDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicKeyDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e10ce150d9f211caf279516676d962f1f5b71c4c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicKeyDelegate.hpp @@ -0,0 +1,71 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_KEY_DELEGATE_HPP_ +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_KEY_DELEGATE_HPP_ + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +class BuiltinTopicKeyDelegate +{ +public: + typedef uint32_t VALUE_T; +public: + BuiltinTopicKeyDelegate() { } + BuiltinTopicKeyDelegate(int32_t v[]) + { + key_[0] = v[0]; + key_[1] = v[1]; + key_[2] = v[2]; + } +public: + const int32_t* value() const + { + return key_; + } + + void value(int32_t v[]) + { + key_[0] = v[0]; + key_[1] = v[1]; + key_[2] = v[2]; + } + + bool operator ==(const BuiltinTopicKeyDelegate& other) const + { + return other.key_[0] == key_[0] + && other.key_[1] == key_[1] + && other.key_[2] == key_[2]; + } + +private: + int32_t key_[3]; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_KEY_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicTraits.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicTraits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b5f4eac22df48fbde430cd444fff5ec7c2e95fb1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicTraits.hpp @@ -0,0 +1,21 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_TRAITS_HPP +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_TRAITS_HPP + +#include +#include +#include + +/* TODO: add builtin topic traits. */ + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_TRAITS_HPP */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/CDRBlob.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/CDRBlob.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f480ead8bd9c5f365d19456e9b5665fa7cb01df4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/CDRBlob.hpp @@ -0,0 +1,68 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_TOPIC_CDRBLOB_HPP +#define CYCLONEDDS_TOPIC_CDRBLOB_HPP + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ +enum class BlobKind +{ + Empty, + KeyOnly, + Data, +}; + +class CDRBlob +{ +private: + std::array encoding_ = { }; + BlobKind kind_ = BlobKind::Empty; + std::vector payload_; + +public: + CDRBlob() = default; + + explicit CDRBlob( + const std::array& encoding, + BlobKind kind, + const std::vector& payload) : + encoding_(encoding), + kind_(kind), + payload_(payload) {} + + const std::array& encoding() const { return this->encoding_; } + std::array& encoding() { return this->encoding_; } + void encoding(const std::array& _val_) { this->encoding_ = _val_; } + void encoding(std::array&& _val_) { this->encoding_ = _val_; } + BlobKind kind() const { return this->kind_; } + BlobKind& kind() { return this->kind_; } + void kind(BlobKind _val_) { this->kind_ = _val_; } + const std::vector& payload() const { return this->payload_; } + std::vector& payload() { return this->payload_; } + void payload(const std::vector& _val_) { this->payload_ = _val_; } + void payload(std::vector&& _val_) { this->payload_ = _val_; } +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_CDRBLOB_HPP */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/FilterDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/FilterDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8846834c302e5abbaf564a1105574b5ac06920c2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/FilterDelegate.hpp @@ -0,0 +1,106 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_FILTER_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_FILTER_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include +#include + +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + +class OMG_DDS_API FilterDelegate +{ +public: + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; + +public: + FilterDelegate(); + FilterDelegate(const std::string& query_expression); + + + template + FilterDelegate(const std::string& query_expression, + const FWIterator& params_begin, const FWIterator& params_end) + : myExpression(query_expression) + { + std::copy(params_begin, params_end, std::back_insert_iterator >(myParams)); + } + + const std::string& expression() const; + + /** + * @internal Provides the begin iterator to the parameter list. + */ + const_iterator begin() const; + + /** + * @internal The const end iterator to the parameter list. + */ + const_iterator end() const; + + /** + * @internal Provides the begin const iterator to the parameter list. + */ + iterator begin(); + + /** + * @internal The end iterator to the parameter list. + */ + iterator end(); + + template + void parameters(const FWIterator& begin, const FWIterator end) + { + myParams.erase(myParams.begin(), myParams.end()); + std::copy(begin, end, std::back_insert_iterator >(myParams)); + } + + void add_parameter(const std::string& param); + + uint32_t parameters_length() const; + + bool operator ==(const FilterDelegate& other) const; + +private: + std::string myExpression; + std::vector myParams; +}; + +DDSCXX_WARNING_MSVC_ON(4251) + +// End of implementation +} +} +} +} + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_FILTER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TBuiltinTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TBuiltinTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4a9f04a9908115af19b182c748f2449a28a6688e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TBuiltinTopic.hpp @@ -0,0 +1,186 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef CYCLONEDDS_TOPIC_TBUILTIN_TOPIC_HPP_ +#define CYCLONEDDS_TOPIC_TBUILTIN_TOPIC_HPP_ + + +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ +template +class TCMParticipantBuiltinTopicData; + +template +class TCMPublisherBuiltinTopicData; + +template +class TCMSubscriberBuiltinTopicData; + +template +class TCMDataWriterBuiltinTopicData; + +template +class TCMDataReaderBuiltinTopicData; +} +} +} +} + +/** + * The CMParticipant topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMParticipantBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } +}; + +/** + * The CMPublisher topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMPublisherBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } + const dds::topic::BuiltinTopicKey& participant_key() const + { + return this->delegate().participant_key(); + } + const std::string& name() const + { + return this->delegate().name(); + } + const ::dds::core::policy::EntityFactory& entity_factory() const + { + return this->delegate().entity_factory(); + } + const ::dds::core::policy::Partition& partition() const + { + return this->delegate().partition(); + } +}; + +/** + * The CMSubscriber topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMSubscriberBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } + const dds::topic::BuiltinTopicKey& participant_key() const + { + return this->delegate().participant_key(); + } + const std::string& name() const + { + return this->delegate().name(); + } + const ::dds::core::policy::EntityFactory& entity_factory() const + { + return this->delegate().entity_factory(); + } + const ::dds::core::policy::Partition& partition() const + { + return this->delegate().partition(); + } +}; + +/** + * The CMDataWriter topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMDataWriterBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } + const dds::topic::BuiltinTopicKey& publisher_key() const + { + return this->delegate().publisher_key(); + } + const std::string& name() const + { + return this->delegate().name(); + } + const ::dds::core::policy::History& history() const + { + return this->delegate().history(); + } + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return this->delegate().resource_limits(); + } + const ::dds::core::policy::WriterDataLifecycle& writer_data_lifecycle() const + { + return this->delegate().writer_data_lifecycle(); + } +}; + +/** + * The CMDataReader topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMDataReaderBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } + const dds::topic::BuiltinTopicKey& subscriber_key() const + { + return this->delegate().subscriber_key(); + } + const std::string& name() const + { + return this->delegate().name(); + } + const ::dds::core::policy::History& history() const + { + return this->delegate().history(); + } + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return this->delegate().resource_limits(); + } + const ::dds::core::policy::ReaderDataLifecycle& reader_data_lifecycle() const + { + return this->delegate().reader_data_lifecycle(); + } +}; + +#endif /* CYCLONEDDS_TOPIC_TBUILTIN_TOPIC_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..98cacd734dee1c7eaebf799d60d7277adb01ed94 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp @@ -0,0 +1,88 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_TOPICDESCRIPTIONDELEGATE_HPP_ +#define CYCLONEDDS_TOPIC_TOPICDESCRIPTIONDELEGATE_HPP_ + +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +class OMG_DDS_API TopicDescriptionDelegate : public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< TopicDescriptionDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< TopicDescriptionDelegate >::weak_ref_type weak_ref_type; + +public: + TopicDescriptionDelegate(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name); + virtual ~TopicDescriptionDelegate(); + +public: + + /** + * @internal Get the name used to create the TopicDescription. + */ + const std::string& name() const; + + /** + * @internal The type_name used to create the TopicDescription. + */ + const std::string& type_name() const; + + /** + * @internal This operation returns the DomainParticipant to which the + * TopicDescription belongs. + */ + const dds::domain::DomainParticipant& domain_participant() const; + + void incrNrDependents(); + + void decrNrDependents(); + + bool hasDependents() const; + + virtual std::string reader_expression() const = 0; + + //@todo virtual c_value *reader_parameters() const = 0; + + ddsi_sertype *get_ser_type() const; + +protected: + dds::domain::DomainParticipant myParticipant; + std::string myTopicName; + std::string myTypeName; + uint32_t nrDependents; + ddsi_sertype *ser_type_; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_TOPICDESCRIPTIONDELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TopicListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TopicListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..180773544b2dce39e2fee9293194a6f75422acda --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TopicListener.hpp @@ -0,0 +1,52 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef CYCLONEDDS_TOPIC_TOPIC_LISTENER_HPP_ +#define CYCLONEDDS_TOPIC_TOPIC_LISTENER_HPP_ + + +#include "dds/topic/TopicListener.hpp" + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +template +class TopicListener : public dds::topic::TopicListener +{ +public: + virtual ~TopicListener() { } +}; + +template +class NoOpTopicListener : public virtual TopicListener +{ +public: + virtual ~NoOpTopicListener() { } + +public: + virtual void on_inconsistent_topic( + dds::topic::Topic&, + const dds::core::status::InconsistentTopicStatus&) { } +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_TOPIC_LISTENER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..437630241b85568a8b3ed9db43d8d2b96d261774 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp @@ -0,0 +1,290 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_TOPICTRAITS_HPP_ +#define CYCLONEDDS_TOPIC_TOPICTRAITS_HPP_ + +#include "dds/ddsrt/heap.h" +#include "dds/ddsi/ddsi_serdata.h" +#include "org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp" +#include "dds/features.hpp" + +//forward declaration of c++ sertype wrapper +template class ddscxx_sertype; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ + +namespace core +{ +namespace cdr +{ +//forward declarations of streamer types +class basic_cdr_stream; +class xcdr_v1_stream; +class xcdr_v2_stream; +} +} + +namespace topic +{ + +using core::cdr::extensibility; +using core::cdr::encoding_version; +using core::cdr::allowable_encodings_t; +using core::cdr::basic_cdr_stream; +using core::cdr::xcdr_v1_stream; +using core::cdr::xcdr_v2_stream; + +template class TopicTraits +{ +public: + + /** + * @brief Returns whether TOPIC contains no key fields. + * + * Used in creating the CycloneDDS writer and equality comparisons with other topics. + * This is one of the traits that is conditionally generated if there are any key fields. + * + * @return Whether TOPIC does not contain any fields marked as key fields. + */ + static constexpr bool isKeyless() + { + return false; + } + + /** + * @brief Returns the name of the type of TOPIC. + * + * Used in creating the correct TopicDescription. + * This trait is always generated for user-defined types, and this function is just a placeholder. + * + * @return The name of the type of TOPIC. + */ + static constexpr const char *getTypeName() + { + return ""; + } + + /** + * @brief Returns an instance of ddsi_sertype for TOPIC. + * + * Used by CycloneDDS-CXX to get a sertype, which contains the functions used by CycloneDDS which are specific to TOPIC. + * + * @param[in] kinds The serialization of the of the sertype to create. + * @return A pointer to a new dssi_sertype. + */ + static ddsi_sertype *getSerType(allowable_encodings_t kinds = allowableEncodings()) + { + if (kinds & allowableEncodings() & DDS_DATA_REPRESENTATION_FLAG_XCDR1) + return static_cast(new ddscxx_sertype()); + else if (kinds & allowableEncodings() & DDS_DATA_REPRESENTATION_FLAG_XCDR2) + return static_cast(new ddscxx_sertype()); + else + return nullptr; + } + + /** + * @brief Returns the size of an instance of TOPIC. + * + * Used by shared memory implementation to determine the size of the block necessary to contain an instance of TOPIC. + * + * @return The size of an instance of TOPIC. + */ + static constexpr size_t getSampleSize() + { + return sizeof(TOPIC); + } + + /** + * @brief Returns whether instances of TOPIC reference memory outside its own declaration. + * + * Used by shared memory implementation. + * This trait will be generated as false if any strings or vectors are found anywhere in TOPIC's member tree. + * + * @return Whether TOPIC is a selfcontained type. + */ + static constexpr bool isSelfContained() + { + return true; + } + + /** + * @brief Returns the allowable encodings for this topic. + * + * Used to determine which encoding type to write in combination with the data representation QoS. + * + * @return The allowable encodings of TOPIC. + */ + static constexpr allowable_encodings_t allowableEncodings() + { + return 0xFFFFFFFFu; + } + + /** + * @brief Returns the xtypes extensibility of TOPIC. + * + * Used to determine which encoding type to write in the CDR header. + * This trait will be generated if the extensibility of TOPIC differs from final. + * + * @return The extensibility of TOPIC. + */ + static constexpr extensibility getExtensibility() + { + return extensibility::ext_final; + } + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY + /** + * @brief Returns the typeid for TOPIC. + * + * Is a simple pass-through for the derivation of the typeid from the type information. + * As C++ keeps the topic type as the template parameter, there is no need to look at the + * sertype for this topic. + * + * @param[in] kind The kind of typeid. + * + * @return A pointer to the typeid of this topic. + */ + static ddsi_typeid_t* getTypeId(const struct ddsi_sertype *, ddsi_typeid_kind_t kind) + { + auto ti = getTypeInfo(NULL); + if (ti) { + auto id = ddsi_typeinfo_typeid(ti, kind); + ddsi_typeinfo_fini(ti); + ddsrt_free(ti); + return id; + } else { + return nullptr; + } + } + + /** + * @brief Returns the type map for TOPIC. + * + * Takes the type map blob for this topic which is part of the generated type traits, and deserializes + * the type map from this blob. + * + * @return A pointer to the typemap for this topic. + */ + static ddsi_typemap_t* getTypeMap(const struct ddsi_sertype *) + { + ddsi_sertype_cdr_data_t cdr{type_map_blob_sz(), const_cast(type_map_blob())}; + return ddsi_typemap_deser(&cdr); + } + + /** + * @brief Returns the type info for TOPIC. + * + * Takes the type info blob for this topic which is part of the generated type traits, and deserializes + * the type info from this blob. + * + * @return A pointer to the typeinfo for this topic. + */ + static ddsi_typeinfo_t* getTypeInfo(const struct ddsi_sertype *) + { + ddsi_sertype_cdr_data_t cdr{type_info_blob_sz(), const_cast(type_info_blob())}; + return ddsi_typeinfo_deser(&cdr); + } + + /** + * @brief Returns size of the blob of the cdr serialized type map. + * + * This function is a placeholder, it will be instantiated for all valid topics. + * + * @return The size of the serialized type map blob. + */ + static constexpr unsigned int type_map_blob_sz() + { + return static_cast(-1); + } + + /** + * @brief Returns size of the blob of the cdr serialized type info. + * + * This function is a placeholder, it will be instantiated for all valid topics. + * + * @return The size of the serialized type info blob. + */ + static constexpr unsigned int type_info_blob_sz() + { + return static_cast(-1); + } + + /** + * @brief Returns pointer to the blob of the cdr serialized type map. + * + * This function is a placeholder, it will be instantiated for all valid topics. + * + * @return Pointer to the serialized type map blob. + */ + static inline const uint8_t * type_map_blob() + { + return nullptr; + } + + /** + * @brief Returns pointer to the blob of the cdr serialized type info. + * + * This function is a placeholder, it will be instantiated for all valid topics. + * + * @return Pointer to the serialized type info blob. + */ + static inline const uint8_t * type_info_blob() + { + return nullptr; + } +#endif //DDSCXX_HAS_TYPE_DISCOVERY + + /** + * @brief Returns a pointer to the derived sertype. + * + * Returns a nullptr if no type can be derived succesfully. + * + * @param[in] data_representation The type of data representation to use. + * + * @return The pointer to the derived sertype. + */ + static struct ddsi_sertype* deriveSertype(const struct ddsi_sertype *, dds_data_representation_id_t data_representation, dds_type_consistency_enforcement_qospolicy_t) + { + struct ddsi_sertype *ptr = nullptr; + switch (data_representation) { + case DDS_DATA_REPRESENTATION_XCDR1: + ptr = getSerType(DDS_DATA_REPRESENTATION_FLAG_XCDR1); + break; + case DDS_DATA_REPRESENTATION_XCDR2: + ptr = getSerType(DDS_DATA_REPRESENTATION_FLAG_XCDR2); + break; + } + if (ptr) { + uint32_t refc = ddsrt_atomic_ld32 (&ptr->flags_refc); + ddsrt_atomic_st32 (&ptr->flags_refc, refc & ~DDSI_SERTYPE_REFC_MASK); + } + return ptr; + } +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_TOPICTRAITS_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b620e4d07fe4acdafe671c1762c56bc0d57ef121 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp @@ -0,0 +1,1021 @@ +/* + * Copyright(c) 2020 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSCXXDATATOPIC_HPP_ +#define DDSCXXDATATOPIC_HPP_ + +#include +#include +#include +#include +#include + +#include "dds/ddsrt/md5.h" +#include "org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp" +#include "org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp" +#include "org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp" +#include "org/eclipse/cyclonedds/core/cdr/fragchain.hpp" +#include "org/eclipse/cyclonedds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/hash.hpp" + +#ifdef DDSCXX_HAS_SHM +#include "dds/ddsi/ddsi_shm_transport.h" +#endif + +constexpr size_t CDR_HEADER_SIZE = 4U; +#define BO_LITTLE 0X01 +#define PLAIN_CDR 0x00 +#define PL_CDR 0x02 +#define PLAIN_CDR2 0x06 +#define D_CDR 0x08 +#define PL_CDR2 0x0A + +// macro to check if a pointer is nullptr and return false +#define CHECK_FOR_NULL(val) if ((val) == nullptr) return false; + +using org::eclipse::cyclonedds::core::cdr::endianness; +using org::eclipse::cyclonedds::core::cdr::native_endianness; +using org::eclipse::cyclonedds::core::cdr::cdr_stream; +using org::eclipse::cyclonedds::core::cdr::basic_cdr_stream; +using org::eclipse::cyclonedds::core::cdr::xcdr_v1_stream; +using org::eclipse::cyclonedds::core::cdr::xcdr_v2_stream; +using org::eclipse::cyclonedds::core::cdr::extensibility; +using org::eclipse::cyclonedds::core::cdr::encoding_version; +using org::eclipse::cyclonedds::topic::TopicTraits; + +template +bool get_serialized_size(const T& sample, bool as_key, size_t &sz); + +template +bool to_key(const T& tokey, ddsi_keyhash_t& hash) +{ + if (TopicTraits::isKeyless()) + { + memset(&(hash.value), 0x0, sizeof(hash.value)); //just set all key bytes to 0 as all instances have the same hash value, and hashing is pointless + return true; + } else + { + basic_cdr_stream str(endianness::big_endian); + size_t sz = 0; + if (!get_serialized_size(tokey, true, sz)) { + assert(false); + return false; + } + size_t padding = 0; + if (sz < 16) + padding = (16 - sz % 16)%16; + std::vector buffer(sz + padding); + if (padding) + memset(buffer.data() + sz, 0x0, padding); + str.set_buffer(buffer.data(), sz); + if (!write(str, tokey, true)) { + assert(false); + return false; + } + static thread_local bool (*fptr)(const std::vector&, ddsi_keyhash_t&) = NULL; + if (fptr == NULL) + { + max(str, tokey, true); + if (str.position() <= 16) + { + //bind to unmodified function which just copies buffer into the keyhash + fptr = &org::eclipse::cyclonedds::topic::simple_key; + } + else + { + //bind to MD5 hash function + fptr = &org::eclipse::cyclonedds::topic::complex_key; + } + } + return (*fptr)(buffer, hash); + } +} + +static inline void* calc_offset(void* ptr, ptrdiff_t n) +{ + return static_cast(static_cast(ptr) + n); +} + +static inline const void* calc_offset(const void* ptr, ptrdiff_t n) +{ + return static_cast(static_cast(ptr) + n); +} + +template::value, bool> = true > +bool write_header(void *buffer) +{ + CHECK_FOR_NULL(buffer); + memset(buffer, 0x0, 4); + + auto ptr = static_cast(calc_offset(buffer, 1)); + + assert(TopicTraits::getExtensibility() == extensibility::ext_final); + *ptr = PLAIN_CDR; + + if (native_endianness() == endianness::little_endian) + *ptr |= BO_LITTLE; + + return true; +} + +template::value, bool> = true > +bool write_header(void *buffer) +{ + CHECK_FOR_NULL(buffer); + memset(buffer, 0x0, 4); + + auto ptr = static_cast(calc_offset(buffer, 1)); + + switch (TopicTraits::getExtensibility()) { + case extensibility::ext_final: + *ptr = PLAIN_CDR2; + break; + case extensibility::ext_appendable: + *ptr = D_CDR; + break; + case extensibility::ext_mutable: + *ptr = PL_CDR2; + break; + } + + if (native_endianness() == endianness::little_endian) + *ptr |= BO_LITTLE; + + return true; +} + +template::value, bool> = true > +bool write_header(void *buffer) +{ + CHECK_FOR_NULL(buffer); + memset(buffer, 0x0, 4); + + auto ptr = static_cast(calc_offset(buffer, 1)); + + switch (TopicTraits::getExtensibility()) { + case extensibility::ext_final: + case extensibility::ext_appendable: + *ptr = PLAIN_CDR; + break; + case extensibility::ext_mutable: + *ptr = PL_CDR; + break; + } + + if (native_endianness() == endianness::little_endian) + *ptr |= BO_LITTLE; + + return true; +} + +template +bool finish_header(void *buffer, size_t bytes_written) +{ + CHECK_FOR_NULL(buffer); + auto alignbytes = static_cast(4 % (4 - bytes_written % 4)); + auto ptr = static_cast(calc_offset(buffer, 3)); + + *ptr = alignbytes; + + return true; +} + +template +bool read_header(const void *buffer, encoding_version &ver, endianness &end) +{ + CHECK_FOR_NULL(buffer); + auto ptr = static_cast(calc_offset(buffer, 1)); + + if (*ptr & BO_LITTLE) + end = endianness::little_endian; + else + end = endianness::big_endian; + + auto field = *ptr & ~BO_LITTLE; + switch (TopicTraits::getExtensibility()) { + case extensibility::ext_final: + switch (field) { + case PLAIN_CDR: + if (TopicTraits::allowableEncodings() & DDS_DATA_REPRESENTATION_FLAG_XCDR1) + ver = encoding_version::basic_cdr; + else + ver = encoding_version::xcdr_v1; + break; + case PLAIN_CDR2: + ver = encoding_version::xcdr_v2; + break; + default: + return false; + } + break; + case extensibility::ext_appendable: + switch (field) { + case PL_CDR: + ver = encoding_version::xcdr_v1; + break; + case D_CDR: + ver = encoding_version::xcdr_v2; + break; + default: + return false; + } + break; + case extensibility::ext_mutable: + switch (field) { + case PL_CDR: + ver = encoding_version::xcdr_v1; + break; + case PL_CDR2: + ver = encoding_version::xcdr_v2; + break; + default: + return false; + } + break; + default: + return false; + } + + return true; +} + +template +bool get_serialized_fixed_size(const T& sample, size_t &sz) +{ + static thread_local size_t serialized_size = 0; + static thread_local std::mutex mtx; + static thread_local std::atomic_bool initialized {false}; + if (initialized.load(std::memory_order_relaxed)) { + sz = serialized_size; + return true; + } + std::lock_guard lock(mtx); + if (initialized.load(std::memory_order_relaxed)) { + sz = serialized_size; + return true; + } + S str; + if (!move(str, sample, K)) + return false; + serialized_size = str.position(); + initialized.store(true, std::memory_order_release); + sz = serialized_size; + return true; +} + +template +bool get_serialized_size(const T& sample, bool as_key, size_t &sz) +{ + if (TopicTraits::isSelfContained()) { + if ((as_key && !get_serialized_fixed_size(sample, sz)) || + (!as_key && !get_serialized_fixed_size(sample, sz))) + return false; + } else { + S str; + if (!move(str, sample, as_key)) + return false; + sz = str.position(); + } + + return true; +} + +template +bool serialize_into(void *buffer, + size_t buf_sz, + const T &sample, + bool as_key) +{ + CHECK_FOR_NULL(buffer); + assert(buf_sz >= CDR_HEADER_SIZE); + + S str; + str.set_buffer(calc_offset(buffer, CDR_HEADER_SIZE), buf_sz-CDR_HEADER_SIZE); + return (write_header(buffer) + && write(str, sample, as_key) + && finish_header(buffer, buf_sz)); +} + +/// \brief De-serialize the buffer into the sample +/// \param[in] buffer The buffer to be de-serialized +/// \param[out] sample Type to which the buffer will be de-serialized +/// \param[in] data_kind The data kind (data, or key) +/// \tparam T The sample type +/// \return True if the deserialization is successful +/// False if the deserialization failed +template +bool deserialize_sample_from_buffer(void *buffer, + size_t buf_sz, + T &sample, + const ddsi_serdata_kind data_kind=SDK_DATA) +{ + CHECK_FOR_NULL(buffer); + assert(data_kind != SDK_EMPTY); + + encoding_version ver; + endianness end; + if (!read_header(buffer, ver, end)) + return false; + + switch (ver) { + case encoding_version::basic_cdr: + { + basic_cdr_stream str(end); + str.set_buffer(calc_offset(buffer, CDR_HEADER_SIZE), buf_sz-CDR_HEADER_SIZE); + return read(str, sample, data_kind == SDK_KEY); + } + break; + case encoding_version::xcdr_v1: + { + xcdr_v1_stream str(end); + str.set_buffer(calc_offset(buffer, CDR_HEADER_SIZE), buf_sz-CDR_HEADER_SIZE); + return read(str, sample, data_kind == SDK_KEY); + } + break; + case encoding_version::xcdr_v2: + { + xcdr_v2_stream str(end); + str.set_buffer(calc_offset(buffer, CDR_HEADER_SIZE), buf_sz-CDR_HEADER_SIZE); + return read(str, sample, data_kind == SDK_KEY); + } + break; + default: + return false; + } +} + +template class ddscxx_serdata; + +template +bool serdata_eqkey(const ddsi_serdata* a, const ddsi_serdata* b) +{ + auto s_a = static_cast*>(a); + auto s_b = static_cast*>(b); + + return 0 == memcmp(s_a->key().value, s_b->key().value, 16); +} + +template +uint32_t serdata_size(const ddsi_serdata* dcmn) +{ + return static_cast(static_cast*>(dcmn)->size()); +} + +template +ddsi_serdata *serdata_from_ser( + const ddsi_sertype* type, + enum ddsi_serdata_kind kind, + const struct nn_rdata* fragchain, + size_t size) +{ + auto d = new ddscxx_serdata(type, kind); + d->resize(size); + auto cursor = static_cast(d->data()); + org::eclipse::cyclone::core::cdr::serdata_from_ser_copyin_fragchain (cursor, fragchain, size); + + if (d->getT()) + { + d->key_md5_hashed() = to_key(*d->getT(), d->key()); + d->populate_hash(); + } + else + { + delete d; + d = nullptr; + } + + return d; +} + +template +ddsi_serdata *serdata_from_ser_iov( + const ddsi_sertype* type, + enum ddsi_serdata_kind kind, + ddsrt_msg_iovlen_t niov, + const ddsrt_iovec_t* iov, + size_t size) +{ + auto d = new ddscxx_serdata(type, kind); + d->resize(size); + + size_t off = 0; + auto cursor = static_cast(d->data()); + for (ddsrt_msg_iovlen_t i = 0; i < niov && off < size; i++) + { + size_t n_bytes = iov[i].iov_len; + if (n_bytes + off > size) n_bytes = size - off; + memcpy(cursor, iov[i].iov_base, n_bytes); + cursor += n_bytes; + off += n_bytes; + } + + T* ptr = d->getT(); + if (ptr) { + d->key_md5_hashed() = to_key(*ptr, d->key()); + d->populate_hash(); + } else { + delete d; + d = nullptr; + } + + return d; + +} + +template +ddsi_serdata *serdata_from_keyhash( + const ddsi_sertype* type, + const struct ddsi_keyhash* keyhash) +{ + (void)keyhash; + (void)type; + //replace with (if key_size_max <= 16) then populate the data class with the key hash + return nullptr; +} + +template +ddsi_serdata *serdata_from_sample( + const ddsi_sertype* typecmn, + enum ddsi_serdata_kind kind, + const void* sample) +{ + assert(kind != SDK_EMPTY); + auto d = new ddscxx_serdata(typecmn, kind); + const auto& msg = *static_cast(sample); + size_t sz = 0; + + if (!get_serialized_size(msg, kind == SDK_KEY, sz)) + goto failure; + + sz += CDR_HEADER_SIZE; + d->resize(sz); + + if (!serialize_into(d->data(), sz, msg, kind == SDK_KEY)) + goto failure; + + d->key_md5_hashed() = to_key(msg, d->key()); + d->setT(&msg); + d->populate_hash(); + return d; + +failure: + if (d) + delete d; + return nullptr; +} + +template +void serdata_to_ser(const ddsi_serdata* dcmn, size_t off, size_t sz, void* buf) +{ + auto d = static_cast*>(dcmn); + memcpy(buf, calc_offset(d->data(), static_cast(off)), sz); +} + +template +ddsi_serdata *serdata_to_ser_ref( + const ddsi_serdata* dcmn, size_t off, + size_t sz, ddsrt_iovec_t* ref) +{ + auto d = static_cast*>(dcmn); + ref->iov_base = calc_offset(d->data(), static_cast(off)); + ref->iov_len = static_cast(sz); + return ddsi_serdata_ref(d); +} + +template +void serdata_to_ser_unref(ddsi_serdata* dcmn, const ddsrt_iovec_t* ref) +{ + static_cast(ref); // unused + ddsi_serdata_unref(static_cast*>(dcmn)); +} + +template +bool serdata_to_sample( + const ddsi_serdata* dcmn, void* sample, void** bufptr, + void* buflim) +{ + (void)bufptr; + (void)buflim; + + auto typed_sample_ptr = static_cast(sample); + // cast away const, with the reasoning that we don't modify the underlying ddsi_serdata which + // is actually const, we only modify the ddscxx_serdata non const contents + auto d = const_cast*>(static_cast*>(dcmn)); + + auto t_ptr = d->getT(); + if (!t_ptr) + return false; + + *typed_sample_ptr = *t_ptr; + return true; +} + +template +ddsi_serdata *serdata_to_untyped(const ddsi_serdata* dcmn) +{ + /* Cast away const: the serialized ddsi_serdata itself is not touched: only its C++ representation + * in the C++ wrapper may initialized if this was not done before. So conceptually the const for + * ddsi_serdata is not violated. + */ + auto d = const_cast*>(static_cast*>(dcmn)); + auto d1 = new ddscxx_serdata(d->type, SDK_KEY); + d1->type = nullptr; + + auto t = d->getT(); + size_t sz = 0; + if (t == nullptr || !get_serialized_size(*t, true, sz)) + goto failure; + + sz += CDR_HEADER_SIZE; + d1->resize(sz); + + if (!serialize_into(d1->data(), sz, *t, true)) + goto failure; + + d1->key_md5_hashed() = to_key(*t, d1->key()); + d1->hash = d->hash; + + return d1; + +failure: + delete d1; + return nullptr; +} + +template +bool serdata_untyped_to_sample( + const ddsi_sertype* type, + const ddsi_serdata* dcmn, void* sample, + void** bufptr, void* buflim) +{ + (void)type; + (void)bufptr; + (void)buflim; + + auto d = static_cast*>(dcmn); + T* ptr = static_cast(sample); + + return deserialize_sample_from_buffer(d->data(), d->size(), *ptr, SDK_KEY); +} + +template +void serdata_free(ddsi_serdata* dcmn) +{ + auto* d = static_cast*>(dcmn); + +#ifdef DDSCXX_HAS_SHM + if (d->iox_chunk && d->iox_subscriber) + { + // Explicit cast to iox_subscriber is required here, since the C++ binding has no notion of + // iox subscriber, but the underlying C API expects this to be a typed iox_subscriber. + // TODO (Sumanth), Fix this when we cleanup the interfaces to not use iceoryx directly in + // the C++ plugin + free_iox_chunk(static_cast(d->iox_subscriber), &d->iox_chunk); + } +#endif + delete d; +} + +template +size_t serdata_print( + const ddsi_sertype* tpcmn, const ddsi_serdata* dcmn, char* buf, size_t bufsize) +{ + (void)tpcmn; + (void)dcmn; + //implementation to follow!!! + if (bufsize > 0) + buf[0] = 0x0; + return 0; +} + +template +void serdata_get_keyhash( + const ddsi_serdata* d, struct ddsi_keyhash* buf, + bool force_md5) +{ + auto ptr = static_cast*>(d); + assert(buf); + if (force_md5 && !ptr->key_md5_hashed()) + { + ddsrt_md5_state_t md5st; + ddsrt_md5_init(&md5st); + ddsrt_md5_append(&md5st, static_cast(ptr->key().value), 16); + ddsrt_md5_finish(&md5st, static_cast(buf->value)); + } + else + { + memcpy(buf->value, ptr->key().value, 16); + } +} + +#ifdef DDSCXX_HAS_SHM +template +uint32_t serdata_iox_size(const struct ddsi_serdata* d) +{ + assert(sizeof(T) == d->type->iox_size); + return d->type->iox_size; +} + +template +ddsi_serdata * serdata_from_iox_buffer( + const struct ddsi_sertype * typecmn, enum ddsi_serdata_kind kind, + void * sub, void * iox_buffer) +{ + try { + auto d = new ddscxx_serdata(typecmn, kind); + + // serdata from the loaned sample (when using iceoryx) + d->iox_chunk = iox_buffer; + + // Update the iox subscriber, when constructing the serdata in the case of sample received + // from iceoryx + if (sub != nullptr) { + d->iox_subscriber = sub; + } + + // key handling + const auto& msg = *static_cast(d->iox_chunk); + d->key_md5_hashed() = to_key(msg, d->key()); + d->populate_hash(); + + return d; + } + catch (std::exception&) { + return nullptr; + } +} +#endif + +template +struct ddscxx_serdata_ops: public ddsi_serdata_ops { + ddscxx_serdata_ops(): ddsi_serdata_ops { + &serdata_eqkey, + &serdata_size, + &serdata_from_ser, + &serdata_from_ser_iov, + &serdata_from_keyhash, + &serdata_from_sample, + &serdata_to_ser, + &serdata_to_ser_ref, + &serdata_to_ser_unref, + &serdata_to_sample, + &serdata_to_untyped, + &serdata_untyped_to_sample, + &serdata_free, + &serdata_print, + &serdata_get_keyhash +#ifdef DDSCXX_HAS_SHM + , &serdata_iox_size + , &serdata_from_iox_buffer +#endif + } { ; } +}; + +template +class ddscxx_serdata : public ddsi_serdata { + size_t m_size{ 0 }; + std::unique_ptr m_data{ nullptr }; + ddsi_keyhash_t m_key; + bool m_key_md5_hashed = false; + std::atomic m_t{ nullptr }; + +public: + bool hash_populated = false; + ddscxx_serdata(const ddsi_sertype* type, ddsi_serdata_kind kind); + ~ddscxx_serdata() { delete m_t.load(std::memory_order_acquire); } + + void resize(size_t requested_size); + size_t size() const { return m_size; } + void* data() const { return m_data.get(); } + ddsi_keyhash_t& key() { return m_key; } + const ddsi_keyhash_t& key() const { return m_key; } + bool& key_md5_hashed() { return m_key_md5_hashed; } + const bool& key_md5_hashed() const { return m_key_md5_hashed; } + void populate_hash(); + T* setT(const T* toset); + T* getT(); + +private: + void deserialize_and_update_sample(uint8_t * buffer, size_t sz, T *& t); + void update_sample_from_iox_chunk(T *& t); +}; + +template +ddscxx_serdata::ddscxx_serdata(const ddsi_sertype* type, ddsi_serdata_kind kind) + : ddsi_serdata{} +{ + memset(m_key.value, 0x0, 16); + ddsi_serdata_init(this, type, kind); +} + +template +void ddscxx_serdata::resize(size_t requested_size) +{ + if (!requested_size) { + m_size = 0; + m_data.reset(); + return; + } + + /* FIXME: CDR padding in DDSI makes me do this to avoid reading beyond the bounds + when copying data to network. Should fix Cyclone to handle that more elegantly. */ + size_t n_pad_bytes = (0 - requested_size) % 4; + m_data.reset(new unsigned char[requested_size + n_pad_bytes]); + m_size = requested_size + n_pad_bytes; + + // zero the very end. The caller isn't necessarily going to overwrite it. + std::memset(calc_offset(m_data.get(), static_cast(requested_size)), '\0', n_pad_bytes); +} + +template +void ddscxx_serdata::populate_hash() +{ + if (hash_populated) + return; + + key_md5_hashed() = to_key(*getT(), key()); + if (!key_md5_hashed()) + { + ddsi_keyhash_t buf; + ddsrt_md5_state_t md5st; + ddsrt_md5_init(&md5st); + ddsrt_md5_append(&md5st, static_cast(key().value), 16); + ddsrt_md5_finish(&md5st, static_cast(buf.value)); + memcpy(&(hash), buf.value, 4); + } + else + { + memcpy(&(hash), key().value, 4); + } + + hash ^= type->serdata_basehash; + hash_populated = true; +} + +template +T* ddscxx_serdata::setT(const T* toset) +{ + assert(toset); + T* t = m_t.load(std::memory_order_acquire); + if (t == nullptr) { + t = new T(*toset); + T* exp = nullptr; + if (!m_t.compare_exchange_strong(exp, t, std::memory_order_seq_cst)) { + delete t; + t = exp; + } + } else { + *t = *toset; + } + return t; +} + +template +T* ddscxx_serdata::getT() { + // check if m_t is already set + T *t = m_t.load(std::memory_order_acquire); + // if m_t is not set + if (t == nullptr) { + // if the data is available on iox_chunk, update and get the sample + update_sample_from_iox_chunk(t); + // if its not possible to get the sample from iox_chunk + if(t == nullptr) { + // deserialize and get the sample + deserialize_and_update_sample(static_cast(data()), size(), t); + } + } + return t; +} + +template +void ddscxx_serdata::deserialize_and_update_sample(uint8_t * buffer, size_t sz, T *& t) { + t = new T(); + // if deserialization failed + if(!deserialize_sample_from_buffer(buffer, sz, *t, kind)) { + delete t; + t = nullptr; + } + + T* exp = nullptr; + if (!m_t.compare_exchange_strong(exp, t, std::memory_order_seq_cst)) { + delete t; + t = exp; + } +} + +template +void ddscxx_serdata::update_sample_from_iox_chunk(T *& t) { +#ifdef DDSCXX_HAS_SHM + // if data is available on the iox_chunk (and doesn't have a serialized representation) + if (iox_chunk != nullptr && data() == nullptr) { + auto iox_header = iceoryx_header_from_chunk(iox_chunk); + // if the iox chunk has the data in serialized form + if (iox_header->shm_data_state == IOX_CHUNK_CONTAINS_SERIALIZED_DATA) { + deserialize_and_update_sample(static_cast(iox_chunk), iox_header->data_size, t); + } else if (iox_header->shm_data_state == IOX_CHUNK_CONTAINS_RAW_DATA) { + // get the chunk directly without any copy + t = static_cast(this->iox_chunk); + } else { + // Data is in un-initialized state, which shouldn't happen + t = nullptr; + } + } else { + // data is not available on iox_chunk + t = nullptr; + } +#else + t = nullptr; +#endif // DDSCXX_HAS_SHM +} + +template +class ddscxx_sertype; + +template +void sertype_free(ddsi_sertype* tpcmn) +{ + auto tp = static_cast*>(tpcmn); + ddsi_sertype_fini(tpcmn); + delete tp; +} + +template +void sertype_zero_samples(const ddsi_sertype*, void*, size_t) +{ + return; +} + +template +void sertype_realloc_samples( + void** ptrs, const ddsi_sertype*, void*, size_t, size_t) +{ + /* For C++ we make one big assumption about the caller of this function: + * it can only be invoked by the ddsi_sertype_alloc_sample, and will therefore + * never be used to reallocate an existing sample collection. This is caused by + * the fact that the C++ API lets either the user specify the exact dimensions + * of his preallocated collection (in which case there is no need to realloc them), + * or if the user didn't preallocate any memory it peeks at the available + * samples prior to allocating the sample collection that is returned (so that + * again there is no need to reallocate it). + * Because of this, we can safely assume that sertype_realloc_samples can only + * be invoked by ddsi_sertype_alloc_sample, in which case oldCount is always 0, + * count is always 1 and the old pointer is always null. + */ + ptrs[0] = new T(); +} + +template +void sertype_free_samples( + const ddsi_sertype*, void** ptrs, size_t, dds_free_op_t op) +{ + /* For C++ we make one big assumption about the caller of this function: + * it can only be invoked by the ddsi_sertype_free_sample, and will therefore + * never be used to free an existing sample collection. This is caused by + * the fact that the C++ API lets either the user specify the exact dimensions + * of his preallocated collection (in which case there is no need to release + * it in the cyclone code base), or if the user didn't preallocate any memory it + * returns a collection of samples that will be owned by the user (in which case + * cyclone doesn't need to release the collection either). + * Because of this, we can safely assume that sertype_free_samples can only + * be invoked by ddsi_sertype_free_sample, in which case count is always 1, + * and the op flags can either be set to DDS_FREE_ALL_BIT, or to DDS_FREE_CONTENTS_BIT. + */ + T* ptr = reinterpret_cast(ptrs[0]); + if (op & DDS_FREE_ALL_BIT) { + delete ptr; + } else { + assert(op & DDS_FREE_CONTENTS_BIT); + *ptr = T(); + } +} + +template +bool sertype_equal( + const ddsi_sertype* acmn, const ddsi_sertype* bcmn) +{ + /* A bit of a guess: types with the same name & type name are really the same if they have + the same type support identifier as well */ + (void)acmn; + (void)bcmn; + return true; +} + +template +uint32_t sertype_hash(const ddsi_sertype* tpcmn) +{ + (void)tpcmn; + return 0x0; +} + +template +size_t sertype_get_serialized_size(const ddsi_sertype*, const void * sample) +{ + const auto& msg = *static_cast(sample); + + // get the serialized size of the sample (with out serializing) + size_t sz = 0; + if (!get_serialized_size(msg, false, sz)) { + // the max value is treated as an error in the Cyclone core + return SIZE_MAX; + } + + return sz + CDR_HEADER_SIZE; // Include the additional bytes for the CDR header +} + +template +bool sertype_serialize_into(const ddsi_sertype*, + const void * sample, + void * dst_buffer, + size_t sz) +{ + // cast to the type + const auto& msg = *static_cast(sample); + + return serialize_into(dst_buffer, sz, msg, false); +} + +template +struct ddscxx_sertype_ops: public ddsi_sertype_ops { + ddscxx_sertype_ops(): ddsi_sertype_ops { + ddsi_sertype_v0, + nullptr, + sertype_free, + sertype_zero_samples, + sertype_realloc_samples, + sertype_free_samples, + sertype_equal, + sertype_hash, + #ifdef DDSCXX_HAS_TYPE_DISCOVERY + TopicTraits::getTypeId, + TopicTraits::getTypeMap, + TopicTraits::getTypeInfo, + #else + nullptr, + nullptr, + nullptr, + #endif //DDSCXX_HAS_TYPE_DISCOVERY + TopicTraits::deriveSertype, + sertype_get_serialized_size, + sertype_serialize_into + } { ; } +}; + +template +class ddscxx_sertype : public ddsi_sertype { +public: + static const ddscxx_sertype_ops sertype_ops; + static const ddscxx_serdata_ops serdata_ops; + ddscxx_sertype(); +}; + +template +const ddscxx_sertype_ops ddscxx_sertype::sertype_ops; + +template +const ddscxx_serdata_ops ddscxx_sertype::serdata_ops; + +template +ddscxx_sertype::ddscxx_sertype() + : ddsi_sertype{} +{ + uint32_t flags = (TopicTraits::isKeyless() ? DDSI_SERTYPE_FLAG_TOPICKIND_NO_KEY : 0); +#ifdef DDSCXX_HAS_SHM + flags |= (TopicTraits::isSelfContained() ? + DDSI_SERTYPE_FLAG_FIXED_SIZE : 0); +#endif + + ddsi_sertype_init_flags( + static_cast(this), + TopicTraits::getTypeName(), + &sertype_ops, + &serdata_ops, + flags); + + allowed_data_representation = TopicTraits::allowableEncodings(); + +#ifdef DDSCXX_HAS_SHM + // update the size of the type, if its fixed + // this needs to be done after sertype init! TODO need an API in Cyclone DDS to set this + this->iox_size = + static_cast(TopicTraits::getSampleSize()); +#endif +} + +#endif // DDSCXXDATATOPIC_HPP_ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/discovery.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/discovery.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bc574693e129265fbeb76db094ca7422dcf42b9d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/discovery.hpp @@ -0,0 +1,169 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_DISCOVER_HPP_ +#define CYCLONEDDS_TOPIC_DISCOVER_HPP_ + +#include +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + + +template +struct typed_lookup_topic { + template + static inline TOPIC discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout); + + template + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector& list, + uint32_t max_size); +}; + + +template +struct typed_lookup_topic > { + static inline dds::topic::ContentFilteredTopic discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + (void)dp; + (void)topic_name; + (void)timeout; + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported"); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector >& list, + uint32_t max_size) + { + (void)dp; + (void)list; + (void)max_size; + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported"); + } +}; + +template +struct typed_lookup_topic > { + static inline dds::topic::Topic discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + return dds::topic::detail::Topic::discover_topic(dp, topic_name, timeout); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector >& list, + uint32_t max_size) + { + dds::topic::detail::Topic::discover_topics(dp, list, max_size); + } +}; + + + +template +struct lookup_topic { + static inline TOPIC discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + return org::eclipse::cyclonedds::topic::typed_lookup_topic::discover(dp, topic_name, timeout); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector& list, + uint32_t max_size) + { + org::eclipse::cyclonedds::topic::typed_lookup_topic::discover(dp, list, max_size); + } +}; + +template <> +struct lookup_topic { + static inline dds::topic::TopicDescription discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + return org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topic(dp, topic_name, timeout); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector& list, + uint32_t max_size) + { + std::vector anyTopics; + org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topics(dp, anyTopics, max_size); + for (std::vector::iterator it = anyTopics.begin(); it != anyTopics.end(); ++it) { + list.push_back(*it); + } + } +}; + +template <> +struct lookup_topic { + static inline dds::topic::AnyTopic discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + return org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topic(dp, topic_name, timeout); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector& list, + uint32_t max_size) + { + org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topics(dp, list, max_size); + } +}; + + + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_DISCOVER_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/find.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/find.hpp new file mode 100644 index 0000000000000000000000000000000000000000..91ae24f45a677b34010a79d175e45109c7b05d78 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/find.hpp @@ -0,0 +1,133 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_FIND_HPP_ +#define CYCLONEDDS_TOPIC_FIND_HPP_ + +#include +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +OMG_DDS_API dds::topic::TopicDescription +find_topic_description( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name); + +OMG_DDS_API dds::topic::AnyTopic +find_any_topic( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name); + + +template +struct typed_finder { + template + static inline TOPIC find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name); +}; + + +template +struct typed_finder > { + static inline dds::topic::ContentFilteredTopic find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + dds::topic::ContentFilteredTopic topic = dds::core::null; + + org::eclipse::cyclonedds::core::ObjectDelegate::ref_type entity = dp.delegate()->find_cfTopic(topic_name); + + if (entity) { + typename dds::topic::ContentFilteredTopic::DELEGATE_REF_T topic_typed = + ::std::dynamic_pointer_cast::DELEGATE_T>(entity); + topic = dds::topic::ContentFilteredTopic(topic_typed); + } + return topic; + } +}; + +template +struct typed_finder > { + static inline dds::topic::Topic find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + dds::topic::Topic topic = dds::core::null; + + org::eclipse::cyclonedds::core::EntityDelegate::ref_type entity = dp.delegate()->find_topic(topic_name); + + if (entity) { + typename dds::topic::Topic::DELEGATE_REF_T topic_typed = + ::std::dynamic_pointer_cast::DELEGATE_T>(entity); + topic = dds::topic::Topic(topic_typed); + } + return topic; + } +}; + + + +template +struct finder { + static inline TOPIC find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + return org::eclipse::cyclonedds::topic::typed_finder::find(dp, topic_name); + } +}; + +template <> +struct finder { + static inline dds::topic::TopicDescription find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + return find_topic_description(dp, topic_name); + } +}; + +template <> +struct finder { + static inline dds::topic::AnyTopic find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + return find_any_topic(dp, topic_name); + } +}; + + + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_FIND_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp new file mode 100644 index 0000000000000000000000000000000000000000..27a2778209ae1f56fe1d66cef51bf717174302e6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp @@ -0,0 +1,42 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + + /** + * @file + */ + +#ifndef IDLCXX_HASH_HPP_ +#define IDLCXX_HASH_HPP_ + +#include "dds/core/macros.hpp" +#include "dds/ddsi/ddsi_keyhash.h" +#include + +namespace org +{ + + namespace eclipse + { + namespace cyclonedds + { + namespace topic + { + bool OMG_DDS_API simple_key(const std::vector& in, ddsi_keyhash_t& out); + + bool OMG_DDS_API complex_key(const std::vector& in, ddsi_keyhash_t& out); + } + } + } +} + +#endif /* IDLCXX_HASH_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/qos/TopicQosDelegate.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/qos/TopicQosDelegate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f056eec46990f81c9d8eb5f1e60866d25f3f5580 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/topic/qos/TopicQosDelegate.hpp @@ -0,0 +1,289 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_QOS_TOPIC_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_TOPIC_QOS_TOPIC_QOS_DELEGATE_HPP_ + +#include +#include + +struct _DDS_NamedTopicQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ +namespace qos +{ + +class OMG_DDS_API TopicQosDelegate +{ +public: + TopicQosDelegate(); + + void policy(const dds::core::policy::TopicData& topic_data); + void policy(const dds::core::policy::Durability& durability); +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + void policy(const dds::core::policy::DurabilityService& durability_service); +#endif // OMG_DDS_PERSISTENCE_SUPPORT + void policy(const dds::core::policy::Deadline& deadline); + void policy(const dds::core::policy::LatencyBudget& budget); + void policy(const dds::core::policy::Liveliness& liveliness); + void policy(const dds::core::policy::Reliability& reliability); + void policy(const dds::core::policy::DestinationOrder& order); + void policy(const dds::core::policy::History& history); + void policy(const dds::core::policy::ResourceLimits& resources); + void policy(const dds::core::policy::TransportPriority& priority); + void policy(const dds::core::policy::Lifespan& lifespan); + void policy(const dds::core::policy::Ownership& ownership); +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + void policy(const dds::core::policy::DataRepresentation& datarepresentation); + void policy(const dds::core::policy::TypeConsistencyEnforcement& typeconsistencyenforcement); +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedTopicQos &qos); + + void check() const; + + bool operator ==(const TopicQosDelegate& other) const; + +private: + dds::core::policy::TopicData topic_data_; + dds::core::policy::Durability durability_; +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + dds::core::policy::DurabilityService durability_service_; +#endif // OMG_DDS_PERSISTENCE_SUPPORT + dds::core::policy::Deadline deadline_; + dds::core::policy::LatencyBudget budget_; + dds::core::policy::Liveliness liveliness_; + dds::core::policy::Reliability reliability_; + dds::core::policy::DestinationOrder order_; + dds::core::policy::History history_; + dds::core::policy::ResourceLimits resources_; + dds::core::policy::TransportPriority priority_; + dds::core::policy::Lifespan lifespan_; + dds::core::policy::Ownership ownership_; +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + dds::core::policy::DataRepresentation datarepresentation_; + dds::core::policy::TypeConsistencyEnforcement typeconsistencyenforcement_; +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +}; + + + +//============================================================================== + + +template<> inline const dds::core::policy::TopicData& +TopicQosDelegate::policy() const +{ + return topic_data_; +} +template<> inline dds::core::policy::TopicData& +TopicQosDelegate::policy() +{ + return topic_data_; +} + + +template<> inline const dds::core::policy::Durability& +TopicQosDelegate::policy() const +{ + return durability_; +} +template<> inline dds::core::policy::Durability& +TopicQosDelegate::policy() +{ + return durability_; +} + + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT +template<> inline const dds::core::policy::DurabilityService& +TopicQosDelegate::policy() const +{ + return durability_service_; +} +template<> inline dds::core::policy::DurabilityService& +TopicQosDelegate::policy() +{ + return durability_service_; +} +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + +template<> inline const dds::core::policy::Deadline& +TopicQosDelegate::policy() const +{ + return deadline_; +} +template<> inline dds::core::policy::Deadline& +TopicQosDelegate::policy() +{ + return deadline_; +} + + +template<> inline const dds::core::policy::LatencyBudget& +TopicQosDelegate::policy() const +{ + return budget_; +} +template<> inline dds::core::policy::LatencyBudget& +TopicQosDelegate::policy() +{ + return budget_; +} + + +template<> inline const dds::core::policy::Liveliness& +TopicQosDelegate::policy() const +{ + return liveliness_; +} +template<> inline dds::core::policy::Liveliness& +TopicQosDelegate::policy() +{ + return liveliness_; +} + + +template<> inline const dds::core::policy::Reliability& +TopicQosDelegate::policy() const +{ + return reliability_; +} +template<> inline dds::core::policy::Reliability& +TopicQosDelegate::policy() +{ + return reliability_; +} + + +template<> inline const dds::core::policy::DestinationOrder& +TopicQosDelegate::policy() const +{ + return order_; +} +template<> inline dds::core::policy::DestinationOrder& +TopicQosDelegate::policy() +{ + return order_; +} + + +template<> inline const dds::core::policy::History& +TopicQosDelegate::policy() const +{ + return history_; +} +template<> inline dds::core::policy::History& +TopicQosDelegate::policy() +{ + return history_; +} + + +template<> inline const dds::core::policy::ResourceLimits& +TopicQosDelegate::policy() const +{ + return resources_; +} +template<> inline dds::core::policy::ResourceLimits& +TopicQosDelegate::policy() +{ + return resources_; +} + + +template<> inline const dds::core::policy::TransportPriority& +TopicQosDelegate::policy() const +{ + return priority_; +} +template<> inline dds::core::policy::TransportPriority& +TopicQosDelegate::policy() +{ + return priority_; +} + + +template<> inline const dds::core::policy::Lifespan& +TopicQosDelegate::policy() const +{ + return lifespan_; +} +template<> inline dds::core::policy::Lifespan& +TopicQosDelegate::policy() +{ + return lifespan_; +} + + +template<> inline const dds::core::policy::Ownership& +TopicQosDelegate::policy() const +{ + return ownership_; +} +template<> inline dds::core::policy::Ownership& +TopicQosDelegate::policy() +{ + return ownership_; +} + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +template<> inline const dds::core::policy::DataRepresentation& +TopicQosDelegate::policy() const +{ + return datarepresentation_; +} +template<> inline dds::core::policy::DataRepresentation& +TopicQosDelegate::policy() +{ + return datarepresentation_; +} + +template<> inline const dds::core::policy::TypeConsistencyEnforcement& +TopicQosDelegate::policy() const +{ + return typeconsistencyenforcement_; +} +template<> inline dds::core::policy::TypeConsistencyEnforcement& +TopicQosDelegate::policy() +{ + return typeconsistencyenforcement_; +} +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +} +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_QOS_TOPIC_QOS_DELEGATE_HPP_ */ diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/visualize_motion.py b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/visualize_motion.py new file mode 100644 index 0000000000000000000000000000000000000000..68ff214c6cb600c83eacd5b3192406336a527906 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/visualize_motion.py @@ -0,0 +1,432 @@ +import argparse +import csv +import os +import time +from scipy.spatial.transform import Rotation as R + +import mujoco +import mujoco.viewer +import numpy as np + +from lxml import etree + +import zmq +import threading +import msgpack + +def key_call_back(keycode): + global \ + curr_start, \ + num_motions, \ + motion_id, \ + motion_acc, \ + time_step, \ + dt, \ + paused, \ + data_csv_dict, \ + frame_idx, \ + anim_idx + + try: + c = chr(keycode) + except: + c = "" + if c == "R": + print("Reset") + frame_idx = int(0) + elif c == " ": + print("Paused") + paused = not paused + elif c == ".": + frame_idx = frame_idx + 1 + print("frame", frame_idx) + elif c == ",": + frame_idx = frame_idx - 1 + print("frame", frame_idx) + elif c == "=": + anim_idx = anim_idx + 1 + print("anim", anim_idx) + elif c == "-": + anim_idx = anim_idx - 1 + print("anim", anim_idx) + else: + print("not mapped", c) + + +def load_anim_data(csv_path: str): + + ret = [] + if os.path.isdir(csv_path): + + joint_pos_path = os.path.join(csv_path, "joint_pos.csv") + body_pos_path = os.path.join(csv_path, "body_pos.csv") + body_quat_path = os.path.join(csv_path, "body_quat.csv") + + isaaclab_to_mujoco = [0, 3, 6, 9, 13, 17, 1, 4, 7, 10, 14, 18, 2, 5, 8, + 11, 15, 19, 21, 23, 25, 27, 12, 16, 20, 22, 24, 26, 28] + + with open(joint_pos_path, mode="r", newline="") as joint_pos_file, open(body_pos_path, mode="r", newline="") as body_pos_file, open(body_quat_path, mode="r", newline="") as body_quat_file: + firstRow = True + joint_pos_rowlist = [] + body_pos_rowlist = [] + body_quat_rowlist = [] + for joint_pos_row, body_pos_row, body_quat_row in zip(joint_pos_file, body_pos_file, body_quat_file): + if firstRow: + firstRow = False + continue + + joint_pos_row = np.array([float(x) for x in joint_pos_row.split(",")]) + body_pos_row = np.array([float(x) for x in body_pos_row.split(",")]) + body_quat_row = np.array([float(x) for x in body_quat_row.split(",")]) + + joint_pos_rowlist.append(joint_pos_row) + body_pos_rowlist.append(body_pos_row) + body_quat_rowlist.append(body_quat_row) + + ret.append({ + "dof": np.array(joint_pos_rowlist)[:, isaaclab_to_mujoco], + "root_rot": np.array(body_quat_rowlist)[:, [0, 1, 2, 3]], # [x, y, z, w] + "root_trans_offset": np.array(body_pos_rowlist)[:, :3], + }) + + else: + csv_data = [] + current_rowlist = [] + with open(csv_path, mode="r", newline="") as file: + + csv_reader = csv.reader(file) + for row in csv_reader: + if len(row): + r = [x for x in row if x] + assert len(r) == 36 + current_rowlist.append(r) + else: + csv_data.append(current_rowlist) + current_rowlist = [] + + if current_rowlist: + csv_data.append(current_rowlist) + + for d in csv_data: + ret.append({ + "dof": np.array(d)[:, 7:], + "root_rot": np.array(d)[:, 3:7][:, [0, 1, 2, 3]], # [x, y, z, w] + "root_trans_offset": np.array(d)[:, :3], + }) + + return ret + + +def receive_realtime_debug_messages(socket, data_csv_dicts, topic): + while True: + message = socket.recv() + + # Remove any header or leading bytes (should be exactly 8 bytes for "g1_debug") + data = message.split(topic.encode())[1] + + result = msgpack.unpackb(data) + + data_csv_dicts[0]["root_trans_offset"][0, ...] = result["base_trans_target"] + data_csv_dicts[0]["root_rot"][0, ...] = result["base_quat_target"] + data_csv_dicts[0]["dof"][0, ...] = result["body_q_target"] + + data_csv_dicts[0]["root_trans_offset_measured"][0, ...] = result["base_trans_measured"] + data_csv_dicts[0]["root_rot_measured"][0, ...] = result["base_quat_measured"] + data_csv_dicts[0]["dof_measured"][0, ...] = result["body_q_measured"] + + data_csv_dicts[0]["vr_3point_position"] = np.array(result["vr_3point_position"]).reshape(3,3) + data_csv_dicts[0]["vr_3point_orientation"] = np.array(result["vr_3point_orientation"]).reshape(3,4) + data_csv_dicts[0]["vr_3point_compliance"] = np.array(result["vr_3point_compliance"]).reshape(3) + + if "motor_temperature" in result: + temps = np.array(result["motor_temperature"]) + # 58 values: 29 motors × 2 (winding, driver). Take max per motor. + data_csv_dicts[0]["motor_temperature"] = np.maximum(temps[0::2], temps[1::2]) # shape (29,) + +def main(args) -> None: + global \ + curr_start, \ + num_motions, \ + motion_id, \ + motion_acc, \ + time_step, \ + dt, \ + paused, \ + data_csv_dict, \ + frame_idx, \ + anim_idx + + fps = 50 + curr_start, num_motions, motion_id, motion_acc, time_step, dt, paused, frame_idx, anim_idx = 0, 1, 0, set(), 0, 1 / fps, False, int(0), 0 + + def prepend_names(elem, prefix): + # If element has a 'name' attribute, prepend the prefix + if 'name' in elem.attrib: + elem.attrib['name'] = prefix + elem.attrib['name'] + # Recurse for all child elements + for child in elem: + prepend_names(child, prefix) + + def replace_attribute(elem, attribute, value): + # If element has a 'name' attribute, prepend the prefix + if attribute in elem.attrib: + elem.attrib[attribute] = value + # Recurse for all child elements + for child in elem: + replace_attribute(child, attribute, value) + + main_scene = etree.parse('g1/scene_empty.xml') + robot1 = etree.parse('g1/g1_29dof_old.xml') + robot_asset = robot1.find('asset') + scene_asset = main_scene.find('asset') + for mesh in robot_asset.findall('mesh'): + # INSERT_YOUR_CODE + mesh.set("file", os.path.join("g1","meshes", mesh.get('file'))) + scene_asset.append(mesh) + + robot_default = robot1.find('default') + scene_default = main_scene.find('default') + for default in robot_default.findall('default'): + scene_default.append(default) + + scene_worldbody = main_scene.find('worldbody') + robot1_body = robot1.find('worldbody').find('body') + prepend_names(robot1_body, "robot1_") + scene_worldbody.append(robot1_body) + + robot2 = etree.parse('g1/g1_29dof_old.xml') + robot2_body = robot2.find('worldbody').find('body') + prepend_names(robot2_body, "robot2_") + replace_attribute(robot2_body, "rgba", "0.5 0.1 0.1 1") + robot2_body.set("pos", "0 -1 -10") + scene_worldbody.append(robot2_body) + + robot3 = etree.parse('g1/g1_29dof_old.xml') + robot3_body = robot3.find('worldbody').find('body') + prepend_names(robot3_body, "robot3_") + replace_attribute(robot3_body, "rgba", "0.1 0.5 0.1 0.2") + robot3_body.set("pos", "0 -2 -10") + scene_worldbody.append(robot3_body) + + # Robot 4: temperature visualization robot (white transparent, offset 3m to the right) + robot4 = etree.parse('g1/g1_29dof_old.xml') + robot4_body = robot4.find('worldbody').find('body') + prepend_names(robot4_body, "robot4_") + replace_attribute(robot4_body, "rgba", "0.8 0.8 0.8 0.1") + robot4_body.set("pos", "0 -3 -10") + scene_worldbody.append(robot4_body) + + mj_model = mujoco.MjModel.from_xml_string(etree.tostring(main_scene, pretty_print=True, encoding="unicode")) + mj_data = mujoco.MjData(mj_model) + + # Disable advanced visual effects for better performance + mj_model.vis.global_.offwidth = 1920 + mj_model.vis.global_.offheight = 1080 + mj_model.vis.quality.shadowsize = 0 # Disable shadows + mj_model.vis.quality.offsamples = 1 # Reduce anti-aliasing + mj_model.vis.rgba.fog = [0, 0, 0, 0] # Disable fog + + # Disable advanced lighting effects + mj_model.vis.headlight.ambient = [0.8, 0.8, 0.8] # Increase ambient light + mj_model.vis.headlight.diffuse = [0.8, 0.8, 0.8] # Increase diffuse light + mj_model.vis.headlight.specular = [0.1, 0.1, 0.1] # Reduce specular highlights + + if args.realtime_debug_url: + context = zmq.Context() + socket = context.socket(zmq.SUB) + socket.connect(args.realtime_debug_url) + socket.setsockopt(zmq.SUBSCRIBE, args.realtime_debug_topic.encode()) + + data_csv_dicts = [{ + "dof": np.zeros((1,29), dtype=np.float64), + "root_rot": np.array([[0.0, 0.0, 0.0, 1.0]]), # [x, y, z, w] + "root_trans_offset": np.array([[0.0, 0.0, .9]], dtype=np.float64), + "dof_measured": np.zeros((1,29), dtype=np.float64), + "root_rot_measured": np.array([[0.0, 0.0, 0.0, 1.0]]), + "root_trans_offset_measured": np.array([[0.0, 0.0, 0.0]], dtype=np.float64), + "vr_3point_position": np.zeros((3,3), dtype=np.float64), + "vr_3point_orientation": np.zeros((3,4), dtype=np.float64), + "vr_3point_compliance": np.zeros((3), dtype=np.float64), + "motor_temperature": np.zeros(29, dtype=np.float64), + }] + + threading.Thread(target=receive_realtime_debug_messages, args=(socket, data_csv_dicts, args.realtime_debug_topic)).start() + + elif args.motion_dir: + data_csv_dicts = load_anim_data(args.motion_dir) + elif args.csv_path: + data_csv_dicts = load_anim_data(args.csv_path) + else: + raise ValueError("Either --realtime_debug_url, --motion_dir, or --csv_path must be provided") + + RECORDING = False + mj_model.opt.timestep = dt + try: + context = mujoco.GLContext(1920, 1080) + context.make_current() + print("✓ GPU acceleration enabled") + except Exception as e: + print(f"✗ GPU acceleration not available: {e}") + context = None + + with mujoco.viewer.launch_passive( + mj_model, + mj_data, + key_callback=key_call_back, + show_left_ui=False, + show_right_ui=False, + ) as viewer: + # Set camera position to be further away + viewer.cam.distance = 15.0 # Increase distance from the scene + viewer.cam.azimuth = 90.0 # Set azimuth angle + viewer.cam.elevation = -20.0 # Set elevation angle + + while viewer.is_running(): + motion_len = data_csv_dicts[anim_idx % len(data_csv_dicts)]["dof"].shape[0] + step_start = time.time() + time_idx = frame_idx % motion_len + data_dict = data_csv_dicts[anim_idx % len(data_csv_dicts)] + mj_data.qpos[:3] = data_dict["root_trans_offset"][time_idx] + mj_data.qpos[3:7] = data_dict["root_rot"][time_idx] + mj_data.qpos[7:7+29] = data_dict["dof"][time_idx] + + if "dof_measured" in data_dict: + mj_data.qpos[36:36+3] = data_dict["root_trans_offset_measured"][time_idx] + mj_data.qpos[39:39+4] = data_dict["root_rot_measured"][time_idx] + mj_data.qpos[43:43+29] = data_dict["dof_measured"][time_idx] + + + mj_data.qpos[43+29:43+29+3] = data_dict["root_trans_offset_measured"][time_idx] + mj_data.qpos[43+29+3:43+29+3+4] = data_dict["root_rot"][time_idx] + mj_data.qpos[43+29+3+4:43+29+3+4+29] = data_dict["dof"][time_idx] + + # Robot 4: temperature visualization (copy measured state, offset 3m on y) + r4_base = 36 * 3 # 108 + r4_pos = data_dict["root_trans_offset_measured"][time_idx].copy() + r4_pos[1] -= 1.0 # offset 1m to the right + mj_data.qpos[r4_base:r4_base+3] = r4_pos + mj_data.qpos[r4_base+3:r4_base+7] = data_dict["root_rot_measured"][time_idx] + mj_data.qpos[r4_base+7:r4_base+36] = data_dict["dof_measured"][time_idx] + + mujoco.mj_forward(mj_model, mj_data) + if not paused: + frame_idx += 1 + + viewer.user_scn.ngeom = 0 + if "vr_3point_position" in data_dict: + # Get root pose for transforming root-relative coordinates to world space + # VR 3-point data from C++ is normalized relative to root (see g1_deploy_onnx_ref.cpp) + root_trans = data_dict["root_trans_offset_measured"][time_idx] + root_quat_wxyz = data_dict["root_rot_measured"][time_idx] # [w, x, y, z] format (MuJoCo/C++ convention) + root_rot = R.from_quat(root_quat_wxyz, scalar_first=True) + + for i in range(3): + # VR 3-point position is in root-relative coordinates, transform to world + vr_pos_root_frame = data_dict["vr_3point_position"][i] + # vr_pos_world = root_trans + root_rot.apply(vr_pos_root_frame) + vr_pos_world = vr_pos_root_frame + data_dict["root_trans_offset_measured"][time_idx] + + if np.linalg.norm(data_dict["vr_3point_orientation"][i]) > 0: + # VR orientation is also root-relative, transform to world + # C++ quaternion is in [w, x, y, z] format (scalar_first=True) + vr_quat_root_frame = R.from_quat(data_dict["vr_3point_orientation"][i], scalar_first=True) + vr_rot_world = root_rot * vr_quat_root_frame # Quaternion multiplication + mat = vr_rot_world.as_matrix() + else: + mat = root_rot.as_matrix() # If no VR orientation, use root orientation + + mujoco.mjv_initGeom( + viewer.user_scn.geoms[i], + type=mujoco.mjtGeom.mjGEOM_BOX, + size=[0.05, 0.01, 0.01], + pos=vr_pos_world, + mat=mat.flatten(), + rgba=0.5*np.array([1, 1, 0, 2]) + ) + viewer.user_scn.ngeom += 1 + + # Draw temperature indicators at each joint of the measured robot (robot2_) + if "motor_temperature" in data_dict: + # Body names for each motor joint (MuJoCo order, 29 joints) + motor_body_names = [ + "left_hip_pitch_link", "left_hip_roll_link", "left_hip_yaw_link", + "left_knee_link", "left_ankle_pitch_link", "left_ankle_roll_link", + "right_hip_pitch_link", "right_hip_roll_link", "right_hip_yaw_link", + "right_knee_link", "right_ankle_pitch_link", "right_ankle_roll_link", + "waist_yaw_link", "waist_roll_link", "torso_link", + "left_shoulder_pitch_link", "left_shoulder_roll_link", "left_shoulder_yaw_link", + "left_elbow_link", "left_wrist_roll_link", "left_wrist_pitch_link", + "left_wrist_yaw_link", "right_shoulder_pitch_link", "right_shoulder_roll_link", + "right_shoulder_yaw_link", "right_elbow_link", "right_wrist_roll_link", + "right_wrist_pitch_link", "right_wrist_yaw_link", + ] + temps = data_dict["motor_temperature"] + flash = (int(time.time() * 4) % 2 == 0) # 4 Hz flash toggle + for j in range(min(29, len(temps))): + t = temps[j] + body_name = "robot4_" + motor_body_names[j] + body_id = mj_model.body(body_name).id + pos = mj_data.xpos[body_id].copy() + + # Color: green (< 50) -> yellow (50-70) -> orange (70-90) -> red (>= 90, flashing) + if t >= 90: + rgba = np.array([1.0, 0.0, 0.0, 1.0 if flash else 0.3]) + elif t >= 70: + frac = (t - 70) / 20.0 + rgba = np.array([1.0, 0.5 * (1 - frac), 0.0, 0.9]) + elif t >= 50: + frac = (t - 50) / 20.0 + rgba = np.array([frac, 1.0, 0.0, 0.8]) + else: + rgba = np.array([0.0, 0.8, 0.0, 0.8]) + + geom_idx = viewer.user_scn.ngeom + if geom_idx < viewer.user_scn.maxgeom: + mujoco.mjv_initGeom( + viewer.user_scn.geoms[geom_idx], + type=mujoco.mjtGeom.mjGEOM_SPHERE, + size=[0.04, 0, 0], + pos=pos, + mat=np.eye(3).flatten(), + rgba=rgba, + ) + viewer.user_scn.ngeom += 1 + + # Pick up changes to the physics state, apply perturbations, update options from GUI. + viewer.sync() + time_until_next_step = mj_model.opt.timestep - (time.time() - step_start) + if time_until_next_step > 0: + time.sleep(time_until_next_step) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Visualize retargeted motion data in MuJoCo" + ) + parser.add_argument( + "--csv_path", + type=str, + default="", + help="Path to the CSV file containing retargeted motion data", + ) + parser.add_argument( + "--motion_dir", + type=str, + default="", + help="Path to the CSV file containing retargeted motion data", + ) + parser.add_argument( + "--realtime_debug_url", + type=str, + default="", + help="URL to receive realtime debug messages from", + ) + parser.add_argument( + "--realtime_debug_topic", + type=str, + default="g1_debug", + help="Topic to receive realtime debug messages from", + ) + args = parser.parse_args() + + main(args) \ No newline at end of file diff --git a/third-party/GR00T-WholeBodyControl/hardware/camera_mount/README.md b/third-party/GR00T-WholeBodyControl/hardware/camera_mount/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ca5d68380741de75478eba972db5dc7c4978525f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/hardware/camera_mount/README.md @@ -0,0 +1,50 @@ +# OAK-D W Camera Mount + +3D-printed mount for the ego / head-view camera used in the GR00T-WholeBodyControl +data-collection and VLA pipeline. The mount positions the camera that produces the +`observation.images.ego_view` stream, so reproducing this mount reproduces the +camera viewpoint the policies were trained with. + +| | | +|---|---| +| **File** | [`oak_d_w_mount.step`](./oak_d_w_mount.step) (STEP AP242) | +| **Version** | v1 | +| **Camera** | [Luxonis OAK-D W](https://shop.luxonis.com/products/oak-d-w) (OV9782 global-shutter sensor) | + +> **Note:** The `.step` file is stored directly in Git (it is ~44 KB of plain ASCII +> text), so a normal `git clone` or the GitHub "Download" button gives you the real +> geometry — no Git LFS required. + +## Manufacturing + +| Parameter | Value | +|---|---| +| Process | FDM 3D printing | +| Material | PLA | +| Layer height | 0.2 mm | +| Infill / supports | Slicer defaults — no special settings required | + +Open the STEP file in any CAD tool (FreeCAD, Fusion 360, SolidWorks, or any +online STEP viewer). + +## Bill of materials + +| Fastener | Spec | Notes | +|---|---|---| +| Camera → mount | 2 × M4 × 8 mm | Threads directly into the printed PLA — no heat-set inserts. The OAK-D W sits flush against the mount face. | +| Mount → G1 | Stock G1 screws | Reuses the default screws at the G1 mounting location. | + +## Mounting on the G1 + +The mount attaches at the **same location as the G1's stock Intel RealSense head +camera** — it screws into the existing RealSense mounting point using the stock +G1 screws, so no new holes or modifications are needed. + +The OAK-D W sits flush against the printed face and keeps the **same orientation +plane as the stock RealSense**, angled approximately **40° relative to the head**. +This reproduces the ego-view camera pose the policies were trained with. + +## Related documentation + +- [Data Collection for VLA](../../docs/source/tutorials/data_collection.md) — camera + server setup and the `ego_view` image stream this mount provides. diff --git a/third-party/GR00T-WholeBodyControl/hardware/camera_mount/oak_d_w_mount.step b/third-party/GR00T-WholeBodyControl/hardware/camera_mount/oak_d_w_mount.step new file mode 100644 index 0000000000000000000000000000000000000000..8c93f52bf764528ea6a1d101feb3c84b9d9328c2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/hardware/camera_mount/oak_d_w_mount.step @@ -0,0 +1,1054 @@ +ISO-10303-21; +HEADER; +/* Generated by software containing ST-Developer + * from STEP Tools, Inc. (www.steptools.com) + */ + +FILE_DESCRIPTION( +/* description */ ('STEP AP242'), +/* implementation_level */ '2;1'); + +FILE_NAME( +/* name */ 'oak - v1.step', +/* time_stamp */ '2025-12-23T12:09:19-08:00', +/* author */ (''), +/* organization */ (''), +/* preprocessor_version */ 'ST-DEVELOPER v20.1', +/* originating_system */ 'Autodesk Translation Framework v14.21.0.0', +/* authorisation */ ''); + +FILE_SCHEMA (('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); +ENDSEC; + +DATA; +#10=MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',(#13),#971); +#11=SHAPE_REPRESENTATION_RELATIONSHIP('SRR','None',#977,#12); +#12=ADVANCED_BREP_SHAPE_REPRESENTATION('',(#14),#970); +#13=STYLED_ITEM('',(#987),#14); +#14=MANIFOLD_SOLID_BREP('Body1',#587); +#15=CYLINDRICAL_SURFACE('',#620,0.0016); +#16=CYLINDRICAL_SURFACE('',#630,0.005); +#17=CYLINDRICAL_SURFACE('',#631,0.005); +#18=CYLINDRICAL_SURFACE('',#632,0.002); +#19=CYLINDRICAL_SURFACE('',#635,0.0016); +#20=CYLINDRICAL_SURFACE('',#644,0.005); +#21=CYLINDRICAL_SURFACE('',#645,0.005); +#22=CYLINDRICAL_SURFACE('',#646,0.002); +#23=ELLIPSE('',#610,0.00503989870734971,0.005); +#24=ELLIPSE('',#611,0.00503989870734971,0.005); +#25=ELLIPSE('',#612,0.00503989870734971,0.005); +#26=ELLIPSE('',#613,0.00503989870734971,0.005); +#27=ELLIPSE('',#624,0.00503989870734971,0.005); +#28=ELLIPSE('',#625,0.00503989870734971,0.005); +#29=ELLIPSE('',#638,0.00503989870734971,0.005); +#30=ELLIPSE('',#639,0.00503989870734971,0.005); +#31=FACE_BOUND('',#79,.T.); +#32=FACE_BOUND('',#80,.T.); +#33=FACE_BOUND('',#82,.T.); +#34=FACE_BOUND('',#83,.T.); +#35=FACE_BOUND('',#86,.T.); +#36=FACE_BOUND('',#87,.T.); +#37=FACE_BOUND('',#96,.T.); +#38=FACE_BOUND('',#108,.T.); +#39=CIRCLE('',#603,0.0016); +#40=CIRCLE('',#604,0.0016); +#41=CIRCLE('',#606,0.0016); +#42=CIRCLE('',#607,0.0016); +#43=CIRCLE('',#614,0.002); +#44=CIRCLE('',#615,0.002); +#45=CIRCLE('',#626,0.002); +#46=CIRCLE('',#640,0.002); +#47=FACE_OUTER_BOUND('',#77,.T.); +#48=FACE_OUTER_BOUND('',#78,.T.); +#49=FACE_OUTER_BOUND('',#81,.T.); +#50=FACE_OUTER_BOUND('',#84,.T.); +#51=FACE_OUTER_BOUND('',#85,.T.); +#52=FACE_OUTER_BOUND('',#88,.T.); +#53=FACE_OUTER_BOUND('',#89,.T.); +#54=FACE_OUTER_BOUND('',#90,.T.); +#55=FACE_OUTER_BOUND('',#91,.T.); +#56=FACE_OUTER_BOUND('',#92,.T.); +#57=FACE_OUTER_BOUND('',#93,.T.); +#58=FACE_OUTER_BOUND('',#94,.T.); +#59=FACE_OUTER_BOUND('',#95,.T.); +#60=FACE_OUTER_BOUND('',#97,.T.); +#61=FACE_OUTER_BOUND('',#98,.T.); +#62=FACE_OUTER_BOUND('',#99,.T.); +#63=FACE_OUTER_BOUND('',#100,.T.); +#64=FACE_OUTER_BOUND('',#101,.T.); +#65=FACE_OUTER_BOUND('',#102,.T.); +#66=FACE_OUTER_BOUND('',#103,.T.); +#67=FACE_OUTER_BOUND('',#104,.T.); +#68=FACE_OUTER_BOUND('',#105,.T.); +#69=FACE_OUTER_BOUND('',#106,.T.); +#70=FACE_OUTER_BOUND('',#107,.T.); +#71=FACE_OUTER_BOUND('',#109,.T.); +#72=FACE_OUTER_BOUND('',#110,.T.); +#73=FACE_OUTER_BOUND('',#111,.T.); +#74=FACE_OUTER_BOUND('',#112,.T.); +#75=FACE_OUTER_BOUND('',#113,.T.); +#76=FACE_OUTER_BOUND('',#114,.T.); +#77=EDGE_LOOP('',(#375,#376,#377,#378,#379,#380,#381,#382,#383,#384)); +#78=EDGE_LOOP('',(#385,#386,#387,#388,#389,#390,#391,#392)); +#79=EDGE_LOOP('',(#393)); +#80=EDGE_LOOP('',(#394)); +#81=EDGE_LOOP('',(#395,#396,#397,#398,#399,#400,#401,#402)); +#82=EDGE_LOOP('',(#403)); +#83=EDGE_LOOP('',(#404)); +#84=EDGE_LOOP('',(#405,#406,#407,#408)); +#85=EDGE_LOOP('',(#409,#410,#411,#412,#413,#414,#415,#416,#417,#418,#419, +#420)); +#86=EDGE_LOOP('',(#421)); +#87=EDGE_LOOP('',(#422)); +#88=EDGE_LOOP('',(#423,#424,#425,#426)); +#89=EDGE_LOOP('',(#427,#428,#429,#430)); +#90=EDGE_LOOP('',(#431,#432,#433,#434)); +#91=EDGE_LOOP('',(#435,#436,#437,#438)); +#92=EDGE_LOOP('',(#439,#440,#441,#442)); +#93=EDGE_LOOP('',(#443,#444,#445,#446)); +#94=EDGE_LOOP('',(#447,#448,#449,#450)); +#95=EDGE_LOOP('',(#451,#452,#453,#454,#455,#456)); +#96=EDGE_LOOP('',(#457)); +#97=EDGE_LOOP('',(#458,#459,#460,#461)); +#98=EDGE_LOOP('',(#462,#463,#464,#465)); +#99=EDGE_LOOP('',(#466,#467,#468,#469)); +#100=EDGE_LOOP('',(#470,#471,#472,#473)); +#101=EDGE_LOOP('',(#474,#475,#476,#477)); +#102=EDGE_LOOP('',(#478,#479,#480,#481)); +#103=EDGE_LOOP('',(#482,#483,#484,#485,#486,#487,#488,#489,#490,#491)); +#104=EDGE_LOOP('',(#492,#493,#494,#495)); +#105=EDGE_LOOP('',(#496,#497,#498,#499)); +#106=EDGE_LOOP('',(#500,#501,#502,#503)); +#107=EDGE_LOOP('',(#504,#505,#506,#507,#508,#509)); +#108=EDGE_LOOP('',(#510)); +#109=EDGE_LOOP('',(#511,#512,#513,#514)); +#110=EDGE_LOOP('',(#515,#516,#517,#518)); +#111=EDGE_LOOP('',(#519,#520,#521,#522)); +#112=EDGE_LOOP('',(#523,#524,#525,#526)); +#113=EDGE_LOOP('',(#527,#528,#529,#530)); +#114=EDGE_LOOP('',(#531,#532,#533,#534)); +#115=LINE('',#809,#179); +#116=LINE('',#811,#180); +#117=LINE('',#813,#181); +#118=LINE('',#815,#182); +#119=LINE('',#817,#183); +#120=LINE('',#819,#184); +#121=LINE('',#821,#185); +#122=LINE('',#823,#186); +#123=LINE('',#825,#187); +#124=LINE('',#826,#188); +#125=LINE('',#829,#189); +#126=LINE('',#831,#190); +#127=LINE('',#833,#191); +#128=LINE('',#835,#192); +#129=LINE('',#837,#193); +#130=LINE('',#839,#194); +#131=LINE('',#840,#195); +#132=LINE('',#848,#196); +#133=LINE('',#850,#197); +#134=LINE('',#852,#198); +#135=LINE('',#854,#199); +#136=LINE('',#855,#200); +#137=LINE('',#857,#201); +#138=LINE('',#858,#202); +#139=LINE('',#865,#203); +#140=LINE('',#866,#204); +#141=LINE('',#869,#205); +#142=LINE('',#873,#206); +#143=LINE('',#876,#207); +#144=LINE('',#878,#208); +#145=LINE('',#882,#209); +#146=LINE('',#886,#210); +#147=LINE('',#887,#211); +#148=LINE('',#894,#212); +#149=LINE('',#895,#213); +#150=LINE('',#898,#214); +#151=LINE('',#899,#215); +#152=LINE('',#901,#216); +#153=LINE('',#903,#217); +#154=LINE('',#905,#218); +#155=LINE('',#907,#219); +#156=LINE('',#908,#220); +#157=LINE('',#913,#221); +#158=LINE('',#916,#222); +#159=LINE('',#918,#223); +#160=LINE('',#923,#224); +#161=LINE('',#925,#225); +#162=LINE('',#927,#226); +#163=LINE('',#928,#227); +#164=LINE('',#932,#228); +#165=LINE('',#936,#229); +#166=LINE('',#937,#230); +#167=LINE('',#938,#231); +#168=LINE('',#939,#232); +#169=LINE('',#941,#233); +#170=LINE('',#943,#234); +#171=LINE('',#948,#235); +#172=LINE('',#951,#236); +#173=LINE('',#953,#237); +#174=LINE('',#958,#238); +#175=LINE('',#960,#239); +#176=LINE('',#962,#240); +#177=LINE('',#963,#241); +#178=LINE('',#967,#242); +#179=VECTOR('',#651,1.); +#180=VECTOR('',#652,1.); +#181=VECTOR('',#653,1.); +#182=VECTOR('',#654,1.); +#183=VECTOR('',#655,1.); +#184=VECTOR('',#656,1.); +#185=VECTOR('',#657,1.); +#186=VECTOR('',#658,1.); +#187=VECTOR('',#659,1.); +#188=VECTOR('',#660,1.); +#189=VECTOR('',#663,1.); +#190=VECTOR('',#664,1.); +#191=VECTOR('',#665,1.); +#192=VECTOR('',#666,1.); +#193=VECTOR('',#667,1.); +#194=VECTOR('',#668,1.); +#195=VECTOR('',#669,1.); +#196=VECTOR('',#676,1.); +#197=VECTOR('',#677,1.); +#198=VECTOR('',#678,1.); +#199=VECTOR('',#679,1.); +#200=VECTOR('',#680,1.); +#201=VECTOR('',#681,1.); +#202=VECTOR('',#682,1.); +#203=VECTOR('',#689,1.); +#204=VECTOR('',#690,1.); +#205=VECTOR('',#693,1.); +#206=VECTOR('',#696,1.); +#207=VECTOR('',#699,1.); +#208=VECTOR('',#700,1.); +#209=VECTOR('',#703,1.); +#210=VECTOR('',#706,1.); +#211=VECTOR('',#707,1.); +#212=VECTOR('',#714,1.); +#213=VECTOR('',#715,1.); +#214=VECTOR('',#718,1.); +#215=VECTOR('',#719,1.); +#216=VECTOR('',#722,1.); +#217=VECTOR('',#725,1.); +#218=VECTOR('',#728,0.0016); +#219=VECTOR('',#731,1.); +#220=VECTOR('',#732,1.); +#221=VECTOR('',#737,1.); +#222=VECTOR('',#740,1.); +#223=VECTOR('',#741,1.); +#224=VECTOR('',#748,1.); +#225=VECTOR('',#751,1.); +#226=VECTOR('',#754,1.); +#227=VECTOR('',#755,1.); +#228=VECTOR('',#762,0.002); +#229=VECTOR('',#765,1.); +#230=VECTOR('',#766,1.); +#231=VECTOR('',#767,1.); +#232=VECTOR('',#768,1.); +#233=VECTOR('',#771,1.); +#234=VECTOR('',#774,0.0016); +#235=VECTOR('',#779,1.); +#236=VECTOR('',#782,1.); +#237=VECTOR('',#783,1.); +#238=VECTOR('',#790,1.); +#239=VECTOR('',#793,1.); +#240=VECTOR('',#796,1.); +#241=VECTOR('',#797,1.); +#242=VECTOR('',#804,0.002); +#243=VERTEX_POINT('',#807); +#244=VERTEX_POINT('',#808); +#245=VERTEX_POINT('',#810); +#246=VERTEX_POINT('',#812); +#247=VERTEX_POINT('',#814); +#248=VERTEX_POINT('',#816); +#249=VERTEX_POINT('',#818); +#250=VERTEX_POINT('',#820); +#251=VERTEX_POINT('',#822); +#252=VERTEX_POINT('',#824); +#253=VERTEX_POINT('',#828); +#254=VERTEX_POINT('',#830); +#255=VERTEX_POINT('',#832); +#256=VERTEX_POINT('',#834); +#257=VERTEX_POINT('',#836); +#258=VERTEX_POINT('',#838); +#259=VERTEX_POINT('',#841); +#260=VERTEX_POINT('',#843); +#261=VERTEX_POINT('',#846); +#262=VERTEX_POINT('',#847); +#263=VERTEX_POINT('',#849); +#264=VERTEX_POINT('',#851); +#265=VERTEX_POINT('',#853); +#266=VERTEX_POINT('',#856); +#267=VERTEX_POINT('',#859); +#268=VERTEX_POINT('',#861); +#269=VERTEX_POINT('',#864); +#270=VERTEX_POINT('',#868); +#271=VERTEX_POINT('',#870); +#272=VERTEX_POINT('',#872); +#273=VERTEX_POINT('',#874); +#274=VERTEX_POINT('',#877); +#275=VERTEX_POINT('',#879); +#276=VERTEX_POINT('',#881); +#277=VERTEX_POINT('',#883); +#278=VERTEX_POINT('',#885); +#279=VERTEX_POINT('',#888); +#280=VERTEX_POINT('',#890); +#281=VERTEX_POINT('',#893); +#282=VERTEX_POINT('',#897); +#283=VERTEX_POINT('',#911); +#284=VERTEX_POINT('',#912); +#285=VERTEX_POINT('',#914); +#286=VERTEX_POINT('',#917); +#287=VERTEX_POINT('',#920); +#288=VERTEX_POINT('',#934); +#289=VERTEX_POINT('',#935); +#290=VERTEX_POINT('',#946); +#291=VERTEX_POINT('',#947); +#292=VERTEX_POINT('',#949); +#293=VERTEX_POINT('',#952); +#294=VERTEX_POINT('',#955); +#295=EDGE_CURVE('',#243,#244,#115,.T.); +#296=EDGE_CURVE('',#244,#245,#116,.T.); +#297=EDGE_CURVE('',#246,#245,#117,.T.); +#298=EDGE_CURVE('',#247,#246,#118,.T.); +#299=EDGE_CURVE('',#248,#247,#119,.T.); +#300=EDGE_CURVE('',#249,#248,#120,.T.); +#301=EDGE_CURVE('',#250,#249,#121,.T.); +#302=EDGE_CURVE('',#251,#250,#122,.T.); +#303=EDGE_CURVE('',#252,#251,#123,.T.); +#304=EDGE_CURVE('',#243,#252,#124,.T.); +#305=EDGE_CURVE('',#248,#253,#125,.T.); +#306=EDGE_CURVE('',#254,#253,#126,.T.); +#307=EDGE_CURVE('',#254,#255,#127,.T.); +#308=EDGE_CURVE('',#256,#255,#128,.T.); +#309=EDGE_CURVE('',#256,#257,#129,.T.); +#310=EDGE_CURVE('',#257,#258,#130,.T.); +#311=EDGE_CURVE('',#249,#258,#131,.T.); +#312=EDGE_CURVE('',#259,#259,#39,.T.); +#313=EDGE_CURVE('',#260,#260,#40,.T.); +#314=EDGE_CURVE('',#261,#262,#132,.T.); +#315=EDGE_CURVE('',#261,#263,#133,.T.); +#316=EDGE_CURVE('',#264,#263,#134,.T.); +#317=EDGE_CURVE('',#265,#264,#135,.T.); +#318=EDGE_CURVE('',#251,#265,#136,.T.); +#319=EDGE_CURVE('',#250,#266,#137,.T.); +#320=EDGE_CURVE('',#262,#266,#138,.T.); +#321=EDGE_CURVE('',#267,#267,#41,.F.); +#322=EDGE_CURVE('',#268,#268,#42,.F.); +#323=EDGE_CURVE('',#269,#265,#139,.T.); +#324=EDGE_CURVE('',#252,#269,#140,.T.); +#325=EDGE_CURVE('',#270,#245,#141,.T.); +#326=EDGE_CURVE('',#270,#271,#23,.T.); +#327=EDGE_CURVE('',#271,#272,#142,.T.); +#328=EDGE_CURVE('',#272,#273,#24,.T.); +#329=EDGE_CURVE('',#273,#252,#143,.T.); +#330=EDGE_CURVE('',#274,#269,#144,.T.); +#331=EDGE_CURVE('',#275,#274,#25,.T.); +#332=EDGE_CURVE('',#276,#275,#145,.T.); +#333=EDGE_CURVE('',#277,#276,#26,.T.); +#334=EDGE_CURVE('',#277,#278,#146,.T.); +#335=EDGE_CURVE('',#245,#278,#147,.T.); +#336=EDGE_CURVE('',#279,#279,#43,.T.); +#337=EDGE_CURVE('',#280,#280,#44,.T.); +#338=EDGE_CURVE('',#281,#278,#148,.T.); +#339=EDGE_CURVE('',#246,#281,#149,.T.); +#340=EDGE_CURVE('',#282,#281,#150,.T.); +#341=EDGE_CURVE('',#247,#282,#151,.T.); +#342=EDGE_CURVE('',#253,#282,#152,.T.); +#343=EDGE_CURVE('',#266,#258,#153,.T.); +#344=EDGE_CURVE('',#260,#267,#154,.T.); +#345=EDGE_CURVE('',#262,#257,#155,.T.); +#346=EDGE_CURVE('',#261,#256,#156,.T.); +#347=EDGE_CURVE('',#283,#284,#157,.T.); +#348=EDGE_CURVE('',#284,#285,#27,.T.); +#349=EDGE_CURVE('',#285,#244,#158,.T.); +#350=EDGE_CURVE('',#286,#243,#159,.T.); +#351=EDGE_CURVE('',#286,#283,#28,.T.); +#352=EDGE_CURVE('',#287,#287,#45,.T.); +#353=EDGE_CURVE('',#273,#286,#160,.F.); +#354=EDGE_CURVE('',#285,#270,#161,.T.); +#355=EDGE_CURVE('',#271,#284,#162,.F.); +#356=EDGE_CURVE('',#283,#272,#163,.T.); +#357=EDGE_CURVE('',#280,#287,#164,.T.); +#358=EDGE_CURVE('',#288,#289,#165,.T.); +#359=EDGE_CURVE('',#288,#269,#166,.T.); +#360=EDGE_CURVE('',#264,#254,#167,.T.); +#361=EDGE_CURVE('',#289,#278,#168,.T.); +#362=EDGE_CURVE('',#263,#255,#169,.T.); +#363=EDGE_CURVE('',#259,#268,#170,.T.); +#364=EDGE_CURVE('',#290,#291,#171,.T.); +#365=EDGE_CURVE('',#292,#290,#29,.T.); +#366=EDGE_CURVE('',#292,#288,#172,.T.); +#367=EDGE_CURVE('',#293,#289,#173,.T.); +#368=EDGE_CURVE('',#291,#293,#30,.T.); +#369=EDGE_CURVE('',#294,#294,#46,.T.); +#370=EDGE_CURVE('',#274,#292,#174,.F.); +#371=EDGE_CURVE('',#293,#277,#175,.T.); +#372=EDGE_CURVE('',#290,#275,#176,.T.); +#373=EDGE_CURVE('',#276,#291,#177,.F.); +#374=EDGE_CURVE('',#279,#294,#178,.T.); +#375=ORIENTED_EDGE('',*,*,#295,.T.); +#376=ORIENTED_EDGE('',*,*,#296,.T.); +#377=ORIENTED_EDGE('',*,*,#297,.F.); +#378=ORIENTED_EDGE('',*,*,#298,.F.); +#379=ORIENTED_EDGE('',*,*,#299,.F.); +#380=ORIENTED_EDGE('',*,*,#300,.F.); +#381=ORIENTED_EDGE('',*,*,#301,.F.); +#382=ORIENTED_EDGE('',*,*,#302,.F.); +#383=ORIENTED_EDGE('',*,*,#303,.F.); +#384=ORIENTED_EDGE('',*,*,#304,.F.); +#385=ORIENTED_EDGE('',*,*,#305,.T.); +#386=ORIENTED_EDGE('',*,*,#306,.F.); +#387=ORIENTED_EDGE('',*,*,#307,.T.); +#388=ORIENTED_EDGE('',*,*,#308,.F.); +#389=ORIENTED_EDGE('',*,*,#309,.T.); +#390=ORIENTED_EDGE('',*,*,#310,.T.); +#391=ORIENTED_EDGE('',*,*,#311,.F.); +#392=ORIENTED_EDGE('',*,*,#300,.T.); +#393=ORIENTED_EDGE('',*,*,#312,.F.); +#394=ORIENTED_EDGE('',*,*,#313,.T.); +#395=ORIENTED_EDGE('',*,*,#314,.F.); +#396=ORIENTED_EDGE('',*,*,#315,.T.); +#397=ORIENTED_EDGE('',*,*,#316,.F.); +#398=ORIENTED_EDGE('',*,*,#317,.F.); +#399=ORIENTED_EDGE('',*,*,#318,.F.); +#400=ORIENTED_EDGE('',*,*,#302,.T.); +#401=ORIENTED_EDGE('',*,*,#319,.T.); +#402=ORIENTED_EDGE('',*,*,#320,.F.); +#403=ORIENTED_EDGE('',*,*,#321,.T.); +#404=ORIENTED_EDGE('',*,*,#322,.F.); +#405=ORIENTED_EDGE('',*,*,#318,.T.); +#406=ORIENTED_EDGE('',*,*,#323,.F.); +#407=ORIENTED_EDGE('',*,*,#324,.F.); +#408=ORIENTED_EDGE('',*,*,#303,.T.); +#409=ORIENTED_EDGE('',*,*,#325,.F.); +#410=ORIENTED_EDGE('',*,*,#326,.T.); +#411=ORIENTED_EDGE('',*,*,#327,.T.); +#412=ORIENTED_EDGE('',*,*,#328,.T.); +#413=ORIENTED_EDGE('',*,*,#329,.T.); +#414=ORIENTED_EDGE('',*,*,#324,.T.); +#415=ORIENTED_EDGE('',*,*,#330,.F.); +#416=ORIENTED_EDGE('',*,*,#331,.F.); +#417=ORIENTED_EDGE('',*,*,#332,.F.); +#418=ORIENTED_EDGE('',*,*,#333,.F.); +#419=ORIENTED_EDGE('',*,*,#334,.T.); +#420=ORIENTED_EDGE('',*,*,#335,.F.); +#421=ORIENTED_EDGE('',*,*,#336,.F.); +#422=ORIENTED_EDGE('',*,*,#337,.T.); +#423=ORIENTED_EDGE('',*,*,#335,.T.); +#424=ORIENTED_EDGE('',*,*,#338,.F.); +#425=ORIENTED_EDGE('',*,*,#339,.F.); +#426=ORIENTED_EDGE('',*,*,#297,.T.); +#427=ORIENTED_EDGE('',*,*,#339,.T.); +#428=ORIENTED_EDGE('',*,*,#340,.F.); +#429=ORIENTED_EDGE('',*,*,#341,.F.); +#430=ORIENTED_EDGE('',*,*,#298,.T.); +#431=ORIENTED_EDGE('',*,*,#341,.T.); +#432=ORIENTED_EDGE('',*,*,#342,.F.); +#433=ORIENTED_EDGE('',*,*,#305,.F.); +#434=ORIENTED_EDGE('',*,*,#299,.T.); +#435=ORIENTED_EDGE('',*,*,#343,.F.); +#436=ORIENTED_EDGE('',*,*,#319,.F.); +#437=ORIENTED_EDGE('',*,*,#301,.T.); +#438=ORIENTED_EDGE('',*,*,#311,.T.); +#439=ORIENTED_EDGE('',*,*,#313,.F.); +#440=ORIENTED_EDGE('',*,*,#344,.T.); +#441=ORIENTED_EDGE('',*,*,#321,.F.); +#442=ORIENTED_EDGE('',*,*,#344,.F.); +#443=ORIENTED_EDGE('',*,*,#314,.T.); +#444=ORIENTED_EDGE('',*,*,#345,.T.); +#445=ORIENTED_EDGE('',*,*,#309,.F.); +#446=ORIENTED_EDGE('',*,*,#346,.F.); +#447=ORIENTED_EDGE('',*,*,#320,.T.); +#448=ORIENTED_EDGE('',*,*,#343,.T.); +#449=ORIENTED_EDGE('',*,*,#310,.F.); +#450=ORIENTED_EDGE('',*,*,#345,.F.); +#451=ORIENTED_EDGE('',*,*,#347,.T.); +#452=ORIENTED_EDGE('',*,*,#348,.T.); +#453=ORIENTED_EDGE('',*,*,#349,.T.); +#454=ORIENTED_EDGE('',*,*,#295,.F.); +#455=ORIENTED_EDGE('',*,*,#350,.F.); +#456=ORIENTED_EDGE('',*,*,#351,.T.); +#457=ORIENTED_EDGE('',*,*,#352,.F.); +#458=ORIENTED_EDGE('',*,*,#329,.F.); +#459=ORIENTED_EDGE('',*,*,#353,.T.); +#460=ORIENTED_EDGE('',*,*,#350,.T.); +#461=ORIENTED_EDGE('',*,*,#304,.T.); +#462=ORIENTED_EDGE('',*,*,#349,.F.); +#463=ORIENTED_EDGE('',*,*,#354,.T.); +#464=ORIENTED_EDGE('',*,*,#325,.T.); +#465=ORIENTED_EDGE('',*,*,#296,.F.); +#466=ORIENTED_EDGE('',*,*,#327,.F.); +#467=ORIENTED_EDGE('',*,*,#355,.T.); +#468=ORIENTED_EDGE('',*,*,#347,.F.); +#469=ORIENTED_EDGE('',*,*,#356,.T.); +#470=ORIENTED_EDGE('',*,*,#348,.F.); +#471=ORIENTED_EDGE('',*,*,#355,.F.); +#472=ORIENTED_EDGE('',*,*,#326,.F.); +#473=ORIENTED_EDGE('',*,*,#354,.F.); +#474=ORIENTED_EDGE('',*,*,#351,.F.); +#475=ORIENTED_EDGE('',*,*,#353,.F.); +#476=ORIENTED_EDGE('',*,*,#328,.F.); +#477=ORIENTED_EDGE('',*,*,#356,.F.); +#478=ORIENTED_EDGE('',*,*,#337,.F.); +#479=ORIENTED_EDGE('',*,*,#357,.T.); +#480=ORIENTED_EDGE('',*,*,#352,.T.); +#481=ORIENTED_EDGE('',*,*,#357,.F.); +#482=ORIENTED_EDGE('',*,*,#358,.F.); +#483=ORIENTED_EDGE('',*,*,#359,.T.); +#484=ORIENTED_EDGE('',*,*,#323,.T.); +#485=ORIENTED_EDGE('',*,*,#317,.T.); +#486=ORIENTED_EDGE('',*,*,#360,.T.); +#487=ORIENTED_EDGE('',*,*,#306,.T.); +#488=ORIENTED_EDGE('',*,*,#342,.T.); +#489=ORIENTED_EDGE('',*,*,#340,.T.); +#490=ORIENTED_EDGE('',*,*,#338,.T.); +#491=ORIENTED_EDGE('',*,*,#361,.F.); +#492=ORIENTED_EDGE('',*,*,#362,.T.); +#493=ORIENTED_EDGE('',*,*,#307,.F.); +#494=ORIENTED_EDGE('',*,*,#360,.F.); +#495=ORIENTED_EDGE('',*,*,#316,.T.); +#496=ORIENTED_EDGE('',*,*,#312,.T.); +#497=ORIENTED_EDGE('',*,*,#363,.T.); +#498=ORIENTED_EDGE('',*,*,#322,.T.); +#499=ORIENTED_EDGE('',*,*,#363,.F.); +#500=ORIENTED_EDGE('',*,*,#315,.F.); +#501=ORIENTED_EDGE('',*,*,#346,.T.); +#502=ORIENTED_EDGE('',*,*,#308,.T.); +#503=ORIENTED_EDGE('',*,*,#362,.F.); +#504=ORIENTED_EDGE('',*,*,#364,.F.); +#505=ORIENTED_EDGE('',*,*,#365,.F.); +#506=ORIENTED_EDGE('',*,*,#366,.T.); +#507=ORIENTED_EDGE('',*,*,#358,.T.); +#508=ORIENTED_EDGE('',*,*,#367,.F.); +#509=ORIENTED_EDGE('',*,*,#368,.F.); +#510=ORIENTED_EDGE('',*,*,#369,.T.); +#511=ORIENTED_EDGE('',*,*,#330,.T.); +#512=ORIENTED_EDGE('',*,*,#359,.F.); +#513=ORIENTED_EDGE('',*,*,#366,.F.); +#514=ORIENTED_EDGE('',*,*,#370,.F.); +#515=ORIENTED_EDGE('',*,*,#367,.T.); +#516=ORIENTED_EDGE('',*,*,#361,.T.); +#517=ORIENTED_EDGE('',*,*,#334,.F.); +#518=ORIENTED_EDGE('',*,*,#371,.F.); +#519=ORIENTED_EDGE('',*,*,#332,.T.); +#520=ORIENTED_EDGE('',*,*,#372,.F.); +#521=ORIENTED_EDGE('',*,*,#364,.T.); +#522=ORIENTED_EDGE('',*,*,#373,.F.); +#523=ORIENTED_EDGE('',*,*,#368,.T.); +#524=ORIENTED_EDGE('',*,*,#371,.T.); +#525=ORIENTED_EDGE('',*,*,#333,.T.); +#526=ORIENTED_EDGE('',*,*,#373,.T.); +#527=ORIENTED_EDGE('',*,*,#365,.T.); +#528=ORIENTED_EDGE('',*,*,#372,.T.); +#529=ORIENTED_EDGE('',*,*,#331,.T.); +#530=ORIENTED_EDGE('',*,*,#370,.T.); +#531=ORIENTED_EDGE('',*,*,#336,.T.); +#532=ORIENTED_EDGE('',*,*,#374,.T.); +#533=ORIENTED_EDGE('',*,*,#369,.F.); +#534=ORIENTED_EDGE('',*,*,#374,.F.); +#535=PLANE('',#601); +#536=PLANE('',#602); +#537=PLANE('',#605); +#538=PLANE('',#608); +#539=PLANE('',#609); +#540=PLANE('',#616); +#541=PLANE('',#617); +#542=PLANE('',#618); +#543=PLANE('',#619); +#544=PLANE('',#621); +#545=PLANE('',#622); +#546=PLANE('',#623); +#547=PLANE('',#627); +#548=PLANE('',#628); +#549=PLANE('',#629); +#550=PLANE('',#633); +#551=PLANE('',#634); +#552=PLANE('',#636); +#553=PLANE('',#637); +#554=PLANE('',#641); +#555=PLANE('',#642); +#556=PLANE('',#643); +#557=ADVANCED_FACE('',(#47),#535,.T.); +#558=ADVANCED_FACE('',(#48,#31,#32),#536,.T.); +#559=ADVANCED_FACE('',(#49,#33,#34),#537,.T.); +#560=ADVANCED_FACE('',(#50),#538,.T.); +#561=ADVANCED_FACE('',(#51,#35,#36),#539,.T.); +#562=ADVANCED_FACE('',(#52),#540,.T.); +#563=ADVANCED_FACE('',(#53),#541,.T.); +#564=ADVANCED_FACE('',(#54),#542,.T.); +#565=ADVANCED_FACE('',(#55),#543,.T.); +#566=ADVANCED_FACE('',(#56),#15,.F.); +#567=ADVANCED_FACE('',(#57),#544,.T.); +#568=ADVANCED_FACE('',(#58),#545,.T.); +#569=ADVANCED_FACE('',(#59,#37),#546,.T.); +#570=ADVANCED_FACE('',(#60),#547,.F.); +#571=ADVANCED_FACE('',(#61),#548,.T.); +#572=ADVANCED_FACE('',(#62),#549,.T.); +#573=ADVANCED_FACE('',(#63),#16,.T.); +#574=ADVANCED_FACE('',(#64),#17,.T.); +#575=ADVANCED_FACE('',(#65),#18,.F.); +#576=ADVANCED_FACE('',(#66),#550,.T.); +#577=ADVANCED_FACE('',(#67),#551,.T.); +#578=ADVANCED_FACE('',(#68),#19,.F.); +#579=ADVANCED_FACE('',(#69),#552,.T.); +#580=ADVANCED_FACE('',(#70,#38),#553,.T.); +#581=ADVANCED_FACE('',(#71),#554,.F.); +#582=ADVANCED_FACE('',(#72),#555,.T.); +#583=ADVANCED_FACE('',(#73),#556,.T.); +#584=ADVANCED_FACE('',(#74),#20,.T.); +#585=ADVANCED_FACE('',(#75),#21,.T.); +#586=ADVANCED_FACE('',(#76),#22,.F.); +#587=CLOSED_SHELL('',(#557,#558,#559,#560,#561,#562,#563,#564,#565,#566, +#567,#568,#569,#570,#571,#572,#573,#574,#575,#576,#577,#578,#579,#580,#581, +#582,#583,#584,#585,#586)); +#588=DERIVED_UNIT_ELEMENT(#590,1.); +#589=DERIVED_UNIT_ELEMENT(#972,-3.); +#590=( +MASS_UNIT() +NAMED_UNIT(*) +SI_UNIT(.KILO.,.GRAM.) +); +#591=DERIVED_UNIT((#588,#589)); +#592=MEASURE_REPRESENTATION_ITEM('density measure', +POSITIVE_RATIO_MEASURE(7850.),#591); +#593=PROPERTY_DEFINITION_REPRESENTATION(#598,#595); +#594=PROPERTY_DEFINITION_REPRESENTATION(#599,#596); +#595=REPRESENTATION('material name',(#597),#970); +#596=REPRESENTATION('density',(#592),#970); +#597=DESCRIPTIVE_REPRESENTATION_ITEM('Steel','Steel'); +#598=PROPERTY_DEFINITION('material property','material name',#979); +#599=PROPERTY_DEFINITION('material property','density of part',#979); +#600=AXIS2_PLACEMENT_3D('',#805,#647,#648); +#601=AXIS2_PLACEMENT_3D('',#806,#649,#650); +#602=AXIS2_PLACEMENT_3D('',#827,#661,#662); +#603=AXIS2_PLACEMENT_3D('',#842,#670,#671); +#604=AXIS2_PLACEMENT_3D('',#844,#672,#673); +#605=AXIS2_PLACEMENT_3D('',#845,#674,#675); +#606=AXIS2_PLACEMENT_3D('',#860,#683,#684); +#607=AXIS2_PLACEMENT_3D('',#862,#685,#686); +#608=AXIS2_PLACEMENT_3D('',#863,#687,#688); +#609=AXIS2_PLACEMENT_3D('',#867,#691,#692); +#610=AXIS2_PLACEMENT_3D('',#871,#694,#695); +#611=AXIS2_PLACEMENT_3D('',#875,#697,#698); +#612=AXIS2_PLACEMENT_3D('',#880,#701,#702); +#613=AXIS2_PLACEMENT_3D('',#884,#704,#705); +#614=AXIS2_PLACEMENT_3D('',#889,#708,#709); +#615=AXIS2_PLACEMENT_3D('',#891,#710,#711); +#616=AXIS2_PLACEMENT_3D('',#892,#712,#713); +#617=AXIS2_PLACEMENT_3D('',#896,#716,#717); +#618=AXIS2_PLACEMENT_3D('',#900,#720,#721); +#619=AXIS2_PLACEMENT_3D('',#902,#723,#724); +#620=AXIS2_PLACEMENT_3D('',#904,#726,#727); +#621=AXIS2_PLACEMENT_3D('',#906,#729,#730); +#622=AXIS2_PLACEMENT_3D('',#909,#733,#734); +#623=AXIS2_PLACEMENT_3D('',#910,#735,#736); +#624=AXIS2_PLACEMENT_3D('',#915,#738,#739); +#625=AXIS2_PLACEMENT_3D('',#919,#742,#743); +#626=AXIS2_PLACEMENT_3D('',#921,#744,#745); +#627=AXIS2_PLACEMENT_3D('',#922,#746,#747); +#628=AXIS2_PLACEMENT_3D('',#924,#749,#750); +#629=AXIS2_PLACEMENT_3D('',#926,#752,#753); +#630=AXIS2_PLACEMENT_3D('',#929,#756,#757); +#631=AXIS2_PLACEMENT_3D('',#930,#758,#759); +#632=AXIS2_PLACEMENT_3D('',#931,#760,#761); +#633=AXIS2_PLACEMENT_3D('',#933,#763,#764); +#634=AXIS2_PLACEMENT_3D('',#940,#769,#770); +#635=AXIS2_PLACEMENT_3D('',#942,#772,#773); +#636=AXIS2_PLACEMENT_3D('',#944,#775,#776); +#637=AXIS2_PLACEMENT_3D('',#945,#777,#778); +#638=AXIS2_PLACEMENT_3D('',#950,#780,#781); +#639=AXIS2_PLACEMENT_3D('',#954,#784,#785); +#640=AXIS2_PLACEMENT_3D('',#956,#786,#787); +#641=AXIS2_PLACEMENT_3D('',#957,#788,#789); +#642=AXIS2_PLACEMENT_3D('',#959,#791,#792); +#643=AXIS2_PLACEMENT_3D('',#961,#794,#795); +#644=AXIS2_PLACEMENT_3D('',#964,#798,#799); +#645=AXIS2_PLACEMENT_3D('',#965,#800,#801); +#646=AXIS2_PLACEMENT_3D('',#966,#802,#803); +#647=DIRECTION('axis',(0.,0.,1.)); +#648=DIRECTION('refdir',(1.,0.,0.)); +#649=DIRECTION('center_axis',(0.,-1.,0.)); +#650=DIRECTION('ref_axis',(1.,0.,0.)); +#651=DIRECTION('',(0.719339800338651,0.,-0.694658370458997)); +#652=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#653=DIRECTION('',(-1.,0.,0.)); +#654=DIRECTION('',(0.719339800338651,0.,-0.694658370458997)); +#655=DIRECTION('',(9.09177391738478E-17,0.,-1.)); +#656=DIRECTION('',(1.,0.,0.)); +#657=DIRECTION('',(0.,0.,1.)); +#658=DIRECTION('',(-1.,0.,0.)); +#659=DIRECTION('',(7.60207536292217E-17,0.,1.)); +#660=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#661=DIRECTION('center_axis',(0.,0.,1.)); +#662=DIRECTION('ref_axis',(1.,0.,0.)); +#663=DIRECTION('',(0.,1.,0.)); +#664=DIRECTION('',(1.,0.,0.)); +#665=DIRECTION('',(0.,-1.,0.)); +#666=DIRECTION('',(-1.,0.,0.)); +#667=DIRECTION('',(1.3010426069826E-16,-1.,0.)); +#668=DIRECTION('',(-1.,0.,0.)); +#669=DIRECTION('',(0.,1.,0.)); +#670=DIRECTION('center_axis',(0.,0.,1.)); +#671=DIRECTION('ref_axis',(-1.,0.,0.)); +#672=DIRECTION('center_axis',(0.,0.,-1.)); +#673=DIRECTION('ref_axis',(-1.,0.,0.)); +#674=DIRECTION('center_axis',(0.,0.,-1.)); +#675=DIRECTION('ref_axis',(-1.,0.,0.)); +#676=DIRECTION('',(1.3010426069826E-16,-1.,0.)); +#677=DIRECTION('',(-1.,0.,0.)); +#678=DIRECTION('',(0.,-1.,0.)); +#679=DIRECTION('',(-1.,0.,0.)); +#680=DIRECTION('',(0.,1.,0.)); +#681=DIRECTION('',(0.,1.,0.)); +#682=DIRECTION('',(-1.,0.,0.)); +#683=DIRECTION('center_axis',(0.,0.,-1.)); +#684=DIRECTION('ref_axis',(-1.,0.,0.)); +#685=DIRECTION('center_axis',(0.,0.,1.)); +#686=DIRECTION('ref_axis',(-1.,0.,0.)); +#687=DIRECTION('center_axis',(-1.,0.,7.60207536292217E-17)); +#688=DIRECTION('ref_axis',(7.60207536292217E-17,0.,1.)); +#689=DIRECTION('',(7.60207536292217E-17,0.,1.)); +#690=DIRECTION('',(0.,1.,0.)); +#691=DIRECTION('center_axis',(-0.694658370458997,0.,-0.719339800338651)); +#692=DIRECTION('ref_axis',(-0.719339800338651,0.,0.694658370458997)); +#693=DIRECTION('',(0.,1.,0.)); +#694=DIRECTION('center_axis',(-0.694658370458997,0.,-0.719339800338651)); +#695=DIRECTION('ref_axis',(-0.719339800338651,0.,0.694658370458997)); +#696=DIRECTION('',(-0.719339800338651,0.,0.694658370458997)); +#697=DIRECTION('center_axis',(-0.694658370458997,0.,-0.719339800338651)); +#698=DIRECTION('ref_axis',(0.719339800338651,0.,-0.694658370458997)); +#699=DIRECTION('',(0.,1.,0.)); +#700=DIRECTION('',(0.,-1.,0.)); +#701=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338651)); +#702=DIRECTION('ref_axis',(0.719339800338651,0.,-0.694658370458997)); +#703=DIRECTION('',(-0.719339800338651,0.,0.694658370458997)); +#704=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338651)); +#705=DIRECTION('ref_axis',(-0.719339800338651,0.,0.694658370458997)); +#706=DIRECTION('',(0.,-1.,0.)); +#707=DIRECTION('',(0.,1.,0.)); +#708=DIRECTION('center_axis',(-0.694658370458997,0.,-0.719339800338651)); +#709=DIRECTION('ref_axis',(0.719339800338651,0.,-0.694658370458997)); +#710=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338651)); +#711=DIRECTION('ref_axis',(0.719339800338651,0.,-0.694658370458997)); +#712=DIRECTION('center_axis',(0.,0.,-1.)); +#713=DIRECTION('ref_axis',(-1.,0.,0.)); +#714=DIRECTION('',(-1.,0.,0.)); +#715=DIRECTION('',(0.,1.,0.)); +#716=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338651)); +#717=DIRECTION('ref_axis',(0.719339800338651,0.,-0.694658370458997)); +#718=DIRECTION('',(0.719339800338651,0.,-0.694658370458997)); +#719=DIRECTION('',(0.,1.,0.)); +#720=DIRECTION('center_axis',(1.,0.,9.09177391738478E-17)); +#721=DIRECTION('ref_axis',(9.09177391738478E-17,0.,-1.)); +#722=DIRECTION('',(9.09177391738478E-17,0.,-1.)); +#723=DIRECTION('center_axis',(-1.,0.,0.)); +#724=DIRECTION('ref_axis',(0.,0.,1.)); +#725=DIRECTION('',(0.,0.,1.)); +#726=DIRECTION('center_axis',(0.,0.,-1.)); +#727=DIRECTION('ref_axis',(-1.,0.,0.)); +#728=DIRECTION('',(0.,0.,-1.)); +#729=DIRECTION('center_axis',(-1.,-1.3010426069826E-16,0.)); +#730=DIRECTION('ref_axis',(1.3010426069826E-16,-1.,0.)); +#731=DIRECTION('',(0.,0.,1.)); +#732=DIRECTION('',(0.,0.,1.)); +#733=DIRECTION('center_axis',(0.,1.,0.)); +#734=DIRECTION('ref_axis',(0.,0.,1.)); +#735=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338652)); +#736=DIRECTION('ref_axis',(0.719339800338652,0.,-0.694658370458997)); +#737=DIRECTION('',(0.719339800338651,0.,-0.694658370458997)); +#738=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338652)); +#739=DIRECTION('ref_axis',(-0.719339800338652,0.,0.694658370458997)); +#740=DIRECTION('',(0.,1.,0.)); +#741=DIRECTION('',(0.,1.,0.)); +#742=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338652)); +#743=DIRECTION('ref_axis',(0.719339800338652,0.,-0.694658370458997)); +#744=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338651)); +#745=DIRECTION('ref_axis',(0.719339800338651,0.,-0.694658370458997)); +#746=DIRECTION('center_axis',(0.626409538921933,0.,-0.779494124126418)); +#747=DIRECTION('ref_axis',(-0.779494124126418,0.,-0.626409538921933)); +#748=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#749=DIRECTION('center_axis',(0.626409538921933,0.,-0.779494124126418)); +#750=DIRECTION('ref_axis',(-0.779494124126418,0.,-0.626409538921933)); +#751=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#752=DIRECTION('center_axis',(0.,-1.,0.)); +#753=DIRECTION('ref_axis',(1.,0.,0.)); +#754=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#755=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#756=DIRECTION('center_axis',(-0.779494124126418,0.,-0.626409538921933)); +#757=DIRECTION('ref_axis',(-0.626409538921933,0.,0.779494124126418)); +#758=DIRECTION('center_axis',(0.779494124126418,0.,0.626409538921933)); +#759=DIRECTION('ref_axis',(0.626409538921933,0.,-0.779494124126418)); +#760=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338651)); +#761=DIRECTION('ref_axis',(0.719339800338651,0.,-0.694658370458997)); +#762=DIRECTION('',(0.694658370458997,0.,0.719339800338651)); +#763=DIRECTION('center_axis',(0.,1.,0.)); +#764=DIRECTION('ref_axis',(1.,0.,0.)); +#765=DIRECTION('',(0.719339800338651,0.,-0.694658370458997)); +#766=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#767=DIRECTION('',(0.,0.,1.)); +#768=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#769=DIRECTION('center_axis',(-1.,0.,0.)); +#770=DIRECTION('ref_axis',(0.,0.,1.)); +#771=DIRECTION('',(0.,0.,1.)); +#772=DIRECTION('center_axis',(0.,0.,-1.)); +#773=DIRECTION('ref_axis',(-1.,0.,0.)); +#774=DIRECTION('',(0.,0.,-1.)); +#775=DIRECTION('center_axis',(0.,-1.,0.)); +#776=DIRECTION('ref_axis',(0.,0.,1.)); +#777=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338652)); +#778=DIRECTION('ref_axis',(0.719339800338652,0.,-0.694658370458997)); +#779=DIRECTION('',(0.719339800338651,0.,-0.694658370458997)); +#780=DIRECTION('center_axis',(-0.694658370458997,0.,-0.719339800338652)); +#781=DIRECTION('ref_axis',(0.719339800338652,0.,-0.694658370458997)); +#782=DIRECTION('',(0.,-1.,0.)); +#783=DIRECTION('',(0.,-1.,0.)); +#784=DIRECTION('center_axis',(-0.694658370458997,0.,-0.719339800338652)); +#785=DIRECTION('ref_axis',(-0.719339800338652,0.,0.694658370458997)); +#786=DIRECTION('center_axis',(-0.694658370458997,0.,-0.719339800338651)); +#787=DIRECTION('ref_axis',(0.719339800338651,0.,-0.694658370458997)); +#788=DIRECTION('center_axis',(0.626409538921933,0.,-0.779494124126418)); +#789=DIRECTION('ref_axis',(-0.779494124126418,0.,-0.626409538921933)); +#790=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#791=DIRECTION('center_axis',(0.626409538921933,0.,-0.779494124126418)); +#792=DIRECTION('ref_axis',(-0.779494124126418,0.,-0.626409538921933)); +#793=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#794=DIRECTION('center_axis',(0.,1.,0.)); +#795=DIRECTION('ref_axis',(1.,0.,0.)); +#796=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#797=DIRECTION('',(-0.779494124126418,0.,-0.626409538921933)); +#798=DIRECTION('center_axis',(-0.779494124126418,0.,-0.626409538921933)); +#799=DIRECTION('ref_axis',(-0.626409538921933,0.,0.779494124126418)); +#800=DIRECTION('center_axis',(0.779494124126418,0.,0.626409538921933)); +#801=DIRECTION('ref_axis',(0.626409538921933,0.,-0.779494124126418)); +#802=DIRECTION('center_axis',(0.694658370458997,0.,0.719339800338651)); +#803=DIRECTION('ref_axis',(0.719339800338651,0.,-0.694658370458997)); +#804=DIRECTION('',(0.694658370458997,0.,0.719339800338651)); +#805=CARTESIAN_POINT('',(0.,0.,0.)); +#806=CARTESIAN_POINT('Origin',(0.00754316629139926,-0.02,-0.013307266963672)); +#807=CARTESIAN_POINT('',(0.00275,-0.02,-0.0172900715621611)); +#808=CARTESIAN_POINT('',(0.0142594368054184,-0.02,-0.0284046054895051)); +#809=CARTESIAN_POINT('',(0.00850471840270921,-0.02,-0.0228473385258331)); +#810=CARTESIAN_POINT('',(0.0115094368054184,-0.02,-0.030614533927344)); +#811=CARTESIAN_POINT('',(0.0128844368054184,-0.02,-0.0295095697084245)); +#812=CARTESIAN_POINT('',(0.0215863325827985,-0.02,-0.030614533927344)); +#813=CARTESIAN_POINT('',(0.0165478846941085,-0.02,-0.030614533927344)); +#814=CARTESIAN_POINT('',(0.0055,-0.02,-0.0150801431243222)); +#815=CARTESIAN_POINT('',(0.0135431662913993,-0.02,-0.0228473385258331)); +#816=CARTESIAN_POINT('',(0.0055,-0.02,0.004)); +#817=CARTESIAN_POINT('',(0.0055,-0.02,-0.00554007156216108)); +#818=CARTESIAN_POINT('',(-0.0065,-0.02,0.004)); +#819=CARTESIAN_POINT('',(-0.00325,-0.02,0.004)); +#820=CARTESIAN_POINT('',(-0.0065,-0.02,0.)); +#821=CARTESIAN_POINT('',(-0.0065,-0.02,0.002)); +#822=CARTESIAN_POINT('',(0.,-0.02,0.)); +#823=CARTESIAN_POINT('',(-0.00325,-0.02,0.)); +#824=CARTESIAN_POINT('',(-1.48240469576982E-18,-0.02,-0.0195)); +#825=CARTESIAN_POINT('',(-7.41202347884911E-19,-0.02,-0.00975)); +#826=CARTESIAN_POINT('',(0.001375,-0.02,-0.0183950357810805)); +#827=CARTESIAN_POINT('Origin',(-0.00325,-0.02,0.004)); +#828=CARTESIAN_POINT('',(0.0055,0.02,0.004)); +#829=CARTESIAN_POINT('',(0.0055,-0.02,0.004)); +#830=CARTESIAN_POINT('',(-0.0065,0.02,0.004)); +#831=CARTESIAN_POINT('',(-0.00325,0.02,0.004)); +#832=CARTESIAN_POINT('',(-0.0065,0.005,0.004)); +#833=CARTESIAN_POINT('',(-0.0065,0.02,0.004)); +#834=CARTESIAN_POINT('',(-0.0015,0.005,0.004)); +#835=CARTESIAN_POINT('',(-0.004,0.005,0.004)); +#836=CARTESIAN_POINT('',(-0.0015,-0.005,0.004)); +#837=CARTESIAN_POINT('',(-0.0015,-0.0025,0.004)); +#838=CARTESIAN_POINT('',(-0.0065,-0.005,0.004)); +#839=CARTESIAN_POINT('',(-0.004,-0.005,0.004)); +#840=CARTESIAN_POINT('',(-0.0065,-0.02,0.004)); +#841=CARTESIAN_POINT('',(-0.0019,0.01,0.004)); +#842=CARTESIAN_POINT('Origin',(-0.0035,0.01,0.004)); +#843=CARTESIAN_POINT('',(-0.0019,-0.01,0.004)); +#844=CARTESIAN_POINT('Origin',(-0.0035,-0.01,0.004)); +#845=CARTESIAN_POINT('Origin',(-0.00325,-0.02,0.)); +#846=CARTESIAN_POINT('',(-0.0015,0.005,0.)); +#847=CARTESIAN_POINT('',(-0.0015,-0.005,0.)); +#848=CARTESIAN_POINT('',(-0.0015,-0.0025,0.)); +#849=CARTESIAN_POINT('',(-0.0065,0.005,0.)); +#850=CARTESIAN_POINT('',(-0.004,0.005,0.)); +#851=CARTESIAN_POINT('',(-0.0065,0.02,0.)); +#852=CARTESIAN_POINT('',(-0.0065,0.02,0.)); +#853=CARTESIAN_POINT('',(0.,0.02,0.)); +#854=CARTESIAN_POINT('',(-0.00325,0.02,0.)); +#855=CARTESIAN_POINT('',(0.,-0.02,0.)); +#856=CARTESIAN_POINT('',(-0.0065,-0.005,0.)); +#857=CARTESIAN_POINT('',(-0.0065,-0.02,0.)); +#858=CARTESIAN_POINT('',(-0.004,-0.005,0.)); +#859=CARTESIAN_POINT('',(-0.0019,-0.01,0.)); +#860=CARTESIAN_POINT('Origin',(-0.0035,-0.01,0.)); +#861=CARTESIAN_POINT('',(-0.0019,0.01,0.)); +#862=CARTESIAN_POINT('Origin',(-0.0035,0.01,0.)); +#863=CARTESIAN_POINT('Origin',(-7.41202347884911E-19,-0.02,-0.00975)); +#864=CARTESIAN_POINT('',(-1.48240469576982E-18,0.02,-0.0195)); +#865=CARTESIAN_POINT('',(-7.41202347884911E-19,0.02,-0.00975)); +#866=CARTESIAN_POINT('',(-1.48240469576982E-18,-0.02,-0.0195)); +#867=CARTESIAN_POINT('Origin',(0.00575471840270921,-0.02,-0.025057266963672)); +#868=CARTESIAN_POINT('',(0.0115094368054184,-0.037,-0.030614533927344)); +#869=CARTESIAN_POINT('',(0.0115094368054184,-0.042,-0.030614533927344)); +#870=CARTESIAN_POINT('',(0.00788403707554645,-0.042,-0.027113526104018)); +#871=CARTESIAN_POINT('Origin',(0.00788403707554645,-0.037,-0.027113526104018)); +#872=CARTESIAN_POINT('',(0.00362539972987196,-0.042,-0.0230010078233259)); +#873=CARTESIAN_POINT('',(0.00575471840270921,-0.042,-0.025057266963672)); +#874=CARTESIAN_POINT('',(-1.48240469576982E-18,-0.037,-0.0195)); +#875=CARTESIAN_POINT('Origin',(0.00362539972987196,-0.037,-0.0230010078233259)); +#876=CARTESIAN_POINT('',(-1.48240469576982E-18,-0.042,-0.0195)); +#877=CARTESIAN_POINT('',(-1.48240469576982E-18,0.037,-0.0195)); +#878=CARTESIAN_POINT('',(-1.48240469576982E-18,0.042,-0.0195)); +#879=CARTESIAN_POINT('',(0.00362539972987196,0.042,-0.0230010078233259)); +#880=CARTESIAN_POINT('Origin',(0.00362539972987196,0.037,-0.0230010078233259)); +#881=CARTESIAN_POINT('',(0.00788403707554645,0.042,-0.027113526104018)); +#882=CARTESIAN_POINT('',(0.00575471840270921,0.042,-0.025057266963672)); +#883=CARTESIAN_POINT('',(0.0115094368054184,0.037,-0.030614533927344)); +#884=CARTESIAN_POINT('Origin',(0.00788403707554645,0.037,-0.027113526104018)); +#885=CARTESIAN_POINT('',(0.0115094368054184,0.02,-0.030614533927344)); +#886=CARTESIAN_POINT('',(0.0115094368054184,0.042,-0.030614533927344)); +#887=CARTESIAN_POINT('',(0.0115094368054184,-0.02,-0.030614533927344)); +#888=CARTESIAN_POINT('',(0.00431603880203191,0.0375,-0.023667950222754)); +#889=CARTESIAN_POINT('Origin',(0.00575471840270921,0.0375,-0.025057266963672)); +#890=CARTESIAN_POINT('',(0.00431603880203191,-0.0375,-0.023667950222754)); +#891=CARTESIAN_POINT('Origin',(0.00575471840270921,-0.0375,-0.025057266963672)); +#892=CARTESIAN_POINT('Origin',(0.0165478846941085,-0.02,-0.030614533927344)); +#893=CARTESIAN_POINT('',(0.0215863325827985,0.02,-0.030614533927344)); +#894=CARTESIAN_POINT('',(0.0165478846941085,0.02,-0.030614533927344)); +#895=CARTESIAN_POINT('',(0.0215863325827985,-0.02,-0.030614533927344)); +#896=CARTESIAN_POINT('Origin',(0.0135431662913993,-0.02,-0.0228473385258331)); +#897=CARTESIAN_POINT('',(0.0055,0.02,-0.0150801431243222)); +#898=CARTESIAN_POINT('',(0.0135431662913993,0.02,-0.0228473385258331)); +#899=CARTESIAN_POINT('',(0.0055,-0.02,-0.0150801431243222)); +#900=CARTESIAN_POINT('Origin',(0.0055,-0.02,-0.00554007156216108)); +#901=CARTESIAN_POINT('',(0.0055,0.02,-0.00554007156216108)); +#902=CARTESIAN_POINT('Origin',(-0.0065,-0.02,0.002)); +#903=CARTESIAN_POINT('',(-0.0065,-0.005,-0.0306165339273439)); +#904=CARTESIAN_POINT('Origin',(-0.0035,-0.01,0.004)); +#905=CARTESIAN_POINT('',(-0.0019,-0.01,0.004)); +#906=CARTESIAN_POINT('Origin',(-0.0015,-0.0025,-0.0306165339273439)); +#907=CARTESIAN_POINT('',(-0.0015,-0.005,-0.0306165339273439)); +#908=CARTESIAN_POINT('',(-0.0015,0.005,-0.0306165339273439)); +#909=CARTESIAN_POINT('Origin',(-0.004,-0.005,-0.0306165339273439)); +#910=CARTESIAN_POINT('Origin',(0.00850471840270921,-0.042,-0.0228473385258331)); +#911=CARTESIAN_POINT('',(0.00637539972987196,-0.042,-0.020791079385487)); +#912=CARTESIAN_POINT('',(0.0106340370755465,-0.042,-0.0249035976661791)); +#913=CARTESIAN_POINT('',(0.00850471840270921,-0.042,-0.0228473385258331)); +#914=CARTESIAN_POINT('',(0.0142594368054184,-0.037,-0.0284046054895051)); +#915=CARTESIAN_POINT('Origin',(0.0106340370755465,-0.037,-0.0249035976661791)); +#916=CARTESIAN_POINT('',(0.0142594368054184,-0.042,-0.0284046054895051)); +#917=CARTESIAN_POINT('',(0.00275,-0.037,-0.0172900715621611)); +#918=CARTESIAN_POINT('',(0.00275,-0.042,-0.0172900715621611)); +#919=CARTESIAN_POINT('Origin',(0.00637539972987196,-0.037,-0.020791079385487)); +#920=CARTESIAN_POINT('',(0.00674734309863841,-0.0375,-0.0211502609215687)); +#921=CARTESIAN_POINT('Origin',(0.0081860226993157,-0.0375,-0.0225395776624867)); +#922=CARTESIAN_POINT('Origin',(0.001375,-0.042,-0.0183950357810805)); +#923=CARTESIAN_POINT('',(0.00275,-0.037,-0.0172900715621611)); +#924=CARTESIAN_POINT('Origin',(0.0128844368054184,-0.042,-0.0295095697084245)); +#925=CARTESIAN_POINT('',(0.0128844368054184,-0.037,-0.0295095697084245)); +#926=CARTESIAN_POINT('Origin',(0.00754316629139926,-0.042,-0.013307266963672)); +#927=CARTESIAN_POINT('',(0.0144182756934675,-0.042,-0.0218625443798838)); +#928=CARTESIAN_POINT('',(0.00313204769460966,-0.042,-0.0233974706206321)); +#929=CARTESIAN_POINT('Origin',(0.00975238911080876,-0.037,-0.0256120990877924)); +#930=CARTESIAN_POINT('Origin',(0.0107391626922731,-0.037,-0.0172843143430875)); +#931=CARTESIAN_POINT('Origin',(0.00575471840270921,-0.0375,-0.025057266963672)); +#932=CARTESIAN_POINT('',(0.00431603880203191,-0.0375,-0.023667950222754)); +#933=CARTESIAN_POINT('Origin',(0.00754316629139926,0.02,-0.013307266963672)); +#934=CARTESIAN_POINT('',(0.00275,0.02,-0.0172900715621611)); +#935=CARTESIAN_POINT('',(0.0142594368054184,0.02,-0.0284046054895051)); +#936=CARTESIAN_POINT('',(0.00850471840270921,0.02,-0.0228473385258331)); +#937=CARTESIAN_POINT('',(0.001375,0.02,-0.0183950357810805)); +#938=CARTESIAN_POINT('',(-0.0065,0.02,0.002)); +#939=CARTESIAN_POINT('',(0.0128844368054184,0.02,-0.0295095697084245)); +#940=CARTESIAN_POINT('Origin',(-0.0065,0.02,0.002)); +#941=CARTESIAN_POINT('',(-0.0065,0.005,-0.0306165339273439)); +#942=CARTESIAN_POINT('Origin',(-0.0035,0.01,0.004)); +#943=CARTESIAN_POINT('',(-0.0019,0.01,0.004)); +#944=CARTESIAN_POINT('Origin',(-0.004,0.005,-0.0306165339273439)); +#945=CARTESIAN_POINT('Origin',(0.00850471840270921,0.042,-0.0228473385258331)); +#946=CARTESIAN_POINT('',(0.00637539972987196,0.042,-0.020791079385487)); +#947=CARTESIAN_POINT('',(0.0106340370755465,0.042,-0.0249035976661791)); +#948=CARTESIAN_POINT('',(0.00850471840270921,0.042,-0.0228473385258331)); +#949=CARTESIAN_POINT('',(0.00275,0.037,-0.0172900715621611)); +#950=CARTESIAN_POINT('Origin',(0.00637539972987196,0.037,-0.020791079385487)); +#951=CARTESIAN_POINT('',(0.00275,0.042,-0.0172900715621611)); +#952=CARTESIAN_POINT('',(0.0142594368054184,0.037,-0.0284046054895051)); +#953=CARTESIAN_POINT('',(0.0142594368054184,0.042,-0.0284046054895051)); +#954=CARTESIAN_POINT('Origin',(0.0106340370755465,0.037,-0.0249035976661791)); +#955=CARTESIAN_POINT('',(0.00674734309863841,0.0375,-0.0211502609215687)); +#956=CARTESIAN_POINT('Origin',(0.0081860226993157,0.0375,-0.0225395776624867)); +#957=CARTESIAN_POINT('Origin',(0.001375,0.042,-0.0183950357810805)); +#958=CARTESIAN_POINT('',(0.00275,0.037,-0.0172900715621611)); +#959=CARTESIAN_POINT('Origin',(0.0128844368054184,0.042,-0.0295095697084245)); +#960=CARTESIAN_POINT('',(0.0128844368054184,0.037,-0.0295095697084245)); +#961=CARTESIAN_POINT('Origin',(0.00754316629139926,0.042,-0.013307266963672)); +#962=CARTESIAN_POINT('',(0.00313204769460966,0.042,-0.0233974706206321)); +#963=CARTESIAN_POINT('',(0.0144182756934675,0.042,-0.0218625443798838)); +#964=CARTESIAN_POINT('Origin',(0.00975238911080876,0.037,-0.0256120990877924)); +#965=CARTESIAN_POINT('Origin',(0.0107391626922731,0.037,-0.0172843143430875)); +#966=CARTESIAN_POINT('Origin',(0.00575471840270921,0.0375,-0.025057266963672)); +#967=CARTESIAN_POINT('',(0.00431603880203191,0.0375,-0.023667950222754)); +#968=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-5),#972, +'DISTANCE_ACCURACY_VALUE', +'Maximum model space distance between geometric entities at asserted c +onnectivities'); +#969=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-5),#972, +'DISTANCE_ACCURACY_VALUE', +'Maximum model space distance between geometric entities at asserted c +onnectivities'); +#970=( +GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#968)) +GLOBAL_UNIT_ASSIGNED_CONTEXT((#972,#973,#974)) +REPRESENTATION_CONTEXT('','3D') +); +#971=( +GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#969)) +GLOBAL_UNIT_ASSIGNED_CONTEXT((#972,#973,#974)) +REPRESENTATION_CONTEXT('','3D') +); +#972=( +LENGTH_UNIT() +NAMED_UNIT(*) +SI_UNIT($,.METRE.) +); +#973=( +NAMED_UNIT(*) +PLANE_ANGLE_UNIT() +SI_UNIT($,.RADIAN.) +); +#974=( +NAMED_UNIT(*) +SI_UNIT($,.STERADIAN.) +SOLID_ANGLE_UNIT() +); +#975=SHAPE_DEFINITION_REPRESENTATION(#976,#977); +#976=PRODUCT_DEFINITION_SHAPE('',$,#979); +#977=SHAPE_REPRESENTATION('',(#600),#970); +#978=PRODUCT_DEFINITION_CONTEXT('part definition',#983,'design'); +#979=PRODUCT_DEFINITION('2025-07-25-23-29-53-268','oak - v1',#980,#978); +#980=PRODUCT_DEFINITION_FORMATION('',$,#985); +#981=PRODUCT_RELATED_PRODUCT_CATEGORY('oak - v1','oak - v1',(#985)); +#982=APPLICATION_PROTOCOL_DEFINITION('international standard', +'automotive_design',2009,#983); +#983=APPLICATION_CONTEXT( +'Core Data for Automotive Mechanical Design Process'); +#984=PRODUCT_CONTEXT('part definition',#983,'mechanical'); +#985=PRODUCT('2025-07-25-23-29-53-268','oak - v1','STEP AP242',(#984)); +#986=PRESENTATION_STYLE_ASSIGNMENT((#988)); +#987=PRESENTATION_STYLE_ASSIGNMENT((#989)); +#988=SURFACE_STYLE_USAGE(.BOTH.,#990); +#989=SURFACE_STYLE_USAGE(.BOTH.,#991); +#990=SURFACE_SIDE_STYLE('',(#992)); +#991=SURFACE_SIDE_STYLE('',(#993)); +#992=SURFACE_STYLE_FILL_AREA(#994); +#993=SURFACE_STYLE_FILL_AREA(#995); +#994=FILL_AREA_STYLE('Steel - Satin',(#996)); +#995=FILL_AREA_STYLE('Opaque(157,207,237)',(#997)); +#996=FILL_AREA_STYLE_COLOUR('Steel - Satin',#998); +#997=FILL_AREA_STYLE_COLOUR('Opaque(157,207,237)',#999); +#998=COLOUR_RGB('Steel - Satin',0.627450980392157,0.627450980392157,0.627450980392157); +#999=COLOUR_RGB('Opaque(157,207,237)',0.615686274509804,0.811764705882353, +0.929411764705882); +ENDSEC; +END-ISO-10303-21; diff --git a/third-party/GR00T-WholeBodyControl/install_scripts/install_camera_server.sh b/third-party/GR00T-WholeBodyControl/install_scripts/install_camera_server.sh new file mode 100644 index 0000000000000000000000000000000000000000..3cf0a9aa66f42ad75742c76d03fc4de4f356bca4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/install_scripts/install_camera_server.sh @@ -0,0 +1,252 @@ +#!/usr/bin/env bash +# install_camera_server.sh +# Sets up the .venv_camera venv for running the composed camera server +# on the robot computer. +# +# Installs gear_sonic[camera] which includes the ZMQ-based camera server +# framework and the depthai SDK (OAK cameras). For other camera SDKs +# (e.g. pyrealsense2), install them into the venv after setup. +# +# Usage: bash install_scripts/install_camera_server.sh (run from repo root) + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# ── 0. Print detected architecture ─────────────────────────────────────────── +ARCH="$(uname -m)" +echo "[OK] Architecture: $ARCH" + +# ── 1. Ensure uv is installed and available ────────────────────────────────── +if ! command -v uv &>/dev/null; then + echo "[INFO] uv not found – installing via official installer …" + curl -LsSf https://astral.sh/uv/install.sh | sh + + if [ -f "$HOME/.local/bin/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.local/bin/env" + elif [ -f "$HOME/.cargo/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.cargo/env" + else + export PATH="$HOME/.local/bin:$PATH" + fi + + if ! command -v uv &>/dev/null; then + echo "[ERROR] uv installation succeeded but binary not found on PATH." + echo " Please add ~/.local/bin (or ~/.cargo/bin) to your PATH and re-run." + exit 1 + fi +fi +echo "[OK] uv $(uv --version)" + +# ── 2. Install a uv-managed Python 3.10 ───────────────────────────────────── +echo "[INFO] Installing uv-managed Python 3.10 …" +uv python install 3.10 +MANAGED_PY="$(uv python find --no-project 3.10)" +echo "[OK] Using Python: $MANAGED_PY" + +# ── 3. Clean previous venv (if any) ───────────────────────────────────────── +cd "$REPO_ROOT" +echo "[INFO] Removing old .venv_camera (if present) …" +rm -rf .venv_camera + +# ── 4. Create venv & install camera extra ──────────────────────────────────── +echo "[INFO] Creating .venv_camera with uv-managed Python 3.10 …" +uv venv .venv_camera --python "$MANAGED_PY" --prompt gear_sonic_camera +# shellcheck disable=SC1091 +source .venv_camera/bin/activate +echo "[INFO] Installing gear_sonic[camera] …" +uv pip install -e "gear_sonic[camera]" + +echo "" +echo "══════════════════════════════════════════════════════════════" +echo " Camera server venv setup complete!" +echo " depthai (OAK cameras) is included by default." +echo "" +echo " Activate the venv with:" +echo " source .venv_camera/bin/activate" +echo "" +echo " For other camera SDKs, install into the venv:" +echo " pip install pyrealsense2 # Intel RealSense" +echo "" +echo " See docs/source/tutorials/data_collection.md for full setup." +echo "══════════════════════════════════════════════════════════════" + +# ── 5. Optionally install the systemd service ──────────────────────────────── +SERVICE_TEMPLATE="$REPO_ROOT/systemd/composed_camera_server.service" +SERVICE_NAME="composed_camera_server.service" + +if [ ! -f "$SERVICE_TEMPLATE" ]; then + echo "" + echo "[WARN] systemd template not found at $SERVICE_TEMPLATE — skipping." + exit 0 +fi + +echo "" +read -rp "Install the camera server as a systemd service (auto-start on boot)? [y/N] " INSTALL_SERVICE +if [[ ! "$INSTALL_SERVICE" =~ ^[Yy]$ ]]; then + echo "" + echo " Skipped systemd install. You can run the camera server manually:" + echo " source .venv_camera/bin/activate" + echo " python -m gear_sonic.camera.composed_camera --ego-view-camera oak --port 5555" + echo "" + exit 0 +fi + +# Gather configuration +echo "" +echo "── Camera service configuration ──" +echo " Each camera needs a type and a device ID so the server knows" +echo " which physical camera maps to each mount position (ego, wrist, etc.)." +echo "" + +detect_oak_cameras() { + "${REPO_ROOT}/.venv_camera/bin/python" -c " +import depthai as dai +devices = dai.Device.getAllAvailableDevices() +if not devices: + exit(1) +for i, d in enumerate(devices): + # Try to get actual MxID; fall back to string representation + mxid = None + for attr in ['mxid', 'getMxId']: + if hasattr(d, attr): + val = getattr(d, attr) + mxid = val() if callable(val) else val + if mxid: + break + state = d.state.name if hasattr(d, 'state') else 'N/A' + name = getattr(d, 'name', '') + if mxid and mxid != name: + print(f' [{i}] MxId: {mxid} port: {name} state: {state}') + else: + # MxID not available; show all useful attributes + print(f' [{i}] device: {d} state: {state}') + print(f' attributes: {[a for a in dir(d) if not a.startswith(\"_\")]}') +" 2>&1 +} + +while true; do + echo " Detecting connected OAK cameras …" + OAK_DEVICES="$(detect_oak_cameras)" && OAK_FOUND=true || OAK_FOUND=false + + if $OAK_FOUND && [ -n "$OAK_DEVICES" ]; then + echo "$OAK_DEVICES" + break + else + echo " (no OAK devices detected)" + if [ -n "$OAK_DEVICES" ]; then + echo " depthai output: $OAK_DEVICES" + fi + echo "" + read -rp " Retry detection? [Y/n] (or 'n' to enter device IDs manually): " RETRY + if [[ "$RETRY" =~ ^[Nn]$ ]]; then + break + fi + echo "" + fi +done +echo "" + +# Build ExecStart args incrementally +CAMERA_ARGS="" + +# --- Ego-view camera (required) --- +read -rp " Ego-view camera type (oak, oak_mono, realsense, usb) [oak]: " EGO_TYPE +EGO_TYPE="${EGO_TYPE:-oak}" +read -rp " Ego-view device ID (MxID or /dev/video index): " EGO_DEVICE_ID +CAMERA_ARGS="--ego-view-camera ${EGO_TYPE}" +if [ -n "$EGO_DEVICE_ID" ]; then + CAMERA_ARGS="${CAMERA_ARGS} --ego-view-device-id ${EGO_DEVICE_ID}" +fi + +# --- Left wrist camera (optional) --- +echo "" +read -rp " Add a left-wrist camera? [y/N]: " ADD_LEFT +if [[ "$ADD_LEFT" =~ ^[Yy]$ ]]; then + read -rp " Left-wrist camera type [oak]: " LEFT_TYPE + LEFT_TYPE="${LEFT_TYPE:-oak}" + read -rp " Left-wrist device ID (MxID): " LEFT_DEVICE_ID + CAMERA_ARGS="${CAMERA_ARGS} --left-wrist-camera ${LEFT_TYPE}" + if [ -n "$LEFT_DEVICE_ID" ]; then + CAMERA_ARGS="${CAMERA_ARGS} --left-wrist-device-id ${LEFT_DEVICE_ID}" + fi +fi + +# --- Right wrist camera (optional) --- +echo "" +read -rp " Add a right-wrist camera? [y/N]: " ADD_RIGHT +if [[ "$ADD_RIGHT" =~ ^[Yy]$ ]]; then + read -rp " Right-wrist camera type [oak]: " RIGHT_TYPE + RIGHT_TYPE="${RIGHT_TYPE:-oak}" + read -rp " Right-wrist device ID (MxID): " RIGHT_DEVICE_ID + CAMERA_ARGS="${CAMERA_ARGS} --right-wrist-camera ${RIGHT_TYPE}" + if [ -n "$RIGHT_DEVICE_ID" ]; then + CAMERA_ARGS="${CAMERA_ARGS} --right-wrist-device-id ${RIGHT_DEVICE_ID}" + fi +fi + +echo "" +read -rp " ZMQ port [5555]: " CFG_PORT +CFG_PORT="${CFG_PORT:-5555}" +CAMERA_ARGS="${CAMERA_ARGS} --port ${CFG_PORT}" + +EXEC_START="${REPO_ROOT}/.venv_camera/bin/python -m gear_sonic.camera.composed_camera ${CAMERA_ARGS}" +echo "" +echo " ExecStart command:" +echo " $EXEC_START" +echo "" +read -rp " Look correct? [Y/n]: " CONFIRM +if [[ "$CONFIRM" =~ ^[Nn]$ ]]; then + echo " Aborted. Edit systemd/composed_camera_server.service manually." + exit 0 +fi + +# Generate unit file directly (avoids fragile sed on multi-line ExecStart) +TMPUNIT="$(mktemp)" +cat > "$TMPUNIT" </dev/null; then + sudo apt-get install -y espeak >/dev/null 2>&1 || echo "[WARN] Could not install espeak — voice feedback will be disabled" +fi + +# ── 1. Ensure uv is installed and available ────────────────────────────────── +if ! command -v uv &>/dev/null; then + echo "[INFO] uv not found – installing via official installer …" + curl -LsSf https://astral.sh/uv/install.sh | sh + + # Source the uv env so it's available in this session + if [ -f "$HOME/.local/bin/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.local/bin/env" + elif [ -f "$HOME/.cargo/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.cargo/env" + else + export PATH="$HOME/.local/bin:$PATH" + fi + + if ! command -v uv &>/dev/null; then + echo "[ERROR] uv installation succeeded but binary not found on PATH." + echo " Please add ~/.local/bin (or ~/.cargo/bin) to your PATH and re-run." + exit 1 + fi +fi +echo "[OK] uv $(uv --version)" + +# ── 2. Install a uv-managed Python 3.10 (includes dev headers / Python.h) ──── +echo "[INFO] Installing uv-managed Python 3.10 (includes development headers) …" +uv python install 3.10 +MANAGED_PY="$(uv python find --no-project 3.10)" +echo "[OK] Using Python: $MANAGED_PY" + +# ── 3. Clean previous venv (if any) ────────────────────────────────────────── +cd "$REPO_ROOT" +echo "[INFO] Removing old .venv_data_collection (if present) …" +rm -rf .venv_data_collection + +# ── 4. Create venv & install data_collection extra ─────────────────────────── +echo "[INFO] Creating .venv_data_collection with uv-managed Python 3.10 …" +uv venv .venv_data_collection --python "$MANAGED_PY" --prompt gear_sonic_data_collection +# shellcheck disable=SC1091 +source .venv_data_collection/bin/activate +echo "[INFO] Installing gear_sonic[data_collection] (this may take a few minutes) …" +# LeRobot's git repo contains LFS test artifacts that aren't needed at runtime. +# Skip them to avoid download failures and save bandwidth. +GIT_LFS_SKIP_SMUDGE=1 uv pip install -e "gear_sonic[data_collection]" + +echo "" +echo "══════════════════════════════════════════════════════════════" +echo " Setup complete! Activate the venv with:" +echo "" +echo " source .venv_data_collection/bin/activate" +echo "" +echo " You should see (gear_sonic_data_collection) in your prompt." +echo "" +echo " Then run the data exporter with:" +echo " python gear_sonic/scripts/run_data_exporter.py" +echo "══════════════════════════════════════════════════════════════" diff --git a/third-party/GR00T-WholeBodyControl/install_scripts/install_inference.sh b/third-party/GR00T-WholeBodyControl/install_scripts/install_inference.sh new file mode 100644 index 0000000000000000000000000000000000000000..0f98903039435bb019c953545ffd3920d78bd601 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/install_scripts/install_inference.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# install_inference.sh +# Sets up the .venv_inference venv for running VLA inference with +# Isaac-GR00T PolicyClient against a remote or local policy server. +# +# Installs gear_sonic[inference] which pulls in the Isaac-GR00T library, +# PyZMQ, msgpack, Pinocchio, and other inference dependencies. +# +# Usage: bash install_scripts/install_inference.sh (run from repo root) + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# ── 0. System dependencies ──────────────────────────────────────────────────── +ARCH="$(uname -m)" +echo "[OK] Architecture: $ARCH" + +# ── 1. Ensure uv is installed and available ────────────────────────────────── +if ! command -v uv &>/dev/null; then + echo "[INFO] uv not found – installing via official installer …" + curl -LsSf https://astral.sh/uv/install.sh | sh + + if [ -f "$HOME/.local/bin/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.local/bin/env" + elif [ -f "$HOME/.cargo/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.cargo/env" + else + export PATH="$HOME/.local/bin:$PATH" + fi + + if ! command -v uv &>/dev/null; then + echo "[ERROR] uv installation succeeded but binary not found on PATH." + echo " Please add ~/.local/bin (or ~/.cargo/bin) to your PATH and re-run." + exit 1 + fi +fi +echo "[OK] uv $(uv --version)" + +# ── 2. Install a uv-managed Python 3.10 (includes dev headers / Python.h) ──── +echo "[INFO] Installing uv-managed Python 3.10 (includes development headers) …" +uv python install 3.10 +MANAGED_PY="$(uv python find --no-project 3.10)" +echo "[OK] Using Python: $MANAGED_PY" + +# ── 3. Clean previous venv (if any) ────────────────────────────────────────── +cd "$REPO_ROOT" +echo "[INFO] Removing old .venv_inference (if present) …" +rm -rf .venv_inference + +# ── 4. Create venv & install inference extra ───────────────────────────────── +echo "[INFO] Creating .venv_inference with uv-managed Python 3.10 …" +uv venv .venv_inference --python "$MANAGED_PY" --prompt gear_sonic_inference +# shellcheck disable=SC1091 +source .venv_inference/bin/activate +echo "[INFO] Installing gear_sonic[inference] (this may take a few minutes) …" +uv pip install -e "gear_sonic[inference]" + +echo "" +echo "══════════════════════════════════════════════════════════════" +echo " Setup complete! Activate the venv with:" +echo "" +echo " source .venv_inference/bin/activate" +echo "" +echo " You should see (gear_sonic_inference) in your prompt." +echo "" +echo " Then run VLA inference with:" +echo " python gear_sonic/scripts/run_vla_inference.py --help" +echo "══════════════════════════════════════════════════════════════" diff --git a/third-party/GR00T-WholeBodyControl/install_scripts/install_leap_sdk.sh b/third-party/GR00T-WholeBodyControl/install_scripts/install_leap_sdk.sh new file mode 100644 index 0000000000000000000000000000000000000000..b3966934a2ab156272f0c226147c3d13ab144e9e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/install_scripts/install_leap_sdk.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +# Install UltraLeap repository and key +wget -qO - https://repo.ultraleap.com/keys/apt/gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/ultraleap.gpg + +echo 'deb [arch=amd64] https://repo.ultraleap.com/apt stable main' | sudo tee /etc/apt/sources.list.d/ultraleap.list +sudo apt update + +# Install UltraLeap hand tracking (auto-accept license) +sudo apt install -y ultraleap-hand-tracking + +# Clone and install leapc-python-bindings +git clone https://github.com/ultraleap/leapc-python-bindings /tmp/leapc-python-bindings +cd /tmp/leapc-python-bindings +pip install -r requirements.txt +python -m build leapc-cffi +pip install leapc-cffi/dist/leapc_cffi-0.0.1.tar.gz +pip install -e leapc-python-api diff --git a/third-party/GR00T-WholeBodyControl/install_scripts/install_mujoco_sim.sh b/third-party/GR00T-WholeBodyControl/install_scripts/install_mujoco_sim.sh new file mode 100644 index 0000000000000000000000000000000000000000..71f6d37110aafbe60a672358093c32a5c2f252b1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/install_scripts/install_mujoco_sim.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +# install_mujoco_sim.sh +# Minimal venv setup for running the MuJoCo simulator (run_sim_loop.py). +# Skips XRoboToolkit SDK and teleop dependencies that are NOT needed for sim. +# Based on install_pico.sh — see that script for the full teleop setup. +# +# Usage: bash install_scripts/install_mujoco_sim.sh (run from repo root) + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# ── 0. Print detected architecture ─────────────────────────────────────────── +ARCH="$(uname -m)" +echo "[OK] Architecture: $ARCH" + +# ── 1. Ensure uv is installed and available ────────────────────────────────── +if ! command -v uv &>/dev/null; then + echo "[INFO] uv not found – installing via official installer …" + curl -LsSf https://astral.sh/uv/install.sh | sh + + # Source the uv env so it's available in this session + if [ -f "$HOME/.local/bin/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.local/bin/env" + elif [ -f "$HOME/.cargo/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.cargo/env" + else + export PATH="$HOME/.local/bin:$PATH" + fi + + # Verify uv is now reachable + if ! command -v uv &>/dev/null; then + echo "[ERROR] uv installation succeeded but binary not found on PATH." + echo " Please add ~/.local/bin (or ~/.cargo/bin) to your PATH and re-run." + exit 1 + fi +fi +echo "[OK] uv $(uv --version)" + +# ── 2. Install a uv-managed Python 3.10 (includes dev headers / Python.h) ──── +echo "[INFO] Installing uv-managed Python 3.10 (includes development headers) …" +uv python install 3.10 +MANAGED_PY="$(uv python find --no-project 3.10)" +echo "[OK] Using Python: $MANAGED_PY" + +# ── 3. Clean previous venv (if any) ────────────────────────────────────────── +cd "$REPO_ROOT" +echo "[INFO] Removing old .venv_sim (if present) …" +rm -rf .venv_sim + +# ── 4. Create venv & install sim extra ──────────────────────────────────────── +echo "[INFO] Creating .venv_sim with uv-managed Python 3.10 …" +uv venv .venv_sim --python "$MANAGED_PY" --prompt gear_sonic_sim +# shellcheck disable=SC1091 +source .venv_sim/bin/activate +echo "[INFO] Installing gear_sonic[sim] …" +uv pip install -e "gear_sonic[sim]" + +# ── 5. Install unitree_sdk2_python (needed by the sim ↔ WBC bridge) ────────── +echo "[INFO] Installing unitree_sdk2_python …" +uv pip install -e external_dependencies/unitree_sdk2_python + +echo "" +echo "══════════════════════════════════════════════════════════════" +echo " Setup complete! Activate the venv with:" +echo "" +echo " source .venv_sim/bin/activate" +echo "" +echo " You should see (gear_sonic_sim) in your prompt." +echo "" +echo " Then run the MuJoCo simulator with:" +echo " python gear_sonic/scripts/run_sim_loop.py" +echo "══════════════════════════════════════════════════════════════" diff --git a/third-party/GR00T-WholeBodyControl/install_scripts/install_pico.sh b/third-party/GR00T-WholeBodyControl/install_scripts/install_pico.sh new file mode 100644 index 0000000000000000000000000000000000000000..c4c25be717aaa5f2381ac4b5d3f8b036331a70de --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/install_scripts/install_pico.sh @@ -0,0 +1,191 @@ +#!/usr/bin/env bash +# install_pico.sh +# Sets up the gear_sonic_teleop venv for PICO VR teleop on any x86_64 or arm64 +# machine (desktop, laptop, or G1 onboard). +# +# Usage: +# bash install_scripts/install_pico.sh # full install +# SKIP_SIM_AND_UNITREE=1 bash install_scripts/install_pico.sh +# # publisher-only profile +# # (Thor/Orin used as a +# # headless Isaac Teleop / +# # CloudXR ROS publisher +# # — neither sim nor the +# # unitree DDS bindings +# # are on that path) +# +# Optional env vars: +# SKIP_SIM_AND_UNITREE=1 Skip the mujoco sim extra and unitree_sdk2_python. +# On aarch64 also skips the CycloneDDS C-lib build. +# CYCLONEDDS_HOME= Override the CycloneDDS install prefix on aarch64 +# (default: ~/cyclonedds/install). Not used on +# x86_64 because prebuilt cyclonedds wheels exist. +# +# Run from the repo root. + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# ── 0. Print detected architecture ─────────────────────────────────────────── +ARCH="$(uname -m)" +echo "[OK] Architecture: $ARCH" + +# ── 1. Ensure uv is installed and available ────────────────────────────────── +if ! command -v uv &>/dev/null; then + echo "[INFO] uv not found – installing via official installer …" + curl -LsSf https://astral.sh/uv/install.sh | sh + + # Source the uv env so it's available in this session + if [ -f "$HOME/.local/bin/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.local/bin/env" + elif [ -f "$HOME/.cargo/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.cargo/env" + else + export PATH="$HOME/.local/bin:$PATH" + fi + + # Verify uv is now reachable + if ! command -v uv &>/dev/null; then + echo "[ERROR] uv installation succeeded but binary not found on PATH." + echo " Please add ~/.local/bin (or ~/.cargo/bin) to your PATH and re-run." + exit 1 + fi +fi +echo "[OK] uv $(uv --version)" + +# ── 2. Install a uv-managed Python 3.10 (includes dev headers / Python.h) ──── +echo "[INFO] Installing uv-managed Python 3.10 (includes development headers) …" +uv python install 3.10 +MANAGED_PY="$(uv python find --no-project 3.10)" +echo "[OK] Using Python: $MANAGED_PY" + +# ── 3. Clean previous venv (if any) ────────────────────────────────────────── +cd "$REPO_ROOT" +echo "[INFO] Removing old .venv_teleop (if present) …" +rm -rf .venv_teleop + +# ── 4. Create venv & install teleop extra ───────────────────────────────────── +echo "[INFO] Creating .venv_teleop with uv-managed Python 3.10 …" +uv venv .venv_teleop --python "$MANAGED_PY" --prompt gear_sonic_teleop +# shellcheck disable=SC1091 +source .venv_teleop/bin/activate +echo "[INFO] Installing gear_sonic[teleop] …" +uv pip install -e "gear_sonic[teleop]" + +# ── 5. Install xrobotoolkit_sdk (CMake-based, not a pip package) ────────────── +echo "[INFO] Installing XRoboToolkit SDK …" +# Install cmake + pybind11 into the venv so the CMake-based build can find them. +# Build with --no-build-isolation so CMake inherits the venv's pybind11. +uv pip install cmake pybind11 setuptools +echo "[OK] cmake $(cmake --version | head -1)" +# Point CMake at pybind11's cmake config so find_package(pybind11) succeeds +export CMAKE_PREFIX_PATH="$(python -m pybind11 --cmakedir)" +echo "[OK] pybind11 cmake dir: $CMAKE_PREFIX_PATH" + +# On aarch64 (Jetson Orin), build the PXREARobotSDK native lib from source +# because pre-built aarch64 binaries are not shipped in the repo. +XRT_DIR="$REPO_ROOT/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64" +if [ "$ARCH" = "aarch64" ] && [ ! -f "$XRT_DIR/lib/aarch64/libPXREARobotSDK.so" ]; then + echo "[INFO] Building PXREARobotSDK for aarch64 (Jetson Orin) …" + XRT_TMP="$XRT_DIR/tmp" + mkdir -p "$XRT_TMP" + if [ ! -d "$XRT_TMP/XRoboToolkit-PC-Service" ]; then + git clone -b orin https://github.com/XR-Robotics/XRoboToolkit-PC-Service.git "$XRT_TMP/XRoboToolkit-PC-Service" + fi + pushd "$XRT_TMP/XRoboToolkit-PC-Service/RoboticsService/PXREARobotSDK" > /dev/null + bash build.sh + popd > /dev/null + mkdir -p "$XRT_DIR/lib/aarch64" "$XRT_DIR/include/aarch64" + cp "$XRT_TMP/XRoboToolkit-PC-Service/RoboticsService/PXREARobotSDK/PXREARobotSDK.h" \ + "$XRT_DIR/include/aarch64/" + cp -r "$XRT_TMP/XRoboToolkit-PC-Service/RoboticsService/PXREARobotSDK/nlohmann" \ + "$XRT_DIR/include/aarch64/nlohmann/" + cp "$XRT_TMP/XRoboToolkit-PC-Service/RoboticsService/PXREARobotSDK/build/libPXREARobotSDK.so" \ + "$XRT_DIR/lib/aarch64/" + rm -rf "$XRT_TMP" + echo "[OK] PXREARobotSDK aarch64 native library built and installed" +fi + +uv pip install --no-build-isolation -e external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/ + +# ── 5c. Install isaacteleop[cloudxr] for the in-process CloudXR / DeviceIO path +# (--input-source isaac-teleop in pico_manager_thread_server.py). +# Hosted on pypi.nvidia.com (public index, no auth). Replaces the legacy +# multi-container path (./scripts/run_cloudxr_via_docker.sh + teleop_ros2_ref). +echo "[INFO] Installing isaacteleop[cloudxr]~=1.3.0 from pypi.nvidia.com …" +uv pip install 'isaacteleop[cloudxr]~=1.3.0' --prerelease=allow \ + --extra-index-url https://pypi.nvidia.com + +# Seed ~/cloudxr.env with the device profile CloudXRLauncher negotiates against. +# Skip if the file already exists. +if [ ! -f "$HOME/cloudxr.env" ]; then + echo "NV_DEVICE_PROFILE=Quest3" > "$HOME/cloudxr.env" + echo "[OK] Seeded $HOME/cloudxr.env with NV_DEVICE_PROFILE=Quest3" +else + echo "[OK] $HOME/cloudxr.env already exists (leaving as-is)" +fi + +# ── 5b, 6, 7: CycloneDDS C lib (aarch64) + sim extra + unitree_sdk2_python ──── +# Skip when: +# • onboard unitree-provisioned image (aarch64 + user==unitree): the image +# already ships CycloneDDS, sim has no display, and the on-robot deploy +# uses the C++ stack directly. Applies to both Orin and Thor onboards. +# • SKIP_SIM_AND_UNITREE=1 is set explicitly: e.g. a Thor or Orin used as a +# headless Isaac Teleop / CloudXR streamer — neither mujoco nor the +# unitree DDS bindings are on that path. +if { [ "$ARCH" = "aarch64" ] && [ "$(whoami)" = "unitree" ]; } \ + || [ "${SKIP_SIM_AND_UNITREE:-0}" = "1" ]; then + echo "[SKIP] Skipping CycloneDDS build, sim extra & unitree_sdk2_python" +else + # ── 5b. Build CycloneDDS C library on aarch64 (needed by the cyclonedds + # Python binding which unitree_sdk2_python depends on). + # x86_64 hosts get prebuilt cyclonedds wheels and skip this entirely. + # Pattern follows Unitree's own README for this exact error + # (https://github.com/unitreerobotics/unitree_sdk2_python#faq): + # per-user source checkout in $HOME, sibling install/ dir, no sudo. + if [ "$ARCH" = "aarch64" ]; then + CDDS_DIR="$HOME/cyclonedds" + CDDS_PREFIX="${CYCLONEDDS_HOME:-$CDDS_DIR/install}" + if [ ! -f "$CDDS_PREFIX/lib/libddsc.so" ]; then + echo "[INFO] Building CycloneDDS releases/0.10.x → $CDDS_PREFIX …" + # Track the releases/0.10.x maintenance branch (per Unitree's FAQ). + # The 0.10.2 tag is unpatched 2022 code and trips glibc FORTIFY_SOURCE + # in dds_create_domain on modern Ubuntu / glibc; the branch has fixes. + if [ ! -d "$CDDS_DIR/.git" ]; then + git clone -b releases/0.10.x --depth 1 \ + https://github.com/eclipse-cyclonedds/cyclonedds.git "$CDDS_DIR" + fi + cmake -S "$CDDS_DIR" -B "$CDDS_DIR/build" \ + -DCMAKE_INSTALL_PREFIX="$CDDS_PREFIX" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$CDDS_DIR/build" -j"$(nproc)" + cmake --install "$CDDS_DIR/build" + echo "[OK] CycloneDDS installed at $CDDS_PREFIX" + else + echo "[OK] CycloneDDS already present at $CDDS_PREFIX (libddsc.so found)" + fi + export CYCLONEDDS_HOME="$CDDS_PREFIX" + fi + + # ── 6. Install sim extra (for run_sim_loop.py / sim2sim testing) + echo "[INFO] Installing sim extra …" + uv pip install -e "gear_sonic[sim]" + + # ── 7. Install unitree_sdk2_python (needed by the sim2sim bridge) + echo "[INFO] Installing unitree_sdk2_python …" + uv pip install -e external_dependencies/unitree_sdk2_python +fi + +echo "" +echo "══════════════════════════════════════════════════════════════" +echo " Setup complete! Activate the venv with:" +echo "" +echo " source .venv_teleop/bin/activate" +echo "" +echo " You should see (gear_sonic_teleop) in your prompt." +echo "══════════════════════════════════════════════════════════════" diff --git a/third-party/GR00T-WholeBodyControl/install_scripts/install_ros.sh b/third-party/GR00T-WholeBodyControl/install_scripts/install_ros.sh new file mode 100644 index 0000000000000000000000000000000000000000..994a9732db7b249480ba4c20406368447d89f0cb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/install_scripts/install_ros.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# install_ros.sh +# Sets up the `teleop_ros` conda env with RoboStack ROS 2 Humble for the +# Isaac Teleop / CloudXR ROS bridge. Pinned to Python 3.10 to compose with +# .venv_teleop (created by install_pico.sh). +# +# Usage: bash install_scripts/install_ros.sh (run from repo root) + +set -e + +ENV_NAME="${1:-teleop_ros}" +PY_VERSION="3.10" + +# Source conda's shell hooks so `conda activate` works in a non-interactive script. +source "$(conda info --base)/etc/profile.d/conda.sh" + +if conda env list | awk '{print $1}' | grep -qx "$ENV_NAME"; then + echo "♻️ Reusing existing conda env: $ENV_NAME" +else + echo "🆕 Creating conda env '$ENV_NAME' with Python $PY_VERSION..." + conda create -n "$ENV_NAME" "python=$PY_VERSION" -y +fi +conda activate "$ENV_NAME" + +echo "🔄 Cleaning up incomplete or cached packages..." +conda clean --packages --tarballs --yes + +echo "🔧 Adding RoboStack and conda-forge channels to the current environment..." +conda config --env --add channels conda-forge +conda config --env --add channels robostack-staging + +# Optional: remove defaults to avoid conflicts (ignore error if not present) +echo "⚙️ Removing 'defaults' channel if present..." +conda config --env --remove channels defaults || true + +echo "📦 Installing ROS 2 Humble Desktop from RoboStack..." +# RoboStack recommends mamba over conda; conda+libmamba hits a post-link +# ordering bug in ros-humble-ros-workspace, and conda+classic is very slow +# on aarch64. Install mamba into base if it isn't already there. +if ! command -v mamba &>/dev/null; then + echo "🆕 Installing mamba into base env..." + conda install -n base -c conda-forge -y mamba +fi +mamba install -y ros-humble-desktop + +echo "✅ Sourcing ROS environment from current conda env..." +source "$CONDA_PREFIX/setup.bash" + +echo "🧪 Verifying rclpy import..." +python -c "import rclpy; print('✅ rclpy imported')" + +cat < + Project Page + Documentation +

+ +

+ MotionBricks teaser +

+ +MotionBricks is a real-time generative framework that transforms interactive motion control for animation and robotics. By combining a large-scale latent backbone with intuitive "smart primitives," it delivers high-quality, zero-shot motion synthesis at 15,000 FPS, allowing users to effortlessly build complex animations and robotic movements like assembling bricks. + +## Contents + +- [News & Roadmap](#news--roadmap) +- [Results](#results) +- [Setup](#setup) +- [Interactive Demo: Quick Start](#interactive-demo-quick-start) +- [Training](#training) +- [Motion Representation and Custom Datasets](#motion-representation-and-custom-datasets) +- [Related Work](#related-work) +- [Project Structure](#project-structure) +- [Known Issues](#known-issues) +- [Citation](#citation) +- [License](#license) +- [Contact](#contact) + +## News & Roadmap + +### News + +- **2026-04-27** — Initial public release: interactive demo, pretrained checkpoints (VQVAE · pose · root), synthetic training code, motion-representation docs, and GIF gallery. + +### Roadmap + +- [ ] Full training pipeline inside [GR00T Whole-Body Control](https://github.com/NVlabs/GR00T-WholeBodyControl)'s GEAR-SONIC pipeline — targeted for approximately one month out; reproducibility experiments are already in flight. + +## Results + +See the [project page](https://nvlabs.github.io/motionbricks) for the full uncut demos and comparison videos. Short clips below are GIFs (muted, ~10 s each). + +### Teasers + +| Animation | Robotics | +| :---: | :---: | +| ![Animation teaser](assets/gifs/teaser_animation.gif) | ![Robotics teaser](assets/gifs/teaser_robotics.gif) | + +### Smart Locomotion — Single Styles + +| Zombie | Injured leg | +| :---: | :---: | +| ![Zombie](assets/gifs/loco_zombie.gif) | ![Injured leg](assets/gifs/loco_injured_leg.gif) | +| **Injured torso** | **Skipping** | +| ![Injured torso](assets/gifs/loco_injured_torso.gif) | ![Skipping](assets/gifs/loco_skipping.gif) | +| **Strafing** | **Crouch strafing** | +| ![Strafing](assets/gifs/loco_strafing.gif) | ![Crouch strafing](assets/gifs/loco_crouch_strafing.gif) | + +### Smart Locomotion — Mixture of Styles + +| Freestyle | Idle · Walk · Jog · Run | +| :---: | :---: | +| ![Freestyle](assets/gifs/loco_freestyle.gif) | ![Idle / walk / jog / run](assets/gifs/loco_idle_walk_jog_run.gif) | + +### Smart Objects + +| Pick up sword | Falling | +| :---: | :---: | +| ![Pick up sword](assets/gifs/obj_pickup_sword.gif) | ![Falling](assets/gifs/obj_falling.gif) | +| **Jump over bench** | **Sitting** | +| ![Jump over bench](assets/gifs/obj_jump_bench.gif) | ![Sitting](assets/gifs/obj_sitting.gif) | +| **Interactive authoring** | | +| ![Interactive authoring](assets/gifs/obj_interactive_authoring.gif) | | + +## Setup + +**Requirements:** Python 3.10+, a CUDA-capable GPU, [Git LFS](https://git-lfs.com/). + +### Clone the repository + +MotionBricks ships as a subproject of [GR00T Whole-Body Control](https://github.com/NVlabs/GR00T-WholeBodyControl). Clone the parent repo and `cd` into `motionbricks/`. Pretrained checkpoints, mesh assets, and gallery GIFs are tracked with Git LFS, so install LFS before cloning: + +```bash +git lfs install +``` + +The parent repo skips MotionBricks pretrained checkpoints by default so a normal monorepo clone does not automatically download the extra ~2.2 GB of checkpoint files. MotionBricks GIFs and mesh assets still download normally. If you only need source code (for example, to train on your own data), clone normally: + +```bash +git clone https://github.com/NVlabs/GR00T-WholeBodyControl.git +cd GR00T-WholeBodyControl/motionbricks +``` + +If you want the checkpoints for the interactive demo, fetch them explicitly from the repo root: + +```bash +git clone https://github.com/NVlabs/GR00T-WholeBodyControl.git +cd GR00T-WholeBodyControl +git lfs pull --include="motionbricks/out/**" --exclude="" +git lfs pull --include="motionbricks/assets/skeletons/g1/meshes/**" --exclude="" # needed for interactive demo +cd motionbricks +``` + +After fetching MotionBricks checkpoints, verify that checkpoint files were downloaded (not tiny Git LFS pointer files): + +```bash +ls -lh out/G1-clip.ckpt # ~7.5 MB +ls -lh out/motionbricks_vqvae/version_1/checkpoints/*.ckpt # ~273 MB +ls -lh out/motionbricks_pose/version_1/checkpoints/*.ckpt # ~1.6 GB +ls -lh out/motionbricks_root/version_1/checkpoints/*.ckpt # ~391 MB +``` + +If these files are unexpectedly small (around 1 KB), they are LFS pointers. From the repo root, run `git lfs pull --include="motionbricks/out/**" --exclude=""` to fetch the actual checkpoints. + + +### Install dependencies + +```bash +# Create environment +conda create -n motionbricks python=3.10 -y +conda activate motionbricks + +# Install dependencies +pip install -e . + +# Linux only: needed for keyboard input and MuJoCo key-grab workaround +pip install pynput python-xlib +``` + +## Interactive Demo: Quick Start + +```bash +DISPLAY=:1 python scripts/interactive_demo_g1.py +``` + +This launches the MuJoCo viewer with the G1 robot. Use your keyboard to control it in real time. Hold the left mouse button and drag to change the camera look-at direction. + +

+ Interactive demo screencast +

+ +### Movement Controls + +| Key | Action | +|-----|--------| +| `W` | Move forward | +| `A` | Move left | +| `S` | Move backward | +| `D` | Move right | + +The movement direction is relative to the camera. Rotate the camera by right-clicking and dragging in the MuJoCo viewer. + +### Motion Styles + +| Key | Style | +|-----|-------| +| `V` | Slow walk | +| `Z` | Hand crawling | +| `X` | Walk boxing | +| `B` | Elbow crawling | +| `R` | Stealth walk | +| `T` | Injured walk | +| `C` | Walk stealth (crouched) | +| `E` | Happy dance walk | +| `F` | Zombie walk | +| `G` | Gun walk | +| `Q` | Scared walk | + +Note: crawling modes (`Z` hand crawling and `B` elbow crawling) currently do not support side-only directions. + +Without pressing a style key, the default locomotion is: **idle** (no movement keys), **walk** (WASD pressed). + +## Training + +Training scripts are provided for all three model components. The scripts use synthetic data by default and load model configs from the saved checkpoints in `out/`. The full motion datasets are available at . + +**Full release status:** A full release — a model fully embedded in [GR00T whole-body control](https://github.com/NVlabs/GR00T-WholeBodyControl)'s robotics formulation, along with the complete training pipeline — is targeted for approximately one month out. Reproducibility experiments are already in flight; please check back for updates. + +```bash +# Train the VQVAE (motion tokenizer) +python scripts/train_vqvae.py + +# Train the pose model (requires pretrained VQVAE checkpoint) +python scripts/train_pose.py + +# Train the root model (no VQVAE needed) +python scripts/train_root.py +``` + +### Dataset + +The datasets used to train the pretrained checkpoints can be downloaded at . All current training scripts default to **synthetic data** (see `motionbricks/data/synthetic_dataset.py`) so that the full training pipeline can be verified end-to-end without the real dataset. + +## Motion Representation and Custom Datasets + +For details on the motion feature representation, skeleton system, coordinate conventions, normalization, and feature computation pipeline, see [docs/motion_representation.md](docs/motion_representation.md). + +For a step-by-step guide to training MotionBricks on your own motion data and adapting it to a new robot, see [docs/adding_your_own_dataset.md](docs/adding_your_own_dataset.md). + +## Related Work + +**Kimodo** — A sibling project focused on offline motion generation, complementary to MotionBricks' real-time runtime. + +[Project page](https://research.nvidia.com/labs/sil/projects/kimodo/) · [GitHub](https://github.com/nv-tlabs/kimodo) + +

+ Kimodo teaser +

+ +**GEAR-SONIC** — Together with MotionBricks, GEAR-SONIC anchors NVIDIA's GR00T Whole-Body Control initiative. + +[Project page](https://nvlabs.github.io/GEAR-SONIC/) · [GitHub](https://github.com/NVlabs/GR00T-WholeBodyControl) + +

+ GEAR-SONIC teaser +

+ +**BONES-SEED Dataset** — MotionBricks' training corpus — 350k production-grade mocap clips from real human actors and actresses. + +[Dataset page](https://huggingface.co/datasets/bones-studio/seed) + +

+ BONES-SEED teaser +

+ +**SOMA Retargeter** — The Newton-based solver that retargets SOMA capture onto the G1, producing MotionBricks' training data. + +[GitHub](https://github.com/NVIDIA/soma-retargeter) + +

+ SOMA Retargeter teaser +

+ +## Project Structure + +``` +motionbricks/ + assets/skeletons/g1/ # MuJoCo XMLs and STL meshes + motionbricks/ # Python package + scripts/ + interactive_demo_g1.py # Interactive demo + train_vqvae.py # VQVAE training + train_pose.py # Pose model training + train_root.py # Root model training + out/ # Pre-trained checkpoints (Git LFS) + G1-clip.ckpt + motionbricks_vqvae/ + motionbricks_pose/ + motionbricks_root/ + setup.py +``` + +## Known Issues + +- **Linux/X11 only:** The keyboard key-grab workaround requires X11 (`python-xlib`). On Wayland, macOS, or Windows, some MuJoCo keyboard shortcuts may conflict with the controller keys. Keep the **terminal focused** (not the MuJoCo window) as a workaround. +- **`PYTORCH_JIT=0` disables key grabs:** Running with `PYTORCH_JIT=0` interferes with the X11 key-grab workaround. If you need `PYTORCH_JIT=0`, keep the terminal focused instead. +- The `pynput` package is required for keyboard input on Linux/macOS. On Windows, the `keyboard` package is used instead. + +## Citation + +If you use MotionBricks in your research, please cite: + +```bibtex +@misc{wang2026motionbricksscalablerealtimemotions, + title={MotionBricks: Scalable Real-Time Motions with Modular Latent Generative Model and Smart Primitives}, + author={Tingwu Wang and Olivier Dionne and Michael De Ruyter and David Minor and Davis Rempe and Kaifeng Zhao and Mathis Petrovich and Ye Yuan and Chenran Li and Zhengyi Luo and Brian Robison and Xavier Blackwell and Bernardo Antoniazzi and Xue Bin Peng and Yuke Zhu and Simon Yuen}, + year={2026}, + eprint={2604.24833}, + archivePrefix={arXiv}, + primaryClass={cs.RO}, + url={https://arxiv.org/abs/2604.24833}, +} +``` + +## License + +Source code in this repository is licensed under **Apache 2.0**. Pretrained model weights are licensed under the **NVIDIA Open Model License**, which permits commercial use with attribution subject to the trustworthy AI requirements. + +## Contact + +For questions and feedback, please reach out at **`gear-wbc@nvidia.com`**. diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1.xml b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1.xml new file mode 100644 index 0000000000000000000000000000000000000000..36231a5b97ab1784ad2e2c889b974b086639c120 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1.xml @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1_23dof.xml b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1_23dof.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c9526e7765f74c0e74515335757ef99b19069d3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1_23dof.xml @@ -0,0 +1,477 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1_29dof.xml b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1_29dof.xml new file mode 100644 index 0000000000000000000000000000000000000000..0707bb3eed19ac01c848c70e2b158dd780a716d0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1_29dof.xml @@ -0,0 +1,521 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1_29dof_with_hand.xml b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1_29dof_with_hand.xml new file mode 100644 index 0000000000000000000000000000000000000000..1d76bbf0d9a51b7c0a32bbce6983b2f12f22448c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/g1_29dof_with_hand.xml @@ -0,0 +1,743 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/scene_23dof.xml b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/scene_23dof.xml new file mode 100644 index 0000000000000000000000000000000000000000..b697dc54b2c1cecc1a6fefa1daef5655a6bc7a4f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/scene_23dof.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/scene_29dof.xml b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/scene_29dof.xml new file mode 100644 index 0000000000000000000000000000000000000000..838de41a834e96db823937449fb55ea0374e62aa --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/scene_29dof.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/scene_29dof_with_hand.xml b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/scene_29dof_with_hand.xml new file mode 100644 index 0000000000000000000000000000000000000000..d1b1683a904c93a1bd24ecc4b345ebdd4f1a715c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/assets/skeletons/g1/scene_29dof_with_hand.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/assets/teaser_motion_bricks_three_rows.jpg b/third-party/GR00T-WholeBodyControl/motionbricks/assets/teaser_motion_bricks_three_rows.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6adc418d765e62008d08bc3f71cc5ef5d1d61d81 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/assets/teaser_motion_bricks_three_rows.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84a0d7f1a22b374713cc03df7c73d2f443a2832a338c5d168a78f4d88a31164d +size 554895 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/docs/adding_your_own_dataset.md b/third-party/GR00T-WholeBodyControl/motionbricks/docs/adding_your_own_dataset.md new file mode 100644 index 0000000000000000000000000000000000000000..fe47cf67533821a16472ddce1116f00ed5e77f97 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/docs/adding_your_own_dataset.md @@ -0,0 +1,36 @@ +# Adding Your Own Dataset + +Our open-sourced datasets are available at . The full training code, within the GR00T whole-body control framework, will be open-sourced soon at . This guide covers bringing your own motion data into MotionBricks training. + +## Two paths + +You have two choices when bringing your own data: + +1. **Bring your own training pipeline without the dependency on motionbricks' motion-representation handler and data loader (highly recommended).** There's no restriction on the motion representation used in our tokenizer, root, and pose module training. It is highly recommended to build your own training pipeline by referencing the current synthetic training path. + +2. **Reuse the MotionBricks motion data representation.** In this path, you assume the same G1 Skeleton34 representation and only work with a different dataset processed in the same way. Full spec of the representation is in [`motion_representation.md`](./motion_representation.md). + +--- + +## Reusing the MotionBricks Representation + +Write a PyTorch `Dataset` whose `__getitem__` returns `{"keyid": int, "motion": Tensor[T, feature_dim]}`, where `motion` is the **already computed and normalized** global motion feature tensor for a single clip. See [`motion_representation.md`](./motion_representation.md) for the feature layout and how to produce it from raw joint rotations + global positions. + +You can reuse the provided normalization stats, but you are also encouraged to compute your own. + +See `motionbricks/data/synthetic_dataset.py` for the minimal dataset interface. + +## Rolling Your Own + +For most non-G1 datasets, we **highly recommend** writing your own dataset loader and motion-representation handler rather than forcing the existing ones to fit. + +### Pointers in the code + +| What you're writing | Start from | +|---------------------|------------| +| A new motion-rep class | `motionbricks/motionlib/core/motion_reps/motion_reps_base/motion_rep_base.py` (`MotionRepBase`) — minimal base that only wires normalization | +| A representation with a separate root / body split | `motionbricks/motionlib/core/motion_reps/motion_reps_base/seperate_root_local_body.py` | +| A full dual-root example | `motionbricks/motionlib/core/motion_reps/dual_root_global_joints.py` (builds `GlobalRootGlobalJoints`, `LocalRootGlobalJoints`, `DualRootGlobalJoints`) | +| The actual feature math (FK, velocity, heading) | `motionbricks/motionlib/core/motion_reps/tools/motion_features.py` — in particular `compute_motion_features` and the per-feature helpers it dispatches to | +| A minimal dataset loader | `motionbricks/data/synthetic_dataset.py` (`SyntheticMotionDataset`, `collate_batch`) | +| Stats handling | `motionbricks/motionlib/core/utils/stats.py` (`Stats`) | diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/docs/motion_representation.md b/third-party/GR00T-WholeBodyControl/motionbricks/docs/motion_representation.md new file mode 100644 index 0000000000000000000000000000000000000000..a6301a2ed870983a857ae15cbe45540b5a99adc9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/docs/motion_representation.md @@ -0,0 +1,154 @@ +# Motion Representation + +## Overview + +MotionBricks represents motion as a normalized feature vector per frame. The representation separates **root motion** (global position and heading of the robot's pelvis) from **body motion** (joint rotations, positions, velocities, and foot contacts). This separation lets the root model and the pose/tokenizer module operate on different subsets of the same representation. + +Throughout the paper and codebase, two interchangeable subsets are used: + +- **Global** (`GlobalRootGlobalJoints`, 414 dims) — **root model** mostly operates with this representation for precise global root control. This is also what the data loader returns directly. +- **Local** (`LocalRootGlobalJoints`, 413 dims) — used by the **pose/tokenizer module**. + +The two subsets share the same 409-dim body features and differ only in how the root is parameterized (5 global vs 4 local dims). They convert losslessly to each other via `dual_rep.global_to_local` / `dual_rep.local_to_global`. In the training loop, batches come out of the loader in the global representation and are converted to local on the fly before being passed to the pose/tokenizer module. Concretely, the `"motion"` tensor in every batch dict is always the **global** motion — per-sample conversion to local happens inside the training step. + +The current configuration uses the **DualRootGlobalJoints** representation on the **G1Skeleton34** skeleton (Unitree G1 with 34 joints). The full feature vector is 418-dimensional per frame, composed of the 414-dim global subset and the 413-dim local subset that share the 409-dim body features. + +See the MotionBricks paper for the full derivation of the representation. + +## Feature Breakdown + +All body features are defined in the **global (world) frame**. The `local_` prefix on `local_vel` is a naming holdover — in `DualRootGlobalJoints` (`removing_heading=False`), the velocity is NOT heading-rotated, and its normalization statistics are computed from the same world-frame values. + +### Body Features (409 dimensions) + +Shared by both global and local root representations. + +| Feature | Dimensions | Description | +|---------|-----------|-------------| +| `ric_data` | 99 | Global joint positions with the **projected (XZ) root position** subtracted per frame, for 33 non-root joints. Not heading-canonicalized. | +| `global_rot_data` | 204 | **Global (world-frame)** 6D continuous rotations for all 34 joints.| +| `local_vel` | 102 | **Global-frame** per-joint velocity, computed as finite differences of world positions. | +| `foot_contacts` | 4 | Binary contact states for left ankle, left toe, right ankle, right toe. | + +### Global Root Features (5 dimensions) + +Used by the global representation subset (consumed by the root model). + +| Feature | Dimensions | Description | +|---------|-----------|-------------| +| `global_root_pos` | 3 | XYZ position in world frame (during training and inference, first frame's root XZ is placed at origin). | +| `global_root_heading` | 2 | Root heading as (cos, sin) of the Y-axis rotation angle. | + +### Local Root Features (4 dimensions) + +Used by the local representation subset (consumed by the pose/tokenizer module). Derived from the global root during the `global_to_local` conversion. + +| Feature | Dimensions | Description | +|---------|-----------|-------------| +| `local_root_rot_vel` | 1 | Angular velocity around the Y-axis. | +| `local_root_vel` | 2 | Root translational velocity in the XZ plane, expressed in the root's heading-aligned frame. | +| `global_root_y` | 1 | Root height (Y-axis position in world frame). | + +### Combined Dimensions + +| Representation | Formula | Total | +|---------------|---------|-------| +| Global subset (`GlobalRootGlobalJoints`) | 5 (global root) + 409 (body) | **414** | +| Local subset (`LocalRootGlobalJoints`) | 4 (local root) + 409 (body) | **413** | +| Full dual (`DualRootGlobalJoints`) | 5 + 4 + 409 | **418** | + +The root model uses the **global subset** (414 dims). The pose/tokenizer module uses the **local subset** (413 dims). + +## Skeleton: G1Skeleton34 + +The skeleton defines the kinematic tree. G1Skeleton34 has 34 joints: 32 active joints from the Unitree G1 robot plus 2 dummy toe joints for foot contact detection. + +``` +pelvis (root) + |-- left_hip_pitch -- left_hip_roll -- left_hip_yaw -- left_knee + | \-- left_ankle_pitch -- left_ankle_roll -- left_toe_base* + |-- right_hip_pitch -- right_hip_roll -- right_hip_yaw -- right_knee + | \-- right_ankle_pitch -- right_ankle_roll -- right_toe_base* + |-- waist_yaw -- waist_roll -- waist_pitch + |-- left_shoulder_pitch -- left_shoulder_roll -- left_shoulder_yaw -- left_elbow + | \-- left_wrist_roll -- left_wrist_pitch -- left_wrist_yaw -- left_hand_roll + |-- right_shoulder_pitch -- right_shoulder_roll -- right_shoulder_yaw -- right_elbow + \-- right_wrist_roll -- right_wrist_pitch -- right_wrist_yaw -- right_hand_roll +``` + +*Dummy toe joints (not actuated on the real robot). + +### MuJoCo Joint Mapping + +The MuJoCo model has 29 hinge joints (excluding the free-floating root and toe joints). The output qpos vector is 36-dimensional: + +| Indices | Content | +|---------|---------| +| 0-2 | Root translation (x, y, z) | +| 3-6 | Root quaternion (w, x, y, z) | +| 7-35 | 29 joint angles (1 DOF per hinge joint) | + +The `mujoco_qpos_converter` class handles the mapping between the 34-joint motion representation and the 29-DOF MuJoCo model, including coordinate system transformation (motion space: Y-up, Z-forward; MuJoCo space: Z-up, X-forward). + +## Coordinate Systems + +| Space | Up | Forward | Handedness | +|-------|-----|---------|------------| +| Motion | Y | Z | Right-handed | +| MuJoCo | Z | X | Right-handed | + +The coordinate transformation between the two: +- Motion X = MuJoCo Y +- Motion Y = MuJoCo Z +- Motion Z = MuJoCo X + +## Normalization + +All features are z-score normalized before being fed to models: + +``` +normalized = (feature - mean) / sqrt(std^2 + eps) +``` + +where `eps = 1e-5` for numerical stability. The `mean.npy` and `std.npy` files are computed per-dimension over the training dataset and stored alongside each model checkpoint in the `stats/motion/` directory. + +## Feature Computation Pipeline + +MotionBricks does **not** apply a fixed heading canonicalization to its features. Instead, each motion segment is placed at the origin with a heading that is *randomly rotated* at training time and *explicitly chosen by the caller* at inference time. This way the model sees motion in all orientations, so there is nothing to gain from pre-canonicalizing to a fixed frame. + +The pipeline, mirroring the order in `compute_motion_features` in `motionlib/core/motion_reps/tools/motion_features.py`, is: + +``` +Raw motion (local / global joint rotations + root translation) + │ + ▼ +Compute ROOT features (compute_heading_info + compute_heading_features): + • Global root: (root XYZ, heading cos/sin) + • Local root : (XZ linear velocity, Y angular velocity, root height) + │ + ▼ +Compute BODY features in the WORLD frame (compute_position_features): + • ric_data (world joint positions − per-frame root XZ) + • local_vel (world-frame finite-difference velocity) + • foot_contacts (from position/velocity thresholds) + • global_rot_data (world-frame 6D rotations) + │ + ▼ +Concatenate per frame → [T, 418]; obtain normalization stats (z-score) + │ + ▼ +The data loader returns the NORMALIZED GLOBAL rep [T, 414]. + │ + ▼ +At training / inference time, for each motion segment: + 1. Call `change_first_heading(..., first_heading_angle)` + - TRAINING: first_heading_angle ~ Uniform(0, 2π) → random heading + - INFERENCE: first_heading_angle = 0 → deterministic + Effect: rotates every frame so that the first frame faces the target + heading, AND places the first frame's root XZ at the origin + (Y / root height is preserved). + 2. If feeding the pose / tokenizer module: convert to LOCAL via + `dual_rep.global_to_local(...)` (lossless; invertible via `local_to_global`). +``` + +The inverse pipeline (used at inference time) converts features back to joint positions and rotations, which are then mapped to MuJoCo qpos via the `mujoco_qpos_converter`. diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..288a19e96dfcd4958f1a758e83a57631b287f216 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/data/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/data/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/data/synthetic_dataset.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/data/synthetic_dataset.py new file mode 100644 index 0000000000000000000000000000000000000000..45c6cdac0516e8c2ca6e273d1eb54173b0ee3b14 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/data/synthetic_dataset.py @@ -0,0 +1,78 @@ +import random +from typing import List, Dict, Optional, Tuple + +import torch +from torch import Tensor +from torch.utils.data import Dataset + + +class SyntheticMotionDataset(Dataset): + """Synthetic motion dataset for training without the full motion dataset. + + Each sample is a random tensor of shape [T, feat_dim] where T is drawn + uniformly from [min_frames, max_frames] and feat_dim matches the motion + representation dimensionality (e.g. 418 for G1Skeleton34). + """ + + def __init__( + self, + feat_dim: int, + num_samples: int = 1000, + min_frames: int = 80, + max_frames: int = 300, + ): + self.feat_dim = feat_dim + self.num_samples = num_samples + self.lengths = [ + random.randint(min_frames, max_frames) for _ in range(num_samples) + ] + + def __len__(self): + return self.num_samples + + def __getitem__(self, idx): + T = self.lengths[idx] + motion = torch.randn(T, self.feat_dim) + return {"keyid": idx, "motion": motion} + + +def collate_tensors( + tensor_batch: List[Tensor], + size: Optional[int] = None, +) -> Tuple[Tensor, Tensor, Tensor]: + """Pad variable-length tensors to a common length. + + Returns: + - padded motions [B, T, D] + - lengths [B] + - pad_mask [B, T] (True where valid) + """ + rep_dim = tensor_batch[0].shape[1] + max_size = max(mo.shape[0] for mo in tensor_batch) + if size is not None: + assert size >= max_size + max_size = size + + motion_batch = torch.zeros(len(tensor_batch), max_size, rep_dim) + pad_mask = torch.zeros(len(tensor_batch), max_size, dtype=torch.bool) + lengths = [] + for bi, mo in enumerate(tensor_batch): + cur_len = mo.shape[0] + lengths.append(cur_len) + motion_batch[bi, :cur_len] = mo + pad_mask[bi, :cur_len] = True + + len_batch = torch.tensor(lengths) + return motion_batch, len_batch, pad_mask + + +def collate_batch(batch: List[Dict]) -> Dict: + """Collate a batch of motion dicts into padded tensors.""" + motion = [bdict["motion"] for bdict in batch] + motion, motion_len, motion_pad_mask = collate_tensors(motion) + return { + "motion": motion, + "motion_len": motion_len, + "motion_pad_mask": motion_pad_mask, + "batch_size": len(motion), + } diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8461557f602140e00ede5c52f18c2181e8d944a Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/__pycache__/experiment.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/__pycache__/experiment.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d5186b77d9b18a04131da94fdb7d66aa6c6deffc Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/__pycache__/experiment.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/experiment.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/experiment.py new file mode 100644 index 0000000000000000000000000000000000000000..2ff42642efe98cfd545b61261ee9e3aaf4e0f175 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/exp_setup/experiment.py @@ -0,0 +1,160 @@ +import os +import argparse +from omegaconf import OmegaConf, open_dict +from motionbricks.helper.pl_util import load_motion_rep +from hydra.utils import instantiate +import copy + +DEFAULT_RESULT_DIR = "./out" +LOCAL_RESULT_DIR = ['./out', 'out/'] +COPY_DATASET_TO_LOCAL = False +EXP = [ + "default", +][-1] + +def get_path_dir(exp): + if exp == "default": + vqvae_path = 'motionbricks_vqvae' + vqvae_ckpt = 'model-step=2000000.ckpt' + + pose_model_path = 'motionbricks_pose' + pose_model_ckpt = 'model-step=2000000.ckpt' + + root_model_path = 'motionbricks_root' + root_model_ckpt = 'model-step=2000000.ckpt' + + else: + raise NotImplementedError(f"exp {exp} not implemented.") + + return {'pose_model_path': pose_model_path, 'pose_model_ckpt': pose_model_ckpt, + 'root_model_path': root_model_path, 'root_model_ckpt': root_model_ckpt, + 'vqvae_path': vqvae_path, 'vqvae_ckpt': vqvae_ckpt} + +def test(args: argparse.Namespace = None): + if args is None: + parser = argparse.ArgumentParser(description='model_test') + parser.add_argument("--result_dir", type=str, default=DEFAULT_RESULT_DIR) + parser.add_argument("--data_root", type=str, default="./datasets") + parser.add_argument("--explicit_dataset_folder", type=str, default=None) + parser.add_argument("--EXP", type=str, default=None) + args = parser.parse_args() + + if getattr(args, 'EXP', None) is not None: + exp = args.EXP + else: + exp = EXP + ckpt_info = get_path_dir(exp) + + models, confs = {}, {} + for model_name in ['pose', 'root']: + # hard code the config path for now + model_key = model_name + '_model' + ckpt_dir = f"{args.result_dir}/{ckpt_info[model_key + '_path']}/version_1" + ckpt_path = f"{ckpt_dir}/checkpoints/{ckpt_info[model_key + '_ckpt']}" + config_path = f"{ckpt_dir}/hparams.yaml" + + conf = OmegaConf.load(config_path) + conf.ckpt_path = ckpt_path + + if type(conf.model.args.vqvae_model_ckpt_path) == str: + for prefix in LOCAL_RESULT_DIR: + + if conf.model.args.vqvae_model_ckpt_path.startswith(prefix): + conf.model.args.vqvae_model_ckpt_path = \ + conf.model.args.vqvae_model_ckpt_path.replace(prefix, f"{args.result_dir}/") + conf.model.args.vqvae_model_ckpt_path = os.path.abspath(conf.model.args.vqvae_model_ckpt_path) + + if args.data_root is not None: + conf.data_root = args.data_root + + if getattr(args, 'explicit_dataset_folder', None) is not None: + # save the results in a different folder: "+data.explicit_dataset_folder=YOUR_DEBUG_FOLDER" + conf.data.folder = args.explicit_dataset_folder + + from motionbricks.motionlib.train.utils import get_rank, setup_train_logging + motion_rep = load_motion_rep(conf) + if conf.model.pose_vqvae_network is None and model_name == 'pose': + pose_vqvae_config_path = \ + os.path.abspath(os.path.join(conf.model.args.vqvae_model_ckpt_path, "..", "..", "config.yaml")) + pose_vqvae_config = OmegaConf.load(pose_vqvae_config_path) + pose_network_config = pose_vqvae_config.model.pose_network if 'pose_network' in pose_vqvae_config.model \ + else pose_vqvae_config.model.pose_vqvae_network + conf.model.pose_vqvae_network = copy.deepcopy(pose_network_config) + + if conf.model.pose_vqvae_network is not None: + pose_vqvae_motion_rep = getattr(conf.model, 'pose_vqvae_motion_rep', 'local') + pose_vqvae_motion_rep = motion_rep.dual_rep.local_motion_rep if \ + pose_vqvae_motion_rep == 'local' else motion_rep.dual_rep.global_motion_rep + pose_vqvae_network = instantiate(conf.model.pose_vqvae_network, motion_rep=pose_vqvae_motion_rep) + + # make sure it's the same model expected in config + sanitized_vqvae_model_ckpt_path = conf.model.args.vqvae_model_ckpt_path.replace("\\", '/') # for windows + assert sanitized_vqvae_model_ckpt_path.split("/")[-4] == ckpt_info['vqvae_path'] and \ + sanitized_vqvae_model_ckpt_path.split("/")[-1] == ckpt_info['vqvae_ckpt'], \ + f"vqvae model path {conf.model.args.vqvae_model_ckpt_path} not match with {ckpt_info}" + else: + pose_vqvae_network = None + + # find rank + global_rank = get_rank() + import tempfile + run_dir = tempfile.mkdtemp(prefix="motionbricks_") + conf.out_dir = run_dir + + log = setup_train_logging(run_dir, global_rank) + + assert not conf.resume, "resuming training only valid for training mode. Provide the ckpt path in `def test`." + + import pytorch_lightning as pl + import torch + + pl.seed_everything(conf.seed + max(0, global_rank), workers=True) + + if conf.trainer.accelerator == "gpu": # for tinycudann default memory + torch.cuda.set_device(int(os.environ.get("LOCAL_RANK", "0"))) + + if "matmul_precision" in conf: + torch.set_float32_matmul_precision(conf.matmul_precision) + + # Load the model + log.info("Loading the model") + + # Strip training-only config keys that Hydra would try to instantiate + for key in ['optimizer', 'scheduler']: + if key in conf.model: + with open_dict(conf): + del conf.model[key] + + backbone_network = instantiate(conf.model.backbone_network, motion_rep=motion_rep) + models[model_name] = instantiate(conf.model, pose_vqvae_network=pose_vqvae_network, + backbone_network=backbone_network, motion_rep=motion_rep) + # models[model_name]= instantiate(conf.model) + confs[model_name] = conf + assert models[model_name].vqvae_model_loaded, \ + f"vqvae model not loaded for {model_name} model. Please check the config file." + + log.info("Loading the datasets") + assert global_rank == 0, "This script is only for testing, so only rank 0 is supported." + + # compatibility; probably not needed after the new ckpts + conf.data.augment_text = False + conf.data.use_overview_desc = False + + if hasattr(args, 'return_model_configs') and args.return_model_configs: + if hasattr(args, 'return_dataloader') and args.return_dataloader: + dataset_motion_rep = load_motion_rep(conf) + train_dataset = instantiate(conf.data, split="train", motion_rep=dataset_motion_rep) + train_dataloader = instantiate(conf.dataloader, train_dataset, shuffle=True) + # train_dataset, train_dataloader = None, None + val_dataset = instantiate(conf.data, split="test", motion_rep=dataset_motion_rep) + val_dataloader = instantiate(conf.dataloader, val_dataset, shuffle=False) + return models, confs, train_dataloader, val_dataloader + else: + return models, confs + else: + dataset_motion_rep = load_motion_rep(conf) + train_dataset = instantiate(conf.data, split="train", motion_rep=dataset_motion_rep) + train_dataloader = instantiate(conf.dataloader, train_dataset, shuffle=True) + # train_dataset, train_dataloader = None, None + val_dataset = instantiate(conf.data, split="test", motion_rep=dataset_motion_rep) + val_dataloader = instantiate(conf.dataloader, val_dataset, shuffle=False) diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..baf2cc6c728723e65400ccec7f2380428bcab8b7 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/__pycache__/quaternions.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/__pycache__/quaternions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..75fdc7773960687b29ee30890369888891af13c7 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/__pycache__/quaternions.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/quaternions.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/quaternions.py new file mode 100644 index 0000000000000000000000000000000000000000..5be4e41619cb752ff0050e3bdb3916ffa0f6e89c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/geometry/quaternions.py @@ -0,0 +1,50 @@ +import torch +import torch.nn.functional as F + + +def _sqrt_positive_part(x: torch.Tensor) -> torch.Tensor: + """Returns torch.sqrt(torch.max(0, x)) subgradient is zero where x is 0.""" + return torch.sqrt(x * (x > 0).to(x.dtype)) + +def matrix_to_quaternion(matrix: torch.Tensor) -> torch.Tensor: + """Convert rotations given as rotation matrices to quaternions. + + Args: + matrix: Rotation matrices as tensor of shape (..., 3, 3). + Returns: + quaternions with real part first, as tensor of shape (..., 4). + """ + if matrix.size(-1) != 3 or matrix.size(-2) != 3: + raise ValueError(f"Invalid rotation matrix shape {matrix.shape}.") + + batch_dim = matrix.shape[:-2] + m00, m01, m02, m10, m11, m12, m20, m21, m22 = torch.unbind( + matrix.reshape(batch_dim + (9,)), dim=-1 + ) + + q_abs = _sqrt_positive_part( + torch.stack( + [ + 1.0 + m00 + m11 + m22, + 1.0 + m00 - m11 - m22, + 1.0 - m00 + m11 - m22, + 1.0 - m00 - m11 + m22, + ], + dim=-1, + ) + ) + + quat_by_rijk = torch.stack( + [ + torch.stack([q_abs[..., 0] ** 2, m21 - m12, m02 - m20, m10 - m01], dim=-1), + torch.stack([m21 - m12, q_abs[..., 1] ** 2, m10 + m01, m02 + m20], dim=-1), + torch.stack([m02 - m20, m10 + m01, q_abs[..., 2] ** 2, m12 + m21], dim=-1), + torch.stack([m10 - m01, m20 + m02, m21 + m12, q_abs[..., 3] ** 2], dim=-1), + ], + dim=-2, + ) + + flr = torch.tensor(0.1).to(dtype=q_abs.dtype, device=q_abs.device) + quat_candidates = quat_by_rijk / (2.0 * q_abs[..., None].max(flr)) + + return (F.one_hot(q_abs.argmax(dim=-1), num_classes=4)[..., None] * quat_candidates).sum(dim=-2).reshape(batch_dim + (4,)) diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8ba63097c63ed6594199bcfbf735ca1904dce03e Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/data_training_util.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/data_training_util.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3135288c58054a1844f86ba86f6421a3edcb93ae Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/data_training_util.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/mujoco_helper.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/mujoco_helper.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d5ffb4eeb431b431462d940ae5464c29b927eb43 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/mujoco_helper.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/pl_util.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/pl_util.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..90984ad1f27ec34d643738fe6715e3fe7147040e Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/__pycache__/pl_util.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/data_training_util.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/data_training_util.py new file mode 100644 index 0000000000000000000000000000000000000000..74bfc7c0c6eda993a35ba42153088a7e420bf9ca --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/data_training_util.py @@ -0,0 +1,186 @@ +import torch +import torch as t +import numpy as np +from motionbricks.motionlib.core.motion_reps import MotionRepBase + + +def sample_motion_segments_from_motion_clips(motions: t.Tensor, motion_lengths: t.Tensor, + num_desired_frames: int, batchsize_mul_factor_for_segments: int, + info: dict = {}, + motion_rep: MotionRepBase = None): + """ @brief: the dataloader provides motion clips, which are variable length sequences of motion frames. + In training of vqvae and the backbone model, we require fixed length motion segments. + + @param motions: normalized global motion rep, shape [batch_size, max_motion_length, motion_dim] + + @param motion_lengths: length of each motion clip. shape [batch_size], + + @param num_desired_frames: the number of frames in each motion segment. + NOTE: the output motion segment will have (num_desired_frames + 1) frames so that user could decide whether to + use just global motion rep or need to convert global to local later. The convertion loses 1 frame. + + @param batchsize_mul_factor_for_segments: + the number of output motion segments = batch_size * batchsize_mul_factor_for_segments + """ + batch_size = motions.shape[0] + augmented_batch_size = int(batch_size * batchsize_mul_factor_for_segments) + device = motions.device + + valid_samples_id = (motion_lengths >= num_desired_frames + 1) # 1 additional frame for global-local convertion + num_invalid_samples = batch_size - valid_samples_id.sum() + assert num_invalid_samples < batch_size, "all samples are invalid." + num_new_motions = (batchsize_mul_factor_for_segments - 1) * batch_size + num_invalid_samples + p_sample = \ + (motion_lengths - num_desired_frames).clip(min=.0) * valid_samples_id.float() # invalid samples has 0.0 prob + p_sample = p_sample.cpu().numpy().astype("float64") # this is needed otherwise sum!= 1.0 precision error + new_motions_ids = np.random.choice(batch_size, replace=True, + size=num_new_motions.item(), p=(p_sample / p_sample.sum())) + + motions = t.concat([motions[valid_samples_id], motions[new_motions_ids]], dim=0) + info['chosen_ids'] = t.concat([t.where(valid_samples_id)[0], t.from_numpy(new_motions_ids).to(device)], dim=0) + motion_lengths = t.concat([motion_lengths[valid_samples_id], motion_lengths[new_motions_ids]], dim=0) + + m_start_idx = t.randint(low=0, high=31415926, size=[motions.shape[0]]).to(device) # just use a big high value + m_start_idx = m_start_idx % (motion_lengths - (num_desired_frames + 1) + 1) # at least (numFrame+1) frames left + + m_chunk_idx = torch.arange(num_desired_frames + 1).tile([augmented_batch_size, 1]).to(device) + m_start_idx[:, None] + motions = motions.gather(1, m_chunk_idx[:, :, None].tile([1, 1, motions.shape[-1]])) + + return motions + + +def sample_keyframes(motions: t.Tensor, max_num_keyframes: int, prob_num_keyframes: list, bound_keyframes: bool = False): + batch_size, num_frames = motions.shape[0], motions.shape[1] + if bound_keyframes: # only use the first and last frame as the keyframe + chosen_keyframes = t.zeros([batch_size, num_frames], dtype=t.bool).to(motions.device) + chosen_keyframes[:, [0, -1]] = True + masked_motions = motions * chosen_keyframes[:, :, None].float() + else: + assert max_num_keyframes == len(prob_num_keyframes) - 1, "for compatibility we still have max_num_keyframes" + assert num_frames >= max_num_keyframes + + num_keyframes = np.random.choice(np.arange(max_num_keyframes + 1), + p=prob_num_keyframes, size=batch_size, replace=True) + num_keyframes = t.tensor(num_keyframes).to(motions.device).clip(max=num_frames) + + candidates = t.rand_like(motions[:, :, 0]) + chosen_keyframes = candidates.sort()[1] < num_keyframes[:, None] + + masked_motions = motions * chosen_keyframes[:, :, None].float() + + return chosen_keyframes, masked_motions + +def convert_sparse_cond_to_dense_cond_if_needed(cond: t.Tensor, has_cond: t.Tensor, num_max_cond: int): + """ @brief: we could either provide + In the dense case: + cond: [batch_size, numFrames (num_max_cond), feat_dim] + has_cond: [batch_size, numFrames (num_max_cond)] (bool) + In the sparse case (could be potentially more efficient for onnx trt models): + cond: [batch_size, numCondionedFrames, feat_dim] + has_cond: [batch_size, numConditionedFrames] (int) + """ + assert cond.shape[1] == has_cond.shape[1] + batch_size, feat_dim = cond.shape[0], cond.shape[2] + + if has_cond.dtype == t.bool: # the dense case + assert cond.shape[1] == num_max_cond + return cond, has_cond + else: # the sparse case; this is very handy for onnx trt models for minimum data transfer + assert cond.shape[1] <= num_max_cond + + # construct the dense results + has_cond_map = t.nn.functional.one_hot(has_cond, num_classes=num_max_cond) # [batch, numCondF, numF] + dense_has_cond = has_cond_map.sum(dim=1).reshape([batch_size, num_max_cond, 1]).tile([1, 1, feat_dim]).bool() + dense_cond = t.zeros([batch_size, num_max_cond, feat_dim]).to(cond.device, cond.dtype) + dense_cond[dense_has_cond] = cond.view(-1) # they are all in flatten view + return dense_cond, dense_has_cond + +def extract_feature_from_motion_rep(x: t.Tensor | None, + motion_rep: MotionRepBase, feature: str, fetch_feat_idx: bool = False): + """ @brief: extract the corresponding features from the original motion representation + """ + + if feature in ['root_with_mask', 'root_without_heading_with_mask', + 'root_without_hip_height_with_mask', 'root_without_hip_height_without_heading_with_mask']: + # in the end there's a mask bit attached to the feature vector returned + # 1 indicates a reliable feature and 0 indicates a unrealiable feature + if fetch_feat_idx: + raise NotImplementedError("fetch_feat_idx is not supported for with_mask features") + else: + raw_feature = extract_feature_from_motion_rep(x, motion_rep, feature.split("_with_mask")[0]) + mask = t.zeros([x.shape[0], x.shape[1], 1]).to(x.device) + return t.concat([raw_feature, mask], dim=-1) + + elif feature == 'root': + if fetch_feat_idx: + return motion_rep.indices['root'] + else: + return x if x.shape[-1] == len(motion_rep.indices['root']) else x[:, :, motion_rep.indices['root']] + + elif feature == 'root_without_heading': + if motion_rep.root_mode == 'global': + feat_idx = np.concatenate([motion_rep.indices['global_root_pos_2d'], + np.array([i for i in motion_rep.indices['global_root_pos'] + if i not in motion_rep.indices['global_root_pos_2d']])]) + else: + feat_idx = np.concatenate([motion_rep.indices['local_root_vel'], + motion_rep.indices['global_root_y']]) + if fetch_feat_idx: + return feat_idx + else: + return x if x.shape[-1] == len(feat_idx) else x[:, :, feat_idx] + + elif feature == 'root_without_hip_height': + if motion_rep.root_mode == 'global': + feat_idx = np.concatenate([motion_rep.indices['global_root_pos_2d'], + motion_rep.indices['global_root_heading']]) + else: + feat_idx = np.concatenate([motion_rep.indices['local_root_rot_vel'], + motion_rep.indices['local_root_vel']]) + if fetch_feat_idx: + return feat_idx + else: + return x if x.shape[-1] == len(feat_idx) else x[:, :, feat_idx] + + elif feature == 'root_without_hip_height_without_heading': + if motion_rep.root_mode == 'global': + feat_idx = motion_rep.indices['global_root_pos_2d'] + else: + feat_idx = motion_rep.indices['local_root_vel'] + if fetch_feat_idx: + return feat_idx + else: + return x if x.shape[-1] == len(feat_idx) else x[:, :, feat_idx] + + elif feature == 'pose': + if fetch_feat_idx: + return motion_rep.indices['all'] + else: + assert x.shape[-1] == len(motion_rep.indices['all']) + return x + + elif feature == 'joint_positions_and_rotations': + feat_idx = np.concatenate([motion_rep.indices['ric_data'], + motion_rep.indices['global_rot_data']]) + if fetch_feat_idx: + return feat_idx + else: + return x if x.shape[-1] == len(feat_idx) else x[:, :, feat_idx] + + elif feature == 'joint_positions_and_rotations_and_hip_height': + if motion_rep.root_mode == 'global': + feat_idx = np.concatenate([np.array([i for i in motion_rep.indices['global_root_pos'] + if i not in motion_rep.indices['global_root_pos_2d']]), + motion_rep.indices['ric_data'], + motion_rep.indices['global_rot_data']]) + else: + feat_idx = np.concatenate([motion_rep.indices['global_root_y'], + motion_rep.indices['ric_data'], + motion_rep.indices['global_rot_data']]) + if fetch_feat_idx: + return feat_idx + else: + return x if x.shape[-1] == len(feat_idx) else x[:, :, feat_idx] + + else: + raise NotImplementedError diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/mujoco_helper.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/mujoco_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..f3ff6e3d4419aba8cfcc43c149f6174b23db46b9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/mujoco_helper.py @@ -0,0 +1,456 @@ +import numpy as np +import torch as t +import torch +import torch.nn as nn +import xml.etree.ElementTree as ET +import os +import torch.nn.functional as F +from typing import List +from motionbricks.motionlib.core.motion_reps import MotionRepBase +from motionbricks.motionlib.core.motion_reps.tools.changing_t_pose import get_global_offset +from motionbricks.motionlib.core.utils.rotations import cont6d_to_matrix, quaternion_to_matrix +from motionbricks.motionlib.core.utils.torch_utils import compute_idx_levels +from motionbricks.motionlib.core.skeletons import SkeletonBase + + +# using this matrix_to_quaternion instead of the one in motionbricks.motionlib.core.utils.rotations +# to avoid some tensorrt issues +from motionbricks.geometry.quaternions import matrix_to_quaternion + +# redefining this function in motionbricks.motionlib.core.motion_rep.tools.changing_t_pose as +# tensorrt complains about capital letters in t.einsum() +def global_mats_to_local_mats(global_rot_mats: t.Tensor, skeleton: SkeletonBase): + # obtain back the local rotations from the global rotations + parent_rot_mats = global_rot_mats[..., skeleton.joint_parents, :, :] + parent_rot_mats[..., skeleton.root_idx, :, :] = t.eye(3) # the root joint + local_rot_mats = t.einsum( + "... x n m, ... x n o -> ... x m o", + parent_rot_mats, # taken as the inverse/transpose in einsum + global_rot_mats, + ) + return local_rot_mats + +# this is the same as motionbricks.motionlib.core.utils.torch_utils.transform_mat, but without the __jit_traced__ decorator +# which is not supported by onnx / tensorrt export +def transform_mat(R: t.Tensor, t: t.Tensor): + """Creates a batch of transformation matrices. + + Args: + - R: Bx3x3 array of a batch of rotation matrices + - t: Bx3x1 array of a batch of translation vectors + Returns: + - T: Bx4x4 Transformation matrix + """ + # No padding left or right, only add an extra row + return torch.cat([F.pad(R, [0, 0, 0, 1]), F.pad(t, [0, 0, 0, 1], value=1.0)], dim=2) + +# this is the same as motionbricks.motionlib.core.utils.torch_utils.forward_kinematics, but without the __jit_traced__ decorator +# which is not supported by onnx / tensorrt export +def forward_kinematics( + rot_mats, + joints, + parents: t.Tensor, + idx_levs: List[t.Tensor], + root_idx: int, +): + """Perform forward kinematics to compute posed joints and global rotation matrices. + + Args: + rot_mats: Local rotation matrices for each joint: (B, J, 3, 3) + joints: Initial joint positions: (B, J, 3) + parents: Tensor indicating the parent of each joint: (J,) + idx_levs: List of tensors containing indices for each level in the kinematic tree + root_idx (int): index of the root + Returns: + Posed joints: (B, J, 3) + Global rotation matrices: (B, J, 3, 3) + """ + + # Add an extra dimension to joints + joints = torch.unsqueeze(joints, dim=-1) + + # Compute relative joint positions + rel_joints = joints.clone() + + mask_no_root = torch.ones(joints.shape[1], dtype=torch.bool) + mask_no_root[root_idx] = False + mask_no_root_inds = mask_no_root.nonzero().squeeze().tolist() + rel_joints[:, mask_no_root_inds] -= joints[:, parents[mask_no_root_inds]].clone() + + # Compute initial transformation matrices + # (B, J + 1, 4, 4) + transforms_mat = transform_mat( + rot_mats.reshape(-1, 3, 3), rel_joints.reshape(-1, 3, 1) + ).reshape(-1, joints.shape[1], 4, 4) + + # Initialize the root transformation matrices + transforms = torch.zeros_like(transforms_mat) + transforms[:, root_idx] = transforms_mat[:, root_idx] + + # Compute global transformations level by level + for indices in idx_levs: + curr_res = torch.matmul( + transforms[:, parents[indices]], transforms_mat[:, indices] + ) + transforms[:, indices] = curr_res + + # Extract posed joint positions from the transformation matrices + posed_joints = transforms[:, :, :3, 3] + + # Extract global rotation matrices from the transformation matrices + global_rot_mat = transforms[:, :, :3, :3] + + return posed_joints, global_rot_mat + + +_global_converter = None + +def get_mujoco_converter(motion_rep: MotionRepBase, xml_path: str = "assets/skeletons/g1/g1.xml"): + """Get a cached mujoco converter instance for efficient reuse.""" + global _global_converter + if _global_converter is None: + _global_converter = mujoco_qpos_converter(motion_rep, xml_path) + return _global_converter + + +def motion_feature_to_mujoco_qpos(motion_features: t.Tensor, motion_rep: MotionRepBase, + is_normalized: bool = False, use_fast_converter: bool = True): + """Convert motion features to mujoco qpos format. + + Args: + motion_features: Motion features + motion_rep: MotionRepBase object + is_normalized: Whether input features are normalized + use_fast_converter: Whether to use the optimized converter (recommended) + """ + assert use_fast_converter, "only fast converter is supported for now" + converter = get_mujoco_converter(motion_rep) + qpos = converter.convert_motion_features_to_mujoco_qpos(motion_features, motion_rep, + is_normalized, root_quat_w_first=True) + return qpos +class mujoco_qpos_converter(nn.Module): + """Fast batch converter from motion features to mujoco qpos with precomputed transforms. + + In mujoco, the coordination is z up and x forward, right handed + + features (30 joints): + root (pelvis, 7 = translation + rotation) + 29 dof joints (29) + + The motion feature coordinate system is y up and z forward, right handed + features (34 joints): + root (pelvis) + (34 - 1) joints; among these joints, 4 are end-effector joints. + """ + + def __init__(self, motion_rep: MotionRepBase, xml_path: str = "assets/skeletons/g1/g1.xml", + dead_joint_rotation_scheme: str = "dummy"): + """Initialize converter with precomputed transforms. + + Args: + xml_path: Path to the mujoco XML file containing joint definitions + dead_joint_rotation_scheme: Scheme for handling dead joints (end-effectors joints); + if "dummy", the dead joints's global rotations are set to identity matrix; + if "parent", the dead joints's global rotations are set to the parent's rotation. + """ + super(mujoco_qpos_converter, self).__init__() + self.xml_path = xml_path + self.motion_rep = motion_rep + self._prepare_transforms() + self._subtree_joints = {} + self._dead_joint_rotation_scheme = dead_joint_rotation_scheme + + def _prepare_transforms(self): + """Precompute all necessary transforms for efficient batch processing.""" + # Define coordinate transformations between mujoco and motion space + # 1) R_zup_to_yup: rotation around x-axis by -90 degrees + # 2) x_forward_to_y_forward: rotation around z-axis by -90 degrees + # Combined transformation matrix: mujoco_to_motion = R_zup_to_yup * x_forward_to_y_forward + self.mujoco_to_motion_matrix = t.tensor([[0., 1., 0.], [0., 0., 1.], [1., 0., 0.]], dtype=t.float32) + self.motion_to_mujoco_matrix = self.mujoco_to_motion_matrix.T # Inverse transformation: motion_to_mujoco + + # Parse XML once and extract joint information + tree = ET.parse(self.xml_path) + root = tree.getroot() + + xml_classes = [x for x in tree.findall('.//default') if "class" in x.attrib] + joint_axes = dict() + for xml_class in xml_classes: + j = xml_class.findall("joint") + if j: + joint_axes[xml_class.get("class")] = j[0].get("axis") + + mujoco_hinge_joints = root.find("worldbody").findall(".//joint") # skip the base joint + self._mujoco_joint_axis_values_motion_space = \ + t.zeros((len(mujoco_hinge_joints), 3), dtype=t.float32) # mujoco order but motion space + self._mujoco_joint_axis_values_mujoco_space = \ + t.zeros((len(mujoco_hinge_joints), 3), dtype=t.float32) # mujoco order but mujoco space + + # for the below indices, mujoco_indices_to_motion_indices does not include mujoco root (30 - 1 = 29 elements), + # while motion_indices_to_mujoco_indices includes the motion root (32 elements). + self._mujoco_indices_to_motion_indices = t.zeros((len(mujoco_hinge_joints),), dtype=t.int32) + self._motion_indices_to_mujoco_indices = \ + t.ones((self.motion_rep.skeleton.nbjoints,), dtype=t.int32) * -1 # -1 means not in the mujoco skeleton + + self._nb_joints_mujoco = len(mujoco_hinge_joints) + 1 + self._nb_joints_motion = self.motion_rep.skeleton.nbjoints + self._mujoco_joint_including_root_parent_list = t.full((len(mujoco_hinge_joints) + 1,), -1, dtype=t.int32) + self._mujoco_joint_including_root_list = ['pelvis_skel'] + + for joint_id_in_csv, joint in enumerate(mujoco_hinge_joints): + joint_name_in_skeleton = joint.get("name").replace("_joint", "_skel") + joint_parent_name_in_skeleton = self.motion_rep.skeleton.bone_parents[joint_name_in_skeleton] + + self._mujoco_joint_including_root_list.append(joint_name_in_skeleton) + self._mujoco_joint_including_root_parent_list[joint_id_in_csv + 1] = \ + self._mujoco_joint_including_root_list.index(joint_parent_name_in_skeleton) + + joint_idx_in_skeleton = self.motion_rep.skeleton.bone_order_names.index(joint_name_in_skeleton) + axis_values = [ + float(x) for x in + ( + joint.get("axis") or + joint_axes[joint.get("class")] + ).split(" ") + ] + + # the mapped axis in motion skeleton space is calculated as motion_axis = mujoco_to_motion.apply(axis_values) + # [1, 0, 0] -> [0, 0, 1]; [0, 1, 0] -> [1, 0, 0]; [0, 0, 1] -> [0, 1, 0] + mujoco_joint_axis_mapping_motion_space = \ + [t.tensor([0, 0, 1]), t.tensor([1, 0, 0]), t.tensor([0, 1, 0])][np.argmax(axis_values)] + + self._mujoco_joint_axis_values_motion_space[joint_id_in_csv] = mujoco_joint_axis_mapping_motion_space + self._mujoco_joint_axis_values_mujoco_space[joint_id_in_csv] = t.tensor(axis_values) + + self._mujoco_indices_to_motion_indices[joint_id_in_csv] = joint_idx_in_skeleton + self._motion_indices_to_mujoco_indices[joint_idx_in_skeleton] = joint_id_in_csv + 1 # +1 for the root + self._motion_indices_to_mujoco_indices[0] = 0 # the root joint mapping + + # load the offset matrices from the xml + from scipy.spatial.transform import Rotation + + R_zup_to_yup = Rotation.from_euler("x", -90, degrees=True) + x_forward_to_y_forward = Rotation.from_euler("z", -90, degrees=True) + mujoco_to_motion = R_zup_to_yup * x_forward_to_y_forward + + + self._rot_offsets_q2t = t.zeros(len(self._motion_indices_to_mujoco_indices), 3, 3, dtype=t.float32) + self._rot_offsets_q2t[...] = t.eye(3)[None] + + self._rot_offsets_f2q = t.zeros(len(self._motion_indices_to_mujoco_indices), 3, 3, dtype=t.float32) + self._rot_offsets_f2q[...] = t.eye(3)[None] + parent_map = {child: parent for parent in root.iter() for child in parent} + for i, joint in enumerate(mujoco_hinge_joints): + body = parent_map[joint] + if "quat" in body.attrib: + rot = Rotation.from_quat( + [float(x) for x in body.get("quat").strip().split(" ")], + scalar_first=True + ) + idx = self._mujoco_indices_to_motion_indices[i] + self._rot_offsets_q2t[idx] = torch.from_numpy(rot.as_matrix()) + rot = mujoco_to_motion * rot * mujoco_to_motion.inv() + self._rot_offsets_f2q[idx] = torch.from_numpy(rot.as_matrix().T) + + self._capture_neutral_joints_mujoco = t.zeros(len(self._mujoco_indices_to_motion_indices) + 1, 3, dtype=t.float32) + for i, joint in enumerate(mujoco_hinge_joints): + body = parent_map[joint] + pos = body.get("pos") + if pos is not None: + self._capture_neutral_joints_mujoco[i+1] = t.tensor([float(x) for x in pos.strip().split(" ")]) + + self._mujoco_joint_idx_levs = compute_idx_levels(self._mujoco_joint_including_root_parent_list) + for indices in self._mujoco_joint_idx_levs: + self._capture_neutral_joints_mujoco[indices] += self._capture_neutral_joints_mujoco[self._mujoco_joint_including_root_parent_list[indices]] + + + def convert_motion_features_to_mujoco_qpos(self, motion_features: t.Tensor, motion_rep: MotionRepBase, + is_normalized: bool = True, root_quat_w_first: bool = False) -> t.Tensor: + """Fast batch conversion from motion features to mujoco qpos format. + + Args: + motion_features: [batch, numFrames, motion_dim] Motion features + motion_rep: MotionRepBase object for the motion representation + is_normalized: Whether the input features are normalized + + Returns: + torch.Tensor of shape [batch, numFrames, 36] containing mujoco qpos data: + - root_trans (3) + root_quat (4) + joint_dofs (29) = 36 columns + """ + # Get joint output from motion representation + batch_size, num_frames, nb_joints = motion_features.shape[0], motion_features.shape[1], motion_rep.skeleton.nbjoints + motion_rep = motion_rep.to(motion_features.device) + if is_normalized: + motion_features = motion_rep.unnormalize(motion_features) + root_translation, root_rot_quat = motion_rep.compute_root_pos_and_rot(motion_features) + + global_joints_ric_rot = motion_rep.slice(motion_features, "global_rot_data") + global_rot = cont6d_to_matrix(global_joints_ric_rot.view([batch_size, num_frames, nb_joints, 6])) + + local_joint_rot = global_mats_to_local_mats(global_rot, motion_rep.skeleton) + local_joint_rot = t.matmul(self._rot_offsets_f2q.to(motion_features.device), local_joint_rot) + + batch_size, num_frames = root_translation.shape[0], root_translation.shape[1] + device, dtype = root_translation.device, root_translation.dtype + + # Move precomputed matrices to the same device/dtype + motion_to_mujoco_matrix = self.motion_to_mujoco_matrix.to(device=device, dtype=dtype) + + # Initialize output tensor: [batch, numFrames, 36] + qpos = t.zeros((batch_size, num_frames, 36), dtype=dtype, device=device) + + # Convert root translation: apply coordinate transformation + root_translation_mujoco = t.matmul(motion_to_mujoco_matrix[None, None, ...], + root_translation[..., None]) + qpos[:, :, :3] = root_translation_mujoco.view(batch_size, num_frames, 3) + + # Convert root rotation: apply coordinate transformation to rotation matrix + root_rot = local_joint_rot[:, :, 0, :] # [batch, numFrames, 3, 3] + + # Apply coordinate transformation: R_mujoco = motion_to_mujoco * R_motion * motion_to_mujoco^T + mujoco_to_motion_matrix = motion_to_mujoco_matrix.T + root_rot_mujoco = t.matmul(t.matmul(motion_to_mujoco_matrix[None, None, ...], root_rot), + mujoco_to_motion_matrix[None, None, ...]) + root_rot_quat = matrix_to_quaternion(root_rot_mujoco) # [w, x, y, z] + if root_quat_w_first: + qpos[:, :, 3: 7] = root_rot_quat[:, :, [0, 1, 2, 3]] # [w, x, y, z] + else: + qpos[:, :, 3: 7] = root_rot_quat[:, :, [1, 2, 3, 0]] # [w, x, y, z] -> [x, y, z, w] + + # Convert joint DOFs using precomputed mappings + joint_rot_mujoco = \ + local_joint_rot[:, :, self._mujoco_indices_to_motion_indices, :] # mujoco joint order but motion feature space + x_joint_dof = t.atan2(joint_rot_mujoco[..., 2, 1], joint_rot_mujoco[..., 2, 2]) + y_joint_dof = t.atan2(joint_rot_mujoco[..., 0, 2], joint_rot_mujoco[..., 0, 0]) + z_joint_dof = t.atan2(joint_rot_mujoco[..., 1, 0], joint_rot_mujoco[..., 1, 1]) + xyz_joint_dofs = t.stack([x_joint_dof, y_joint_dof, z_joint_dof], dim=-1) + joint_dofs = \ + (xyz_joint_dofs * self._mujoco_joint_axis_values_motion_space[None, None, :, :].to(device)).sum(dim=-1) + qpos[:, :, 7:] = joint_dofs + + return qpos + + def convert_mujoco_qpos_to_mujoco_transforms(self, mujoco_qpos: t.Tensor) -> t.Tensor: + """ @brief: the inverse process of convert_motion_features_to_mujoco_qpos """ + raise NotImplementedError("Not implemented yet") + + def convert_mujoco_qpos_to_motion_transforms(self, mujoco_qpos: t.Tensor) -> t.Tensor: + """ @brief: the inverse process of convert_motion_features_to_mujoco_qpos """ + batch_size, num_frames = mujoco_qpos.shape[:2] + device, dtype = mujoco_qpos.device, mujoco_qpos.dtype + + # the obtain the root (pelvis) information + root_translation_mujoco = mujoco_qpos[:, :, :3] + root_quat_mujoco = mujoco_qpos[:, :, 3: 7] # [w, x, y, z] + root_rotation_mujoco = quaternion_to_matrix(root_quat_mujoco) + + # the joint rotations from dof and rotation axis + dof = mujoco_qpos[:, :, 7:] # batch_size, num_frames=4, joints=30 - 1 (pelvis) = 29 + quaternion_if_x_axis = t.stack([t.cos(dof / 2), t.sin(dof / 2), t.zeros_like(dof), t.zeros_like(dof)], dim=-1) + quaternion_if_y_axis = t.stack([t.cos(dof / 2), t.zeros_like(dof), t.sin(dof / 2), t.zeros_like(dof)], dim=-1) + quaternion_if_z_axis = t.stack([t.cos(dof / 2), t.zeros_like(dof), t.zeros_like(dof), t.sin(dof / 2)], dim=-1) + quaternion_from_xyz_axis = t.stack([quaternion_if_x_axis, quaternion_if_y_axis, quaternion_if_z_axis], + dim=-1) # [batch_size, num_frames, joints, 4 quat, 3 axis] + joint_quaternion = ( + quaternion_from_xyz_axis * + self._mujoco_joint_axis_values_mujoco_space[None, None, :, None, :].to(device) + ).sum(dim=-1) + joint_rotation_matrix = quaternion_to_matrix(joint_quaternion) # [batch_size, num_frames, joints, 3, 3] + joint_rotation_matrix = t.matmul(self._rot_offsets_q2t.to(device)[self._mujoco_indices_to_motion_indices], + joint_rotation_matrix) + + # run FK to compute joint positions + rot_matrices = t.concat([root_rotation_mujoco[:, :, None, :, :], joint_rotation_matrix], dim=2) + rot_matrices = rot_matrices.view(batch_size * num_frames, self._nb_joints_mujoco, 3, 3) + global_joint_positions, global_joint_rotations = forward_kinematics( + rot_matrices, + self._capture_neutral_joints_mujoco.to(device).repeat(batch_size * num_frames, 1, 1), + self._mujoco_joint_including_root_parent_list, self._mujoco_joint_idx_levs, 0 # root index = 0 + ) + global_joint_positions = global_joint_positions.view(batch_size, num_frames, self._nb_joints_mujoco, 3) + global_joint_rotations = global_joint_rotations.view(batch_size, num_frames, self._nb_joints_mujoco, 3, 3) + + global_joint_positions = global_joint_positions + root_translation_mujoco[:, :, None, :] + + # convert to the motion joint transforms + return self.convert_mujoco_transforms_to_motion_transforms(global_joint_positions, global_joint_rotations) + + def convert_mujoco_transforms_to_motion_transforms(self, global_joint_positions_mujoco: t.Tensor, + global_joint_rotations_mujoco: t.Tensor): + """ @brief: + convert the mujoco transforms to motion transforms: + 1. coordinate system conversion, 2. t-pose conversion, 3. populate dead end-effector joints + """ + batch_size, num_frames = global_joint_rotations_mujoco.shape[:2] + device, dtype = global_joint_rotations_mujoco.device, global_joint_rotations_mujoco.dtype + mujoco_to_motion_matrix = self.mujoco_to_motion_matrix.to(device=device, dtype=dtype) + motion_to_mujoco_matrix = self.motion_to_mujoco_matrix.to(device=device, dtype=dtype) + + # coordinate system conversion + global_joint_positions_mujoco = t.matmul(mujoco_to_motion_matrix[None, None, None, ...], + global_joint_positions_mujoco[..., None])[..., 0] # [B, F, J, 3] + global_joint_rotations_mujoco = t.matmul(t.matmul(mujoco_to_motion_matrix[None, None, None, ...], + global_joint_rotations_mujoco), + motion_to_mujoco_matrix[None, None, None, ...]) # [B, F, J, 3, 3] + + # swap the order of the joints + global_joint_rotations_motion = global_joint_rotations_mujoco[:, :, self._motion_indices_to_mujoco_indices, ...] + global_joint_positions_motion = global_joint_positions_mujoco[:, :, self._motion_indices_to_mujoco_indices, ...] + + # populate the dead joints' rotations (`right_hand_roll_skel` and `left_hand_roll_skel` not in the mujoco dof) + # this is assuming the dead joints has 0 relative rotation, which is true for `capture` tpose + is_dead_joints = self._motion_indices_to_mujoco_indices == -1 + is_dead_joints_inds = is_dead_joints.nonzero().squeeze().tolist() + + dead_joints_parent_joints = self.motion_rep.skeleton.joint_parents[t.where(is_dead_joints)[0]] + dead_joints_parent_joints_inds = dead_joints_parent_joints.squeeze().tolist() + + if self._dead_joint_rotation_scheme == "dummy": + # Explicitly expand identity matrix to match target shape for ONNX compatibility + batch_size, num_frames = global_joint_rotations_motion.shape[:2] + num_dead_joints = len(is_dead_joints_inds) + identity_expanded = t.eye(3, device=device, dtype=dtype).expand(batch_size, num_frames, num_dead_joints, 3, 3) + global_joint_rotations_motion[:, :, is_dead_joints_inds, ...] = identity_expanded + elif self._dead_joint_rotation_scheme == "parent": + global_joint_rotations_motion[:, :, is_dead_joints_inds, ...] = \ + global_joint_rotations_motion[:, :, dead_joints_parent_joints_inds, ...] + else: + raise ValueError(f"Invalid dead joint rotation scheme: {self._dead_joint_rotation_scheme}") + + # populate the dead joints's global positions + dead_joint_neutral_positions = \ + self.motion_rep.skeleton.neutral_joints[is_dead_joints_inds][None, None, :, :, None].to(device, dtype) - \ + self.motion_rep.skeleton.neutral_joints[dead_joints_parent_joints_inds][None, None, :, :, None].to(device, dtype) + global_joint_positions_motion[:, :, is_dead_joints_inds, ...] = \ + global_joint_positions_motion[:, :, dead_joints_parent_joints_inds, ...] + \ + t.matmul(global_joint_rotations_motion[:, :, dead_joints_parent_joints_inds, ...], + dead_joint_neutral_positions)[..., 0] + + return global_joint_positions_motion, global_joint_rotations_motion + + @property + def t_pose_translations(self): + return {'standard': self._global_offset_standard, 'capture': self._global_offset_capture} + + @property + def joint_indice_mapping(self): + return {'motion_to_mujoco': self._motion_indices_to_mujoco_indices, 'mujoco_to_motion': self._mujoco_indices_to_motion_indices} + + def get_subtree_joints(self, sub_tree_start_joint: str): + """ @brief: get the indices of the joints starting from the @sub_tree_start_joint """ + + if sub_tree_start_joint in self._subtree_joints: + return self._subtree_joints[sub_tree_start_joint] + + assert sub_tree_start_joint in self.motion_rep.skeleton.bone_order_names, \ + f"sub_tree_start_joint {sub_tree_start_joint} not in the skeleton" + tree_idx = self.motion_rep.skeleton.bone_order_names.index(sub_tree_start_joint) + parents, all_children = self.motion_rep.skeleton.joint_parents, [tree_idx] + while True: + new_children = [i for i, p in enumerate(parents) if p in all_children and i not in all_children] + all_children.extend(new_children) + if not new_children: + break + all_children_mujoco = \ + np.array([i for i in self.joint_indice_mapping['motion_to_mujoco'][all_children] if i != -1]) + self._subtree_joints[sub_tree_start_joint] = all_children_mujoco + + return all_children_mujoco diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/pl_util.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/pl_util.py new file mode 100644 index 0000000000000000000000000000000000000000..9fe817e011a5c319e07da0bad51dfd4737340978 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/helper/pl_util.py @@ -0,0 +1,8 @@ +from omegaconf import DictConfig +from hydra.utils import instantiate + + +def load_motion_rep(conf: DictConfig): + skeleton = instantiate(conf.skeleton) + motion_rep = instantiate(conf.motion_rep, fps=conf.fps, skeleton=skeleton) + return motion_rep diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..baafaeae0b838dde62acfab380c78f28521394dd Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..838bc85a8cca22ed07022007718647aa4a2479dc Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__pycache__/clips.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__pycache__/clips.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3577ba6982626e270663ca9f44a081c0de40f3e3 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__pycache__/clips.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__pycache__/full_agent.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__pycache__/full_agent.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..460e0417bd38214f5539b4398bcaef3a1c0c0aeb Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/__pycache__/full_agent.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/clips.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/clips.py new file mode 100644 index 0000000000000000000000000000000000000000..d7d6e0c9f2012b54e884f80d3be47f20e10d1509 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/clips.py @@ -0,0 +1,263 @@ +import torch as t +import numpy as np +import mujoco +from scipy.spatial.transform import Rotation as R +from torch.utils.data import DataLoader +import os +from motionbricks.motionlib.core.utils.rotations import angle_to_Y_rotation_matrix, matrix_to_cont6d +from motionbricks.motion_backbone.inference.motion_inference import motion_inference +from motionbricks.helper.mujoco_helper import motion_feature_to_mujoco_qpos +from copy import deepcopy +from motionbricks.helper.data_training_util import extract_feature_from_motion_rep +import time +from motionbricks.helper.mujoco_helper import mujoco_qpos_converter +from typing import Union + +NUM_FRAMES_PER_TOKEN = 4 +time_stamp = time.strftime("%Y%m%d_%H%M%S") + +def get_clip_data(clip_id: Union[str, int], train_dataloader: DataLoader): + """ @brief: get the clip data from the dataloader """ + if type(clip_id) == int: + clip_data = train_dataloader.dataset[clip_id]['motion'] + else: + # get the actual data index from the clip_id + meta_original_path = train_dataloader.dataset.meta['original_path'] + clip_key_id = np.where(meta_original_path.str.endswith("/" + clip_id))[0].item() + clip_data = train_dataloader.dataset.__getitem__(keyid=clip_key_id)['motion'] + + return clip_data + +class clip_holder(t.nn.Module): + """ @brief: hold the clips to use for interactive demo, such as walking clip, running clip, etc. + """ + + def __init__(self, train_dataloader: DataLoader = None, visualize_clips: bool = False, ckpt_path: str = None, + converter: mujoco_qpos_converter = None, reprocess_clips: bool = False, + val_dataloader: DataLoader = None): + super(clip_holder, self).__init__() + self._converter = converter + if ckpt_path is not None and os.path.exists(ckpt_path) and not reprocess_clips: + self._preprocess_clips_from_ckpt(ckpt_path) + elif train_dataloader is not None: + self._preprocess_clips_from_dataloader(train_dataloader, val_dataloader, visualize_clips, ckpt_path) + else: + raise ValueError("Either train_dataloader or ckpt_path must be provided") + self._apply_root_headings_correction() + + def _preprocess_clips_from_ckpt(self, ckpt_path: str): + """ @brief: create and load the tensors according to the keys /shapes in the ckpt. """ + state_dict = t.load(ckpt_path) + # Remap legacy key names + key_remap = {'mfm_feature': 'motion_feature'} + for key, value in state_dict.items(): + key = key_remap.get(key, key) + self.register_buffer(key, value) + + def _preprocess_clips_from_dataloader(self, train_dataloader: DataLoader, val_dataloader: DataLoader, + visualize_clips: bool = False, ckpt_path: str = None): + """ @brief: preprocess the clips from the dataloader: + + 1. figure out which clips are for walking, running, idle + 2. Process them into global motion representation + 3. store into np files and avoid loading them again + """ + train_dataloader.dataset.motion_sampler.max_seconds = 50.0 # no limit for samples + train_dataloader.dataset.motion_sampler = None # disable the sampler now + train_dataloader.dataset.motion_loader.motion_sampler = None # disable the sampler here too + motion_rep = train_dataloader.dataset.motion_rep + num_joints = motion_rep.skeleton.nbjoints + + max_num_frames, DEFAULT_MAX_NUM_FRAMES = 20, 20 + for clip_name, clip_info in self.CLIPS.items(): + clip_id, start_frame, end_frame = clip_info['clip_id'], clip_info['start_frame'], clip_info['end_frame'] + # clip_data = train_dataloader.dataset[clip_id]['motion'][None, start_frame: end_frame] + clip_data = get_clip_data(clip_id, train_dataloader)[None, start_frame: end_frame] + clip_data = motion_rep.change_first_heading(clip_data, 0.0, is_normalized=True, to_normalize=False) + self.CLIPS[clip_name]['motion_feature'] = clip_data.clone()[0] # remove batch dim + + # get the mujoco qpos + device = self.CLIPS[clip_name]['motion_feature'].device + self.CLIPS[clip_name]['mujoco_qpos'] = \ + self._converter.convert_motion_features_to_mujoco_qpos(self.CLIPS[clip_name]['motion_feature'][None], + motion_rep.to(device), False)[0] + root_rot = self.CLIPS[clip_name]['mujoco_qpos'][:, 3: 7].clone() + self.CLIPS[clip_name]['mujoco_qpos'][:, 3: 7] = root_rot[:, [3, 0, 1, 2]] + max_num_frames = max(max_num_frames, self.CLIPS[clip_name]['mujoco_qpos'].shape[0]) + + # for it to be used, only 1) global root information (num_frames, 3), + # 2) global joint positions wrt to root translation (num_frames, num_joints, 3), + # 3) global joint orientation (num_frames, num_joints, 3, 3) + global_joint_positions, global_joint_rotations = \ + self._converter.convert_mujoco_qpos_to_motion_transforms(self.CLIPS[clip_name]['mujoco_qpos'][None]) + self.CLIPS[clip_name]['global_root_positions'] = \ + global_joint_positions[0, :, 0] * t.tensor([[1.0, 0.0, 1.0]]) + self.CLIPS[clip_name]['global_joint_positions'] = \ + global_joint_positions[0] - self.CLIPS[clip_name]['global_root_positions'][:, None, :] + self.CLIPS[clip_name]['global_joint_rotations'] = global_joint_rotations[0] + + # also cache the heading direction + root_direction = t.matmul(self.CLIPS[clip_name]['global_joint_rotations'][:, 0, :, :], + t.tensor([0.0, 0.0, 1.0]).view([1, -1, 1])) # y up and z forward + root_direction = root_direction.view([-1, 3]) * t.tensor([1.0, 0.0, 1.0]).view([1, -1]) + assert (root_direction.norm(dim=1, keepdim=True) > 1e-5).all().item(), \ + f"Clip with ill defined heading found at clip_id {clip_id}" + root_direction = root_direction / t.norm(root_direction, dim=1, keepdim=True) + self.CLIPS[clip_name]['global_headings'] = t.atan2(root_direction[:, 0], root_direction[:, 2]) + + # register the clips as parameters so that it will be later used in onnx / trt model + motion_feature_shape = self.CLIPS[list(self.CLIPS.keys())[0]]['motion_feature'].shape[-1] + for data_buffer_name, feat_shape in zip(['global_root_positions', 'global_joint_positions', + 'global_joint_rotations', 'global_headings', + 'motion_feature', 'mujoco_qpos'], + [[3], [num_joints, 3], [num_joints, 3, 3], [], + [motion_feature_shape], [36]]): + data_buffer = t.zeros([len(self.CLIPS), max_num_frames, *feat_shape]) + num_frames_per_clip = t.zeros([len(self.CLIPS)], dtype=t.int32) + for clip_idx, clip_name in enumerate(self.CLIPS): + clip_length = self.CLIPS[clip_name][data_buffer_name].shape[0] + num_frames_per_clip[clip_idx] = clip_length + data_buffer[clip_idx, :clip_length] = self.CLIPS[clip_name][data_buffer_name] + self.register_buffer(data_buffer_name, data_buffer) + self.register_buffer('num_frames_per_clip', num_frames_per_clip) + t.save(self.state_dict(), ckpt_path) + + def _apply_root_headings_correction(self): + """ @brief: apply the root headings correction to the clips; since cetain root project is ill defined.""" + pass + +class clip_holder_G1(clip_holder): + LOAD_FROM_CLIP_NAME = True + CLIPS = { + "idle": { + "clip_id": 'neutral_idle_loop_001__A076', + "start_frame": 0, "end_frame": 30, 'avg_root_vel': 0.0, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + "slow_walk": { + "clip_id": 'neutral_idle_loop_001__A076', + "start_frame": 0, "end_frame": 30, 'avg_root_vel': 0.3 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + "walk": { + "clip_id": 'neutral_idle_loop_001__A076', + "start_frame": 0, "end_frame": 30, 'avg_root_vel': 1.0 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + "hand_crawling": { + "clip_id": "mohak_backward_stop_001__A031", + "start_frame": 0, "end_frame": 30, 'avg_root_vel': 0.5 * 2.0, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, # crawling + "walk_boxing": { + "clip_id": "shadow_boxing_R_003__A360_M", + "start_frame": 25, "end_frame": 35, 'avg_root_vel': 1.0 * 2.0, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + }, + "elbow_crawling": { + "clip_id": "crawl_ff_loop_270_001__A130_M", + "start_frame": 13, "end_frame": 18, 'avg_root_vel': 0.8 * 2.0, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + }, # crawling + "stealth_walk": { + "clip_id": "stealth_ff_start_360_001__A125", + "start_frame": 50, "end_frame": 70, 'avg_root_vel': 1.0 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]}, + "injured_walk": { + "clip_id": "dancecards1_AB_injured_L_leg_001__A005", + "start_frame": 211, "end_frame": 219, 'avg_root_vel': 0.5 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + "walk_stealth": { + "clip_id": "crouch_ff_loop_180_R_001__A196", + "start_frame": 50, "end_frame": 70, 'avg_root_vel': 0.7 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + "walk_happy_dance": { + "clip_id": "dance_vouge_vogue_sequence_180_R_002__A316", + "start_frame": 30, "end_frame": 50, 'avg_root_vel': 1.0 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + "walk_zombie": { + "clip_id": "zombie_walk_180_R_003__A330", + "start_frame": 10, "end_frame": 100, 'avg_root_vel': 0.6 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + "walk_gun": { + "clip_id": "angry_gun_walk_ff_loop_090_R_001__A393_M", + "start_frame": 10, "end_frame": 100, 'avg_root_vel': 0.6 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + "walk_scared": { + "clip_id": "scared_walk_ff_start_225_R_002__A423", + "start_frame": 10, "end_frame": 100, 'avg_root_vel': 0.6 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + + "walk_left": { + "clip_id": 'dance_sakuras_victory_sway_001__A464', + "start_frame": 35, "end_frame": 40, 'avg_root_vel': 0.2 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0] + }, # for robot deployment safety; can be turned off + "walk_right": { + "clip_id": 'dance_sakuras_victory_sway_001__A464_M', + "start_frame": 35, "end_frame": 40, 'avg_root_vel': 0.2 * 2, + 'allowed_pred_num_tokens': [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0] + }, # for robot deployment safety; can be turned off + } # the actual velocity is 0.5 of the `avg_root_vel` because of the spring model + + DEFAULT_KEYS = { + "idle": "", + "slow_walk": "v", + "walk": "", + "hand_crawling": "z", + "walk_boxing": "x", + "elbow_crawling": "b", + "stealth_walk": "r", + "injured_walk": "t", + "walk_stealth": "c", + "walk_happy_dance": "e", + "walk_zombie": "f", + "walk_gun": "g", + "walk_scared": "q", + "walk_left": "", + "walk_right": "", + } + + def _apply_root_headings_correction(self): + """ @brief: apply the root headings correction to the clips; since certain root projection is ill defined.""" + hand_crawling_id = list(self.CLIPS.keys()).index('hand_crawling') + elbow_crawling_id = list(self.CLIPS.keys()).index('elbow_crawling') + self.global_headings[hand_crawling_id, 0] = 0.0 # the crawling pose's root heading is ill defined + self.global_headings[elbow_crawling_id, :] -= 0.95 # the elbow crawling pose's root heading is ill defined + + def blendspace_modes_remap_from_velocity(self, mode: t.Tensor, + target_movement_direction: t.Tensor, target_heading: t.Tensor): + """ @brief: This is the getto version of 2D blend space + if no velocity, don't swap + if velocity angle > heading angle, positive, swap to the right + if velocity angle < heading angle, negative, swap to the left + + This is helpful for the robot deployment safety, but can be removed as well. + """ + # note target_movement_direction is in mujoco space, but facing_direction was in the motion space; + # thus the atan2 is not the same as the target_heading is calculated + movement_heading = t.atan2(target_movement_direction[:, 0], target_movement_direction[:, 1]) + indices_of_slow_walk = list(self.CLIPS.keys()).index('slow_walk') + indices_of_walk = list(self.CLIPS.keys()).index('walk') + + indices_of_walk_left = list(self.CLIPS.keys()).index('walk_left') + indices_of_walk_right = list(self.CLIPS.keys()).index('walk_right') + + heading_diff = (movement_heading - target_heading + t.pi) % (2 * t.pi) - t.pi # > 0 left, < 0 right + if heading_diff.item() < -1.0 and mode.item() == indices_of_slow_walk: + pass + + going_right = t.logical_and(heading_diff < -t.pi / 4.0, heading_diff > -3 * t.pi / 4.0) + going_left = t.logical_and(heading_diff > t.pi / 4.0, heading_diff < 3 * t.pi / 4.0) + is_slow_walk_or_walk = t.logical_or(mode == indices_of_slow_walk, mode == indices_of_walk) + + mode = mode * t.logical_or(t.logical_and(~going_right, ~going_left), ~is_slow_walk_or_walk) + \ + t.full_like(mode, indices_of_walk_right) * t.logical_and(is_slow_walk_or_walk, going_right) + \ + t.full_like(mode, indices_of_walk_left) * t.logical_and(is_slow_walk_or_walk, going_left) + return mode diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/controllers.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/controllers.py new file mode 100644 index 0000000000000000000000000000000000000000..f8301156aa8684f544a443540ff26a244fed82d6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/controllers.py @@ -0,0 +1,290 @@ +import torch as t +from motionbricks.motion_backbone.demo.clips import clip_holder_G1 +import mujoco +import numpy as np +from scipy.spatial.transform import Rotation as R +import copy +import platform +if platform.system() == 'Linux' or platform.system() == 'Darwin': + from pynput import keyboard +else: + import keyboard + +class KeyboardHandler: + def __init__(self): + self.listener = keyboard.Listener( + on_press=self.on_press, + on_release=self.on_release) + self.listener.start() + self._pressed_keys = set() + + def on_press(self, key, injected): + """ @brief: track wasd, up left right down, enter, shift, ctrl + """ + if hasattr(key, 'char'): # characters + key_char = key.char + self._pressed_keys.add(key_char) + elif hasattr(key, 'name'): # special keys + key_char = key.name + self._pressed_keys.add(key_char) + + def on_release(self, key, injected): + """ @brief: track wasd, up left right down, enter, shift, ctrl + """ + if hasattr(key, 'char'): # characters + key_char = key.char + if key_char in self._pressed_keys: + self._pressed_keys.remove(key_char) + elif hasattr(key, 'name'): # special keys + key_char = key.name + if key_char in self._pressed_keys: + self._pressed_keys.remove(key_char) + + def get_pressed_keys(self): + return self._pressed_keys.copy() + +class base_controller(object): + """ @brief: this is the base controller class which handles the control. + """ + def __init__(self, clips: str = "G1", min_token: int = 6, max_token: int = 16): + self._prev_qpos: np.ndarray = None + self._FPS = 30 + self._CONTROLLER_DT = 8 / self._FPS # regenerate the results every 8 frames + self._clip_holder_class = clip_holder_G1 + self._min_token = min_token + self._max_token = max_token + + def generate_control_signals(self): + raise NotImplementedError("Subclass must implement this method") + + def get_prev_qpos(self): + return self._prev_qpos.copy() + + def get_controller_dt(self): + return self._CONTROLLER_DT + + def reset(self): + self._prev_qpos = None + + @property + def is_activated(self): + return True # by default, the controller is activated and listening to the keyboard cmds + + @property + def snapshot_keyboard_control(self): + if platform.system() == 'Linux' or platform.system() == 'Darwin': + if not hasattr(self, 'keyboard_handler'): + self.keyboard_handler = KeyboardHandler() + key_pressed = self.keyboard_handler.get_pressed_keys() + candidates = ['w', 'a', 's', 'd', 'left', 'right', 'up', 'down', 'shift', 'ctrl', 'enter', + 'x', 'z', 'c', 'v', 'b', 'r', 't', 'f', 'g', 'q', 'e'] + key_pressed = {key: True if key in key_pressed else False for key in candidates} + else: + # windows / macos + key_pressed = { + # movement direction + "w": keyboard.is_pressed('w'), "a": keyboard.is_pressed('a'), + "s": keyboard.is_pressed('s'), "d": keyboard.is_pressed('d'), + + # heading direction + "left": keyboard.is_pressed('left'), "right": keyboard.is_pressed('right'), + "up": keyboard.is_pressed('up'), "down": keyboard.is_pressed('down'), + + # mode control; zxcvb are the placeholder for different styles of motions + "z": keyboard.is_pressed('z'), + "x": keyboard.is_pressed('x'), + "c": keyboard.is_pressed('c'), + "v": keyboard.is_pressed('v'), + "b": keyboard.is_pressed('b'), + + "r": keyboard.is_pressed('r'), + "t": keyboard.is_pressed('t'), + "f": keyboard.is_pressed('f'), + "g": keyboard.is_pressed('g'), + "q": keyboard.is_pressed('q'), + "e": keyboard.is_pressed('e'), + + # old mode control + "shift": keyboard.is_pressed('shift'), "ctrl": keyboard.is_pressed('ctrl'), + "enter": keyboard.is_pressed('enter'), + } + return key_pressed + + def get_default_allowed_pred_num_tokens(self, mode: str | int): + if type(mode) == int: + assert mode >= 0 and mode < len(list(self._clip_holder_class.CLIPS.keys())), "Invalid mode id" + mode = list(self._clip_holder_class.CLIPS.keys())[mode] + assert mode in list(self._clip_holder_class.CLIPS.keys()), "Invalid mode" + + if self._clip_holder_class.CLIPS[mode].get('allowed_pred_num_tokens', None) is not None: + return t.tensor(self._clip_holder_class.CLIPS[mode]['allowed_pred_num_tokens']).view([1, -1]) + else: + return t.ones(self._max_token - self._min_token + 1, dtype=t.int).view([1, -1]) # default + +class WASD_controller(base_controller): + """ @brief: this is the controller class which handles the WASD control. + + Input: WASD key pressed + Output: target_position, target_heading, which mode the character is in + """ + def __init__(self, lookat_movement_direction: bool = False, clips: str = "G1", **kwargs): + super(WASD_controller, self).__init__(clips, **kwargs) + # if true, the character will look at the keyboard direction; otherwise, it will look at the camera direction + self._LOOKAT_MOVEMENT_DIRECTION = lookat_movement_direction + self._NUM_HISTORY_STEPS = 5 # for the average velocity calculation + self._prev_qpos = None + + def generate_control_signals(self, viewer, mj_model: mujoco.MjModel, mj_data: mujoco.MjData, + visualize: bool = True, control_info: dict = {}): + + if self._prev_qpos is None: + self._prev_qpos = np.zeros((self._NUM_HISTORY_STEPS, mj_model.nq)) + self._prev_qpos[:] = mj_data.qpos.copy().reshape(1, -1) + + key_pressed = self.snapshot_keyboard_control if \ + 'key_pressed' not in control_info or control_info['key_pressed'] is None else control_info['key_pressed'] + + # the control mode + mode = 'walk' if (key_pressed["w"] or key_pressed["a"] or key_pressed["s"] or key_pressed["d"]) else 'idle' + for candidate_mode in [i for i in list(self._clip_holder_class.CLIPS.keys()) if i != 'idle' and i != 'walk']: + mode = candidate_mode \ + if key_pressed.get(self._clip_holder_class.DEFAULT_KEYS[candidate_mode], False) else mode + + # generate the target position & direction here + movement_direction, facing_direction = \ + self._generate_target_position_and_heading(viewer, mj_model, mj_data, key_pressed, mode) + + mode = t.tensor([list(self._clip_holder_class.CLIPS.keys()).index(mode)]) + + # post update the previous qpos + self._prev_qpos = np.concatenate((self._prev_qpos[1:], mj_data.qpos.copy().reshape(1, -1)), axis=0) + control_signals = { + "movement_direction": t.from_numpy(movement_direction).view([1, -1]), + "facing_direction": t.from_numpy(facing_direction).view([1, -1]), + "mode": mode.view([1, -1]) + } + control_signals['allowed_pred_num_tokens'] = self.get_default_allowed_pred_num_tokens(mode.item()) + return control_signals + + def _generate_target_position_and_heading(self, viewer, mj_model: mujoco.MjModel, + mj_data: mujoco.MjData, key_pressed: dict, mode: str): + # get the current camera's lookat position and camera position; use the two position to decide where to go + lookat_position = viewer.cam.lookat + + cam_distance = viewer.cam.distance + cam_azimuth = -np.radians(viewer.cam.azimuth) - np.pi / 2.0 + cam_elevation = -1 * np.radians(viewer.cam.elevation) # negative elevation means looking down + + # Compute actual camera position + cam_pos = lookat_position + cam_distance * np.array([ + np.cos(cam_elevation) * np.sin(cam_azimuth), + np.cos(cam_elevation) * np.cos(cam_azimuth), + np.sin(cam_elevation) + ]) + + # the camera direction + camera_direction = (lookat_position - cam_pos) * np.array([1.0, 1.0, 0.0]) + camera_direction = camera_direction / np.linalg.norm(camera_direction) + + if mode != 'idle': + # get the control's relative direction + controller_relative_direction = \ + np.array([1.0, 0.0, 0.0]) * key_pressed["w"] + np.array([-1.0, 0.0, 0.0]) * key_pressed["s"] + \ + np.array([0.0, -1.0, 0.0]) * key_pressed["d"] + np.array([0.0, 1.0, 0.0]) * key_pressed["a"] + controller_relative_direction = \ + controller_relative_direction / (np.linalg.norm(controller_relative_direction) + 1e-5) + + z_axis_camera_angle = np.arctan2(camera_direction[1], camera_direction[0]) + controller_relative_direction_angle = \ + np.arctan2(controller_relative_direction[1], controller_relative_direction[0]) + + abs_heading_angle = z_axis_camera_angle + controller_relative_direction_angle + movement_direction = np.array([np.cos(abs_heading_angle), np.sin(abs_heading_angle), 0.0]) + + if self._LOOKAT_MOVEMENT_DIRECTION: + facing_direction = movement_direction + else: + facing_direction = camera_direction + + else: # idle states + # if idle, continue the current velocity and heading + qvel = (self._prev_qpos[1:, :3] - self._prev_qpos[:-1, :3]).mean(axis=0) * \ + np.array([1.0, 1.0, 0.0]) / mj_model.opt.timestep + movement_direction = qvel / (np.linalg.norm(qvel) + 1e-5) # if qvel small; no movements + facing_direction = \ + R.from_quat(self._prev_qpos[-1, 3: 7], scalar_first=True).apply(np.array([1.0, 0.0, 0.0])) * \ + np.array([1.0, 1.0, 0.0]) + facing_direction = facing_direction / (np.linalg.norm(facing_direction) + 1e-5) + + return movement_direction, facing_direction + +class random_controller(base_controller): + """ @brief: randomly generate the control signals. + """ + def __init__(self, disable_running: bool = True, lookat_movement_direction: bool = False, + new_control_dt: float = 2.0, + max_angle_change_between_controls: float = 0.5 * np.pi, + clips: str = "G1", **kwargs): + super(random_controller, self).__init__(clips, **kwargs) + self._prev_qpos = None + self._NUM_HISTORY_STEPS = 5 # for the average velocity calculation + self._NEW_CONTROL_DT = new_control_dt # swap the control every `new_control_dt` seconds (2.0s by default) + self._time_since_prev_control = 0.0 + self._control = None + self._disable_running = disable_running # disable running + self._max_angle_change_between_controls = max_angle_change_between_controls + self._LOOKAT_MOVEMENT_DIRECTION = lookat_movement_direction + + def generate_control_signals(self, viewer, mj_model: mujoco.MjModel, mj_data: mujoco.MjData, + visualize: bool = True, control_info: dict = None): + + if self._prev_qpos is None: + self._prev_qpos = np.zeros((self._NUM_HISTORY_STEPS, mj_model.nq)) + self._prev_qpos[:] = mj_data.qpos.copy().reshape(1, -1) + + self._time_since_prev_control += mj_model.opt.timestep + + if self._time_since_prev_control < self._NEW_CONTROL_DT and self._control is not None: + self._prev_qpos = np.concatenate((self._prev_qpos[1:], mj_data.qpos.copy().reshape(1, -1)), axis=0) + return copy.deepcopy(self._control) + else: + self._time_since_prev_control = 0.0 # generate new control + + # the control mode + candidates = [i for i in list(self._clip_holder_class.CLIPS.keys()) if + not ((i == 'run' or i == 'sprint') and self._disable_running)] + if self._control is not None and self._control["mode"].item() == \ + list(self._clip_holder_class.CLIPS.keys()).index('idle'): + candidates.remove("idle") # no idles after idles + else: + candidates.remove("idle") # no runs after runs + if control_info is not None and control_info["force_idle"]: + candidates = ["idle"] + if control_info is not None and control_info["allowed_mode"] is not None: + candidates = [i for i in list(self._clip_holder_class.CLIPS.keys()) if i in control_info["allowed_mode"]] + mode = np.random.choice(candidates, size=1, replace=False) + mode = t.tensor([list(self._clip_holder_class.CLIPS.keys()).index(mode[0])]) + + # generate the target position & direction here + movement_angle, facing_angle = t.rand(1) * 2 * t.pi, t.rand(1) * 2 * t.pi + if self._control is not None: + angle_diff = (t.rand(1) * 2 - 1) * self._max_angle_change_between_controls + facing_angle = self._control["facing_angle"] + angle_diff + facing_angle = facing_angle % (2 * t.pi) + else: + facing_angle = facing_angle * 0.0 # the first run provides the initial global facing angle + movement_direction = t.tensor([t.cos(movement_angle), t.sin(movement_angle), 0.0]) + facing_direction = t.tensor([t.cos(facing_angle), t.sin(facing_angle), 0.0]) + + if self._LOOKAT_MOVEMENT_DIRECTION: + # facing_direction = movement_direction + movement_direction = facing_direction + + # post update the previous qpos + self._prev_qpos = np.concatenate((self._prev_qpos[1:], mj_data.qpos.copy().reshape(1, -1)), axis=0) + self._control = {"movement_direction": movement_direction.view([1, -1]), + "facing_direction": facing_direction.view([1, -1]), "mode": mode.view([1, -1]), + "movement_angle": movement_angle, "facing_angle": facing_angle} + self._control['allowed_pred_num_tokens'] = self.get_default_allowed_pred_num_tokens(mode.item()) + return copy.deepcopy(self._control) + diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/full_agent.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/full_agent.py new file mode 100644 index 0000000000000000000000000000000000000000..3e3b074ab9f413b32ea3b5f410b168d233621385 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/full_agent.py @@ -0,0 +1,596 @@ +from motionbricks.motion_backbone.inference.motion_inference import motion_inference +from copy import deepcopy +import torch as t +from torch.utils.data import DataLoader +from motionbricks.motion_backbone.demo.clips import clip_holder_G1 +from motionbricks.helper.mujoco_helper import get_mujoco_converter +import time +from scipy.spatial.transform import Rotation as R +from motionbricks.motionlib.core.utils.rotations import angle_to_Y_rotation_matrix, matrix_to_cont6d, quat_apply, quat_mul +from motionbricks.motionlib.core.utils.rotations import quaternion_to_matrix + +# using this matrix_to_quaternion instead of the one in motionbricks.motionlib.core.utils.rotations +# to avoid some tensorrt issues +from motionbricks.geometry.quaternions import matrix_to_quaternion + +import os + +def angle_to_Z_rotation_matrix(angle): + """Create rotation matrix around Z-axis for Z-up coordinate system""" + cos, sin = t.cos(angle), t.sin(angle) + one, zero = t.ones_like(angle), t.zeros_like(angle) + # Z-axis rotation matrix: + # [cos(θ) -sin(θ) 0] + # [sin(θ) cos(θ) 0] + # [ 0 0 1] + mat = t.stack((cos, -sin, zero, sin, cos, zero, zero, zero, one), -1) + mat = mat.reshape(angle.shape + (3, 3)) + return mat + +class full_navigation_agent(t.nn.Module): + """ @brief: this is the agent class which handles everything. + """ + DEFAULT_PLANING_HORIZON = 1.0 # 1 second + NUM_FRAMES_PER_TOKEN = 4 + DEFAULT_PRED_OFFSETS = 4 + + def __init__(self, inferencer: motion_inference, train_dataloader: DataLoader, device: str = 'cuda', + speed_scale: list[float] = [1.0, 1.0], target_root_realignment: bool = True, + source_root_realignment: bool = True, + pred_offsets: int = DEFAULT_PRED_OFFSETS, + skeleton_xml: str = "assets/skeletons/g1/g1.xml", + filter_qpos: bool = True, + force_canonicalization: bool = True, clips: str = "G1", + bypass_spring_model: bool = False, + skip_ending_target_cond: bool = True, + ckpt_path: str = None, + reprocess_clips: bool = False, + val_dataloader: DataLoader = None, + use_spring_root_instead: bool = False): + super(full_navigation_agent, self).__init__() + self._inferencer = inferencer.eval().to(device) + self._motion_rep = deepcopy(inferencer.motion_rep).to(device) # make a copy to avoid gpu cpu transfer + self._converter = get_mujoco_converter(self._motion_rep, skeleton_xml).to(device) + self._clip_holder = clip_holder_G1(train_dataloader=train_dataloader, ckpt_path=ckpt_path, + converter=self._converter, reprocess_clips=reprocess_clips, + val_dataloader=val_dataloader) + self._train_dataloader = train_dataloader + self._device = device + self._fps = self._motion_rep.fps + self._target_root_realignment = target_root_realignment + self._source_root_realignment = source_root_realignment + + self.PRED_OFFSETS = pred_offsets + self.FILTER_QPOS = filter_qpos + self.FORCE_CANONICALIZATION = force_canonicalization + self.BYPASS_SPRING_MODEL = bypass_spring_model + self.SKIP_ENDING_TARGET_COND = skip_ending_target_cond + + self.frames = { + # model features are the output from the model inference. The actual inference runs here + "model_features": None, # [batch_size, num_frames, feature_dim (390)] + + # qpos feature is the feature understood by the mujoco simulator + "mujoco_qpos": None, # [batch_size, num_frames, 32] + "mode": None, + } + self._speed_scale_min, self._speed_scale_max = speed_scale # in case you want to perturb the speed + self._initialize_frames() + self._has_prebaked_inference_engine = False + + def set_prebaked_inference_engine(self): + raise NotImplementedError("Prebaked inference engine is not implemented yet") + + def reset(self): + self._current_frame_idx = 0 + self._initialize_frames() + + def _initialize_frames(self): + + # the initial frames + self._current_frame_idx = 0 + # self.frames['model_features'] = self._clip_holder.CLIPS['idle']['motion_feature'] # unnormalized, [batch, F, D=390] + # fetch the motion features for the idle clip + self.frames['model_features'] = self._clip_holder.motion_feature[0, :self._clip_holder.num_frames_per_clip[0]][None] + + self.frames['mujoco_qpos'] = self._converter.convert_motion_features_to_mujoco_qpos( + self.frames['model_features'], self._motion_rep.to(self.frames['model_features'].device), False + ) + root_rot = self.frames['mujoco_qpos'][:, :, 3: 7].clone() + self.frames['mujoco_qpos'][:, :, 3: 7] = root_rot[:, :, [3, 0, 1, 2]] + NUM_MIN_FRAMES_IN_BUFFER = 64 + if self.frames['mujoco_qpos'].shape[1] < NUM_MIN_FRAMES_IN_BUFFER: + self.frames['mujoco_qpos'] = t.cat( + [self.frames['mujoco_qpos'], + self.frames['mujoco_qpos'][:, -1:].repeat(1, NUM_MIN_FRAMES_IN_BUFFER - + self.frames['mujoco_qpos'].shape[1], 1)], dim=1 + ) + + def generate_new_frames(self, input: dict, controller_dt: float = 0.25, force_generation: bool = False): + """ @brief: call the model inference to generate the new frames. + + input: + context_global_joint_positions: [batch_size, num_frames = 4, num_joints (including root), 3] + context_global_joint_rotations: [batch_size, num_frames = 4, num_joints (including root), 3, 3] + + mode: [batch] int which corresponds to ['walk', 'run', 'idle', 'slow_walk'] + + movement_direction: [batch_size, 3] in mujoco coordinate system (global) + facing_direction: [batch_size, 3] in mujoco coordinate system (global) + + """ + if not force_generation: + if self._current_frame_idx < controller_dt * self._fps and \ + self._current_frame_idx < self.frames['mujoco_qpos'].shape[1] - 1: # replan frequency + return self.frames['model_features'], self.frames['mujoco_qpos'] + + if not self._should_regenerate(input): + return self.frames['model_features'], self.frames['mujoco_qpos'] + + self._prev_input = input.copy() + if 'specific_target_positions' in input and 'has_specific_target' not in input: + input['has_specific_target'] = t.tensor([[True]]).int() # compatibility if not provided + input = {i: input[i].to(self._device) for i in input if i} + + if self._has_prebaked_inference_engine: + raise NotImplementedError("Prebaked inference engine is not implemented yet") + else: + + input['context_global_joint_positions'], input['context_global_joint_rotations'] = \ + self._process_input_to_joint_transforms(input) + + # use the spring model to generate the realistic target global root position and heading + input['target_root_position'], input['target_root_positions'], \ + input['target_root_headings'], input['target_root_heading'], \ + input['start_root_positions'], input['start_root_headings'] = \ + self._generate_spring_model_position_and_heading(input) + + if 'has_specific_target' in input and self.BYPASS_SPRING_MODEL: + self._override_target_transforms(input) + + # construct the target joint transforms for the model inference + input['target_global_joint_positions'], input['target_global_joint_rotations'], \ + input['target_global_root_positions'] = self._generate_target_joint_transforms(input) + + # the inference + model_features, mujoco_qpos, num_pred_frames = self._generate_inbetween_frames(input) + + self.frames['mode'] = input['mode'] + + self.frames['mujoco_qpos_notrunc'] = mujoco_qpos + + # truncate the frames; if using onnx model in C++, you should also manually truncate the frames + self.frames['model_features'] = model_features[:, :num_pred_frames.item(), :] + self.frames['mujoco_qpos'] = mujoco_qpos[:, :num_pred_frames.item(), :] + + return self.frames['mujoco_qpos'], num_pred_frames + + def _process_input_to_joint_transforms(self, input: dict): + """ @brief: process the input to joint transforms + """ + if 'context_mujoco_qpos' in input: # should always use this if possible + if self.FORCE_CANONICALIZATION: + self._canonicalize_mujoco_qpos(input) + else: + input['raw_context_mujoco_qpos'] = input['context_mujoco_qpos'].clone() + + context_global_joint_positions, context_global_joint_rotations = \ + self._converter.convert_mujoco_qpos_to_motion_transforms(input['context_mujoco_qpos']) + elif 'context_global_joint_positions' in input and 'context_global_joint_rotations' in input: + # this is the expected input for onnx / trt model + assert not self.FORCE_CANONICALIZATION, "not implemented yet." + context_global_joint_positions = input['context_global_joint_positions'] + context_global_joint_rotations = input['context_global_joint_rotations'] + elif 'context_motion_features' in input: + assert not self.FORCE_CANONICALIZATION, "not implemented yet." + output_results = self._motion_rep.inverse(input['context_motion_features'], + is_normalized=False, return_quat=False, return_all=False) + context_global_joint_positions, context_global_joint_rotations = \ + output_results['posed_joints'], output_results['global_joint_rots'] # [batch, numF, numJ, ...] + else: + raise ValueError("Invalid input: context_global_joint_positions or motion_features not found") + + return context_global_joint_positions, context_global_joint_rotations + + def _generate_spring_model_position_and_heading(self, input: dict): + """ @brief: do the critical damping spring model for the position and heading + """ + batch_size, device = input['context_global_joint_positions'].shape[0], input['mode'].device + + # default parameters and helper functions for the spring model + ln2, eps = 0.69314718056, 1e-5 + def fast_neg_exp_func(x): + return 1.0 / (1.0 + x + 0.48 * x * x + 0.235 * x * x *x) + + # generate position from the spring model + root_joint_idx = 0 + curr_root_pos = input['context_global_joint_positions'][:, 0, root_joint_idx, [0, 2]] + curr_root_vel = (input['context_global_joint_positions'][:, 1, root_joint_idx, [0, 2]] - + input['context_global_joint_positions'][:, 0, root_joint_idx, [0, 2]]) * self._fps + + input['mode'] = t.min(input['mode'], + t.tensor([len(self._clip_holder.CLIPS) - 1]).to(device).int()) # safety check + + translation_movement_in_1s = (input['mode'] == 0) * curr_root_vel.norm(dim=-1, keepdim=False) / 2.0 + for i in range(1, len(self._clip_holder.CLIPS)): + translation_movement_in_1s += (input['mode'] == i) * \ + self._clip_holder.CLIPS[list(self._clip_holder.CLIPS.keys())[i]]['avg_root_vel'] + + # add perturbation to the speed + random_seed = input.get('random_seed', t.randint(0, 10000, (1,))).to(self._device) # map this to float + random_ratio = (random_seed.float() % 100) / 100.0 # [0, 1] + translation_movement_in_1s *= \ + (random_ratio * (self._speed_scale_max - self._speed_scale_min) + self._speed_scale_min) + translation_movement_in_1s = (translation_movement_in_1s > 0.1).float() * translation_movement_in_1s + + # enforce the target velocity + target_vel = (input['mode'] != 0) * \ + input.get('target_vel', -1.0) * 2.0 # 2.0 since the actual speed is usually 0.5 of the target speed + if type(target_vel) == t.Tensor: + target_vel = target_vel.view([batch_size, 1]) # a float tensor + translation_movement_in_1s = (target_vel <= 0.0) * translation_movement_in_1s + \ + (target_vel > 0.0) * target_vel + target_movement_direction = input['movement_direction'][:, [1, 0]] + + # movement for inplace turning + target_movement_direction = (target_movement_direction.norm(dim=-1, keepdim=False) > 1e-5) * \ + target_movement_direction + (target_movement_direction.norm(dim=-1, keepdim=False) <= 1e-5) * \ + input['facing_direction'][:, [1, 0]] * 0.1 + target_root_pos = curr_root_pos + translation_movement_in_1s * target_movement_direction + + if 'specific_target_positions' in input: + has_specific_target = input['has_specific_target'] + target_root_pos = target_root_pos * (1.0 - has_specific_target.float()) + \ + input['specific_target_positions'][:, -1, [1, 0]] * has_specific_target.float() + + y = (4.0 * ln2) / (0.8 + eps) / 2.0 # a typical halflife = 0.4 for the positions; 0.6 for slower changes + dts = t.cat([(t.arange(self.NUM_FRAMES_PER_TOKEN).float() * 1.0 / self._fps).to(self._device), + (1.0 + t.arange(self.NUM_FRAMES_PER_TOKEN).float() * 1.0 / self._fps).to(self._device)], dim=-1) + # dts = t.arange(self.NUM_FRAMES_PER_TOKEN + self._fps).float() * 1.0 / self._fps + dts = dts[None, None, :] # [b, F, DTs] + eydt = fast_neg_exp_func(y * dts) + j0 = curr_root_pos - target_root_pos + j1 = curr_root_vel + j0 * y + root_positions = (j0[:, :, None] + j1[:, :, None] * dts) * eydt + target_root_pos[:, :, None] + start_root_positions = root_positions[:, :, :self.NUM_FRAMES_PER_TOKEN] + target_root_positions = root_positions[:, :, -self.NUM_FRAMES_PER_TOKEN:] + + target_root_positions = (input['mode'][..., None] == 0) * target_root_positions[:, :, :1] + \ + (input['mode'][..., None] != 0) * target_root_positions + target_root_position = target_root_positions[:, :, 0] + + # generate heading from the spring model + curr_heading = t.atan2(input['context_global_joint_rotations'][:, 0, root_joint_idx, 0, 2], + input['context_global_joint_rotations'][:, 0, root_joint_idx, 2, 2]) # y-axis rotation + next_heading = t.atan2(input['context_global_joint_rotations'][:, 1, root_joint_idx, 0, 2], + input['context_global_joint_rotations'][:, 1, root_joint_idx, 2, 2]) + curr_heading_vel = ((next_heading - curr_heading + t.pi) % (2 * t.pi) - t.pi) * self._fps + target_heading = t.atan2(input['facing_direction'][:, 1], input['facing_direction'][:, 0]) # mujoco coordinate + if 'specific_target_headings' in input: + # make it in the range of [-pi, pi] + specific_target_heading = (input['specific_target_headings'][:, -1] + t.pi) % (2 * t.pi) - t.pi + target_heading = specific_target_heading * input['has_specific_target'].view([batch_size]).float() + \ + target_heading * (1.0 - input['has_specific_target'].view([batch_size]).float()) + + target_heading[target_heading.isnan()] = 0.0 + target_heading = target_heading + 2 * t.pi * (curr_heading - target_heading > t.pi) \ + -2 * t.pi * (curr_heading - target_heading < -t.pi) + + # use halflife = 0.17 for the heading + y = (4.0 * ln2) / (0.17 + eps) / 2.0 + # dts = 1.0 + eydt = fast_neg_exp_func(y * dts) + j0 = curr_heading - target_heading + j1 = curr_heading_vel + j0 * y + headings = (j0 + j1 * dts) * eydt + target_heading # [batch, 1, 4] + start_headings = headings[:, :, :self.NUM_FRAMES_PER_TOKEN].view([batch_size, -1]) + target_headings = headings[:, :, -self.NUM_FRAMES_PER_TOKEN:].view([batch_size, -1]) + target_heading = target_headings[:, 0] + + if self.FORCE_CANONICALIZATION: + input['mode'] = self._clip_holder.blendspace_modes_remap_from_velocity( + input['mode'], target_movement_direction, target_heading + ) + + return target_root_position, target_root_positions, target_headings, target_heading, \ + start_root_positions, start_headings + + def _override_target_transforms(self, input: dict): + """ @brief: override the target transforms + """ + if 'specific_target_positions' not in input or 'specific_target_headings' not in input: + return + + # root positions + specific_target_root_positions = input['target_root_positions'].clone() + specific_target_root_positions[:, 0, :] = input['specific_target_positions'][:, :, 1] + specific_target_root_positions[:, 1, :] = input['specific_target_positions'][:, :, 0] + input['target_root_positions'] = \ + specific_target_root_positions * input['has_specific_target'][:, None, :].float() + \ + input['target_root_positions'] * (1.0 - input['has_specific_target'][:, None, :].float()) + input['target_root_position'] = input['target_root_positions'][:, :, 0] + + # root headings + input['target_root_headings'] = \ + input['specific_target_headings'].reshape(input['target_root_headings'].shape) * \ + input['has_specific_target'].float() + \ + input['target_root_headings'] * (1.0 - input['has_specific_target'].float()) + input['target_root_heading'] = input['target_root_headings'][:, 0] + return input + + def _generate_target_joint_transforms(self, input: dict): + """ @brief: generate the target joint transforms + """ + # based on the mode and random seeds, fetch the target poses + NUM_FRAMES_PER_TOKEN, batch_size = self.NUM_FRAMES_PER_TOKEN, input['mode'].shape[0] + random_seed = input.get('random_seed', t.randint(0, 10000, (1,))).to(self._device) + + onehot_mode = t.nn.functional.one_hot(input['mode'].view(-1), len(self._clip_holder.CLIPS)) + num_frames_per_clip = (self._clip_holder.num_frames_per_clip[None] * onehot_mode).sum(dim=1) + frame_idx = random_seed % (num_frames_per_clip - NUM_FRAMES_PER_TOKEN) + + chunks = t.arange(NUM_FRAMES_PER_TOKEN).to(self._device) + frame_idx + + global_root_positions = self._clip_holder.global_root_positions[None,:, chunks] + global_joint_positions = self._clip_holder.global_joint_positions[None,:, chunks] + global_joint_rotations = self._clip_holder.global_joint_rotations[None,:, chunks] + global_headings = self._clip_holder.global_headings[None,:, chunks] + qpos = self._clip_holder.mujoco_qpos[None,:, chunks] + + global_root_positions = (global_root_positions * onehot_mode[:, :, None, None]).sum(dim=1) + global_joint_positions = (global_joint_positions * onehot_mode[:, :, None, None, None]).sum(dim=1) + global_joint_rotations = (global_joint_rotations * onehot_mode[:, :, None, None, None, None]).sum(dim=1) + global_headings = (global_headings * onehot_mode[:, :, None]).sum(dim=1) + qpos = (qpos * onehot_mode[:, :, None, None]).sum(dim=1) + + # rotate the orientation to the target heading + if self._target_root_realignment: + # set the target rotations based on the target headings + + diff_heading = (input['target_root_headings'] - + global_headings + t.pi) % (2 * t.pi) - t.pi # [-pi, pi] + corrective_mat = angle_to_Y_rotation_matrix(diff_heading).float() # [batch, numF, 3, 3] + global_headings = global_headings + diff_heading + global_joint_rotations = t.matmul(corrective_mat[:, :, None], global_joint_rotations) + global_joint_positions = \ + t.matmul(corrective_mat[:, :, None], global_joint_positions[:, :, :, :, None])[..., 0] + + # move the target positions based on the momentum of the spring model + global_root_positions[:, :, [0, 2]] = input['target_root_positions'].transpose(1, 2).float() + else: + + diff_heading = (input['target_root_heading'] - + global_headings[:, 0] + t.pi) % (2 * t.pi) - t.pi # [-pi, pi] + corrective_mat = angle_to_Y_rotation_matrix(diff_heading).float() + global_headings = global_headings + diff_heading + global_joint_rotations = t.matmul(corrective_mat[:, None, None, :, :], global_joint_rotations) + global_joint_positions = \ + t.matmul(corrective_mat[:, None, None, :, :], global_joint_positions[:, :, :, :, None])[..., 0] + + # recenter the target positions and rotate the rest of the root positions + global_root_positions = \ + t.matmul(corrective_mat[: ,None, :, :], global_root_positions[:, :, :, None])[..., 0] + global_root_positions = global_root_positions - global_root_positions[:, :1, :] + global_root_positions[:, :, 0] += input['target_root_position'][:, 0] + global_root_positions[:, :, 2] += input['target_root_position'][:, 1] + + if self._source_root_realignment: + context_headings = t.atan2(input['context_global_joint_rotations'][:, :, 0, 0, 2], + input['context_global_joint_rotations'][:, :, 0, 2, 2]) # y-axis rotation + corrective_mat = angle_to_Y_rotation_matrix(input['start_root_headings'] - context_headings).float() + input['context_global_joint_rotations'] = \ + t.matmul(corrective_mat[:, :, None, :, :], input['context_global_joint_rotations']) + input['context_global_joint_positions'] = \ + t.matmul(corrective_mat[:, :, None, :, :], + input['context_global_joint_positions'][:, :, :, :, None])[..., 0] + input['context_global_joint_positions'][:, :, :, [0, 2]] = \ + input['context_global_joint_positions'][:, :, :, [0, 2]] - \ + input['context_global_joint_positions'][:, :, :1, [0, 2]] + \ + input['start_root_positions'].transpose(1, 2)[:, :, None, :].float() + + return global_joint_positions, global_joint_rotations, global_root_positions + + def _generate_inbetween_frames(self, input: dict): + start_time = time.time() + batch_size, MASKED_NUM_TOKENS = 1, self._inferencer._root_model.backbone_net.MASKED_NUM_TOKENS + fps = self._inferencer.local_motion_rep.fps + root_joint_idx = 0 + + # prepare the values for the context frames + context_global_root_pos = input['context_global_joint_positions'][:, :, root_joint_idx, :] + context_rotation_angle = t.atan2(input['context_global_joint_rotations'][:, :, root_joint_idx, 0, 2], + input['context_global_joint_rotations'][:, :, root_joint_idx, 2, 2]) + context_global_root_values = t.cat([context_global_root_pos, t.cos(context_rotation_angle)[..., None], + t.sin(context_rotation_angle)[..., None]], dim=-1) # [B, numF, 5] + context_local_root_values = \ + t.zeros([batch_size, self.NUM_FRAMES_PER_TOKEN, 4]).to(self._device) # [B, numF, 4] + context_local_root_values[:, :self.NUM_FRAMES_PER_TOKEN - 1, 0] = \ + (((context_rotation_angle[:, 1:] - context_rotation_angle[:, :-1] + t.pi) % (2 * t.pi)) - t.pi) * fps + context_local_root_values[:, :self.NUM_FRAMES_PER_TOKEN - 1, 1: 3] = \ + (context_global_root_pos[:, 1:, [0, 2]] - context_global_root_pos[:, :-1, [0, 2]]) * fps + context_local_root_values[:, :self.NUM_FRAMES_PER_TOKEN - 1, 3] = \ + context_global_root_values[:, :self.NUM_FRAMES_PER_TOKEN - 1, 1] + + context_global_joint_positions = input['context_global_joint_positions'].clone() + joint_positions = context_global_joint_positions[:, :, 1:, :] + joint_positions[..., 0] = \ + context_global_joint_positions[:, :, 1:, 0] - context_global_joint_positions[:, :, :1, 0] + joint_positions[..., 2] = \ + context_global_joint_positions[:, :, 1:, 2] - context_global_joint_positions[:, :, :1, 2] + + joint_rotation_ortho6d = matrix_to_cont6d(input['context_global_joint_rotations']) + context_local_poses = t.cat([joint_positions.view([batch_size, self.NUM_FRAMES_PER_TOKEN, -1]), + joint_rotation_ortho6d.view([batch_size, self.NUM_FRAMES_PER_TOKEN, -1])], dim=-1) + + # prepare the values for the target frames + target_global_root_pos = input['target_global_root_positions'] + \ + input['target_global_joint_positions'][:, :, root_joint_idx, :] + target_rotation_angle = t.atan2(input['target_global_joint_rotations'][:, :, root_joint_idx, 0, 2], + input['target_global_joint_rotations'][:, :, root_joint_idx, 2, 2]) + if 'target_root_headings' in input: + target_rotation_angle = input['target_root_headings'] # avoid double counting AND avoid ill defined angles + target_rotation_angle = target_rotation_angle.float() + + target_global_root_values = t.cat([target_global_root_pos, t.cos(target_rotation_angle)[..., None], + t.sin(target_rotation_angle)[..., None]], dim=-1) # [B, num_frames, 5] + target_local_root_values = t.zeros_like(context_local_root_values).to(self._device) # [b=1, num_frames, 4] + target_local_root_values[:, :self.NUM_FRAMES_PER_TOKEN - 1, 0] = \ + (((target_rotation_angle[:, 1:] - target_rotation_angle[:, :-1] + t.pi) % (2 * t.pi)) - t.pi) * fps + target_local_root_values[:, :self.NUM_FRAMES_PER_TOKEN - 1, 1: 3] = \ + (target_global_root_pos[:, 1:, [0, 2]] - target_global_root_pos[:, :-1, [0, 2]]) * fps + target_local_root_values[:, -1, 0: 3] = target_local_root_values[:, -2, 0: 3] # add the last velocity + target_local_root_values[:, :, 3] = target_global_root_values[:, :, 1] + + joint_positions = input['target_global_joint_positions'][:, :, 1:, :] + joint_rotation_ortho6d = matrix_to_cont6d(input['target_global_joint_rotations']) + target_local_poses = t.cat([joint_positions.view([batch_size, self.NUM_FRAMES_PER_TOKEN, -1]), + joint_rotation_ortho6d.view([batch_size, self.NUM_FRAMES_PER_TOKEN, -1])], dim=-1) + + # merge the constraints + local_root_values = t.cat([context_local_root_values, target_local_root_values], dim=1) + global_root_values = t.cat([context_global_root_values, target_global_root_values], dim=1) + local_poses = t.cat([context_local_poses, target_local_poses], dim=1) + + has_global_root_values = t.ones_like(global_root_values[:, :, 0], dtype=t.bool) + has_local_root_values = t.ones_like(local_root_values[:, :, 0], dtype=t.bool) + has_local_poses = t.ones_like(local_poses[:, :, 0], dtype=t.bool) + has_local_root_values[:, self.NUM_FRAMES_PER_TOKEN - 1] = False # the last velocity is incorrect + + if not self._target_root_realignment: + # if root is not realigned, disable the following info since they might be misleading + has_local_root_values[:, -self.NUM_FRAMES_PER_TOKEN:] = False + has_global_root_values[:, -self.NUM_FRAMES_PER_TOKEN + 1:] = False + has_local_poses[:, -self.NUM_FRAMES_PER_TOKEN + 1:] = False + + num_tokens = t.full([batch_size], MASKED_NUM_TOKENS).int().to(self._device) + + # pred the motions + config = {'num_inference_step': 1, 'smooth_root_traj': False, 'allow_pred_out_of_reach_num_tokens': False, + 'pose_token_sampling_use_argmax': True, 'skip_ending_target_cond': self.SKIP_ENDING_TARGET_COND} + info = {} + pred_global_motions, num_pred_tokens = self._inferencer.predict( + global_root_values, has_global_root_values, local_root_values, has_local_root_values, + local_poses, has_local_poses, num_tokens, config=config, info=info, + allowed_pred_num_tokens=input.get('allowed_pred_num_tokens', None) + ) + + self.frames['model_features'] = pred_global_motions + self.frames['num_pred_frames'] = self.NUM_FRAMES_PER_TOKEN * num_pred_tokens + + self.frames['mujoco_qpos'] = \ + self._converter.convert_motion_features_to_mujoco_qpos(self.frames['model_features'], self._motion_rep, False) + root_rot = self.frames['mujoco_qpos'][:, :, 3: 7].clone() + self.frames['mujoco_qpos'][:, :, 3: 7] = root_rot[:, :, [3, 0, 1, 2]] + if self.FORCE_CANONICALIZATION: + input['mujoco_qpos'] = self.frames['mujoco_qpos'] + self.frames['mujoco_qpos'] = self._uncanonicalize_mujoco_qpos(input) + self._current_frame_idx = self.NUM_FRAMES_PER_TOKEN - self.PRED_OFFSETS + + if self.FILTER_QPOS: + # blend the generated first frames with the context frames for smooth transitions + # can remove since it does not cause visual difference in the motion + self.frames['raw_mujoco_qpos'] = self.frames['mujoco_qpos'].clone() + ctx = input['raw_context_mujoco_qpos'] + num_ctx = ctx.shape[1] + blend = t.linspace(0.3, 0.7, num_ctx)[None, :, None].to(ctx.device) + self.frames['mujoco_qpos'][:, :num_ctx, :3] = \ + ctx[:, :, :3] * (1 - blend) + self.frames['mujoco_qpos'][:, :num_ctx, :3] * blend + self.frames['mujoco_qpos'][:, :num_ctx, 7:] = \ + ctx[:, :, 7:] * (1 - blend) + self.frames['mujoco_qpos'][:, :num_ctx, 7:] * blend + + return self.frames['model_features'], self.frames['mujoco_qpos'], self.frames['num_pred_frames'] + + def get_next_frame(self): + current_frame_idx = self._current_frame_idx + self._current_frame_idx = max(0, min(current_frame_idx + 1, self.frames['mujoco_qpos'].shape[1] - 1)) + next_qpos = self.frames['mujoco_qpos'][0, current_frame_idx] + if type(next_qpos) == t.Tensor: + next_qpos = next_qpos.detach().cpu().numpy() + return next_qpos + + def get_context_motion_features(self): + indices = [max(0, min(self._current_frame_idx - self.NUM_FRAMES_PER_TOKEN + i + self.PRED_OFFSETS, + self.frames['model_features'].shape[1] - 1)) + for i in range(self.NUM_FRAMES_PER_TOKEN)] + return self.frames['model_features'][:, indices, :].to(self._device) + + def get_context_mujoco_qpos(self): + indices = [max(0, min(self._current_frame_idx - self.NUM_FRAMES_PER_TOKEN + i + self.PRED_OFFSETS, + self.frames['mujoco_qpos'].shape[1] - 1)) + for i in range(self.NUM_FRAMES_PER_TOKEN)] + return self.frames['mujoco_qpos'][:, indices, :].to(self._device) + + def _canonicalize_mujoco_qpos(self, input: dict): + mujoco_qpos = input['context_mujoco_qpos'] + input['raw_context_mujoco_qpos'] = input['context_mujoco_qpos'].clone() + + # first frame information + first_frame_position = mujoco_qpos[:, 0, :3].clone() * t.tensor([[1.0, 1.0, 0.0]]).to(mujoco_qpos.device) + first_frame_rot = quaternion_to_matrix(mujoco_qpos[:, 0, 3: 7].clone()) # the rotation of first frame + first_frame_heading_angle = t.atan2(first_frame_rot[:, 1, 0], first_frame_rot[:, 0, 0]) + first_frame_heading_angle[first_frame_heading_angle.isnan()] = 0.0 + first_frame_rot_heading = angle_to_Z_rotation_matrix(first_frame_heading_angle) + inverse_first_frame_rot_heading = first_frame_rot_heading.transpose(-2, -1) + + # get the canonicalized root info + canonicalized_root_position = \ + t.matmul(inverse_first_frame_rot_heading[:, None, :, :], + (mujoco_qpos[:, :, :3].clone() - first_frame_position)[..., None])[..., 0] + + canonicalized_rot_matrix = t.matmul(inverse_first_frame_rot_heading[:, None, :, :], + quaternion_to_matrix(mujoco_qpos[:, :, 3: 7])) + + mujoco_qpos[:, :, 3: 7] = matrix_to_quaternion(canonicalized_rot_matrix) + mujoco_qpos[:, :, :3] = canonicalized_root_position + + # canonicalize the movement & facing direction + input['movement_direction'] = t.matmul(inverse_first_frame_rot_heading, + input['movement_direction'][..., None].float())[..., 0] + input['facing_direction'] = t.matmul(inverse_first_frame_rot_heading, + input['facing_direction'][:, :, None].float())[..., 0] + input['first_frame_heading_angle'] = first_frame_heading_angle + input['first_frame_position'] = first_frame_position + input['context_mujoco_qpos'] = mujoco_qpos + + # also if specific target headings are provided, canonicalize them + if 'specific_target_headings' in input: + input['specific_target_headings'] = \ + input['specific_target_headings'] - first_frame_heading_angle.view([-1, 1]) + input['specific_target_positions'] = \ + t.matmul(inverse_first_frame_rot_heading[:, None, :, :], + (input['specific_target_positions'] - first_frame_position[:, None, :])[..., None])[..., 0] + + def _uncanonicalize_mujoco_qpos(self, input: dict): + mujoco_qpos = input['mujoco_qpos'] + first_frame_heading_angle = input['first_frame_heading_angle'] + first_frame_position = input['first_frame_position'] + + # the first frame + first_frame_rot_heading = angle_to_Z_rotation_matrix(first_frame_heading_angle) + + # get the uncanonicalized root information + current_first_frame_rotation = quaternion_to_matrix(mujoco_qpos[:, :1, 3: 7]) + current_first_frame_heading_angle = t.atan2(current_first_frame_rotation[:, :, 1, 0], + current_first_frame_rotation[:, :, 0, 0]) + current_first_frame_rot_heading = angle_to_Z_rotation_matrix(current_first_frame_heading_angle) + rot_matrix = quaternion_to_matrix(mujoco_qpos[:, :, 3: 7]) + rot_matrix = t.matmul(first_frame_rot_heading[:, None, :, :], + t.matmul(current_first_frame_rot_heading.transpose(-2, -1), rot_matrix)) + root_positions = t.matmul(first_frame_rot_heading[:, None, :, :], + t.matmul(current_first_frame_rot_heading.transpose(-2, -1), + mujoco_qpos[:, :, :3, None]))[..., 0] + root_positions = root_positions - \ + root_positions[:, :1, :] * t.tensor([[[1.0, 1.0, 0.0]]]).to(mujoco_qpos.device) + first_frame_position + + mujoco_qpos[:, :, 3: 7] = matrix_to_quaternion(rot_matrix) + mujoco_qpos[:, :, :3] = root_positions + return mujoco_qpos + + def _should_regenerate(self, input: dict): + + idle_mode_id = list(self._clip_holder.CLIPS.keys()).index('idle') + if self.frames['mode'] is not None and self.frames['mode'].item() == idle_mode_id and \ + input['mode'].item() == idle_mode_id: + return False + + return True diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/utils.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..8159351cb075b31a07a20bab7ea1c0ce943cca7b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/demo/utils.py @@ -0,0 +1,135 @@ +import os +import numpy as np +import mujoco +from types import SimpleNamespace +import torch as t +from motionbricks.motion_backbone.inference.motion_inference import motion_inference +from motionbricks.motion_backbone.demo.controllers import WASD_controller, random_controller +from motionbricks.exp_setup.experiment import test + +class navigation_demo(object): + def __init__(self, args): + self.args = args + self.full_agent = None + self.controller = None + self.mj_model = None + self.mj_data = None + self._parse_args() + self._initialize_inference_modles() + self._initialize_controller() + self._initialize_mj_simulator() + + def _parse_args(self): + self.args.return_model_configs = True + self.args.return_dataloader = True + + # parse the default path if not given (very likely used by an external project) + # Navigate from motionbricks/motion_backbone/demo/utils.py up to the project root + project_base_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) + if not hasattr(self.args, 'humanoid_scene_xml'): + self.args.humanoid_scene_xml = \ + os.path.abspath(os.path.join(project_base_path, "assets", "skeletons", "g1", "scene_29dof.xml")) + + if not hasattr(self.args, 'skeleton_xml'): + self.args.skeleton_xml = \ + os.path.abspath(os.path.join(project_base_path, "assets", "skeletons", "g1", "g1.xml")) + + if not hasattr(self.args, 'result_dir'): + self.args.result_dir = os.path.abspath(os.path.join(project_base_path, "out")) + + if not hasattr(self.args, 'data_root'): + self.args.data_root = os.path.abspath(os.path.join(project_base_path, "datasets")) + + if not hasattr(self.args, 'clips_ckpt'): + result_dir = getattr(self.args, 'result_dir', os.path.join(project_base_path, "out")) + self.args.clips_ckpt = os.path.abspath(os.path.join(result_dir, "G1-clip.ckpt")) + + if not hasattr(self.args, 'explicit_dataset_folder'): + self.args.explicit_dataset_folder = \ + os.path.abspath(os.path.join(project_base_path, "datasets", "motionbricks-G1")) + + def _initialize_inference_modles(self): + reprocess_clips = getattr(self.args, 'reprocess_clips', False) # useful for debugging & development + if self.args.clips_ckpt is None or (not os.path.exists(self.args.clips_ckpt)) or reprocess_clips: + models, confs, train_dataloader, val_dataloader = test(self.args) + self.args.train_dataloader = train_dataloader + self.args.val_dataloader = val_dataloader + else: + self.args.return_dataloader = False + models, confs = test(self.args) + self.args.train_dataloader = None + self.args.val_dataloader = None + + for model_name in ['pose', 'root']: + state_dict = t.load(confs[model_name].ckpt_path)['state_dict'] + models[model_name].load_state_dict(state_dict) + self.inferencer = motion_inference(models, models['pose'].args) + + from motionbricks.motion_backbone.demo.full_agent import full_navigation_agent + target_root_realignment = getattr(self.args, 'target_root_realignment', True) + source_root_realignment = getattr(self.args, 'source_root_realignment', True) + force_canonicalization = getattr(self.args, 'force_canonicalization', True) + skip_ending_target_cond = getattr(self.args, 'skip_ending_target_cond', False) + speed_scale = getattr(self.args, 'speed_scale', [0.8, 1.2]) if \ + getattr(self.args, 'random_speed_scale', False) else [1.0, 1.0] + self.full_agent = full_navigation_agent(self.inferencer, self.args.train_dataloader, device='cuda', + speed_scale=speed_scale, + target_root_realignment=target_root_realignment, + source_root_realignment=source_root_realignment, + force_canonicalization=force_canonicalization, + skeleton_xml=self.args.skeleton_xml, + skip_ending_target_cond=skip_ending_target_cond, + filter_qpos=getattr(self.args, 'pre_filter_qpos', True), + clips=self.args.clips, + ckpt_path=self.args.clips_ckpt, + reprocess_clips=reprocess_clips, + val_dataloader=self.args.val_dataloader).to('cuda') + + def _initialize_controller(self): + lookat_movement_direction = getattr(self.args, 'lookat_movement_direction', False) + min_tokens = self.inferencer._args['min_tokens'] + max_tokens = self.inferencer._args['max_tokens'] + + if self.args.controller == "wasd": + self.controller = WASD_controller(lookat_movement_direction=lookat_movement_direction, + clips=self.args.clips, min_token=min_tokens, max_token=max_tokens) + + elif self.args.controller == "random": + max_angle_change_between_controls = getattr(self.args, 'max_angle_change_between_controls', 0.5 * np.pi) + self.controller = random_controller(disable_running=getattr(self.args, 'disable_running', True), + lookat_movement_direction=lookat_movement_direction, + new_control_dt=getattr(self.args, 'new_control_dt', 2.0), + max_angle_change_between_controls=max_angle_change_between_controls, + clips=self.args.clips, min_token=min_tokens, max_token=max_tokens) + + else: + raise ValueError(f"Controller {self.args.controller} is not supported") + + def _initialize_mj_simulator(self): + self.mj_model, self.mj_data = build_mj_simulator(self.args.humanoid_scene_xml, self.inferencer.motion_rep.fps) + + +def build_mj_simulator(humanoid_xml: str, fps: int = 30, build_dummy_mj_simulator: bool = False): + if build_dummy_mj_simulator: + # mj_model provide a value called qpos + mj_model = SimpleNamespace(opt=SimpleNamespace(timestep=1 / fps)) + mj_data = SimpleNamespace(qpos=np.zeros(36)) # 36 is the number of qpos for humanoid of G1 + else: + mj_model = mujoco.MjModel.from_xml_path(humanoid_xml) + mj_data = mujoco.MjData(mj_model) + # Disable advanced visual effects for better performance + mj_model.vis.global_.offwidth = 1920 + mj_model.vis.global_.offheight = 1080 + mj_model.vis.quality.shadowsize = 0 # Disable shadows + + mj_model.vis.rgba.fog = [0, 0, 0, 0] # Disable fog + + # Disable advanced lighting effects + mj_model.vis.headlight.ambient = [0.8, 0.8, 0.8] # Increase ambient light + mj_model.vis.headlight.diffuse = [0.8, 0.8, 0.8] # Increase diffuse light + mj_model.vis.headlight.specular = [0.1, 0.1, 0.1] # Reduce specular highlights + + mj_model.opt.timestep = 1 / fps + return mj_model, mj_data + + diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9a812e189e2185a14afad14300918fdc47ada3a5 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/__pycache__/motion_inference.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/__pycache__/motion_inference.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1bea5890ca1f1d857bbb6f3568233a0c9cf31271 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/__pycache__/motion_inference.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/motion_inference.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/motion_inference.py new file mode 100644 index 0000000000000000000000000000000000000000..64b2dde617873e17d1b51d220fc3fbb5ea2773f4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/inference/motion_inference.py @@ -0,0 +1,393 @@ +from typing import Dict +import torch as t +import numpy as np +from motionbricks.motion_backbone.models.sampling import gumbel_sample +from motionbricks.motion_backbone.models.pose_model import MotionModel as pose_model_cls +from motionbricks.motion_backbone.models.root_model import MotionModel as root_model_cls +from motionbricks.vqvae.neural_modules.vqvae import VQVAE as vqvae + +from motionbricks.helper.data_training_util import extract_feature_from_motion_rep + +import copy + +class motion_inference(t.nn.Module): + """ @brief: For simplicity, we are mostly likely ONLY CONSIDER batch_size=1 cases + """ + BATCH_SIZE = 1 # batch size > 1 supported as well + + # the feature type of `local_pose` provided to the `predict` function (externally provided) + EXTERNAL_POSE_FEATURE_MODE = "joint_positions_and_rotations" + # the feature type of `global_root` and `local_root` provided to the `predict` function (externally provided) + EXTERNAL_ROOT_FEATURE_MODE = "root" + # this is the feature of `local_pose` used by all three modes: vqvae, pose, root + INTERNAL_POSE_FEATURE_MODE = "joint_positions_and_rotations_and_hip_height" + EPS = 1e-5 + + def __init__(self, models: list, args: Dict, device: str = 'cuda'): + super(motion_inference, self).__init__() + self._pose_model: pose_model_cls = models['pose'].eval().to(device) + self._root_model: root_model_cls = models['root'].eval().to(device) + self._vqvae_pose_model: vqvae = self._pose_model.supporting_nets['pose_net'].eval().to(device) + + self.global_motion_rep = self._pose_model.global_motion_rep + self.local_motion_rep = self._pose_model.local_motion_rep + self.motion_rep = self._pose_model.motion_rep # the dual representation + + self._args = args + self._device = device + self._IS_ROOT_MODEL_TOKENIZED = self._root_model.backbone_net.IS_MODEL_TOKENIZED + + assert self._pose_model.backbone_net.initted and self._pose_model.vqvae_model_loaded \ + and self._root_model.vqvae_model_loaded, "The model should be initialized before inference." + assert not self._IS_ROOT_MODEL_TOKENIZED, "The root model is not tokenized." + + def predict(self, + global_root_values: t.Tensor, has_global_root_values: t.Tensor, + local_root_values: t.Tensor, has_local_root_values: t.Tensor, + local_poses: t.Tensor, has_local_poses: t.Tensor, + num_tokens: t.Tensor, + text_embeddings: t.Tensor = None, has_text_embeddings: t.Tensor = None, + allowed_pred_num_tokens: t.Tensor = None, + config: dict = {}, info: dict= {}): + + """ @param input_data: a dictionary containing the following keys: + All these values are in unnormalized form. Note the root/pose information of the first 4 frames are always + assumed to be given + + @input global_root_values: [batch, numConstrainFrames=8, 5] # required + @input has_global_root_values: [batch, numConstrainFrames=8] # required + + @input local_root_values: [batch, numConstrainFrames=8, 4] # required + @input has_local_root_values: [batch, numConstrainFrames=8] # required + + @input local_poses: [batch, numConstrainFrames=8, featdim] # required + @input has_local_pose: [batch, numConstrainFrames=8] # required + + @input num_tokens: [batch, 1] # optional + + """ + batch_size, device, dtype = has_global_root_values.shape[0], has_global_root_values.device, local_poses.dtype + num_frames_per_token = self._pose_model.backbone_net.get_num_frames_per_token() + if not (t.all(has_global_root_values[:, :num_frames_per_token]) and + t.all(has_local_root_values[:, :num_frames_per_token]) and + t.all(has_local_poses[:, :num_frames_per_token])): + if not getattr(self, 'WARNING_PRINTED', False): + print("WARNING: you are advised to provide all first 4 frames.") + self.WARNING_PRINTED = True # print warning only once + if type(num_tokens) == int: + num_tokens = t.full([batch_size, 1], num_tokens, dtype=t.int).to(device) + elif num_tokens is None: # indicate the length of the motion is not provided; needs to be predicted + num_tokens = \ + self._root_model.backbone_net.MASKED_NUM_TOKENS * t.ones([batch_size, 1], dtype=t.int).to(device) + + # step 1: recenter the global root values so that the motions always start from (0.0f, 0.0f) + batch = {} + + batch['reference_start_root_global_offsets'], batch['reference_start_root_global_heading'], \ + recentered_global_root_values = self._extract_initial_root_info(global_root_values) + + batch['global_root_values'] = self.global_motion_rep.normalize(recentered_global_root_values) + batch['local_root_values'] = self.local_motion_rep.normalize(local_root_values) + + local_pose_feat_idx = extract_feature_from_motion_rep( + t.zeros([1, 1, len(self.local_motion_rep.indices['all'])]), + self.local_motion_rep, self.INTERNAL_POSE_FEATURE_MODE, fetch_feat_idx=True + ) + global_height_values = \ + recentered_global_root_values[:, :, self.global_motion_rep.indices['global_root_pos'][[1]]] + mean = self.local_motion_rep.stats.mean[None, None, local_pose_feat_idx].to(device=device, dtype=dtype) + std = self.local_motion_rep.stats.std[None, None, local_pose_feat_idx].to(device=device, dtype=dtype) + batch['local_poses'] = \ + (t.concat([global_height_values, local_poses], dim=-1) - mean) / t.sqrt(std ** 2 + self.EPS) + + batch['has_global_root_values'] = has_global_root_values + batch['has_local_root_values'] = has_local_root_values + batch['has_local_poses'] = has_local_poses + batch['text_embeddings'] = text_embeddings + batch['has_text_embeddings'] = has_text_embeddings + batch['num_tokens'] = num_tokens + batch['allowed_pred_num_tokens'] = allowed_pred_num_tokens + + # step 2: run the root model to predict the number of tokens and the root tokens + batch['pred_num_tokens'], batch['pred_global_root_values'], batch['pred_local_root_values'] = \ + self._predict_root_trajectories(batch, config) + + # step 3: pred the pose tokens (1 iteration for now but also support multiple iterations) + batch['pred_pose_tokens'], batch['pred_pose_cond'], batch['pred_has_pose_cond'] = \ + self._predict_pose_tokens(batch, config, info) + + # step 4: decode the pose tokens and root prediction to reconstruct the poses + batch['pred_local_poses'], batch['pred_global_poses'] = \ + self._decode_motions_from_predicted_root_and_pose_tokens(batch, config, info) + + # step 5: apply the global root transforms to restore into the original world coordinates + batch['pred_global_poses'] = self._reapply_initial_root_info(batch) + + return batch['pred_global_poses'], batch['pred_num_tokens'] + + def _sample_tokens_with_highest_prob(self, pose_tokens: t.Tensor, pose_tokens_prob: t.Tensor, + pred_num_tokens: t.Tensor, step: int, num_pose_inference_steps: int): + + batch_size, device = pose_tokens.shape[0], pose_tokens.device + rand_mask_prob = np.cos(float(step) / num_pose_inference_steps * np.pi * 0.5) + num_pose_heads = self._pose_model.backbone_net.get_num_heads()[0] + num_tokens = self._args['max_tokens'] * self._pose_model.backbone_net.get_num_heads()[0] + + num_pose_token_masked = t.clip((rand_mask_prob * pred_num_tokens * + self._pose_model.backbone_net.get_num_heads()[0]).int(), min=1) + + # the padded tokens is not part of the masking process; give them +inf prob so that they are never masked + pose_tokens_prob = t.where(t.arange(self._args['max_tokens']).to(device).view([batch_size, -1, 1]) < + pred_num_tokens.view([batch_size, 1, 1]).repeat([1, 1, num_pose_heads]), + pose_tokens_prob, t.full_like(pose_tokens_prob, t.inf)) + + # remove pose tokens with the least prob from pose_tokens_prob (sort) + indices = pose_tokens_prob.view([batch_size, -1]).sort(descending=False)[1] + tokens_to_be_masked = t.arange(num_tokens).tile([self.BATCH_SIZE, 1]).to(self._device) < num_pose_token_masked + indices = indices * tokens_to_be_masked + indices[:, :1] * (~tokens_to_be_masked) + + pose_tokens = pose_tokens.view([batch_size, -1]).clone() + pose_tokens.scatter_(dim=-1, index=indices, value=self._pose_model.backbone_net.POSE_MASK_ID) + return pose_tokens.view([batch_size, self._args['max_tokens'], -1]) + + @property + def device(self): + return self._device + + def _extract_initial_root_info(self, global_root_values: t.Tensor): + """ @brief: save the initial global root offsets and global heading information here so that we could + cannonicalize the input to the network and de-canonicalize the output. + NOTE: Since we are using a model where features are not relative to the root rotation transform, + for the input, we don't rotate the root heading to 0.0f; we only move the root position to (0.0f, 0.0f). + + But for the output, since the `local_to_global` function does not have the initial heading, we log the initial + heading and add back the heading to the output, despite headings are not used to reconstruct the character's + joint transforms. + """ + reference_start_root_global_offsets = \ + global_root_values[:, :1, self.global_motion_rep.indices['global_root_pos_2d']].clone() + _, reference_start_root_global_heading = \ + self.global_motion_rep.compute_root_pos_and_rot(global_root_values[:, :1, :], + return_angle=True, return_quat=False) + + recentered_global_root_values = global_root_values.clone() + recentered_global_root_values[:, :, self.global_motion_rep.indices['global_root_pos_2d']] -= \ + reference_start_root_global_offsets + + return reference_start_root_global_offsets, reference_start_root_global_heading, recentered_global_root_values + + def _reapply_initial_root_info(self, batch: dict): + """ @brief: The follow-up function of `_extract_initial_root_info` to recover the global information. + """ + _, root_rot_angle = self.global_motion_rep.compute_root_pos_and_rot(batch['pred_global_poses'], + return_angle=True, return_quat=False) + + corrective_angle = batch['reference_start_root_global_heading'].reshape(root_rot_angle[..., 0].shape) + new_angles = root_rot_angle + corrective_angle[..., None] # [Batch, T] + + new_heading = t.stack([t.cos(new_angles), t.sin(new_angles)], dim=-1) + + batch['pred_global_poses'][:, :, self.global_motion_rep.indices['global_root_pos_2d']] += \ + batch['reference_start_root_global_offsets'] + batch['pred_global_poses'][:, :, self.global_motion_rep.indices['global_root_heading']] = new_heading + return batch['pred_global_poses'] + + def _predict_root_trajectories(self, batch: dict = {}, config: dict = {}): + """ @brief: run the root module here to pred how many frames are between the keyframes and predict the local + and global root trajectories. + """ + # NOTE: the root module's output is the global root values; it has to be "root" in feature mode + assert self._root_model.args['local_root_feature'] == self.EXTERNAL_ROOT_FEATURE_MODE, \ + self._root_model.args['global_root_feature'] == self.EXTERNAL_ROOT_FEATURE_MODE + assert self._root_model.args['local_pose_feature'] == self.INTERNAL_POSE_FEATURE_MODE, \ + f"All submodules should only use {self.INTERNAL_POSE_FEATURE_MODE} as the local pose feature." + assert self.EXTERNAL_ROOT_FEATURE_MODE == 'root', "Only support full root features for root model." + + num_frames_per_token = self._pose_model.backbone_net.get_num_frames_per_token() + assert num_frames_per_token == self._root_model.backbone_net.get_num_frames_per_token() + + root_model_outputs = self._root_model.backbone_net( + batch['global_root_values'], batch['has_global_root_values'], + batch['local_root_values'], batch['has_local_root_values'], + batch['local_poses'], batch['has_local_poses'], batch['num_tokens'], + text_embeddings=batch['text_embeddings'], has_text_embeddings=batch['has_text_embeddings'], + allowed_pred_num_tokens=batch['allowed_pred_num_tokens'], + config=config + ) + + pred_num_tokens = root_model_outputs['pred_num_tokens'] + pred_global_root_values = root_model_outputs['pred_global_root_values'] + if config.get('debug_ground_truth_root_trajectories', None) is not None: + pred_num_tokens[:] = config['debug_ground_truth_root_trajectories'].shape[1] // num_frames_per_token + pred_global_root_values[:, :config['debug_ground_truth_root_trajectories'].shape[1]] = \ + config['debug_ground_truth_root_trajectories'] # both normalized + pred_local_root_values = \ + self.motion_rep.dual_rep.global_to_local(pred_global_root_values, is_normalized=True, to_normalize=True, + lengths=pred_num_tokens * num_frames_per_token) + + # now be very careful with the final root motion; since the raw calculation could be very incorrect + estimated_final_local_root_motion = \ + t.gather(pred_local_root_values, 1, + pred_num_tokens.long().repeat([1, 4])[:, None, :] * num_frames_per_token - 1) # why was this -2? + local_root_feat_dim = len(self.local_motion_rep.indices['root']) + final_local_root_motion = \ + batch['has_local_root_values'][:, -1:, None].expand([-1, -1, local_root_feat_dim]).float() * \ + batch['local_root_values'][:, -1:] + \ + (1 - batch['has_local_root_values'][:, -1:, None].expand([-1, -1, local_root_feat_dim]).float()) * \ + estimated_final_local_root_motion + pred_local_root_values = pred_local_root_values.scatter( + 1, pred_num_tokens.long().repeat([1, 4])[:, None, :] * num_frames_per_token - 1, final_local_root_motion + ) # replace the last velocity with the second last velocity + + return pred_num_tokens, pred_global_root_values, pred_local_root_values + + def _predict_pose_tokens(self, batch: dict = {}, config: dict = {}, info: dict = {}): + """ @brief: run the pose module here to pred the pose tokens.""" + # NOTE: the root module's output is the global root values; it has to be "root" in feature mode + assert self._pose_model.args['local_pose_feature'] == self.INTERNAL_POSE_FEATURE_MODE + assert self.INTERNAL_POSE_FEATURE_MODE == "joint_positions_and_rotations_and_hip_height" + assert (self._pose_model.args['cond_root_feature_is_from_motion_rep'] == 'local' and + self._pose_model.args['cond_root_feature'] == 'root_without_hip_height_without_heading') or \ + (self._pose_model.args['cond_root_feature_is_from_motion_rep'] == 'global' and + self._pose_model.args['cond_root_feature'] == 'root_without_hip_height'), \ + "These are the only two root cond feature combination supported." + + # collect the configs and construct initial input data + num_pose_heads, num_frames_per_token = \ + self._pose_model.backbone_net.get_num_heads()[0], self._pose_model.backbone_net.get_num_frames_per_token() + batch_size, device = batch['local_poses'].shape[0], batch['local_poses'].device + num_pose_inference_steps = config.get('num_inference_step', 1) + + pose_tokens = t.full([batch_size, self._args['max_tokens'], num_pose_heads], + self._pose_model.backbone_net.POSE_MASK_ID).to(device) + chosen_pose_tokens_prob = \ + t.full([batch_size, self._args['max_tokens'], num_pose_heads], 1.0 / num_pose_heads).to(device) + + pose_cond = t.concat([batch['local_poses'][:, :num_frames_per_token], + t.zeros([batch_size, (self._args['max_tokens'] - 1) * num_frames_per_token, + batch['local_poses'].shape[-1]]).to(device)], dim=1) + has_pose_cond = \ + t.concat([batch['has_local_poses'][:, :num_frames_per_token], + t.zeros([batch_size, (self._args['max_tokens'] - 1) * num_frames_per_token], + dtype=bool).to(device)], dim=1) + + for i in range(num_frames_per_token): # assign the target pose information dynamically + onehot_idx = t.nn.functional.one_hot( + batch['pred_num_tokens'].view([-1]).long() * num_frames_per_token - num_frames_per_token + i, + num_classes=self._args['max_tokens'] * num_frames_per_token + ) + pose_cond = pose_cond + \ + onehot_idx.float().view([batch_size, -1, 1]) * \ + batch['local_poses'][:, -num_frames_per_token + i].view([batch_size, 1, -1]) + has_pose_cond = t.logical_or( + has_pose_cond, (onehot_idx.float().view([batch_size, -1]) * + batch['has_local_poses'][:, -num_frames_per_token + i].view([batch_size, 1])).bool() + ) + + for step in range(num_pose_inference_steps): + pose_tokens = self._sample_tokens_with_highest_prob(pose_tokens, chosen_pose_tokens_prob, + batch['pred_num_tokens'], + step, num_pose_inference_steps) + assert self._args['cond_root_feature_is_from_motion_rep'] in ['local', 'global'] + if self._args['cond_root_feature_is_from_motion_rep'] == 'local': + pose_root_cond = \ + extract_feature_from_motion_rep(batch['pred_local_root_values'], self.local_motion_rep, + self._pose_model.args['cond_root_feature']) + else: + assert self._args['cond_root_feature_is_from_motion_rep'] == 'global' + pose_root_cond = \ + extract_feature_from_motion_rep(batch['pred_global_root_values'], self.global_motion_rep, + self._pose_model.args['cond_root_feature']) + + pose_model_output = self._pose_model.backbone_net( + pose_tokens, pose_root_cond, pose_cond, has_pose_cond, + batch['pred_num_tokens'], batch['text_embeddings'], batch['has_text_embeddings'] + ) + if config.get('pose_token_sampling_use_argmax', False): + pose_tokens = pose_model_output['pose_logits'].argmax(dim=-1) + else: + pose_tokens = gumbel_sample(pose_model_output['pose_logits'], temperature=1.0) + pose_tokens_prob = pose_model_output['pose_logits'].softmax(dim=-1) + chosen_pose_tokens_prob = pose_tokens_prob.gather(dim=-1, index=pose_tokens.unsqueeze(-1)).squeeze(-1) + + if config.get('debug_ground_truth_pose_tokens', None) is not None: + pose_tokens[:, :config['debug_ground_truth_pose_tokens'].shape[1]] = \ + config['debug_ground_truth_pose_tokens'][:, :] + + return pose_tokens, pose_cond, has_pose_cond # pose cond and has_pose cond are re-used in the decoder + + def _decode_motions_from_predicted_root_and_pose_tokens(self, batch: dict = {}, config: dict = {}, info: dict = {}): + """ @brief: decode the pose tokens and root prediction to reconstruct the poses""" + if getattr(self._pose_model.args, 'pose_vqvae_motion_rep', 'local'): + assert self._vqvae_pose_model.motion_rep.name == 'local' + assert self._vqvae_pose_model.decoder_external_cond_feature_mode == \ + "root_without_hip_height_without_heading" + else: + assert self._vqvae_pose_model.motion_rep.name == 'global' + assert self._vqvae_pose_model.decoder_external_cond_feature_mode == \ + "root_without_hip_height_without_heading_with_mask" + + assert self._vqvae_pose_model.decoder_target_cond_feature_mode == self.INTERNAL_POSE_FEATURE_MODE + + pose_external_root_cond = extract_feature_from_motion_rep( + batch['pred_local_root_values'] if self._vqvae_pose_model.motion_rep.name == 'local' \ + else batch['pred_global_root_values'], + self._vqvae_pose_model.motion_rep, self._vqvae_pose_model.decoder_external_cond_feature_mode + ) + if self._vqvae_pose_model.motion_rep.name == 'global': + raise NotImplementedError("The global root feature is not supported yet.") + + batch_size, device = batch['local_poses'].shape[0], batch['local_poses'].device + pose_token_mask = t.arange(self._args['max_tokens']).to(device)[None, :].repeat([batch_size, 1]) < \ + batch['pred_num_tokens'].view([batch_size, 1]) + + if type(config.get("use_target_cond_in_decoder", True)) == t.Tensor: + # if a False tensor is provided, mask out all target condition here + global_target_cond = config["use_target_cond_in_decoder"].bool().expand_as(batch['pred_has_pose_cond']) + has_target_cond = t.logical_and(batch['pred_has_pose_cond'], global_target_cond) + else: + assert type(config.get("use_target_cond_in_decoder", True)) == bool + has_target_cond = batch['pred_has_pose_cond'] \ + if config.get("use_target_cond_in_decoder", True) else t.zeros_like(batch['pred_has_pose_cond']).bool() + if not config.get('use_constraints_at_decoder', True): + has_target_cond = t.zeros_like(has_target_cond).bool() # disable the target cond + if config.get('skip_ending_target_cond', False): + # skip the ending target cond; useful for inprecise ending target cond; can improve the foot steps + num_frames_per_token = self._pose_model.backbone_net.get_num_frames_per_token() + has_target_cond[:, num_frames_per_token:] = False + + pred_poses = self._vqvae_pose_model.forward_decoder(batch['pred_pose_tokens'], + target_cond=batch['pred_pose_cond'], + has_target_cond=has_target_cond, + external_cond=pose_external_root_cond, + use_overall_indices=False, + token_mask=pose_token_mask)['recon_state'] + + num_pred_frames = batch['pred_num_tokens'] * self._pose_model.backbone_net.get_num_frames_per_token() + if self._vqvae_pose_model.motion_rep.name == 'local': + # NOTE: the pred_global_poses has incorrect heading since the accumlation function of `local_to_global` + # does not have initial heading information; luckily the inverse function which reconstruct the final + # results will not use the heading feature at all so it won't affect the final pose outputs + pred_global_poses = self.motion_rep.dual_rep.local_to_global(pred_poses, is_normalized=True, + to_normalize=False, lengths=num_pred_frames) + pred_local_poses = self.local_motion_rep.unnormalize(pred_poses) + else: + pred_local_poses = self.motion_rep.dual_rep.global_to_local(pred_poses, is_normalized=True, + to_normalize=False, lengths=num_pred_frames) + pred_global_poses = self.global_motion_rep.unnormalize(pred_poses) + + if config.get('final_root_pred_mode', 'from_pose_module') == 'from_pose_module': + # use the root prediction from the pose module; do nothing here + pass + elif config['final_root_pred_mode'] == 'from_root_module': + # use the direct root prediction from the root module + local_root_index, global_root_index = \ + self.local_motion_rep.indices['root'], self.global_motion_rep.indices['root'] + + pred_global_poses[:, :, global_root_index] = \ + self.global_motion_rep.unnormalize(batch['pred_global_root_values']) + pred_local_poses[:, :, local_root_index] = \ + self.local_motion_rep.unnormalize(batch['pred_local_root_values']) + else: + raise NotImplementedError(f"Not supported yet {config['final_root_pred_mode']}.") + return pred_local_poses, pred_global_poses diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2233e41b3ed16cede8411e99ffd0326cb8a5f88 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/pose_model.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/pose_model.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8dc212da93099a9f9c8091b73d38b248c6d6f0dd Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/pose_model.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/root_model.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/root_model.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e34fbb8d30a23355a579b565e9e3242cf988850 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/root_model.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/sampling.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/sampling.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43ecf79f19cc552395034b18b7aa270860fd1757 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/__pycache__/sampling.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/pose_model.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/pose_model.py new file mode 100644 index 0000000000000000000000000000000000000000..cad99300ef2439dcf82840609137cb661842478f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/pose_model.py @@ -0,0 +1,382 @@ +from motionbricks.vqvae.neural_modules import vqvae +from motionbricks.motion_backbone.neural_modules.pose_backbone import pose_backbone_network +import torch as t +import os +import logging +from typing import Callable, Optional, Union, Dict + +import torch +from pytorch_lightning import LightningModule +from motionbricks.motionlib.core.motion_reps import MotionRepBase +import numpy as np +from motionbricks.motionlib.core.motion_reps.dual_root_global_joints import GlobalRootGlobalJoints, LocalRootGlobalJoints +from motionbricks.helper.data_training_util import sample_motion_segments_from_motion_clips +from motionbricks.helper.data_training_util import sample_keyframes, extract_feature_from_motion_rep + +log = logging.getLogger(__name__) + + +class MotionModel(LightningModule): + """ @brief: Pose model that predicts discrete pose tokens given root motion and optional pose constraints. + + @input local_root_values: [batch, numFrames, root_dim] # required + @input pose_cond: [batch, numConstrainFrames=[0, 10], featdim] # optional + @input has_pose_cond: [batch, numConstrainFrames=[0, 10]] (int) # required; where poses are provided + @input num_tokens: [batch, 1] # required + @input pose_tokens: [batch, numTokens, num_pose_heads] # required; could be all masked + @input text_embedding: [batch, numTokens, text_embedding_dim] # optional + + @output pose_logits: [batch, numTokens, num_pose_heads, num_codes] + """ + + def __init__(self, + pose_vqvae_network: vqvae.VQVAE, + root_vqvae_network: Union[None, vqvae.VQVAE], + backbone_network: pose_backbone_network, + motion_rep: MotionRepBase, + optimizer: Callable[[list], torch.optim.Optimizer] = None, + scheduler: Optional[Callable[[torch.optim.Optimizer], torch.optim.lr_scheduler.LRScheduler]] = None, + device: Optional[Union[str, torch.device]] = None, + args: Dict = None, + # the other key args here: most of them for compatibility only and won't be used at all + **kwargs): + super().__init__() + + self.optimizer = optimizer + self.scheduler = scheduler + + self._supporting_networks = {'pose_net': pose_vqvae_network, 'root_net': root_vqvae_network} + self.backbone_net = backbone_network + + self.motion_rep: GlobalRootGlobalJoints = motion_rep + self.global_motion_rep: GlobalRootGlobalJoints = motion_rep.dual_rep.global_motion_rep + self.local_motion_rep: LocalRootGlobalJoints = motion_rep.dual_rep.local_motion_rep + + self.DEFAULT_NUM_JOINTS = self.motion_rep.num_joints + self._args = args + self.one_logger_callback = kwargs.get("one_logger_callback", None) + self.callbacks = [] + + self._load_vqvae_models() + + if device is not None: + self.pose_net = self._supporting_networks['pose_net'].to(device) + self.root_net = self._supporting_networks['root_net'].to(device) \ + if root_vqvae_network is not None else None + self.backbone_net = self.backbone_net.to(device) + + self._supporting_networks['pose_net'].requires_grad_ = False + self._supporting_networks['pose_net'] = self._supporting_networks['pose_net'].eval() + if self._supporting_networks['root_net'] is not None: + self._supporting_networks['root_net'].requires_grad_ = False + self._supporting_networks['root_net'] = self._supporting_networks['root_net'].eval() + + def _load_vqvae_models(self): + """ @brief: load the vqvae models and init the backbone's input embedding. + """ + self._vqvae_model_loaded = False + vqvae_model_ckpt_path = self._args.vqvae_model_ckpt_path + if os.path.exists(vqvae_model_ckpt_path): + vqvae_model_weights = t.load(vqvae_model_ckpt_path)['state_dict'] + with t.no_grad(): + for sub_network in ['pose_net', 'root_net']: + if self._supporting_networks[sub_network] is None: + continue + for key, val in self._supporting_networks[sub_network].state_dict().items(): + src = vqvae_model_weights[sub_network + '.' + key] + if val.shape != src.shape: + src = src.reshape(val.shape) + val.copy_(src) + self._vqvae_model_loaded = True + + if not self.backbone_net.initted: # the backbone's input embeddings are not initted; init with vqvae weights + pose_codebook = self._supporting_networks['pose_net'].get_codebook() + root_codebook = self._supporting_networks['root_net'].get_codebook() \ + if self._supporting_networks['root_net'] is not None else None + self.backbone_net.init_embedding_from_codebooks(pose_codebook, root_codebook) + else: + print(f"No VQVAE model checkpoint path available; Assuming the vqvae weights are intergrated in the model") + + def configure_optimizers(self): + if self.one_logger_callback is not None: + self.one_logger_callback.on_optimizer_init_start() + optimizer = self.optimizer(self.parameters()) + if self.one_logger_callback is not None: + self.one_logger_callback.on_optimizer_init_end() + if not self.scheduler: + return optimizer + + lt_kwargs = dict(self.scheduler.keywords.pop("lt_kwargs", {})) + lt_kwargs["scheduler"] = self.scheduler(optimizer) + return {"optimizer": optimizer, "lr_scheduler": lt_kwargs} + + def set_callbacks(self, callbacks: list): + self.callbacks = callbacks + + def configure_callbacks(self): + return self.callbacks + + def inference_step(self, batch, batch_idx, requires_grad=False, meta_info: Dict = {}): + if not hasattr(self, "_printed_inference_warning"): + self._printed_inference_warning = True + print("Warning: Pose model does not have an explicit inference step. Reusing training step.") + with t.no_grad(): + return self.training_step(batch, batch_idx, use_outside_training=True, meta_info=meta_info) + + def training_step(self, batch, batch_idx, use_outside_training: bool = False, meta_info: Dict = {}): + """ @brief: the training step takes input a normalized motion representation. + batch.keys() -> dict_keys(['motion', 'motion_len', 'motion_pad_mask', 'batch_size']) + """ + assert self.training or use_outside_training, \ + "It's possible to use training_step on evaluation set. But otherwise self.training should be true." + + # step 0: data preparations for model training; generate both global and local motions that could be used later + batch_size, device = batch['batch_size'], batch['motion'].device + raw_global_motions, motion_lengths, _ = \ + batch.pop('motion'), batch.pop('motion_len'), batch.pop('motion_pad_mask') + if self.backbone_net.ACCEPT_TEXT_EMB_INPUT: + _, _, _ = batch.pop('text'), batch.pop('text_len'), batch.pop('text_pad_mask') + augmented_batch_size = int(batch_size * self._args['batchsize_mul_factor']) + + num_token_position = np.random.choice(np.arange(self._args['min_tokens'], self._args['max_tokens'] + 1)) + batch['num_tokens'] = t.full([augmented_batch_size, 1], num_token_position).to(device) + num_frames = num_token_position * self.backbone_net.get_num_frames_per_token() + + valid_samples_id = (motion_lengths >= num_frames + 1) # 1 additional frame for global-local convertion + num_invalid_samples = batch_size - valid_samples_id.sum() + if num_invalid_samples > batch_size // 2: + return None # don't have enough valid data samples, skipping this batch + + sample_info = {} + global_motions = sample_motion_segments_from_motion_clips(raw_global_motions, motion_lengths, + num_frames, + self.args['batchsize_mul_factor'], info=sample_info, + motion_rep=self.global_motion_rep) + actual_batch_size = int(batch_size * self.args['batchsize_mul_factor']) + batch['text_embeddings'] = None if (not self.backbone_net.ACCEPT_TEXT_EMB_INPUT) else \ + batch.pop('text_feat')[sample_info['chosen_ids']].view([augmented_batch_size, -1]) + + # step 3: prepares the global & local input motions to the pose and root vqvae models + first_frame_heading_angle = t.rand(actual_batch_size).to(device) * np.pi * 2.0 \ + if not self.motion_rep.compute_kwargs['removing_heading'] else 0.0 + global_motions = self.global_motion_rep.change_first_heading( + global_motions, first_frame_heading_angle, is_normalized=True, to_normalize=True + ) # note this `change_first_heading` also moves the first frame to the origin + local_motions = self.motion_rep.dual_rep.global_to_local( + global_motions, is_normalized=True, to_normalize=True, + lengths=t.full([actual_batch_size], global_motions.shape[1]).to(device) + ) + local_motions, global_motions = \ + local_motions[:, :num_frames, :], global_motions[:, :num_frames, :] # drop last velocity padding frame + batch['local_motions'], batch['global_motions'] = local_motions, global_motions + + # step 1: generate the pose_tokens; note we also mask / perturb the code indices in training + # the shape of @input_tokens is [batch, numTokens, num_pose_heads] + if 'groundtruth_pose_tokens' not in batch: + self.move_supporting_nets_to_device(device) + with t.no_grad(): + assert self._supporting_networks['pose_net'].motion_rep.name in ['local', 'global'] + pose_net_input = batch['local_motions'] \ + if self._supporting_networks['pose_net'].motion_rep.name == 'local' else batch['global_motions'] + pose_tokens = \ + self._supporting_networks['pose_net'].encode_into_idx(pose_net_input, fetch_overall_indices=False) + batch['groundtruth_pose_tokens'] = pose_tokens + + num_pose_heads, _ = self.backbone_net.get_num_heads() + batch['groundtruth_pose_tokens'] = \ + batch['groundtruth_pose_tokens'].view([augmented_batch_size, num_token_position, num_pose_heads]) + batch['focused_token_mask'], batch['masked_token_mask'], batch['incorrect_token_mask'], \ + batch['correct_token_mask'], batch['mask_percentage'], batch['incorrect_percentage'] = \ + self._get_token_masks(batch) + batch['input_tokens'] = self._generate_tokens_for_training(batch) + + # step 2: the local_root_values at each frame location, has the shape [batch, numFrames, 5] + if self._args['cond_root_feature_is_from_motion_rep'] == 'local': + batch['local_root_values'] = extract_feature_from_motion_rep(batch['local_motions'], self.local_motion_rep, + self._args['cond_root_feature']) + else: + assert self._args['cond_root_feature_is_from_motion_rep'] == 'global' + batch['local_root_values'] = extract_feature_from_motion_rep(batch['global_motions'], self.global_motion_rep, + self._args['cond_root_feature']) + + # step 3: the pose cond and whether a pose condition is provided. NOTE: we are using the dense cond during + # training since it's easier to construct. In inference you could also provide the sparse condition which be + # automatically processed in the @net.forward. + # The dense pose_cond shape: [batch, numframes, featdim], and has_poses_cond shape: [batch, numframes] (bool) + batch['pose_cond'], batch['has_pose_cond'], batch['text_embeddings'], batch['has_text_embeddings'] = \ + self._sample_the_local_pose_conditions(batch['local_motions'], num_frames, batch['text_embeddings']) + + # step 4: core network forward and loss calculation + model_outputs = self.backbone_net(batch['input_tokens'], batch['local_root_values'], + batch['pose_cond'], batch['has_pose_cond'], batch['num_tokens'], + batch['text_embeddings'], batch['has_text_embeddings']) + + losses = self.loss(batch, model_outputs) + + if use_outside_training: # use in an evaluation process + meta_info['losses'] = losses + return None + + for key, val in losses.items(): + self.log(f"loss/train_{key}", val, on_step=True, + on_epoch=True, sync_dist=True, batch_size=batch["batch_size"]) + return losses['loss'] + + def loss(self, batch: Dict, model_output_batch: Dict): + """ @brief: calculate the cross-entropy loss between the predicted pose tokens and the groundtruth. + """ + batch_size, num_positions = \ + batch['groundtruth_pose_tokens'].shape[0], model_output_batch['pose_logits'].shape[1] + pose_logits = model_output_batch['pose_logits'] + groundtruth_tokens = batch['groundtruth_pose_tokens'] + + # only consider the tokens that is focused and not masked + IGNORE_TOKEN_IDS = -100 + target_tokens = t.where(batch['focused_token_mask'].view([batch_size, num_positions, -1]), + groundtruth_tokens, IGNORE_TOKEN_IDS) + + losses = {} + pose_loss = t.nn.functional.cross_entropy(pose_logits.reshape([-1, pose_logits.shape[-1]]), + target_tokens.reshape([-1]).long(), ignore_index=IGNORE_TOKEN_IDS) + + losses['pose_loss'] = pose_loss + losses['loss'] = pose_loss + + return losses + + @property + def args(self): + return self._args + + def _get_token_masks(self, batch: dict): + """ @brief: this is the function which generate the token masks during training. It considers both the + perturbation masks where the tokens are randomly flipped to a different token, as well the mask for the + tokens that are replaced with [MASK] token for the network to predict. + + `focused_token_mask`: indicates all the tokens that is either perturbed, masked, or actually are the correct + ones. This is generated with cosine scheduling. + """ + pose_tokens = batch['groundtruth_pose_tokens'] + batch_size, device = pose_tokens.shape[0], pose_tokens.device + num_pose_heads, _ = self.backbone_net.get_num_heads() + num_token_positions = pose_tokens.shape[1] + + # step 1: calculate the number of tokens for each focused/mask/incorrect/correct types. + # focus = masked + correct + incorrect; The non-focused tokens are always assumed to be known correct tokens. + # The % of focused tokens are generated with the cosine schedule here so that more tokens are sampled. + focus_mask_probs = t.cos(t.pi * 0.5 * (t.zeros([batch_size, 1], device=device).float().uniform_(0, 1))) + incorrect_probs = t.zeros([batch_size, 1], device=device).uniform_(self._args['incorrect_token_ratio_min'], + self._args['incorrect_token_ratio_max']) + num_all_tokens_per_sample = num_pose_heads * num_token_positions + num_focus_tokens = (num_all_tokens_per_sample * focus_mask_probs).int() # [batch, 1] + num_masked_tokens = t.floor(num_focus_tokens * self._args['masked_token_ratio']).int() + num_incorrect_tokens = t.floor((num_focus_tokens - num_masked_tokens) * incorrect_probs).int() + # num_correct_tokens = num_focus_tokens - num_masked_tokens - num_incorrect_tokens + + # step 2: sampling and generate the token masks + random_order = t.rand((batch_size, num_all_tokens_per_sample), device=device).argsort(dim=-1) + focused_token_mask = random_order < num_focus_tokens + masked_token_mask = random_order < num_masked_tokens + incorrect_token_mask = t.logical_and(random_order >= num_masked_tokens, + random_order < num_masked_tokens + num_incorrect_tokens) + correct_token_mask = t.logical_and(random_order >= num_masked_tokens + num_incorrect_tokens, + random_order < num_focus_tokens) + + # step 4: the mask / incorrect level + mask_percentage = masked_token_mask.sum(dim=-1, keepdims=True) / num_all_tokens_per_sample + incorrect_percentage = incorrect_token_mask.sum(dim=-1, keepdims=True) / num_all_tokens_per_sample + + return focused_token_mask, masked_token_mask, incorrect_token_mask, \ + correct_token_mask, mask_percentage, incorrect_percentage + + def _generate_tokens_for_training(self, batch: Dict): + """ @brief: based on the mask and the number of steps, change the tokens accordingly. + """ + batch_size, num_positions_in_a_sample = \ + batch['local_motions'].shape[0], batch['groundtruth_pose_tokens'].shape[1] + + # incorrect tokens + input_tokens = batch['groundtruth_pose_tokens'].clone() + num_codes_pose_vqvae, _ = self.backbone_net.get_num_codes(include_aug_tokens=False) + random_pose_tokens = t.randint_like(input_tokens, high=num_codes_pose_vqvae, low=0) + input_tokens = t.where(batch['incorrect_token_mask'].view([batch_size, num_positions_in_a_sample, -1]), + random_pose_tokens, input_tokens) + + # masked tokens + mask_tokens = t.ones_like(input_tokens) * self.backbone_net.POSE_MASK_ID # the mask ids for the pose + input_tokens = t.where(batch['masked_token_mask'].view([batch_size, num_positions_in_a_sample, -1]), + mask_tokens, input_tokens) + + return input_tokens + + @property + def supporting_nets(self): + return self._supporting_networks + + def move_supporting_nets_to_device(self, device): + assert self._supporting_networks['root_net'] is None, "The root net is not supported in this version." + if next(self._supporting_networks['pose_net'].named_parameters())[1].device != device: + self._supporting_networks['pose_net'] = self._supporting_networks['pose_net'].to(device) + if self._supporting_networks['pose_net'].training: # just make sure they are in eval mode + self._supporting_networks['pose_net'] = self._supporting_networks['pose_net'].eval() + + def _construct_keyframe_prob(self, max_num_keyframes: int = None, no_keyframe_prob: float = 0.0): + """ @brief: generate the prob to sample each keyframe during training. + """ + scheduled_max_num_keyframes = max_num_keyframes * \ + (self.trainer.global_step / self.args['keyframe_num_warmup_steps']) + scheduled_max_num_keyframes = int(max(1, min(scheduled_max_num_keyframes, max_num_keyframes))) + + # construct the probability now; p_keyframe is the same for all keyframes=[1, max_num_keyframes] + # and p_keyframe=0 is the no-keyframe probability + prob_num_keyframes = [1.0 if i > 0 and i <= scheduled_max_num_keyframes else 0.0 + for i in range(max_num_keyframes + 1)] + prob_no_keyframe = no_keyframe_prob + prob_num_keyframes[0] = sum(prob_num_keyframes) / (1 - prob_no_keyframe) * prob_no_keyframe + prob_num_keyframes = np.array(prob_num_keyframes) + prob_num_keyframes /= prob_num_keyframes.sum() + return prob_num_keyframes + + def _sample_the_local_pose_conditions(self, local_motions, num_frames: int, text_embedding: t.Tensor = None): + """ @brief: generate the local pose cond during training. Note the sampling for starting frames, ending frames + and middle frames are done separately. + """ + NUM_START_FRAMES = NUM_END_FRAMES = self.backbone_net.get_num_frames_per_token() + NUM_MIDDLE_FRAMES = num_frames - NUM_START_FRAMES - NUM_END_FRAMES + assert NUM_MIDDLE_FRAMES > 0, "The number of frames should be larger than the number of start and end frames." + + local_pose = \ + extract_feature_from_motion_rep(local_motions, self.local_motion_rep, self._args['local_pose_feature']) + local_pose_component = {'start': local_pose[:, :NUM_START_FRAMES], + 'end': local_pose[:, -NUM_END_FRAMES:], + 'middle': local_pose[:, NUM_START_FRAMES:-NUM_END_FRAMES]} + + component_has_pose_cond, component_pose_cond = {}, {} + for component in ['start', 'end', 'middle']: + prob_num_keyframes = self._construct_keyframe_prob( + self._args[f'max_num_{component}_keyframes'], + no_keyframe_prob=self._args[f'no_{component}_keyframe_prob'] + ) + component_has_pose_cond[component], component_pose_cond[component] = \ + sample_keyframes(local_pose_component[component], + self._args[f'max_num_{component}_keyframes'], prob_num_keyframes) + has_pose_cond = t.cat([component_has_pose_cond['start'], + component_has_pose_cond['middle'], component_has_pose_cond['end']], dim=1) + pose_cond = t.cat([component_pose_cond['start'], + component_pose_cond['middle'], component_pose_cond['end']], dim=1) + + if text_embedding is not None: + assert self.backbone_net.ACCEPT_TEXT_EMB_INPUT, "The model does not accept text embedding as input." + has_text_emb = t.rand([text_embedding.shape[0], 1], device=text_embedding.device) < \ + self._args.get('prob_provide_text_emb', 0.2) + # provide text emb if end keyframes are not there + # has_text_emb = t.logical_or(has_text_emb, component_has_pose_cond['end'].sum(dim=1, keepdims=True) < 1) + text_embedding = t.where(has_text_emb, text_embedding, t.zeros_like(text_embedding)) + else: + text_embedding = has_text_emb = None + + return pose_cond, has_pose_cond, text_embedding, has_text_emb # dense condition and the has_target + + @property + def vqvae_model_loaded(self): + return self._vqvae_model_loaded diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/root_model.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/root_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c522029350867ebaf32b2dc4060fbb8381632b49 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/root_model.py @@ -0,0 +1,308 @@ +from motionbricks.vqvae.neural_modules import vqvae +from motionbricks.motion_backbone.neural_modules.pose_backbone import pose_backbone_network +from motionbricks.motion_backbone.neural_modules.root_backbone import root_backbone_network +import torch as t +import os +import logging +from typing import Callable, Optional, Union, Dict + +import torch +from pytorch_lightning import LightningModule +from motionbricks.motionlib.core.motion_reps import MotionRepBase +import numpy as np +from motionbricks.helper.data_training_util import sample_motion_segments_from_motion_clips +from motionbricks.helper.data_training_util import sample_keyframes, extract_feature_from_motion_rep +from motionbricks.motionlib.core.motion_reps.dual_root_global_joints import GlobalRootGlobalJoints, LocalRootGlobalJoints + +log = logging.getLogger(__name__) + + +class MotionModel(LightningModule): + """ @brief: Root model that predicts continuous global root motion given sparse constraints. + + @input global_root_values: [batch, numConstrainFrames, 5] # optional + @input has_global_root_values: [batch, numFrames] (bool) # required + @input local_root_values: [batch, numConstrainFrames, 4] # optional + @input has_local_root_values: [batch, numFrames] (bool) # required + @input local_poses: [batch, numConstrainFrames, featdim] # optional + @input has_local_poses: [batch, numFrames] (bool) # required + @input num_tokens: [batch, 1] # optional + @input text_embeddings: [batch, text_dim] # optional + + @output pred_global_root_values: [batch, numFrames, 5] + @output num_token_logits: [batch, num_token_classes] + """ + + def __init__(self, + pose_vqvae_network: Optional[vqvae.VQVAE], + root_vqvae_network: Optional[vqvae.VQVAE], + backbone_network: Union[pose_backbone_network, root_backbone_network], + motion_rep: MotionRepBase, + optimizer: Callable[[list], torch.optim.Optimizer] = None, + scheduler: Optional[Callable[[torch.optim.Optimizer], torch.optim.lr_scheduler.LRScheduler]] = None, + device: Optional[Union[str, torch.device]] = None, + args: Dict = None, + # the other key args here: most of them for compatibility only and won't be used at all + **kwargs): + super().__init__() + + self.optimizer = optimizer + self.scheduler = scheduler + + self._supporting_networks = {'pose_net': pose_vqvae_network, 'root_net': root_vqvae_network} + self.backbone_net = backbone_network + + self.motion_rep: GlobalRootGlobalJoints = motion_rep + self.global_motion_rep: GlobalRootGlobalJoints = motion_rep.dual_rep.global_motion_rep + self.local_motion_rep: LocalRootGlobalJoints = motion_rep.dual_rep.local_motion_rep + + self.DEFAULT_NUM_JOINTS = self.motion_rep.num_joints + self._args = args + self.one_logger_callback = kwargs.get("one_logger_callback", None) + self.callbacks = [] + + self._load_vqvae_models() + + assert self._supporting_networks['pose_net'] is None and self._supporting_networks['root_net'] is None, \ + "The pose and root networks should be None for the root model." + self.pose_net, self.root_net = None, None + if device is not None: + self.backbone_net = self.backbone_net.to(device) + + def _load_vqvae_models(self): + self._vqvae_model_loaded = True # root model does not use a VQVAE + + def configure_optimizers(self): + if self.one_logger_callback is not None: + self.one_logger_callback.on_optimizer_init_start() + optimizer = self.optimizer(self.parameters()) + if self.one_logger_callback is not None: + self.one_logger_callback.on_optimizer_init_end() + if not self.scheduler: + return optimizer + + lt_kwargs = dict(self.scheduler.keywords.pop("lt_kwargs", {})) + lt_kwargs["scheduler"] = self.scheduler(optimizer) + return {"optimizer": optimizer, "lr_scheduler": lt_kwargs} + + def set_callbacks(self, callbacks: list): + self.callbacks = callbacks + + def configure_callbacks(self): + return self.callbacks + + def inference_step(self, batch, batch_idx, requires_grad=False, meta_info: Dict = {}): + if not hasattr(self, "_printed_inference_warning"): + self._printed_inference_warning = True + print("Warning: Root model does not have an explicit inference step. Reusing training step.") + with t.no_grad(): + return self.training_step(batch, batch_idx, use_outside_training=True, meta_info=meta_info) + + def training_step(self, batch, batch_idx, use_outside_training: bool = False, meta_info: Dict = {}): + """ @brief: the training step takes input a normalized motion representation. + batch.keys() -> dict_keys(['motion', 'motion_len', 'motion_pad_mask', 'batch_size']) + """ + assert self.training or use_outside_training, \ + "It's possible to use training_step on evaluation set. But otherwise self.training should be true." + + # step 0: data preparations for model training; generate both global and local motions that could be used later + batch_size, device = batch['batch_size'], batch['motion'].device + raw_global_motions, motion_lengths, _ = \ + batch.pop('motion'), batch.pop('motion_len'), batch.pop('motion_pad_mask') + if self.backbone_net.ACCEPT_TEXT_EMB_INPUT: + _, _, _ = batch.pop('text'), batch.pop('text_len'), batch.pop('text_pad_mask') + augmented_batch_size = int(batch_size * self._args['batchsize_mul_factor']) + + num_token_position = np.random.choice(np.arange(self._args['min_tokens'], self._args['max_tokens'] + 1)) + num_token_position_off_range = np.random.choice(np.arange(self._args['min_off_target_tokens_to_sample'], + self._args['max_off_target_tokens_to_sample'] + 1)) + sample_off_range_target_token = np.random.rand() < self._args['prob_off_range_target_token'] + num_token_position = num_token_position_off_range if sample_off_range_target_token else num_token_position + + batch['num_tokens'] = t.full([augmented_batch_size, 1], num_token_position).to(device) + num_frames = num_token_position * self.backbone_net.get_num_frames_per_token() + + valid_samples_id = (motion_lengths >= num_frames + 1) # 1 additional frame for global-local convertion + num_invalid_samples = batch_size - valid_samples_id.sum() + if num_invalid_samples > batch_size // 4 * 3: + return None # don't have enough valid data samples, skipping this batch + + sample_info = {} + global_motions = sample_motion_segments_from_motion_clips(raw_global_motions, motion_lengths, + num_frames, + self.args['batchsize_mul_factor'], info=sample_info, + motion_rep=self.global_motion_rep) + actual_batch_size = int(batch_size * self.args['batchsize_mul_factor']) + batch['text_embeddings'] = None if (not self.backbone_net.ACCEPT_TEXT_EMB_INPUT) else \ + batch.pop('text_feat')[sample_info['chosen_ids']].view([augmented_batch_size, -1]) + + # step 3: prepares the global & local input motions to the pose and root vqvae models + first_frame_heading_angle = t.rand(actual_batch_size).to(device) * np.pi * 2.0 \ + if not self.motion_rep.compute_kwargs['removing_heading'] else 0.0 + global_motions = self.global_motion_rep.change_first_heading( + global_motions, first_frame_heading_angle, is_normalized=True, to_normalize=True + ) # note this `change_first_heading` also moves the first frame to the origin + local_motions = self.motion_rep.dual_rep.global_to_local( + global_motions, is_normalized=True, to_normalize=True, + lengths=t.full([actual_batch_size], global_motions.shape[1]).to(device) + ) + local_motions, global_motions = \ + local_motions[:, :num_frames, :], global_motions[:, :num_frames, :] # drop last velocity padding frame + batch['local_motions'], batch['global_motions'] = local_motions, global_motions + + # step 2: sample the constraints, and all of them are in dense format (the network does support sparse format) + batch['local_root_values'], batch['has_local_root_values'] = \ + self._sample_the_conditions(extract_feature_from_motion_rep(batch['local_motions'], self.local_motion_rep, + self._args['local_root_feature']), num_frames) + batch['global_root_values'], batch['has_global_root_values'] = \ + self._sample_the_conditions(extract_feature_from_motion_rep(batch['global_motions'], self.global_motion_rep, + self._args['global_root_feature']), num_frames) + batch['local_poses'], batch['has_local_poses'] = \ + self._sample_the_conditions(extract_feature_from_motion_rep(batch['local_motions'], self.local_motion_rep, + self._args['local_pose_feature']), num_frames) + batch['text_embeddings'], batch['has_text_embeddings'] = \ + self._sample_text_embedding(batch['text_embeddings'], batch['has_global_root_values'], + batch['has_local_root_values'], batch['has_local_poses']) + + # step 3: the num_token processing + batch['num_tokens'] = batch['num_tokens'].clip(max=self.backbone_net.OUT_OF_REACH_NUM_TOKENS) + batch['groundtruth_num_tokens'] = batch['num_tokens'].clone() + provide_num_tokens = t.rand([augmented_batch_size, 1]) < self._args['prob_provide_num_tokens'] + batch['num_tokens'] = t.where(provide_num_tokens.to(device), batch['num_tokens'], + t.full_like(batch['num_tokens'], self.backbone_net.MASKED_NUM_TOKENS)) + + # step 4: core network forward and loss calculation; groundtruth num of token only used in training + model_outputs = self.backbone_net(batch['global_root_values'], batch['has_global_root_values'], + batch['local_root_values'], batch['has_local_root_values'], + batch['local_poses'], batch['has_local_poses'], batch['num_tokens'], + text_embeddings=batch['text_embeddings'], + has_text_embeddings=batch['has_text_embeddings'], + groundtruth_num_tokens=batch['groundtruth_num_tokens']) + + losses = self.loss(batch, model_outputs) + + if use_outside_training: # use in an evaluation process + meta_info['losses'] = losses + return None + + for key, val in losses.items(): + self.log(f"loss/train_{key}", val, on_step=True, + on_epoch=True, sync_dist=True, batch_size=batch["batch_size"]) + return losses['loss'] + + def loss(self, batch: Dict, model_output_batch: Dict): + """ @brief: calculate the root prediction loss and num-token classification loss. + """ + losses = {} + batch_size, num_valid_frames, device = \ + batch['global_motions'].shape[0], batch['global_motions'].shape[1], batch['global_motions'].device + + pred_local_root_motions = self.motion_rep.dual_rep.global_to_local( + model_output_batch['pred_global_root_values'][:, :num_valid_frames, ], + is_normalized=True, to_normalize=True, lengths=t.full([batch_size], num_valid_frames).to(device) + ) + + groundtruth_global_root_values = \ + extract_feature_from_motion_rep(batch['global_motions'][:, :num_valid_frames], + self.global_motion_rep, self._args['global_root_feature']) + global_root_recons_loss = \ + t.nn.SmoothL1Loss()(model_output_batch['pred_global_root_values'][:, :num_valid_frames, :], + groundtruth_global_root_values) + + groundtruth_global_root_values = \ + extract_feature_from_motion_rep(batch['local_motions'][:, :num_valid_frames - 1], + self.local_motion_rep, self._args['local_root_feature']) # drop last frame + local_root_recons_loss = \ + t.nn.SmoothL1Loss()(pred_local_root_motions[:, :num_valid_frames - 1, :], groundtruth_global_root_values) + + num_tokens_idx = batch['groundtruth_num_tokens'].reshape([-1]) - self._args['min_tokens'] + num_token_loss = t.nn.functional.cross_entropy(model_output_batch['num_token_logits'], num_tokens_idx) + pred_rank = model_output_batch['num_token_logits'].argsort(dim=1, descending=True) + for i in [1, 3, 5]: + losses[f'top_{i}_accuracy'] = (pred_rank[:, :i] == num_tokens_idx[:, None]).any(dim=-1).float().mean() + + total_loss = \ + global_root_recons_loss * self._args['global_root_loss_coeff'] + \ + local_root_recons_loss * self._args['local_root_loss_coeff'] + \ + num_token_loss * self._args['num_token_loss_coeff'] + + losses['num_token_loss'] = num_token_loss + losses['global_root_recons_loss'] = global_root_recons_loss + losses['local_root_recons_loss'] = local_root_recons_loss + losses['loss'] = total_loss + + return losses + + @property + def args(self): + return self._args + + @property + def supporting_nets(self): + return self._supporting_networks + + def move_supporting_nets_to_device(self, device): + pass # both networks are empty + + def _construct_keyframe_prob(self, max_num_keyframes: int = None, no_keyframe_prob: float = 0.0): + """ @brief: generate the prob to sample each keyframe during training. + """ + scheduled_max_num_keyframes = max_num_keyframes * \ + (self.trainer.global_step / self.args['keyframe_num_warmup_steps']) + scheduled_max_num_keyframes = int(max(1, min(scheduled_max_num_keyframes, max_num_keyframes))) + + # construct the probability now; p_keyframe is the same for all keyframes=[1, max_num_keyframes] + # and p_keyframe=0 is the no-keyframe probability + prob_num_keyframes = [1.0 if i > 0 and i <= scheduled_max_num_keyframes else 0.0 + for i in range(max_num_keyframes + 1)] + prob_no_keyframe = no_keyframe_prob + prob_num_keyframes[0] = sum(prob_num_keyframes) / (1 - prob_no_keyframe) * prob_no_keyframe + prob_num_keyframes = np.array(prob_num_keyframes) + prob_num_keyframes /= prob_num_keyframes.sum() + return prob_num_keyframes + + def _sample_the_conditions(self, feature: t.Tensor, num_frames: int): + """ @brief: sample sparse conditions (start/end keyframes) during training. + """ + NUM_START_FRAMES = NUM_END_FRAMES = self.backbone_net.get_num_frames_per_token() + NUM_MIDDLE_FRAMES = num_frames - NUM_START_FRAMES - NUM_END_FRAMES + assert NUM_MIDDLE_FRAMES > 0, "The number of frames should be larger than the number of start and end frames." + + feature_component = {'start': feature[:, :NUM_START_FRAMES], 'end': feature[:, -NUM_END_FRAMES:]} + + has_cond, cond = {}, {} + for component in ['start', 'end']: + prob_num_keyframes = self._construct_keyframe_prob( + self._args[f'max_num_{component}_keyframes'], + no_keyframe_prob=self._args[f'no_{component}_keyframe_prob'] + ) + has_cond[component], cond[component] = \ + sample_keyframes(feature_component[component], + self._args[f'max_num_{component}_keyframes'], prob_num_keyframes) + has_cond = t.cat([has_cond['start'], has_cond['end']], dim=1) + cond = t.cat([cond['start'], cond['end']], dim=1) + + return cond, has_cond # dense condition and the has_target + + def _sample_text_embedding(self, text_embedding: t.Tensor = None, has_global_root_values: t.Tensor = None, + has_local_root_values: t.Tensor = None, has_local_poses: t.Tensor = None): + if text_embedding is not None: + assert self.backbone_net.ACCEPT_TEXT_EMB_INPUT, "The model does not accept text embedding as input." + has_text_emb = t.rand([text_embedding.shape[0], 1], device=text_embedding.device) < \ + self._args.get('prob_provide_text_emb', 0.2) + + # provide text emb if no info about end keyframes are presented + NUM_END_FRAMES = self.backbone_net.get_num_frames_per_token() + has_end_target_info = t.logical_or(t.logical_or(has_global_root_values[:, -NUM_END_FRAMES:], + has_local_root_values[:, -NUM_END_FRAMES:]), + has_local_poses[:, -NUM_END_FRAMES:]) + has_text_emb = t.logical_or(has_text_emb, has_end_target_info.sum(dim=1, keepdims=True) < 1) + text_embedding = t.where(has_text_emb, text_embedding, t.zeros_like(text_embedding)) + else: + text_embedding = has_text_emb = None + + return text_embedding, has_text_emb # dense condition and the has_target + + @property + def vqvae_model_loaded(self): + return self._vqvae_model_loaded diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/sampling.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/sampling.py new file mode 100644 index 0000000000000000000000000000000000000000..14ced86bf0aea6c3a463181194eba265afc83465 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/models/sampling.py @@ -0,0 +1,14 @@ +import torch as t + + +def log(x, eps=1e-20): + return t.log(x.clamp(min=eps)) + + +def gumbel_noise(x): + noise = t.zeros_like(x).uniform_(0, 1) + return -log(-log(noise)) + + +def gumbel_sample(x, temperature=1., dim=-1): + return ((x / max(temperature, 1e-10)) + gumbel_noise(x)).argmax(dim=dim) diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7560760ffb1e87bb5353401f9276d39e9829ce0 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/mlp.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/mlp.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2f205a8730e39e9036c92e4c874047d38035467 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/mlp.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/pose_backbone.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/pose_backbone.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fcda2166cbfc4a979f31985d32d08a013863af7a Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/pose_backbone.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/position_embedding.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/position_embedding.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..26eec5d6561a0542606002e7534c2e017a9dbe99 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/position_embedding.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/root_backbone.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/root_backbone.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..856633f72e8825127701cb134adddd3b5ce5ea92 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/__pycache__/root_backbone.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/mlp.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/mlp.py new file mode 100644 index 0000000000000000000000000000000000000000..bf78c7b191fa50cf2721cd22a706c0dd58e8d418 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/mlp.py @@ -0,0 +1,28 @@ +import torch as t + +class FCBlock(t.nn.Module): + """Fully connected residual block""" + + def __init__(self, num_layers: int, layer_width: int, size_in: int, size_out: int, dropout: float = 0.0): + super(FCBlock, self).__init__() + self.num_layers = num_layers + self.layer_width = layer_width + + self.fc_layers = [t.nn.Linear(size_in, layer_width)] + self.relu_layers = [t.nn.LeakyReLU(inplace=True)] + if dropout > 0.0: + self.fc_layers.append(t.nn.Dropout(p=dropout)) + self.relu_layers.append(t.nn.Identity()) + self.fc_layers += [t.nn.Linear(layer_width, layer_width) for _ in range(num_layers - 1)] + self.relu_layers += [t.nn.LeakyReLU(inplace=True) for _ in range(num_layers - 1)] + + self.forward_projection = t.nn.Linear(layer_width, size_out) + self.fc_layers = t.nn.ModuleList(self.fc_layers) + self.relu_layers = t.nn.ModuleList(self.relu_layers) + + def forward(self, x: t.Tensor): + h = x + for layer, relu in zip(self.fc_layers, self.relu_layers): + h = relu(layer(h)) + f = self.forward_projection(h) + return f diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/pose_backbone.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/pose_backbone.py new file mode 100644 index 0000000000000000000000000000000000000000..f3e2a629b3f38714bd61900c626bacff94cf67e8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/pose_backbone.py @@ -0,0 +1,229 @@ +import torch as t +import torch +from torch import nn +from typing import Dict, Optional +import numpy as np +from motionbricks.motion_backbone.neural_modules.position_embedding import PositionEmbedding +from motionbricks.motionlib.core.motion_reps import MotionRepBase +from motionbricks.motion_backbone.neural_modules.mlp import FCBlock as mlp +from motionbricks.helper.data_training_util import convert_sparse_cond_to_dense_cond_if_needed +from functools import cached_property +from motionbricks.helper.data_training_util import extract_feature_from_motion_rep + +class pose_backbone_network(nn.Module): + def __init__(self, motion_rep: MotionRepBase, args: Dict = None): + """ @brief: pose backbone network for motion generation. + """ + super().__init__() + self.motion_rep = motion_rep + self.global_motion_rep = motion_rep.dual_rep.global_motion_rep + self.local_motion_rep = motion_rep.dual_rep.local_motion_rep + + self._args = args + self._build_transformer_backbone() + self._build_input_embeddings_projections() + self.register_buffer('initted', torch.Tensor([False]).to(dtype=t.bool)) # if need to initialize the codebooks + + def init_embedding_from_codebooks(self, pose_codebook: t.Tensor, root_codebook: t.Tensor): + # make sure the codebook has the expected shapes + if not self._args['pose_vqvae'].get('has_codebook', True): + self.initted[:] = True + print("No codebook for pose vqvae, skipping initialization.") + else: + assert self._args.pose_vqvae.num_heads == pose_codebook.shape[0] and \ + self.get_num_codes(include_aug_tokens=False)[0] == pose_codebook.shape[1] and \ + self._args.pose_vqvae.code_dim == pose_codebook.shape[0] * pose_codebook.shape[2], \ + 'Pose codebook shape mismatch.' + pose_token_dim = pose_codebook.shape[2] + + # init the input pose codebook + pose_codebook = t.cat([pose_codebook, pose_codebook.mean(dim=1, keepdim=True)], dim=1) # add [mask] token + pose_codebook = pose_codebook.reshape([-1, pose_token_dim]) # change dim into [numHeads * num_codes, dim] + with t.no_grad(): + self._pose_token_emb.weight[:] = pose_codebook + + self.initted[:] = True + print("Successfully initialized the embeddings from vqvae codebook embeddings.") + + def _build_transformer_backbone(self): + """ @brief: the transformer backbone. + """ + encoder_layer = nn.TransformerEncoderLayer(d_model=self._args['n_embd'], + nhead=self._args['n_head'], batch_first=True) + self._transformer_model = nn.TransformerEncoder(encoder_layer, num_layers=self._args['n_layers']) + + def _build_input_embeddings_projections(self): + """ @brief: build the embeddings for the inputs + """ + # step 1: the projection & embedding matrix for input to the transformer; the input includes + # 1) pose tokens, 2) local root values, 3) pose values, 4) num_of_tokens + num_pose_heads, _ = self.get_num_heads() + num_pose_tokens, _ = self.get_num_codes(include_aug_tokens=False) + if self._args['pose_vqvae'].get('has_codebook', True): + pose_token_dim = self._args['pose_vqvae']['code_dim'] // num_pose_heads + else: + pose_token_dim = self._args['n_embd'] // num_pose_heads + + self._pose_token_emb = t.nn.Embedding(num_pose_heads * self.NUM_WITH_AUG_POSE_TOKENS, pose_token_dim) + self._proj_pose_token_emb = mlp(num_layers=self._args['pose_token_mlp_num_layers'], + layer_width=self._args['pose_feat_width'], + size_in=num_pose_heads * pose_token_dim, + size_out=self._args['pose_feat_width']) # 1) pose tokens + + num_frames_per_token = self.get_num_frames_per_token() + if self._args['cond_root_feature_is_from_motion_rep'] == 'local': + self._args['local_root_dim'] = extract_feature_from_motion_rep(t.zeros([1, 1, 1000]), self.local_motion_rep, + self._args['cond_root_feature']).shape[2] + else: + self._args['local_root_dim'] = extract_feature_from_motion_rep(t.zeros([1, 1, 1000]), self.global_motion_rep, + self._args['cond_root_feature']).shape[2] + self._proj_local_root_values = t.nn.Linear(self._args['local_root_dim'] * num_frames_per_token, + self._args['root_feat_width']) # 2) local root values + + self._args['local_pose_dim'] = extract_feature_from_motion_rep(t.zeros([1, 1, 1000]), self.local_motion_rep, + self._args['local_pose_feature']).shape[2] + self._proj_local_pose = t.nn.Linear(self._args['local_pose_dim'], + self._args['pose_feat_width'] // num_frames_per_token) # 3) pose values + assert self._args['pose_feat_width'] % self.get_num_frames_per_token() == 0, \ + "pose_feat_width needs to be divisible by num_frames_per_token" + + self._proj_num_valid_positions = t.nn.Embedding(self._args['max_tokens'] - self._args['min_tokens'] + 1, + self._args['token_length_feat_width']) # 4) num of tokens + + # step 2: the proj to merge all input features into the input and positional emb + self._proj_input = t.nn.Sequential( + t.nn.Linear(self._args['pose_feat_width'] + self._args['root_feat_width'] + + self._args['token_length_feat_width'], self._args['n_embd']), t.nn.ReLU() + ) + self._position_emb = PositionEmbedding(seq_length=self._args['max_tokens'], + dim=self._args['n_embd']) # the std for this fixed position emb is 0.5 + + # step 3: the output logit projection matrix + self._proj_pose_output_logit = t.nn.Linear(self._args['n_embd'], num_pose_heads * num_pose_tokens) + + # step 4: (optional) + if self.ACCEPT_TEXT_EMB_INPUT: + self._proj_text_embeddings = mlp(num_layers=self._args['pose_token_mlp_num_layers'], + layer_width=self._args['n_embd'], + size_in=self._args['text_emb_dim'], size_out=self._args['n_embd']) + + def forward(self, pose_tokens: t.Tensor, local_root_values: t.Tensor, + pose_cond: t.Tensor, has_pose_cond: t.Tensor, num_tokens: t.Tensor, + text_embeddings: t.Tensor = None, has_text_embeddings: t.Tensor = None): + """ + @input pose_tokens: [batch, numTokens, num_pose_heads] # required; could be all masked + @input local_root_values: [batch, numFrames, 4] # required + @input pose_cond: [batch, numConstrainFrames=[0, 10], featdim] # optional + @input has_poses_cond: [batch, numConstrainFrames=[0, 10]] (int) # required; where poses are provided + @input num_tokens: [batch, 1] # required + @input text_embedding: [batch, numTokens, text_embedding_dim] # optional + """ + batch_size, num_positions, num_pose_heads = pose_tokens.shape + device = pose_tokens.device + num_frames_per_token = self.get_num_frames_per_token() + + # step 1: generate the input embeddings for each term + local_root_values = local_root_values.reshape([batch_size, num_positions, + num_frames_per_token * self._args['local_root_dim']]) + root_embedding = self._proj_local_root_values(local_root_values) # [batch, num_positions, feat_dim] + + # step 2: the pose embeddings, merged from both pose token embedding and the pose value embeddings + dense_pose_cond, dense_has_pose_cond = \ + convert_sparse_cond_to_dense_cond_if_needed(pose_cond, has_pose_cond, num_positions * num_frames_per_token) + pose_cond_embedding = self._proj_local_pose(dense_pose_cond) # [batch, numFrames, feat_dim] + pose_cond_embedding = pose_cond_embedding.view([batch_size, num_positions * num_frames_per_token, + self._args['pose_feat_width'] // num_frames_per_token]) + + pose_token_id_offsets = \ + torch.arange(num_pose_heads).view([1, 1, num_pose_heads]).to(device=device) * self.NUM_WITH_AUG_POSE_TOKENS + pose_tokens = pose_tokens + pose_token_id_offsets # [batch, num_positions, num_heads] + pose_token_embedding = self._pose_token_emb(pose_tokens) # [batch, num_positions, num_heads, feat_dim] + pose_token_embedding = self._proj_pose_token_emb(pose_token_embedding.view([batch_size, num_positions, -1])) + pose_token_embedding = pose_token_embedding.view([batch_size, num_positions * num_frames_per_token, + self._args['pose_feat_width'] // num_frames_per_token]) + + dense_has_pose_cond = dense_has_pose_cond[:, :, None].float() # [batch, numFrames, 1] + pose_embedding = pose_cond_embedding * dense_has_pose_cond + pose_token_embedding * (1 - dense_has_pose_cond) + pose_embedding = pose_embedding.view([batch_size, num_positions, self._args['pose_feat_width']]) + + # step 3: the number of token embeddings [batch, num_positions, embedding_dim] + num_token_embedding = self._proj_num_valid_positions( + num_tokens.reshape([batch_size, 1]) - self._args['min_tokens']).expand([-1, num_positions, -1] + ) + + # step 4: merge the embeddings and apply positional emb; final shape [batch, num_positions, n_embd] + position_ids = t.arange(num_positions).to(device=device) + position_emb = self._position_emb.embed[position_ids].view([1, num_positions, self._args['n_embd']]) + input_embeddings = \ + self._proj_input(t.cat([pose_embedding, root_embedding, num_token_embedding], dim=-1)) + position_emb + + # step 5: the text input + token_mask = t.arange(num_positions).to(device) < num_tokens.view([batch_size, -1]) + if self.ACCEPT_TEXT_EMB_INPUT and text_embeddings is not None: + text_embeddings = self._proj_text_embeddings(text_embeddings)[:, None, :] + input_embeddings = t.concat([text_embeddings, input_embeddings], dim=1) # [batch, 1+num_positions, n_embd] + mask = t.zeros([batch_size, 1 + num_positions], device=device).bool() # zeros mean allowing + mask[:, :1] = ~has_text_embeddings.bool() + mask[:, 1:] = ~token_mask.bool() + else: + mask = ~token_mask.bool() + + # The shape of the 2D attn_mask is torch.Size([256, 83]), but should be (83, 83). + output = self._transformer_model(input_embeddings, src_key_padding_mask=mask)[:, -num_positions:] + pred_logits = self._proj_pose_output_logit(output).reshape([batch_size, num_positions, num_pose_heads, -1]) + + return {'pose_logits': pred_logits} + + def get_num_codes(self, include_aug_tokens: bool): + num_codes_per_head = {} + + for vqvae in ['pose_vqvae', 'root_vqvae']: # calculate nb_code per head from overall nb_codes + nb_code = self._args[vqvae]['nb_code'] + len_nb_code = len(np.array(self._args[vqvae]['nb_code']).reshape([-1])) + if len_nb_code > 1: # likely a fsq config + assert np.all(np.array(nb_code) == nb_code[0]), \ + "fsq config should have the same number of codes for each head" + num_codes_per_head[vqvae] = nb_code[0] + else: + num_heads = self._args[vqvae]['num_heads'] + code_dim = self._args[vqvae]['code_dim'] + if self._args[vqvae].get('has_codebook', True): + assert code_dim % num_heads == 0, "code dim cannot be divided by the number of heads." + num_codes_per_head[vqvae] = int(round(2 ** (np.log2(nb_code) / num_heads))) + assert num_codes_per_head[vqvae] ** num_heads == nb_code, \ + "the specified number of code is not compatible with the number of heads." + else: + num_codes_per_head[vqvae] = nb_code + + if include_aug_tokens: # include a [MASK] token + return num_codes_per_head['pose_vqvae'] + 1, num_codes_per_head['root_vqvae'] + 1 + else: + return num_codes_per_head['pose_vqvae'], num_codes_per_head['root_vqvae'] + + def get_num_heads(self): + """ brief: num heads for the tokenizers """ + return self._args['pose_vqvae']['num_heads'], self._args['root_vqvae']['num_heads'] + + def get_num_frames_per_token(self): + return (2 ** self._args['down_t']) + + # some handy properties + @property + def NUM_WITH_AUG_POSE_TOKENS(self): + return self.get_num_codes(include_aug_tokens=True)[0] + + @property + def NUM_WITH_AUG_ROOT_TOKENS(self): + return self.get_num_codes(include_aug_tokens=True)[1] + + @property + def POSE_MASK_ID(self): + return self.get_num_codes(include_aug_tokens=True)[0] - 1 + + @property + def ROOT_MASK_ID(self): + return self.get_num_codes(include_aug_tokens=True)[1] - 1 + + @cached_property + def ACCEPT_TEXT_EMB_INPUT(self): + return True if self._args.get('text_embeddings', None) is not None else False diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/position_embedding.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/position_embedding.py new file mode 100644 index 0000000000000000000000000000000000000000..2122b6a6cb7a27770b0f9e4afdf1bf438b10a928 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/position_embedding.py @@ -0,0 +1,39 @@ +import torch +from torch import nn +import math + + +def PE1d_sincos(seq_length, dim): + """ + :param d_model: dimension of the model + :param length: length of positions + :return: length*d_model position matrix + """ + if dim % 2 != 0: + raise ValueError("Cannot use sin/cos positional encoding with " + "odd dim (got dim={:d})".format(dim)) + pe = torch.zeros(seq_length, dim) + position = torch.arange(0, seq_length).unsqueeze(1) + div_term = torch.exp((torch.arange(0, dim, 2, dtype=torch.float) * + -(math.log(10000.0) / dim))) + pe[:, 0::2] = torch.sin(position.float() * div_term) + pe[:, 1::2] = torch.cos(position.float() * div_term) + + return pe.unsqueeze(1) + + +class PositionEmbedding(nn.Module): + """ + Absolute pos embedding (standard), learned. + """ + def __init__(self, seq_length, dim, dropout: float = 0.0, grad=False): + super().__init__() + self.embed = nn.Parameter(data=PE1d_sincos(seq_length, dim), requires_grad=grad) + self.dropout = nn.Dropout(p=dropout) + + def forward(self, x): + # x.shape: bs, seq_len, feat_dim + l = x.shape[1] + x = x.permute(1, 0, 2) + self.embed[:l].expand(x.permute(1, 0, 2).shape) + x = self.dropout(x.permute(1, 0, 2)) + return x diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/root_backbone.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/root_backbone.py new file mode 100644 index 0000000000000000000000000000000000000000..4d21f6454690b93b7ab586cde44b823fe6a9ff1f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motion_backbone/neural_modules/root_backbone.py @@ -0,0 +1,313 @@ +import torch as t +import torch +from torch import nn +from typing import Dict, Optional +import numpy as np +from motionbricks.motion_backbone.neural_modules.position_embedding import PositionEmbedding +from motionbricks.motionlib.core.motion_reps import MotionRepBase +from motionbricks.motion_backbone.neural_modules.mlp import FCBlock as mlp +from functools import cached_property +from motionbricks.vqvae.neural_modules.encdec_double_cond import DoubleCondDecoder +from motionbricks.helper.data_training_util import extract_feature_from_motion_rep + +class root_backbone_network(nn.Module): + def __init__(self, args: Dict, motion_rep: MotionRepBase): + """ @brief: root backbone network for motion generation. + """ + super().__init__() + self._args = args + + self.motion_rep = motion_rep + self.global_motion_rep = motion_rep.dual_rep.global_motion_rep + self.local_motion_rep = motion_rep.dual_rep.local_motion_rep + + self.IS_MODEL_TOKENIZED = False + self._build_backbone() + self._build_input_embeddings() + + def _build_backbone(self): + """ @brief: the transformer backbone for the lp. The input is the embeddings of the start and end frames and + the target root transform + """ + encoder_layer = nn.TransformerEncoderLayer(d_model=self._args['n_embd'], + nhead=self._args['n_head'], batch_first=True) + self._shared_transformer_model = nn.TransformerEncoder(encoder_layer, num_layers=self._args['n_layers_shared']) + + if self._args['n_layers_root_token'] > 0: + self._root_token_transformer_model = \ + nn.TransformerEncoder(encoder_layer, num_layers=self._args['n_layers_root_token']) + else: + self._root_token_transformer_model = None + self._args['local_root_dim'] = extract_feature_from_motion_rep(t.zeros([1, 1, 1000]), self.local_motion_rep, + self._args['local_root_feature']).shape[2] + self._args['global_root_dim'] = extract_feature_from_motion_rep(t.zeros([1, 1, 1000]), self.global_motion_rep, + self._args['global_root_feature']).shape[2] + self._args['local_pose_dim'] = extract_feature_from_motion_rep(t.zeros([1, 1, 1000]), self.local_motion_rep, + self._args['local_pose_feature']).shape[2] + + self._conv_output = DoubleCondDecoder( + self._args['global_root_dim'], self._args['n_embd'], + down_t=self._args['down_t'], width=self._args['width'], depth=self._args['depth'], + dilation_growth_rate=self._args['dilation_growth_rate'], + activation=self._args['activation'], norm=self._args['norm'], + target_cond_dim=self._args['global_root_dim'], # global root information + external_cond_dim=self._args['n_embd'] # frame emb from root & pose + ) + + def _build_input_embeddings(self): + """ @brief: + @input global_root_values: [batch, numConstrainFrames=[0, 8], 5] # optional, also used in root decoder + @input has_global_root_values: [batch, 8] # required + + @input local_root_values: [batch, numConstrainFrames=[0, 8], 4] # optional + @input has_local_root_values: [batch, 8] # required + + @input start_pose: [batch, numConstrainFrames=4, featdim] # required + @input has_start_pose: [batch, 4] (bool) # required; whether start_pose is provided + + @input target_pose: [batch, numConstrainFrames=[0, 4], featdim] # optional + @input has_target_pose: [batch, 4] (bool) # required; whether target_pose is provided + + @input num_tokens: [batch, 1] # optional + """ + num_frames_per_token = self.get_num_frames_per_token() + + # input emb projection + self._proj_local_pose = nn.Linear(self._args['local_pose_dim'], self._args['pose_feat_dim']) + self._proj_local_root_value = nn.Linear(self.args['local_root_dim'], + self._args['local_root_feat_dim']) + self._proj_global_root_value = nn.Linear(self.args['global_root_dim'], + self._args['global_root_feat_dim']) + + # emb when the constraints are not given + self._no_local_pose_emb = nn.Parameter(torch.randn([self._args['pose_feat_dim']])) + self._no_local_root_emb = nn.Parameter(torch.randn([self._args['local_root_feat_dim']])) + self._no_global_root_emb = nn.Parameter(torch.randn([self._args['global_root_feat_dim']])) + + self._conv_no_frame_emb = nn.Parameter(torch.randn([self._args['n_embd']])) + + proj_input_dim = self._args['pose_feat_dim'] + \ + self._args['local_root_feat_dim'] + self._args['global_root_feat_dim'] + self._proj_start_input = mlp(num_layers=self._args['input_feat_mlp_num_layers'], + layer_width=self._args['n_embd'], + size_in=proj_input_dim, size_out=self._args['n_embd']) + self._proj_end_input = mlp(num_layers=self._args['input_feat_mlp_num_layers'], + layer_width=self._args['n_embd'], + size_in=proj_input_dim, size_out=self._args['n_embd']) + self._input_position_emb = t.nn.Embedding(num_frames_per_token * 2, self._args['n_embd']) + + # the num_token emd + self._proj_input_num_tokens = t.nn.Embedding( + self._args['max_tokens'] - self._args['min_tokens'] + 1 + 1 + 1, self._args['n_embd'] + ) # the num_token input include [min_tokens, max_tokens] and [out of reach (max_token + 1)] and [mask] + self._position_emb = PositionEmbedding(seq_length=self._args['max_tokens'], + dim=self._args['n_embd']) # the std for this fixed position emb is 0.5 + + # output projection; the num_token input include [min_tokens, max_tokens] and [out of reach (max_token + 1)] + self._proj_num_token_output_logit = t.nn.Linear(self._args['n_embd'], + self._args['max_tokens'] - self._args['min_tokens'] + 1 + 1) + + # step 4: (optional) + if self.ACCEPT_TEXT_EMB_INPUT: + self._proj_text_embeddings = mlp(num_layers=self._args['input_feat_mlp_num_layers'], + layer_width=self._args['n_embd'], + size_in=self._args['text_emb_dim'], size_out=self._args['n_embd']) + if self.USE_HARD_NUM_TOKEN_EMB_FOR_ROOT_PREDICTION and self._root_token_transformer_model is not None: + self._middle_token_emb = t.nn.Embedding(self._args['max_tokens'] - self._args['min_tokens'] + 1 + 1, + self._args['n_embd']) + + def forward(self, global_root_values: t.Tensor, has_global_root_values: t.Tensor, + local_root_values: t.Tensor, has_local_root_values: t.Tensor, + poses: t.Tensor, has_poses: t.Tensor, num_tokens: t.Tensor, + text_embeddings: Optional[t.Tensor] = None, has_text_embeddings: Optional[t.Tensor] = None, + groundtruth_num_tokens: t.Tensor = None, + allowed_pred_num_tokens: t.Tensor = None, config: dict = {}): + """ @brief: + @input global_root_values: [batch, numConstrainFrames=[0, 8], 5] # required, also used in root decoder + @input has_global_root_values: [batch, 8] # required + + @input local_root_values: [batch, numConstrainFrames=[0, 8], 4] # required + @input has_local_root_values: [batch, 8] # required + + @input pose: [batch, numConstrainFrames=8, featdim] # required + @input has_pose: [batch, 8] (bool) # required; whether start_pose is provided + + @input num_tokens: [batch, 1] # optional + + groundtruth_num_tokens: [batch, 1] # optional; only valid in training + """ + batch_size, device = poses.shape[0], poses.device + num_frames_per_token = self.get_num_frames_per_token() + + # step 1: construct the frame embedding and initial time emb + local_pose_emb = self._proj_local_pose(poses) # [batch, numFrames, dim] + local_root_emb = self._proj_local_root_value(local_root_values) # [batch, numFrames, dim] + global_root_emb = self._proj_global_root_value(global_root_values) # [batch, numFrames, dim] + + local_pose_emb = local_pose_emb * has_poses[:, :, None].float() + \ + self._no_local_pose_emb[None, None, :] * (1 - has_poses[:, :, None].float()) + local_root_emb = local_root_emb * has_local_root_values[:, :, None].float() + \ + self._no_local_root_emb[None, None, :] * (1 - has_local_root_values[:, :, None].float()) + global_root_emb = global_root_emb * has_global_root_values[:, :, None].float() + \ + self._no_global_root_emb[None, None, :] * (1 - has_global_root_values[:, :, None].float()) + + start_frame_emb = torch.cat([local_pose_emb[:, :num_frames_per_token, :], + local_root_emb[:, :num_frames_per_token, :], + global_root_emb[:, :num_frames_per_token, :]], dim=-1) + start_frame_emb = self._proj_start_input(start_frame_emb) + end_frame_emb = torch.cat([local_pose_emb[:, -num_frames_per_token:, :], + local_root_emb[:, -num_frames_per_token:, :], + global_root_emb[:, -num_frames_per_token:, :]], dim=-1) + end_frame_emb = self._proj_end_input(end_frame_emb) + frame_emb = torch.cat([start_frame_emb, end_frame_emb], dim=1) + positioned_frame_emb = frame_emb + self._input_position_emb.weight[None, :, :] + + first_stage_time_emb = self._proj_input_num_tokens(num_tokens - self._args['min_tokens']) # [batch, dim] + first_stage_time_emb = first_stage_time_emb.view([batch_size, 1, self._args['n_embd']]) + + # step 2: first stage transformer forward for the num token prediction + first_stage_input_emb = t.concat([first_stage_time_emb, positioned_frame_emb], dim=1) + + if self.ACCEPT_TEXT_EMB_INPUT and text_embeddings is not None: + text_embeddings = self._proj_text_embeddings(text_embeddings)[:, None, :] + first_stage_input_emb = \ + t.concat([text_embeddings, first_stage_input_emb], dim=1) # [batch, 1+num_positions, n_embd] + first_stage_mask = t.zeros([batch_size, 1 + 1 + num_frames_per_token * 2], + device=device).bool() # zeros mean allowing + first_stage_mask[:, :1] = ~has_text_embeddings.bool() + else: + first_stage_mask = None + + first_stage_output_emb = self._shared_transformer_model(first_stage_input_emb, + src_key_padding_mask=first_stage_mask) + num_token_logits = \ + self._proj_num_token_output_logit(first_stage_output_emb[:, self.TRANSFORMER_TIME_LOGIT_ID, :]) + + assert self.USE_HARD_NUM_TOKEN_EMB_FOR_ROOT_PREDICTION, "Only support hard num token emb." + if groundtruth_num_tokens is not None: + chosen_token = groundtruth_num_tokens.view([batch_size]) - self._args['min_tokens'] + else: + assert not self.training, "groundtruth_num_tokens is required in training." + if not config.get('allow_pred_out_of_reach_num_tokens', True): + # erase the prob for predicting out of reach token (OOR token) + num_token_logits = num_token_logits.clone() + num_token_logits[:, self.OUT_OF_REACH_NUM_TOKENS - self._args['min_tokens']] = -t.inf + if allowed_pred_num_tokens is not None: + # only the chosen token is allowed to be predicted + num_time_tokens = self._args['max_tokens'] - self._args['min_tokens'] + 1 + modified_num_token_logits = t.where(allowed_pred_num_tokens == 1, + num_token_logits[:, :num_time_tokens], + t.full([batch_size, num_time_tokens], -t.inf).to(device)) + + num_token_logits = t.cat([modified_num_token_logits, num_token_logits[:, num_time_tokens:]], dim=-1) + + chosen_token = torch.argmax(num_token_logits, dim=-1).int() + chosen_token = t.where(num_tokens.view([batch_size]) == self.MASKED_NUM_TOKENS, + chosen_token, num_tokens.view([batch_size]) - self._args['min_tokens']) + + # step 3: the root global value transformer + position_ids = t.arange(self._args['max_tokens']).to(device=device) + position_emb = self._position_emb.embed[position_ids].view([1, self._args['max_tokens'], self._args['n_embd']]) + position_emb = position_emb.expand([batch_size, -1, -1]) + token_mask = t.arange(self._args['max_tokens']).view([1, -1]).to(device) < \ + chosen_token.view([-1, 1]) + self._args['min_tokens'] + + if self._root_token_transformer_model is None: + second_stage_output_emb = position_emb + else: + second_stage_token_emb = self._middle_token_emb(chosen_token) + second_stage_input_emb = t.concat([second_stage_token_emb[:, None, :], + positioned_frame_emb, position_emb], dim=1) + second_stage_mask = t.cat([t.zeros([batch_size, 1 + num_frames_per_token * 2], + device=device).bool(), # num of token emb, frame emb + ~token_mask], dim=1) + second_stage_output_emb = \ + self._root_token_transformer_model(second_stage_input_emb, src_key_padding_mask=second_stage_mask) + second_stage_output_emb = \ + second_stage_output_emb[:, -self._args['max_tokens']:] # remove frame and num_token emb + + # step 4: the root global value conv output + pred_num_tokens = chosen_token + self._args['min_tokens'] + batch = {} + keys = ['frame', 'global_root'] + num_total_frames = self._args['max_tokens'] * num_frames_per_token + batch['has_frame'] = t.logical_or(t.logical_or(has_poses, has_global_root_values), has_local_root_values) + batch['frame'] = t.where(batch['has_frame'][:, :, None], frame_emb, self._conv_no_frame_emb[None, None, :]) + batch['dense_frame'] = t.cat([batch['frame'][:, :num_frames_per_token], + self._conv_no_frame_emb[None, None, :].repeat([batch_size, num_total_frames - + num_frames_per_token, 1])], dim=1) + + batch['global_root'], batch['has_global_root'] = global_root_values, has_global_root_values + batch['dense_global_root'] = t.cat([batch['global_root'][:, :num_frames_per_token], + t.zeros([batch_size, num_total_frames - num_frames_per_token, + self._args['global_root_dim']], device=device)], dim=1) + + for key in keys: # construct the full batch from sparse ones + batch['dense_has_' + key] = \ + t.cat([batch['has_' + key][:, :num_frames_per_token], + t.zeros([batch_size, num_total_frames - num_frames_per_token], device=device).bool()], dim=1) + for i in range(num_frames_per_token): + offsets = (pred_num_tokens[:, None] * num_frames_per_token - num_frames_per_token + i).long() + batch['dense_' + key] = \ + batch['dense_' + key].scatter(1, offsets[:, :, None].repeat([1, 1, batch[key].shape[-1]]), + batch[key][:, -num_frames_per_token + i][:, None, :]) + batch['dense_has_' + key] = \ + batch['dense_has_' + key].scatter(1, offsets[:, :], + batch['has_' + key][:, -num_frames_per_token + i][:, None]) + + pred_global_root_values = self._conv_output( + second_stage_output_emb.transpose(1, 2), external_cond=batch['dense_frame'], + target_cond=batch['dense_global_root'], + has_target_cond=batch['dense_has_global_root'], token_mask=token_mask + ).transpose(1, 2) # NOTE: only dense_has_global_root is used for no-show cond. Frame-cond uses non-emb instead + + return {'num_token_logits': num_token_logits, 'pred_num_tokens': pred_num_tokens, + 'pred_global_root_values': pred_global_root_values} + + def get_num_frames_per_token(self): + return 2 ** self._args['down_t'] + + @property + def args(self): + return self._args + + def get_num_heads(self): + """ brief: num heads for the tokenizers """ + return self._args['pose_vqvae']['num_heads'], self._args['root_vqvae']['num_heads'] + + def get_num_codes(self, include_aug_tokens: bool): + num_codes_per_head = {} + + for vqvae in ['pose_vqvae', 'root_vqvae']: # calculate nb_code per head from overall nb_codes + nb_code = self._args[vqvae]['nb_code'] + num_heads = self._args[vqvae]['num_heads'] + code_dim = self._args[vqvae]['code_dim'] + assert code_dim % num_heads == 0, "code dim cannot be divided by the number of heads." + num_codes_per_head[vqvae] = int(round(2 ** (np.log2(nb_code) / num_heads))) + assert num_codes_per_head[vqvae] ** num_heads == nb_code, \ + "the specified number of code is not compatible with the number of heads." + + if include_aug_tokens: # include a [MASK] token + return num_codes_per_head['pose_vqvae'] + 1, num_codes_per_head['root_vqvae'] + 1 + else: + return num_codes_per_head['pose_vqvae'], num_codes_per_head['root_vqvae'] + + @property + def OUT_OF_REACH_NUM_TOKENS(self): + return self._args['max_tokens'] + 1 + + @property + def MASKED_NUM_TOKENS(self): + return self._args['max_tokens'] + 2 + + @cached_property + def ACCEPT_TEXT_EMB_INPUT(self): + return True if self._args.get('text_embeddings', None) is not None else False + + @property + def TRANSFORMER_TIME_LOGIT_ID(self): + return 1 if self.ACCEPT_TEXT_EMB_INPUT else 0 + + @cached_property + def USE_HARD_NUM_TOKEN_EMB_FOR_ROOT_PREDICTION(self): + return self._args.get('use_hard_num_token_emb_for_root_prediction', False) diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..491d95d2cd6718c528aebf6d855ee9fe09f2f951 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..999825378667122344a9a5851c67a8a49761d201 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..315e87cbb98980489a06853aca46490043b90a53 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/__init__.py @@ -0,0 +1 @@ +from .motion_reps_base.motion_rep_base import MotionRepBase # noqa diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..522e7da9ac7399cba7e9fe0f4b7ed633d51a48ab Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/__pycache__/dual_root_global_joints.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/__pycache__/dual_root_global_joints.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..718d547da9aa825757060e2b5c6fb4d21ca59ac1 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/__pycache__/dual_root_global_joints.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/dual_root_global_joints.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/dual_root_global_joints.py new file mode 100644 index 0000000000000000000000000000000000000000..617c3caf76e1eeea710d4fe5cf31cd8ca6ddbb99 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/dual_root_global_joints.py @@ -0,0 +1,66 @@ +from .motion_reps_base.dual_root_local_body import DualRootLocalBody +from .motion_reps_base.global_root_local_body import GlobalRootLocalBody +from .motion_reps_base.local_root_local_body import LocalRootLocalBody + +COMPUTE_KWARGS = { + "local_vel_without_root": False, + "local_root_vel_with_y": False, + "compute_heading_method": "hips_pos", # to compute the root heading + "removing_heading": False, +} + +DEFAULT_JOINT_POSITIONS_FROM = "global_rot_data" + + +class DualRootGlobalJoints(DualRootLocalBody): + """Motion representation with global rotation but without removing the heading.""" + + _name_ = "dual_root_global_joints" + compute_kwargs = COMPUTE_KWARGS + default_joint_positions_from = DEFAULT_JOINT_POSITIONS_FROM + + def __init__(self, *args, **kwargs): + super().__init__( + *args, + global_class=GlobalRootGlobalJoints, + local_class=LocalRootGlobalJoints, + **kwargs, + ) + + +def get_body_keys_dim(self, nbjoints: int): + # as removing heading is set to False, we does not remove the y rotation to any data in both root and body + return { + "ric_data": [ + (nbjoints - 1) * 3 + ], # xyz without the root: careful it is actually not rotation invariant + "global_rot_data": [ + nbjoints * 6 + ], # 6D rot with root (y rotation is not removed) + "local_vel": [nbjoints * 3], # local_vel xyz (with root) + "foot_contacts": [4], # Left: Foot + Toe / Right: Foot + Toe + } + + +class GlobalRootGlobalJoints(GlobalRootLocalBody): + """Motion representation with global root.""" + + dual_class = DualRootGlobalJoints + get_body_keys_dim = get_body_keys_dim + compute_kwargs = COMPUTE_KWARGS + default_joint_positions_from = DEFAULT_JOINT_POSITIONS_FROM + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + +class LocalRootGlobalJoints(LocalRootLocalBody): + """Motion representation with local root.""" + + dual_class = DualRootGlobalJoints + get_body_keys_dim = get_body_keys_dim + compute_kwargs = COMPUTE_KWARGS + default_joint_positions_from = DEFAULT_JOINT_POSITIONS_FROM + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c88f6fceaf5637de1382452d7eea6746c59285f Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/dual_root_local_body.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/dual_root_local_body.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..77b2675a7d585abfa1a4f9bee193527a710c4bf7 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/dual_root_local_body.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/global_root_local_body.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/global_root_local_body.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..56c259d7e283428d3437d6b69ec182c6d21bc502 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/global_root_local_body.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/local_root_local_body.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/local_root_local_body.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d712c3c33195685dec3f2abfa2e030643b967031 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/local_root_local_body.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/motion_rep_base.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/motion_rep_base.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bcb68b53c678869f5d1c5cf873b63fadbb5c6650 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/motion_rep_base.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/seperate_root_local_body.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/seperate_root_local_body.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1d7f1160f09899756830b372e6cb184bf81e88e9 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/__pycache__/seperate_root_local_body.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/dual_root_local_body.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/dual_root_local_body.py new file mode 100644 index 0000000000000000000000000000000000000000..82332d0460d1695d41ae988285f8572c31342f49 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/dual_root_local_body.py @@ -0,0 +1,378 @@ +import logging +from typing import Optional, Tuple, Union + +import numpy as np +import torch + +from motionbricks.motionlib.core.skeletons import SkeletonBase +from motionbricks.motionlib.core.utils.stats import Stats + +from .global_root_local_body import GlobalRootLocalBody +from .local_root_local_body import LocalRootLocalBody +from .seperate_root_local_body import SeparatedRootLocalBody + +log = logging.getLogger(__name__) + + +class DualRootLocalBody(SeparatedRootLocalBody): + """Representation with global root and local root.""" + + def __init__( + self, + fps: float, + skeleton: SkeletonBase, + name: str, + *, + # keywords only args + global_class: GlobalRootLocalBody, + local_class: LocalRootLocalBody, + stats: Optional[Stats] = None, + ): + global_motion_rep = global_class(fps=fps, skeleton=skeleton, name="global") + local_motion_rep = local_class(fps=fps, skeleton=skeleton, name="local") + + assert ( + global_motion_rep.default_joint_positions_from + == local_motion_rep.default_joint_positions_from + ) + self.default_joint_positions_from = ( + global_motion_rep.default_joint_positions_from + ) + + self.root_keys_dim = ( + global_motion_rep.root_keys_dim | local_motion_rep.root_keys_dim + ) + # double check there is no overlap between them + assert len(self.root_keys_dim) == len(global_motion_rep.root_keys_dim) + len( + local_motion_rep.root_keys_dim + ) + + # make sure they use the same body motion representation + assert global_motion_rep.body_keys_dim == local_motion_rep.body_keys_dim + self.body_keys_dim = global_motion_rep.body_keys_dim + + super().__init__(fps, skeleton, name, stats) + + # assign after module.init + self.global_motion_rep = global_motion_rep + self.local_motion_rep = local_motion_rep + + # useful indices + self.indices["global_root"] = np.arange(0, global_motion_rep.motion_root_dim) + self.indices["local_root"] = np.arange( + global_motion_rep.motion_root_dim, + self.motion_root_dim, + ) + self.indices["global_rep"] = np.concatenate( + (self.indices["global_root"], self.indices["body"]) + ) + self.indices["local_rep"] = np.concatenate( + (self.indices["local_root"], self.indices["body"]) + ) + + # make sure it uses the same args for compute local motion features + assert global_motion_rep.compute_kwargs == local_motion_rep.compute_kwargs + self.compute_kwargs = global_motion_rep.compute_kwargs + + # subset: it is global by default + self.motion_rep_subset_dim = self.global_motion_rep.motion_rep_dim + + # no dual rep as it is the rep itself + self.dual_rep = None + + # extract the stats for the subset motion rep + if stats is not None and stats.is_loaded(): + # global stats + global_mean = stats.mean[self.indices["global_rep"]] + global_std = stats.std[self.indices["global_rep"]] + + self.global_motion_rep.stats = Stats(eps=stats.eps, legacy=stats.legacy) + self.global_motion_rep.stats.register_from_tensors(global_mean, global_std) + + # local stats + local_mean = stats.mean[self.indices["local_rep"]] + local_std = stats.std[self.indices["local_rep"]] + self.local_motion_rep.stats = Stats(eps=stats.eps, legacy=stats.legacy) + self.local_motion_rep.stats.register_from_tensors(local_mean, local_std) + + def get_feature_subset( + self, motion: torch.Tensor, mode: str = "global" + ) -> torch.Tensor: + """Extract either global or local features from the motion tensor. + + Args: + motion: Motion tensor of shape [..., feature_dim] + mode: Either "global" or "local" + + Returns: + Subset of features corresponding to the specified mode + """ + assert mode in ["global", "local"] + return motion[..., self.indices[f"{mode}_rep"]] + + def get_motion_rep_subset( + self, mode: str = "global" + ) -> Union[GlobalRootLocalBody, LocalRootLocalBody]: + """Get the motion representation object for either global or local features. + + Args: + mode: Either "global" or "local" + + Returns: + The corresponding motion representation object + + Raises: + ValueError: If mode is not "global" or "local" + """ + if mode == "global": + return self.global_motion_rep + elif mode == "local": + return self.local_motion_rep + else: + raise ValueError("The mode should be global or local only.") + + def get_root_index_subset(self, mode: str = "global") -> np.ndarray: + """Get indices for either global or local root features. + + Args: + mode: Either "global" or "local" + + Returns: + Array of indices for the specified root features + + Raises: + ValueError: If mode is not "global" or "local" + """ + if mode == "global": + return self.indices["global_root"] + elif mode == "local": + return self.indices["local_root"] + else: + raise ValueError("The mode should be global or local only.") + + def get_body_index_subset(self, mode: str) -> np.ndarray: + """Get indices for body features. + + Args: + mode: Unused parameter kept for API consistency + + Returns: + Array of indices for body features + """ + return self.indices["body"] + + def _one_subset_to_the_other( + self, + features: torch.Tensor, + is_normalized: bool, + to_normalize: bool, + mode: str, + lengths: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + """Convert features between global and local representations. + + Args: + features: Input features to convert + is_normalized: Whether input features are normalized + to_normalize: Whether to normalize output features + mode: Either "local_to_global" or "global_to_local" + lengths: Optional sequence lengths for batched data + + Returns: + Converted features in the target representation + """ + if mode == "local_to_global": + motion_rep_from = self.local_motion_rep + motion_rep_to = self.global_motion_rep + elif mode == "global_to_local": + motion_rep_from = self.global_motion_rep + motion_rep_to = self.local_motion_rep + else: + raise ValueError("Mode was not recognized.") + + from_rep, to_rep = mode.split("_to_") + + data_type = motion_rep_from.detect_all_body_or_root(features) + if data_type == "all": + # also take care of the body + body_motion = motion_rep_from.extract_body(features) + else: + assert data_type == "root" + + root_motion = motion_rep_from.extract_root(features) + + if is_normalized: + root_motion = self.unnormalize( + root_motion, index=self.indices[f"{from_rep}_root"] + ) + # unnormalize the body only if needed + if not to_normalize and data_type == "all": + body_motion = self.unnormalize(body_motion, index=self.indices["body"]) + + r_pos, r_rot_quat = motion_rep_from.compute_root_pos_and_rot(root_motion) + + # compute new root representation + new_root_motion = motion_rep_to.compute_root_rep_from_root_pos_and_rot( + r_pos, r_rot_quat, lengths + ) + + if to_normalize: + new_root_motion = self.normalize( + new_root_motion, index=self.indices[f"{to_rep}_root"] + ) + if not is_normalized and data_type == "all": + # normalize the body only if needed + body_motion = self.normalize(body_motion, index=self.indices["body"]) + + if data_type == "root": + assert new_root_motion.shape[-1] == motion_rep_to.motion_root_dim + return new_root_motion + + # otherwise recreate the all feature vector + new_features = motion_rep_to.concat_root_body(new_root_motion, body_motion) + assert new_features.shape[-1] == motion_rep_to.motion_rep_dim + return new_features + + def global_to_local( + self, + features: torch.Tensor, + is_normalized: bool, + to_normalize: bool, + lengths: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + """Convert features from global to local representation. + + Args: + features: Input features in global representation + is_normalized: Whether input features are normalized + to_normalize: Whether to normalize output features + lengths: Optional sequence lengths for batched data + + Returns: + Features in local representation + """ + return self._one_subset_to_the_other( + features, + is_normalized=is_normalized, + to_normalize=to_normalize, + mode="global_to_local", + lengths=lengths, + ) + + def local_to_global( + self, + features: torch.Tensor, + is_normalized: bool, + to_normalize: bool, + lengths: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + """Convert features from local to global representation. + + Args: + features: Input features in local representation + is_normalized: Whether input features are normalized + to_normalize: Whether to normalize output features + lengths: Optional sequence lengths for batched data + + Returns: + Features in global representation + """ + return self._one_subset_to_the_other( + features, + is_normalized=is_normalized, + to_normalize=to_normalize, + mode="local_to_global", + lengths=lengths, + ) + + def cat_global_and_local( + self, + global_motion: torch.Tensor, + local_motion: torch.Tensor, + ) -> torch.Tensor: + """Concatenate global and local motion features. + + Args: + global_motion: Motion features in global representation + local_motion: Motion features in local representation + + Returns: + Combined motion features containing both roots and body (the dual form) + """ + # extract global info + global_root = self.global_motion_rep.extract_root(global_motion) + global_body = self.global_motion_rep.extract_body(global_motion) + + # extract local info + local_root = self.local_motion_rep.extract_root(local_motion) + local_body = self.local_motion_rep.extract_body(local_motion) + + # global_body and local body should be the same + + assert (local_body == global_body).all() + motion = torch.cat([global_root, local_root, local_body], axis=-1) + return motion + + def change_first_heading( + self, + motion: torch.Tensor, + first_heading_angle: float, + is_normalized: bool, + to_normalize: bool, + return_numpy: bool = False, + ) -> Union[torch.Tensor, np.ndarray]: + """Transform motion to be relative to the first frame. + + Args: + motion: Input motion features + is_normalized: Whether input features are normalized + to_normalize: Whether to normalize output features + return_numpy: Whether to return a numpy array instead of tensor + + Returns: + Canonicalized motion features + """ + if isinstance(motion, np.ndarray): + motion = torch.from_numpy(motion) + + if is_normalized: + motion = self.unnormalize(motion) + + new_global_rep_motion = self.global_motion_rep.change_first_heading( # noqa + self.get_feature_subset(motion, mode="global"), + first_heading_angle, + is_normalized=False, + to_normalize=False, + ) + + new_local_rep_motion = self.local_motion_rep.change_first_heading( # noqa + self.get_feature_subset(motion, mode="local"), + first_heading_angle, + is_normalized=False, + to_normalize=False, + ) + new_motion = self.cat_global_and_local( + new_global_rep_motion, new_local_rep_motion + ) + + if to_normalize: + new_motion = self.normalize(new_motion) + + if return_numpy: + new_motion = new_motion.cpu().numpy() + return new_motion + + def compute_root_pos_and_rot( + self, motion: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute root position and rotation from the representation. + + Returns: + torch.Tensor: [..., T, 3] global root position + torch.Tensor: [..., T, 4] global root rot quaternion (heading only) + """ + global_features = self.get_feature_subset(motion, mode="global") + r_pos, r_rot_quat = self.global_motion_rep.compute_root_pos_and_rot( + global_features + ) + return r_pos, r_rot_quat diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/global_root_local_body.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/global_root_local_body.py new file mode 100644 index 0000000000000000000000000000000000000000..04ebeb19159c82875dc24e9eb375073e59115790 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/global_root_local_body.py @@ -0,0 +1,206 @@ +from typing import Optional, Tuple + +import einops +import numpy as np +import torch + +from motionbricks.motionlib.core.skeletons import SkeletonBase +from motionbricks.motionlib.core.utils.rotations import ( + angle_to_Y_rotation_matrix, +) +from motionbricks.motionlib.core.utils.stats import Stats + +from .seperate_root_local_body import SeparatedRootLocalBody + + +class GlobalRootLocalBody(SeparatedRootLocalBody): + """Representation with global root.""" + + dual_class = None + + def __init__( + self, + fps: float, + skeleton: SkeletonBase, + name: str, + stats: Optional[Stats] = None, + ): + # Subclasses should define + # get_body_keys_dim + # compute_kwargs + + self.root_keys_dim = { + "global_root_pos": [3], # xyz + "global_root_heading": [2], # cos / sin + } + self.body_keys_dim = self.get_body_keys_dim(skeleton.nbjoints) + + # If we got the stats from the dual representation + if self.dual_class is not None and self.dual_class._name_ in name: + super().__init__(fps, skeleton, name, stats=None) + # full stats for dual rep + self.dual_rep = self.dual_class(fps, skeleton, name, stats=stats) + self.dual_rep_mode = "global" + # load the subset stats + self.stats = self.dual_rep.global_motion_rep.stats + else: + self.dual_rep = None + super().__init__(fps, skeleton, name, stats) + + # additional indices + self.indices["global_root_pos_2d"] = self.indices["global_root_pos"][[0, 2]] + self.root_mode = "global" + + def compute_root_pos_and_rot( + self, + motion: torch.Tensor, + return_quat: bool = True, + return_angle: bool = False, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute root position and rotation from the representation. + + Args: + motion (torch.Tensor): Motion tensor of shape [..., T, D] where T is number of frames, and D is feature dimension + + Returns: + Tuple[torch.Tensor, torch.Tensor]: + - Global root position tensor of shape [B, T, 3] + - Global root rotation quaternion tensor of shape [B, T, 4] (heading only) + """ + + motion, ps = einops.pack([motion], "* nbframes dim") + root_motion = self.extract_root(motion) + + r_pos, rot_cos, rot_sin = einops.unpack( + root_motion, + [[3], [], []], + "batch time *", + ) + + r_rot_ang = torch.atan2(rot_sin, rot_cos) + r_rot_quat = torch.stack( + [ + torch.cos(r_rot_ang / 2), + torch.zeros_like(rot_cos), + torch.sin(r_rot_ang / 2), + torch.zeros_like(rot_cos), + ], + dim=-1, + ) + + [r_pos] = einops.unpack(r_pos, ps, "* nbframes xyz") + [r_rot_quat] = einops.unpack(r_rot_quat, ps, "* nbframes quat") + [r_rot_ang] = einops.unpack(r_rot_ang, ps, "* nbframes") + if return_quat and not return_angle: + return r_pos, r_rot_quat + if not return_quat and return_angle: + return r_pos, r_rot_ang + if return_quat and return_angle: + return r_pos, r_rot_quat, r_rot_ang + if not return_quat and not return_angle: + return r_pos + + def compute_root_rep_from_root_pos_and_rot( + self, + r_pos: torch.Tensor, + r_rot_quat: torch.Tensor, + lengths: Optional[torch.Tensor] = None, + ) -> torch.Tensor: + """Compute root representation from root position and rotation. + + Args: + r_pos (torch.Tensor): Global root position tensor of shape [..., T, 3] + r_rot_quat (torch.Tensor): Global root rotation quaternion tensor of shape [..., T, 4] + lengths (Optional[torch.Tensor]): Sequence lengths, defaults to None (necessary for batched sequences) + + Returns: + torch.Tensor: Root motion representation tensor of shape [..., T, D] + """ + + root_rot_angles = torch.arctan2(r_rot_quat[..., 2], r_rot_quat[..., 0]) * 2 + root_motion = torch.cat( + [ + r_pos, + torch.cos(root_rot_angles)[..., None], + torch.sin(root_rot_angles)[..., None], + ], + axis=-1, + ) + return root_motion + + def change_first_heading( + self, + motion: torch.Tensor | np.ndarray, + first_heading_angle: float | torch.Tensor, + is_normalized: bool, + to_normalize: bool, + return_numpy: bool = False, + ) -> torch.Tensor | np.ndarray: + """Canonicalize motion by aligning the first frame to face +Z direction and moving to + origin. + + Args: + motion (Union[torch.Tensor, np.ndarray]): Input motion tensor of shape [..., T, D] + is_normalized (bool): Whether input motion is normalized + to_normalize (bool): Whether to normalize output motion + return_numpy (bool): Whether to return numpy array. Defaults to False. + + Returns: + Union[torch.Tensor, np.ndarray]: Canonicalized motion of same shape as input + """ + if isinstance(motion, np.ndarray): + motion = torch.from_numpy(motion) + + if is_normalized: + motion = self.unnormalize(motion) + + # make is universally: [X, T, D] + motion, ps = einops.pack([motion], "* nbframes dim") + + root_pos, root_rot_angle = self.compute_root_pos_and_rot( + motion, + return_angle=True, + return_quat=False, + ) + first_heading_angle = ( + first_heading_angle.reshape(root_rot_angle[..., 0].shape) + if isinstance(first_heading_angle, torch.Tensor) + else first_heading_angle + ) + corrective_angle = first_heading_angle - root_rot_angle[..., 0] # [Batch] + new_angles = root_rot_angle + corrective_angle[..., None] # [Batch, T] + corrective_mat = angle_to_Y_rotation_matrix(corrective_angle) + + new_heading = torch.stack( + [torch.cos(new_angles), torch.sin(new_angles)], + dim=-1, + ) + + # move to origin and rotate + first_pos = 1 * root_pos[:, [0]] + first_pos[..., 1] = 0 # don't canonicalize height + + new_root_pos = torch.einsum( + "bik,btk->bti", + corrective_mat, + root_pos - first_pos, + ) + # create the new feature vector + new_global_root, _ = einops.pack( + [new_root_pos, new_heading], "batch nbframes *" + ) + + # be carefull here, could need to rotate part of the body motion + new_body_motion = self.change_first_heading_body(motion, corrective_mat) + new_motion, _ = einops.pack( + [new_global_root, new_body_motion], + "batch nbframes *", + ) + [new_motion] = einops.unpack(new_motion, ps, "* nbframes dim") + + if to_normalize: + new_motion = self.normalize(new_motion) + + if return_numpy: + new_motion = new_motion.cpu().numpy() + return new_motion diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/local_root_local_body.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/local_root_local_body.py new file mode 100644 index 0000000000000000000000000000000000000000..5d6178c228618f6dfb58a65751e2b1fcddd41f57 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/local_root_local_body.py @@ -0,0 +1,276 @@ +from typing import Optional, Tuple + +import einops +import numpy as np +import torch + +from motionbricks.motionlib.core.motion_reps.tools.motion_features import ( + compute_vel_angle, + compute_vel_xyz, +) +from motionbricks.motionlib.core.skeletons import SkeletonBase +from motionbricks.motionlib.core.utils.rotations import ( + angle_to_Y_rotation_matrix, + quat_apply, + quat_conjugate, +) +from motionbricks.motionlib.core.utils.stats import Stats + +from .seperate_root_local_body import SeparatedRootLocalBody + + +class LocalRootLocalBody(SeparatedRootLocalBody): + """Representation with local root and local body.""" + + dual_class = None + + def __init__( + self, + fps: float, + skeleton: SkeletonBase, + name: str, + stats: Optional[Stats] = None, + ): + # Subclasses should define + # get_body_keys_dim + # compute_kwargs + + self.nfeats_vel = 3 if self.compute_kwargs["local_root_vel_with_y"] else 2 + self.root_keys_dim = { + "local_root_rot_vel": [], # vel theta + "local_root_vel": [self.nfeats_vel], # vel xyz or xz + "global_root_y": [], # gravity axis global + } + + self.body_keys_dim = self.get_body_keys_dim(skeleton.nbjoints) + + # If we got the stats from the dual representation + if self.dual_class is not None and self.dual_class._name_ in name: + super().__init__(fps, skeleton, name, stats=None) + # full stats for dual rep + self.dual_rep = self.dual_class(fps, skeleton, name, stats=stats) + self.dual_rep_mode = "local" + # load the subset stats + self.stats = self.dual_rep.local_motion_rep.stats + else: + self.dual_rep = None + super().__init__(fps, skeleton, name, stats) + + self.root_mode = "local" + + def compute_root_pos_and_rot( + self, motion: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute root position and rotation from a local root representation. + + Args: + motion (torch.Tensor): [..., T, 4] (unnormalized) root motion where 4 is [angvel, vel_x, vel_z, height] + or full motion representation [.., T, D] + + Returns: + torch.Tensor: [..., T, 3] global root position + torch.Tensor: [..., T, 4] global root rot quaternion + """ + root_motion = self.extract_root(motion) + + device = root_motion.device + batch, nbframes = root_motion.shape[:2] + + root_rot_vel_angles, root_local_vel, root_y_pos = einops.unpack( + root_motion, + [[], [self.nfeats_vel], []], + "batch time *", + ) + + # multiply by dt (= div by fps) to recover true differences + # dv = dv/dt * dt + root_rot_vel_angles = root_rot_vel_angles / self.fps + root_local_vel = root_local_vel / self.fps + + # Get Y-axis rotation from rotation velocity + r_rot_ang = torch.zeros_like(root_rot_vel_angles, device=device) + r_rot_ang[..., 1:] = root_rot_vel_angles[..., :-1] + # don't use the dummy last one + r_rot_ang = torch.cumsum(r_rot_ang, dim=-1) + + # Create the quaternion from the angle + r_rot_quat = torch.zeros((batch, nbframes, 4), device=device) + r_rot_quat[..., 0] = torch.cos(r_rot_ang / 2) + r_rot_quat[..., 2] = torch.sin(r_rot_ang / 2) + + # Integrate position from linear velocity (for xz only) + r_pos = torch.zeros((batch, nbframes, 3), device=device) + r_pos[..., 1:, [0, 2]] = root_local_vel[..., :-1, :] + # don't use the dummy last one + + # Add Y-axis rotation to velocities + # shift one frame is needed to align root_quat with local_root_motion, + # to match convert_root_global_to_local + removed_heading = self.compute_kwargs.get("removing_heading", True) + if removed_heading: + r_pos[..., 1:, :] = quat_apply(r_rot_quat[..., :-1, :], r_pos[..., 1:, :]) + + r_pos = torch.cumsum(r_pos, dim=-2) + + # Set height + r_pos[..., 1] = root_y_pos + return r_pos, r_rot_quat + + def compute_root_rep_from_root_pos_and_rot( + self, + r_pos, + r_rot_quat, + lengths: Optional[torch.Tensor] = None, + ): + """Compute root representation from root position and rotation. + + Args: + r_pos (torch.Tensor): [..., T, 3] global root position + r_rot_quat (torch.Tensor): [..., T, 4] global root rot quaternion (heading only) + Return: + root_motion (torch.Tensor): [..., T, 4] + """ + + root_rot_angles = torch.arctan2(r_rot_quat[..., 2], r_rot_quat[..., 0]) * 2 + local_root_rot_vel = compute_vel_angle( + root_rot_angles, self.fps, lengths=lengths + ) + root_vel = compute_vel_xyz( + r_pos[..., None, :], + self.fps, + lengths=lengths, + )[..., 0, :] + + removed_heading = self.compute_kwargs.get("removing_heading", True) + if removed_heading: + # rotate back + local_root_vel = quat_apply(quat_conjugate(r_rot_quat), root_vel)[ + ..., [0, 2] + ] + else: + local_root_vel = root_vel[..., [0, 2]] + + global_root_y = r_pos[..., 1] + root_motion = torch.cat( + [ + local_root_rot_vel[..., None], + local_root_vel, + global_root_y[..., None], + ], + axis=-1, + ) + return root_motion + + def change_first_heading( + self, + motion: torch.Tensor, + first_heading_angle: float, + is_normalized: bool, + to_normalize: bool, + return_numpy: bool = False, + ) -> torch.Tensor: + if isinstance(motion, np.ndarray): + motion = torch.from_numpy(motion) + + if is_normalized: + motion = self.unnormalize(motion) + + # make is universally: [X, T, D] + motion, ps = einops.pack([motion], "* nbframes dim") + root_motion = self.extract_root(motion) + + device = root_motion.device + batch, nbframes = root_motion.shape[:2] + + root_rot_vel_angles, root_local_vel, root_y_pos = einops.unpack( + root_motion, + [[], [self.nfeats_vel], []], + "batch time *", + ) + + if not self.removed_heading: + # need to find the original heading from the body features + # only done with hips_pos at the moment + assert self.compute_kwargs["compute_heading_method"] == "hips_pos" + from motionbricks.motionlib.core.motion_reps.tools.heading import calc_heading_from_joints_pos + + root_idx = self.skeleton.root_idx + + # do the smooth root here + if self.using_smooth_root: + # extract the first position + first_position = einops.rearrange( + self.slice(motion, "ric_data")[:, 0], + "batch (nbjoints xyz) -> batch nbjoints xyz", + xyz=3, + ) + assert first_position.shape[-2] == self.skeleton.nbjoints + else: + # extract the first position + first_position = einops.rearrange( + self.slice(motion, "ric_data")[:, 0], + "batch (nbjoints_minus_one xyz) -> batch nbjoints_minus_one xyz", + xyz=3, + ) + assert first_position.shape[-2] == (self.skeleton.nbjoints - 1) + + # add back the dummy (to get good indices for finding the heading) + dummy_root = 0 * first_position[:, 0] + first_position, _ = einops.pack( + [ + first_position[:, :root_idx], + dummy_root, + first_position[:, root_idx:], + ], + "batch * dim", + ) + + # compute the first heading angle + prev_heading_angle = calc_heading_from_joints_pos( + first_position[:, None], + skeleton=self.skeleton, + return_quat=False, + inverse=False, + )[:, 0] + + corrective_angle = first_heading_angle - prev_heading_angle + corrective_mat = angle_to_Y_rotation_matrix(corrective_angle) + + if root_local_vel.shape[-1] == 2: + # rotate the 2D velocities + new_root_local_vel = torch.einsum( + "bik,btk->bti", + corrective_mat[..., [0, 2]][..., [0, 2], :], + root_local_vel, + ) + else: + # rotate the 3D velocities + new_root_local_vel = torch.einsum( + "bik,btk->bti", + corrective_mat, + root_local_vel, + ) + + # create the new local root + new_local_root, _ = einops.pack( + [root_rot_vel_angles, new_root_local_vel, root_y_pos], + "batch time *", + ) + + new_body_motion = self.change_first_heading_body(motion, corrective_mat) + new_motion, _ = einops.pack( + [new_local_root, new_body_motion], + "batch nbframes *", + ) + else: + # changing first heading does not matter + new_motion = motion + + [new_motion] = einops.unpack(new_motion, ps, "* nbframes dim") + + if to_normalize: + new_motion = self.normalize(new_motion) + + if return_numpy: + new_motion = new_motion.cpu().numpy() + return new_motion diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/motion_rep_base.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/motion_rep_base.py new file mode 100644 index 0000000000000000000000000000000000000000..22e618315c9dc5061ef112732764300ccc15021a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/motion_rep_base.py @@ -0,0 +1,50 @@ +from typing import Optional + +import torch + +from motionbricks.motionlib.core.skeletons import SkeletonBase +from motionbricks.motionlib.core.utils.stats import Stats + + +class MotionRepBase(torch.nn.Module): + """Base class for a motion representation.""" + + def __init__( + self, + fps: float, + skeleton: SkeletonBase, + name: str, + stats: Optional[Stats] = None, + ): + super().__init__() + self.stats = stats + # native resolution of the motion + self.fps = fps + # skeleton holds joint names and other info like root and feet indices + # if need to do FK, also holds parents and neutral pose + self.skeleton = skeleton + + # name of the motion rep + self.name = name + + # number of joints in the skeleton + self.num_joints = self.nbjoints = skeleton.nbjoints + + def normalize(self, motion: torch.Tensor, index=None) -> torch.Tensor: + """Normalize a feature vector or a index of it. + + Args: + motion (torch.Tensor): [..., D] the motion to normalize + index (Optional[index]) the index to crop the motion + """ + return self.stats.normalize(motion, index=index) + + def unnormalize(self, motion: torch.Tensor, index=None) -> torch.Tensor: + """Unnormalize a normalized motion. Only one of root_only, nonroot_only, and contacts_only + should be true. + + Args: + motion (torch.Tensor): [..., D] the motion to unnormalize + index (Optional[index]) the index to crop the motion + """ + return self.stats.unnormalize(motion, index=index) diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/seperate_root_local_body.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/seperate_root_local_body.py new file mode 100644 index 0000000000000000000000000000000000000000..719d0b42683ad04b88dd9696666b76233a3741a8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/motion_reps_base/seperate_root_local_body.py @@ -0,0 +1,963 @@ +from typing import Dict, Optional + +import einops +import numpy as np +import torch + +from motionbricks.motionlib.core.motion_reps.tools.changing_t_pose import ( + change_t_pose_global_mats, + global_mats_to_local_mats, +) +from motionbricks.motionlib.core.motion_reps.tools.motion_features import ( + compute_motion_features, + reconstruct_joint_rot_mats_from_ric_global_rots, + reconstruct_joint_rot_mats_from_ric_rots, + recover_joints_from_ric_pos, + recover_joints_with_FK, +) +from motionbricks.motionlib.core.skeletons import SkeletonBase +from motionbricks.motionlib.core.utils.rotations import ( + cont6d_to_matrix, + matrix_to_cont6d, + matrix_to_quaternion, + quat_apply, + quat_mul, +) +from motionbricks.motionlib.core.utils.stats import Stats + +from .motion_rep_base import MotionRepBase + + +class SeparatedRootLocalBody(MotionRepBase): + """Motion representation that separates root and local body motion. + + The representation concatenates [root_motion, local_body_motion] features. + + Subclasses must define: + + Attributes: + body_keys_dim (Dict): Mapping of body feature keys to their dimensions + root_keys_dim (Dict): Mapping of root feature keys to their dimensions + compute_kwargs (Dict): Extra parameters for computing features + default_joint_positions_from (str): Default source for joint positions, one of: + - "ric_data": Relative joint positions + - "rot_data": Local joint rotations + - "global_rot_data": Global joint rotations + + Methods: + compute_root_pos_and_rot(): Extracts root position and rotation from features + compute_root_rep_from_root_pos_and_rot(): Converts root pos/rot to root feature representation + change_first_heading(): Rotate the motion rep to the given heading + """ + + def __init__( + self, + fps: float, + skeleton: SkeletonBase, + name: str, + stats: Optional[Stats] = None, + ): + super().__init__(fps, skeleton, name, stats) + + # set the name with the setter defined below + self.name = name + + # define usefull info for the class + # from "root_keys_dim" and "body_keys_dim" + [*self.root_keys], [*self.root_ps] = zip(*self.root_keys_dim.items()) + [*self.body_keys], [*self.body_ps] = zip(*self.body_keys_dim.items()) + + # all info + self.keys_dim = self.root_keys_dim | self.body_keys_dim + self.keys = self.root_keys + self.body_keys + self.ps = self.root_ps + self.body_ps + + # compute dim + self.motion_rep_dim = sum((sum(x) if x else 1 for x in self.ps)) + self.motion_root_dim = sum((sum(x) if x else 1 for x in self.root_ps)) + self.motion_body_dim = sum((sum(x) if x else 1 for x in self.body_ps)) + + if stats is not None and stats.is_loaded(): + assert self.motion_rep_dim == stats.get_dim() + + # no subset, entire motion rep + self.motion_rep_subset_dim = self.motion_rep_dim + + # compute indices, for easy access + self.indices = {} + idx = 0 + for key, x in zip(self.keys, self.ps): + dim = sum(x) if x else 1 + self.indices[key] = np.arange(idx, idx + dim) + idx += dim + + self.indices["all"] = np.arange(0, self.motion_rep_dim) + self.indices["root"] = np.arange(0, self.motion_root_dim) + self.indices["body"] = np.arange( + self.motion_root_dim, self.motion_root_dim + self.motion_body_dim + ) + + self.removed_heading = self.compute_kwargs.get("removing_heading", True) + self.using_smooth_root = self.compute_kwargs.get("using_smooth_root", False) + + self.extra_skel = self.compute_kwargs.get("extra_skel", False) + if self.extra_skel: + # verify that the skeleton is extra + assert ( + repr(self.skeleton.__class__).split("'")[1].endswith("Extra") + ), "The skeleton should be an extra skeleton" + + def canonicalize_to_first_frame( + self, + motion: torch.Tensor, + is_normalized: bool, + to_normalize: bool, + return_numpy: bool = False, + ) -> torch.Tensor: + new_motion = self.change_first_heading( + motion, + first_heading_angle=0.0, + is_normalized=is_normalized, + to_normalize=to_normalize, + return_numpy=return_numpy, + ) + return new_motion + + def randomize_first_heading( + self, + motion: torch.Tensor, + is_normalized: bool, + to_normalize: bool, + return_numpy: bool = False, + ) -> torch.Tensor: + first_heading_angle = np.random.rand() * 2 * np.pi + new_motion = self.change_first_heading( + motion, + first_heading_angle=first_heading_angle, + is_normalized=is_normalized, + to_normalize=to_normalize, + return_numpy=return_numpy, + ) + return new_motion + + def slice(self, motion, key: str): + """Extracts a specific feature subset from the motion representation. + + Args: + motion (torch.Tensor): Motion features of shape [..., D] + key (str): Feature key to extract, must be in self.indices + + Returns: + torch.Tensor: Extracted feature subset + """ + + assert key in self.indices + assert motion.shape[-1] == self.motion_rep_dim + return motion[..., self.indices[key]] + + def detect_all_body_or_root(self, motion: torch.Tensor): + """Detects whether input contains full, root-only, or body-only features. + + Args: + motion (torch.Tensor): Motion features of shape [..., D] + + Returns: + str: One of "all", "root", or "body" indicating feature type + + Raises: + ValueError: If input dimension doesn't match any known feature subset + """ + dim = motion.shape[-1] + if dim == self.motion_rep_dim: + return "all" + elif dim == self.motion_root_dim: + return "root" + elif dim == self.motion_body_dim: + return "body" + else: + raise ValueError(f"This input dim is not recognized: {dim}") + + def normalize(self, motion: torch.Tensor, index=None) -> torch.Tensor: + """Normalizes motion features using stored statistics. + + Args: + motion (torch.Tensor): Motion features of shape [..., D] to normalize + index (Optional[np.ndarray]): If motion is a subset of full representation, + the indices within the full representation that the input contains + + Returns: + torch.Tensor: Normalized motion features + """ + if index is None: + index = self.indices[self.detect_all_body_or_root(motion)] + return self.stats.normalize(motion, index=index) + + def unnormalize(self, motion: torch.Tensor, index=None) -> torch.Tensor: + """Unnormalizes motion features using stored statistics. + + Args: + motion (torch.Tensor): Normalized motion features of shape [..., D] + index (Optional[np.ndarray]): If motion is a subset of full representation, + the indices within the full representation that the input contains + + Returns: + torch.Tensor: Unnormalized motion features + """ + if index is None: + index = self.indices[self.detect_all_body_or_root(motion)] + return self.stats.unnormalize(motion, index=index) + + def extract_root(self, motion: torch.Tensor) -> torch.Tensor: + """Extracts root motion features from input. + + Args: + motion (torch.Tensor): Motion features of shape [..., D] + + Returns: + torch.Tensor: Root motion features + + Raises: + ValueError: If input doesn't contain root features + """ + type = self.detect_all_body_or_root(motion) + + if type == "root": + return motion + elif type == "all": + return self.slice(motion, "root") + else: + raise ValueError("Cannot compute root info without root") + + def extract_body(self, motion: torch.Tensor) -> torch.Tensor: + """Extracts body motion features from input. + + Args: + motion (torch.Tensor): Motion features of shape [..., D] + + Returns: + torch.Tensor: Body motion features + + Raises: + ValueError: If input doesn't contain body features + """ + type = self.detect_all_body_or_root(motion) + if type == "body": + return motion + elif type == "all": + return self.slice(motion, "body") + else: + raise ValueError("Cannot compute body info without body") + + def extract_foot_contacts( + self, + motion: torch.Tensor, + is_normalized: bool, + contact_thresh: Optional[float] = 0.5, + ) -> torch.Tensor: + """Extracts foot contact states from motion features. + + Args: + motion (torch.Tensor): Motion features of shape [..., D] + is_normalized (bool): Whether input features are normalized + contact_thresh (Optional[float]): Threshold for binary contact classification. + If None, returns raw contact values. + + Returns: + torch.Tensor: Foot contact states, binary if threshold provided + """ + assert "foot_contacts" in self.indices + + foot_contacts = motion[..., self.indices["foot_contacts"]] + + if is_normalized: + foot_contacts = self.unnormalize( + foot_contacts, index=self.indices["foot_contacts"] + ) + + if contact_thresh is not None: + contacts = foot_contacts > contact_thresh + else: + contacts = foot_contacts + return contacts + + def compute_root_pos_and_rot( + self, + motion: torch.Tensor, + type: Optional[str] = None, + ): + """Compute root position and rotation from the representation. + + Args: + motion (torch.Tensor): Motion features of shape [..., D] (can be the full representation or the root subset) + type (Optional[str]): Type of motion features, if None will be auto-detected + + Returns: + Tuple[torch.Tensor, torch.Tensor]: + - torch.Tensor: [..., T, 3] global root position + - torch.Tensor: [..., T, 4] global root rotation quaternion (heading only) + """ + + root_motion = self.extract_root(motion) # noqa + ... + raise NotImplementedError + return root_pos, root_rot_quat # noqa + + def compute_root_rep_from_root_pos_and_rot( + self, root_pos: torch.Tensor, root_rot_quat: torch.Tensor + ): + """Compute root representation from root position and rotation. + + Args: + root_pos (torch.Tensor): [..., T, 3] global root position + root_rot_quat (torch.Tensor): [..., T, 4] global root rotation quaternion + + Returns: + torch.Tensor: [..., T, D] Root motion features + """ + raise NotImplementedError + return root_motion # noqa + + def __call__( + self, + input_tensor_dict, + to_normalize: bool, + original_skeleton: Optional[SkeletonBase] = None, + lengths: Optional[torch.Tensor] = None, + return_numpy: bool = False, + t_pose_from: Optional[str] = None, + return_init_heading_info: bool = False, + ) -> torch.Tensor: + """Converts input motion data to feature representation. + + Args: + input_tensor_dict (Dict): Input motion data containing joint rotations/positions + to_normalize (bool): Whether to normalize the output features + original_skeleton (Optional[SkeletonBase]): Source skeleton if different from self.skeleton + lengths (Optional[torch.Tensor]): Sequence lengths for batched data + return_numpy (bool): Whether to return numpy array instead of torch tensor + t_pose_from (Optional[str]): Source t-pose if converting between differnet t-poses + return_init_heading_info (bool): Whether to return initial heading information + + Returns: + torch.Tensor: Motion features of shape [..., D] + Optional[Dict]: Initial heading info if return_init_heading_info=True + """ + if original_skeleton is None: + # take the current one + # assume the skeleton is the same + original_skeleton = self.skeleton + + skel_slice = self.skeleton.get_skel_slice(original_skeleton) + + new_in_tensor_dict = dict() + for key, val in input_tensor_dict.items(): + if isinstance(val, np.ndarray): + val = torch.from_numpy(val) + + if not isinstance(val, torch.Tensor): + # it is not a tensor + new_in_tensor_dict[key] = val + continue + + # no slice for those + if key in ["translation", "foot_contacts", "root_pos"]: + new_in_tensor_dict[key] = val + continue + + # rotations matrices + if val.shape[-1] == 3 and val.shape[-2] == 3: + # verify the dimensions + if original_skeleton.nbjoints != val.shape[-3]: + base_skel = getattr(original_skeleton, "base_skel", None) + if base_skel is not None and base_skel.nbjoints == val.shape[-3]: + pass + else: + raise ValueError( + "The data is not compatible with the provided skeleton." + ) + val = val[..., skel_slice, :, :] + else: + # verify the dimensions + if original_skeleton.nbjoints != val.shape[-2]: + base_skel = getattr(original_skeleton, "base_skel", None) + if base_skel is not None and base_skel.nbjoints == val.shape[-2]: + pass + else: + raise ValueError( + "The data is not compatible with the provided skeleton." + ) + val = val[..., skel_slice, :] + + new_in_tensor_dict[key] = val + + features = compute_motion_features( + new_in_tensor_dict, + lengths=lengths, + motion_rep=self, + t_pose_from=t_pose_from, + return_init_heading_info=return_init_heading_info, + **self.compute_kwargs, + ) + if return_init_heading_info: + features, init_heading_info = features + + assert features.shape[-1] == self.motion_rep_dim + + if to_normalize: + features = self.normalize(features) + + if return_numpy: + features = features.cpu().numpy() + + if return_init_heading_info: + return features, init_heading_info + return features + + def inverse( + self, + features: torch.Tensor, + is_normalized: bool, + # Neutral joints (take the one from the skeleton by default) + neutral_joints: Optional[torch.Tensor] = None, + # Canonicalization info + init_heading_info: Optional[Dict] = None, + # Default options which depends on the motion rep + joint_positions_from: Optional[str] = None, + # Default options + return_quat: bool = False, + return_all: bool = False, + run_fk: bool = True, + return_numpy: bool = False, + extra_skel_process: bool = True, + # Optional to change t-pose + t_pose_to: str = None, + ) -> torch.Tensor: + """Converts motion features back to joint rotations and positions. + + Args: + features (torch.Tensor): Motion features of shape [..., D] + is_normalized (bool): Whether input features are normalized + neutral_joints (Optional[torch.Tensor]): Custom neutral joints to use for FK. Otherwise uses default from skeleton. + init_heading_info (Optional[Dict]): Initial heading/position for motion + joint_positions_from (Optional[str]): Source for computing default joint positions: + "rot_data", "ric_data", or "global_rot_data" + return_quat (bool): Return quaternions instead of rotation matrices + return_all (bool): Return joints positions from all the possible sources + run_fk (bool): Run forward kinematics to get joint positions + return_numpy (bool): Return numpy arrays instead of torch tensors + t_pose_to (Optional[str]): Target t-pose if converting between different t-poses + + Returns: + Dict[str, torch.Tensor]: Dictionary containing: + - posed_joints: Joint positions + - local_joint_rots: Local joint rotations + - global_joint_rots: Global joint rotations + - foot_contacts: Foot contact states + - all_posed_joints: Joint positions from all methods if return_all=True + - all_local_rots: Local rotations from all methods if return_all=True + - all_global_rots: Global rotations from all methods if return_all=True + """ + + # Changing the t_pose for the rotations + changing_t_pose = False + if t_pose_to is not None: + if self.skeleton.t_pose is None: + raise ValueError( + "Cannot change the t_pose if we don't know the origin t_pose" + ) + # True only if it is changing + changing_t_pose = self.skeleton.t_pose != t_pose_to + + # storage of the outputs + output_tensor_dict = { + "all_posed_joints": {}, + "all_local_rots": {}, + "all_global_rots": {}, + } + + if joint_positions_from is None: + joint_positions_from = self.default_joint_positions_from + + # make sure the default input can be taken + assert ( + joint_positions_from in self.indices + or joint_positions_from == "global_rot_data" + and self.extra_skel + ) + if isinstance(features, np.ndarray): + features = torch.from_numpy(features) + + # make is universally: [X, T, D] + features, ps = einops.pack([features], "* nbframes dim") + nbframes = features.shape[1] + + if init_heading_info is not None: + # universal shapes [X, D] + init_heading_info["init_heading_quat"] = einops.pack( + [init_heading_info["init_heading_quat"]], "* dim" + )[0].to(dtype=features.dtype, device=features.device) + init_heading_info["root_pos_init_xz"] = einops.pack( + [init_heading_info["root_pos_init_xz"]], "* dim" + )[0].to(dtype=features.dtype, device=features.device) + + if is_normalized: + features = self.unnormalize(features) + + root_pos, root_rot_quat = self.compute_root_pos_and_rot(features) + output_tensor_dict["root_pos"] = root_pos.clone() + + # add the hips offset to the root pos if using smooth root + if self.using_smooth_root: + assert ( + "ric_data" in self.indices + ), "ric_data should be in the motion rep if using smooth root. This is useful to get back the root offset" + joints_ric_pos = self.slice(features, "ric_data") + + hips_indices = np.array( + [ + self.skeleton.root_idx, + self.skeleton.root_idx + 1, + self.skeleton.root_idx + 2, + ] + ) + hips_positions = joints_ric_pos[..., hips_indices] + + # add back the hips offset to the root position + root_pos[..., [0, 2]] += hips_positions[..., [0, 2]] + root_pos[..., 1] = hips_positions[..., 1] + + # remove the rotation of the root position + # add back the init positions (already rotated by the rotations) + if init_heading_info is not None: + init_heading_quat = init_heading_info["init_heading_quat"] + root_pos_init_xz = init_heading_info["root_pos_init_xz"] + + # add time dimension + init_heading_quat_time = einops.repeat( + init_heading_quat, + "batch quat -> batch time quat", + time=nbframes, + ) + + # then rotate, to get back the first Z rotation + root_pos = quat_apply(init_heading_quat_time, root_pos) + + # and put the original root position + the offset + root_pos[:, :, [0, 2]] += root_pos_init_xz[:, None] + + # add extra init rotation to all root rotations + root_rot_quat = quat_mul(init_heading_quat_time, root_rot_quat) + else: + init_heading_quat = None + + # Do ric_data first, to get extrapos joints first, to get the global rotations + posed_joints_extra_skel = None + global_rot_mats_from_extra_skel = None + if "ric_data" in self.indices and ( + return_all or joint_positions_from == "ric_data" or self.extra_skel + ): + joints_ric_pos = self.slice(features, "ric_data") + + # recover global joint positions from positions + posed_joints_from_pos = recover_joints_from_ric_pos( + joints_ric_pos, + root_pos, + root_rot_quat, + skeleton=self.skeleton, + removed_heading=self.removed_heading, + init_heading_quat=init_heading_quat, # in case the heading is not removed + using_smooth_root=self.using_smooth_root, + ) + + if extra_skel_process and self.extra_skel: + # crop the output + skel_slice = self.skeleton.base_skel.get_skel_slice(self.skeleton) + posed_joints_extra_skel = posed_joints_from_pos + + # compute the global rotations from extrapos + global_rot_mats_from_extra_skel = compute_rotations_from_extrapos( + posed_joints_extra_skel, self.skeleton + ) + posed_joints_from_pos = posed_joints_extra_skel[..., skel_slice, :] + + [posed_joints_from_pos] = einops.unpack( + posed_joints_from_pos, ps, "* nbframes nbjoints xyz" + ) + output_tensor_dict["all_posed_joints"]["ric_data"] = posed_joints_from_pos + # the one by default + if joint_positions_from == "ric_data": + output_tensor_dict["posed_joints"] = posed_joints_from_pos + + if extra_skel_process and self.extra_skel: + skeleton = self.skeleton.base_skel + else: + skeleton = self.skeleton + + if "rot_data" in self.indices and ( + return_all or joint_positions_from == "rot_data" + ): + joints_ric_rot6d = self.slice(features, "rot_data") + # Get back the full rotation matrix + local_rot_mats = reconstruct_joint_rot_mats_from_ric_rots( + joints_ric_rot6d, + root_pos, + root_rot_quat, + skeleton, + removed_heading=self.removed_heading, + init_heading_quat=init_heading_quat, + ) + + # fk is necessary for changing t-pose + if run_fk or changing_t_pose: + # recover global joint positions from rotations + posed_joints_from_local_rots, global_rot_mats = recover_joints_with_FK( + local_rot_mats, + root_pos, + skeleton, + neutral_joints=neutral_joints, + return_global_rots=True, + ) + + # save the joints positions + [posed_joints_from_local_rots] = einops.unpack( + posed_joints_from_local_rots, ps, "* nbframes nbjoints xyz" + ) + output_tensor_dict["all_posed_joints"]["rot_data"] = ( + posed_joints_from_local_rots + ) + # the one by default + if joint_positions_from == "rot_data": + output_tensor_dict["posed_joints"] = posed_joints_from_local_rots + + if changing_t_pose: + # do this after FK, so that we can keep the old neutral joints + # it will not be compatible with our skeleton anymore + global_rot_mats = change_t_pose_global_mats( + global_rot_mats, + t_pose_to, + skeleton, + ) + local_rot_mats = global_mats_to_local_mats(global_rot_mats, skeleton) + + # save the local rots from local + [local_rot_mats] = einops.unpack( + local_rot_mats, ps, "* nbframes nbjoints dim1 dim2" + ) + if return_quat: + local_rots = matrix_to_quaternion(local_rot_mats) + else: + local_rots = local_rot_mats + + output_tensor_dict["all_local_rots"]["rot_data"] = local_rots + # the one by default + if joint_positions_from == "rot_data": + output_tensor_dict["local_joint_rots"] = local_rots + + # save the global rots from local + [global_rot_mats] = einops.unpack( + global_rot_mats, ps, "* nbframes nbjoints dim1 dim2" + ) + + if return_quat: + global_rots = matrix_to_quaternion(global_rot_mats) + else: + global_rots = global_rot_mats + + output_tensor_dict["all_global_rots"]["rot_data"] = global_rots + # the one by default + if joint_positions_from == "rot_data": + output_tensor_dict["global_joint_rots"] = global_rots + + if ( + "global_rot_data" in self.indices + or global_rot_mats_from_extra_skel is not None + ) and (return_all or joint_positions_from == "global_rot_data"): + if global_rot_mats_from_extra_skel is not None: + # use the global rotations from extrapos + global_rot_mats_from_global = ( + global_rot_mats_from_extra_skel # [B, T, J, 3, 3] + ) + + # obtain back the local rotations from the new global rotations + parent_rot_mats = global_rot_mats_from_global[ + :, :, skeleton.joint_parents + ] + # root joint + parent_rot_mats[:, :, skeleton.root_idx] = torch.eye(3) + local_rot_mats_from_global = torch.einsum( + "B T N n m , B T N n o -> B T N m o", + parent_rot_mats, + global_rot_mats_from_global, + ) + # add extra identity rots: should not be needed + local_rot_mats_from_global[:, :, skeleton.nbjoints :] = torch.eye(3) + else: + global_joints_ric_rot = self.slice(features, "global_rot_data") + + # Get back the local rotation matrix + local_rot_mats_from_global, global_rot_mats_from_global = ( + reconstruct_joint_rot_mats_from_ric_global_rots( + global_joints_ric_rot, + root_rot_quat, + skeleton, + removed_heading=self.removed_heading, + init_heading_quat=init_heading_quat, + ) + ) + + if run_fk: + # recover global joint positions from rotations + posed_joints_from_global_rots, global_rot_mats_from_global = ( + recover_joints_with_FK( + local_rot_mats_from_global, + root_pos, + skeleton, + neutral_joints=neutral_joints, + return_global_rots=True, + ) + ) + + # save the joints positions + [posed_joints_from_global_rots] = einops.unpack( + posed_joints_from_global_rots, ps, "* nbframes nbjoints xyz" + ) + output_tensor_dict["all_posed_joints"]["global_rot_data"] = ( + posed_joints_from_global_rots + ) + # the one by default + if joint_positions_from == "global_rot_data": + output_tensor_dict["posed_joints"] = posed_joints_from_global_rots + + # fk was not necessary for changing t-pose since we already have the global + if changing_t_pose: + # do this after FK, so that we can keep the old neutral joints + # it will not be compatible with our skeleton anymore + global_rot_mats_from_global = change_t_pose_global_mats( + global_rot_mats_from_global, + t_pose_to, + skeleton, + ) + local_rot_mats_from_global = global_mats_to_local_mats( + global_rot_mats_from_global, + skeleton, + ) + + # save the local rots from global + [local_rot_mats_from_global] = einops.unpack( + local_rot_mats_from_global, ps, "* nbframes nbjoints dim1 dim2" + ) + if return_quat: + local_rot_from_global = matrix_to_quaternion(local_rot_mats_from_global) + else: + local_rot_from_global = local_rot_mats_from_global + + output_tensor_dict["all_local_rots"]["global_rot_data"] = ( + local_rot_from_global + ) + # the one by default + if joint_positions_from == "global_rot_data": + output_tensor_dict["local_joint_rots"] = local_rot_from_global + + # save the global rots from global + [global_rot_mats_from_global] = einops.unpack( + global_rot_mats_from_global, ps, "* nbframes nbjoints dim1 dim2" + ) + + if return_quat: + global_rots_from_global = matrix_to_quaternion( + global_rot_mats_from_global + ) + else: + global_rots_from_global = global_rot_mats_from_global + + output_tensor_dict["all_global_rots"]["global_rot_data"] = ( + global_rots_from_global + ) + # the one by default + if joint_positions_from == "global_rot_data": + output_tensor_dict["global_joint_rots"] = global_rots_from_global + + # foot contacts + foot_contacts = self.extract_foot_contacts( + features, + is_normalized=False, # already unnormalized + ) + [output_tensor_dict["foot_contacts"]] = einops.unpack( + foot_contacts, ps, "* nbframes dim" + ) + + if return_numpy: + for key, val in output_tensor_dict.items(): + output_tensor_dict[key] = val.cpu().numpy() + return output_tensor_dict + + def concat_root_body(self, root_data: torch.Tensor, body_data: torch.Tensor): + """Concatenates root and body features into full motion representation. + + Args: + root_data (torch.Tensor): Root motion features of shape [..., root_dim] + body_data (torch.Tensor): Body motion features of shape [..., body_dim] + + Returns: + torch.Tensor: Combined motion features of shape [..., D] + """ + assert root_data.shape[-1] == self.motion_root_dim + assert body_data.shape[-1] == self.motion_body_dim + motion_data = torch.cat([root_data, body_data], axis=-1) + assert motion_data.shape[-1] == self.motion_rep_dim + return motion_data + + def get_feature_subset(self, motion: torch.Tensor, mode: str): + """Extracts a feature subset based on specified mode. + + Args: + motion (torch.Tensor): Motion features of shape [..., D] + mode (str): Subset selection mode + + Returns: + torch.Tensor: Feature subset + """ + return motion + + def get_motion_rep_subset(self, mode: str): + """Gets a subset motion representation. + + Args: + mode (str): Subset selection mode + + Returns: + SeparatedRootLocalBody: Motion representation for subset + """ + return self + + def get_root_index_subset(self, mode: str): + """Gets indices for root features subset. + + Args: + mode (str): Subset selection mode + + Returns: + np.ndarray: Indices for root features + """ + return self.indices["root"] + + def get_body_index_subset(self, mode: str): + """Gets indices for body features subset. + + Args: + mode (str): Subset selection mode + + Returns: + np.ndarray: Indices for body features + """ + return self.indices["body"] + + def change_first_heading_body( + self, + motion: torch.Tensor, + corrective_mat: torch.Tensor, + ): + root_idx = self.skeleton.root_idx + if not self.removed_heading: + all_body_feats = {} + for key in self.body_keys: + feats = self.slice(motion, key) + if key == "ric_data": + positions = einops.rearrange( + feats, + "batch time (nbjoints_minus_one xyz) -> batch time nbjoints_minus_one xyz", + xyz=3, + ) + + if self.using_smooth_root: + assert positions.shape[-2] == self.skeleton.nbjoints + else: + assert positions.shape[-2] == (self.skeleton.nbjoints - 1) + + # rotate the positions + positions = torch.einsum( + "bik,btdk->btdi", + corrective_mat, + positions, + ) # (AX)i = sum_k A_ik X_k + # put back into features + new_feats = einops.rearrange( + positions, + "batch time nbjoints_minus_one xyz -> batch time (nbjoints_minus_one xyz)", + ) + elif key == "local_vel": + local_vel = einops.rearrange( + feats, + "batch time (joints dim) -> batch time joints dim", + dim=3, + ) + # rotate the velocities + new_local_vel = torch.einsum( + "bik,btdk->btdi", + corrective_mat, + local_vel, + ) + new_feats = einops.rearrange( + new_local_vel, + "batch time joints dim -> batch time (joints dim)", + ) + elif key == "rot_data": + local_rot_data = einops.rearrange( + feats, + "batch time (joints dim) -> batch time joints dim", + dim=6, + ) + # extract only the root rotation + local_root_6d = local_rot_data[..., root_idx, :] + local_root_mat = cont6d_to_matrix(local_root_6d) + + new_local_root_mat = torch.einsum( + "bik,btkj->btij", + corrective_mat, + local_root_mat, + ) + new_local_root_6d = matrix_to_cont6d(new_local_root_mat) + new_local_rot_data, _ = einops.pack( + [ + local_rot_data[:, :, :root_idx], + new_local_root_6d, + local_rot_data[:, :, root_idx + 1 :], + ], + "batch time * dim", + ) + new_feats = einops.rearrange( + new_local_rot_data, + "batch time joints dim -> batch time (joints dim)", + ) + elif key == "global_rot_data": + global_rot_data = einops.rearrange( + feats, + "batch time (joints dim) -> batch time joints dim", + dim=6, + ) + global_rot_mats = cont6d_to_matrix(global_rot_data) + global_rot_mats = torch.einsum( + "bik,btdkj->btdij", + corrective_mat, + global_rot_mats, + ) + # (AB)ij = sum_k A_ik B_jk + new_global_rot_data = matrix_to_cont6d(global_rot_mats) + new_feats = einops.rearrange( + new_global_rot_data, + "batch time joints dim -> batch time (joints dim)", + ) + elif key == "foot_contacts": + new_feats = feats + else: + raise ValueError( + "This body feature is not recognised. Needs to verify the rotation for non heading motion reps." + ) + all_body_feats[key] = new_feats + new_body_motion, _ = einops.pack( + [all_body_feats[key] for key in self.body_keys], "batch time *" + ) + else: + # the body motion is already canonical for each frame + new_body_motion = self.extract_body(motion) + return new_body_motion diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9769e9735563bcc3ca8be4a1fdda3b6e6ec6c103 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/changing_t_pose.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/changing_t_pose.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d70e9932529b0c29cb3939b6a1b4da4aee13dcc7 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/changing_t_pose.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/feature_info.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/feature_info.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..770952faccdfac7e3dcd4c5e485392d6c4f0c5d5 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/feature_info.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/feet.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/feet.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3a658b7e5c9b95d19161db406ee51aa90deca934 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/feet.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/heading.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/heading.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8c75b9edd38d3cb3d6523b36068237e1f25bfb03 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/heading.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/motion_features.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/motion_features.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ef79387ffa6ca35103b65c15a67621c6b3dc625 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/__pycache__/motion_features.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/changing_t_pose.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/changing_t_pose.py new file mode 100644 index 0000000000000000000000000000000000000000..af69ac8370dfb11c08d9e8fa7274b99ab7a026a2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/changing_t_pose.py @@ -0,0 +1,192 @@ +import math +import os +from typing import Optional + +import einops +import torch + +from motionbricks.motionlib.core.skeletons import ( + G1Skeleton, + G1Skeleton32, + G1Skeleton34, + SkeletonBase, +) +from motionbricks.motionlib.core.utils.rotations import exp_map_to_matrix, quaternion_to_matrix +from motionbricks.motionlib.core.utils.torch_utils import batch_rigid_transform + + +def _local_rot_offset_from_old_neutral_to_new_T( + n_bones: int, name_to_idx: dict +) -> torch.Tensor: + # local offsets to make the weird skeleton a custom t-pose + + const_exp_map = torch.zeros(n_bones, 3) + + # set (pelvis, x) to -pi/2 + const_exp_map[name_to_idx["Hips"], 0] = -math.pi / 2 + # set (right_shoulder, y) to pi + const_exp_map[name_to_idx["RightShoulder"], 1] = math.pi + # set (right up leg, y) to pi/2 + const_exp_map[name_to_idx["RightUpLeg"], 1] = math.pi / 2 + # set (left up leg, y) to pi/2 + const_exp_map[name_to_idx["LeftUpLeg"], 1] = math.pi / 2 + # set (right foot, z) to -pi/2 + const_exp_map[name_to_idx["RightFoot"], 2] = -math.pi / 2 + # set (left foot, z) to -pi/2 + const_exp_map[name_to_idx["LeftFoot"], 2] = -math.pi / 2 + + const_rot_mats = exp_map_to_matrix(const_exp_map) # (N, 3, 3) + + return const_rot_mats + + +def get_global_offset( + t_pose: str, + skeleton: SkeletonBase, + neutral_joints: Optional[torch.Tensor] = None, + return_neutral_joints=False, + base_path: str = "./", # this is helpful when using the package as a submodule in other projects +): + """Loads the t-pose that we want to convert to and returns the joint positions along with global + joint rotations.""" + if neutral_joints is None: + neutral_joints = skeleton.neutral_joints + + device = neutral_joints.device + dtype = neutral_joints.dtype + + if t_pose == "capture": + # identity: no changes + local_offset = torch.eye(3).repeat(skeleton.nbjoints, 1, 1) + elif t_pose == "custom": + n_bones = skeleton.nbjoints + name_to_idx = skeleton.bone_index + # rotation offsets: (N, 3, 3) + local_offset = _local_rot_offset_from_old_neutral_to_new_T(n_bones, name_to_idx) + elif t_pose == "standard": + t_pose_path = None + native_skel = None + if isinstance(skeleton, G1Skeleton32): + t_pose_path = os.path.join( + base_path, + "assets/skeletons/g1skel32/standard_t_pose_g1skel32_joint_quat.p", + ) + native_skel = G1Skeleton32() + elif isinstance(skeleton, G1Skeleton34): + t_pose_path = os.path.join( + base_path, + "assets/skeletons/g1skel34/standard_t_pose_g1skel34_joint_quat.p", + ) + native_skel = G1Skeleton34() + else: + raise NotImplementedError( + f"This skeleton is not supported for t-pose conversion: {skeleton}" + ) + joints_orients_with_hands = torch.load(t_pose_path) + + skel_slice = skeleton.get_skel_slice(native_skel) + joints_orients = joints_orients_with_hands[skel_slice] + local_offset = quaternion_to_matrix(joints_orients) + else: + raise NotImplementedError(f"This t-pose is not recognized: {t_pose}") + + # run FK to compute new neutral joint positions, and global rot offsets for next step of transforming the motion rot mats + new_neutral_joints, global_rot_offsets = batch_rigid_transform( + local_offset[None].to(device=device, dtype=dtype), + neutral_joints[None], + skeleton.joint_parents, + skeleton.root_idx, + ) + new_neutral_joints = new_neutral_joints[0] # (N, 3) + global_rot_offsets = global_rot_offsets[0] # (N, 3, 3) + + if return_neutral_joints: + return global_rot_offsets, new_neutral_joints + return global_rot_offsets + + +def change_t_pose_global_mats( + global_mats: torch.Tensor, + t_pose_to: str, + skeleton: SkeletonBase, + t_pose_from: Optional[str] = None, +): + if t_pose_from is None: + t_pose_from = skeleton.t_pose + + # no changes + if t_pose_from == t_pose_to: + return global_mats + + assert t_pose_from in ["capture", "custom", "standard"] + assert t_pose_to in ["capture", "custom", "standard"] + + dtype = global_mats.dtype + device = global_mats.device + + global_offset_from = get_global_offset(t_pose_from, skeleton) + global_offset_to = get_global_offset(t_pose_to, skeleton) + + new_global_mats = torch.einsum( + "... N m n, N n o, N p o -> ... N m p", + global_mats, + global_offset_from.to(device=device, dtype=dtype), + global_offset_to.to(device=device, dtype=dtype), + ) + return new_global_mats + + +def change_t_pose_local_mats( + local_mats: torch.Tensor, + t_pose_to: str, + skeleton: SkeletonBase, + return_global_rots=False, + t_pose_from: Optional[str] = None, +): + if t_pose_from is None: + t_pose_from = skeleton.t_pose + + dtype = local_mats.dtype + device = local_mats.device + + orig_shape = local_mats.shape + local_mats = local_mats.reshape(-1, skeleton.nbjoints, 3, 3) + + nbpose = local_mats.shape[0] + neutral_joints = skeleton.neutral_joints + batched_neutral_joints = einops.repeat(neutral_joints, "j k -> b j k", b=nbpose).to( + dtype=dtype, device=device + ) + + _, global_mats = batch_rigid_transform( + local_mats, + batched_neutral_joints, + skeleton.joint_parents, + skeleton.root_idx, + ) # (T, N, 3, 3) + + new_global_mats = change_t_pose_global_mats( + global_mats, + t_pose_to, + skeleton, + t_pose_from=t_pose_from, + ) + new_local_mats = global_mats_to_local_mats(new_global_mats, skeleton) + + if return_global_rots: + return new_local_mats.reshape(orig_shape), new_global_mats.reshape(orig_shape) + return new_local_mats.reshape(orig_shape) + + +def global_mats_to_local_mats( + global_rot_mats: torch.Tensor, skeleton: SkeletonBase +): + # obtain back the local rotations from the global rotations + parent_rot_mats = global_rot_mats[..., skeleton.joint_parents, :, :] + parent_rot_mats[..., skeleton.root_idx, :, :] = torch.eye(3) # the root joint + local_rot_mats = torch.einsum( + "... N n m, ... N n o -> ... N m o", + parent_rot_mats, # taken as the inverse/transpose in einsum + global_rot_mats, + ) + return local_rot_mats diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/feature_info.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/feature_info.py new file mode 100644 index 0000000000000000000000000000000000000000..66142b0bdbb7af72be7d0318d802fe9053aa140d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/feature_info.py @@ -0,0 +1,13 @@ +def tensor_needed(motion_rep): + needs = set() + + for feature in motion_rep.body_keys: + if feature in ["ric_data", "local_vel", "foot_contacts"]: + needs.add("posed_joints") + elif feature in ["rot_data"]: + needs.add("local_joint_rots") + elif feature in ["global_rot_data"]: + needs.add("global_joint_rots") + else: + raise ValueError("This body feature is not recognised") + return needs diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/feet.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/feet.py new file mode 100644 index 0000000000000000000000000000000000000000..001c107799df3b1c1d14412a9a6c65913647cb45 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/feet.py @@ -0,0 +1,50 @@ +from typing import Tuple + +import torch + + +def foot_detect_from_pos_and_vel( + positions: torch.Tensor, + velocity: torch.Tensor, + skeleton, + vel_thres: float, + height_thresh: float, +) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute foot contact labels using heuristics combining joint height and velocities. + + Args: + positions (torch.Tensor): [X, T, J, 3] global joint positions + velocity (torch.Tensor): [X, T, J, 3] velocities (already padded correctly), already multiplied by 1 / dt + vel_thres (float): threshold for joint velocity + height_thresh (float): threshold for joint height + + Returns: + torch.Tensor: [X, T, 2] contact labels for left heel and left toe, 1 for foot plant + torch.Tensor: [X, T, 2] contact labels for right heel and right toe, 1 for foot plant + """ + + device = positions.device + fid_l = skeleton.left_foot_joint_idx + fid_r = skeleton.right_foot_joint_idx + + velfactor, heightfactor = ( + torch.tensor([vel_thres, vel_thres], device=device), + torch.tensor([height_thresh, height_thresh], device=device), + ) + + feet_l_v = torch.linalg.norm(velocity[:, :, fid_l], axis=-1) + feet_l_h = positions[:, :, fid_l, 1] + + feet_l = torch.logical_and( + feet_l_v < velfactor, + feet_l_h < heightfactor, + ).to(positions.dtype) + + feet_r_v = torch.linalg.norm(velocity[:, :, fid_r], axis=-1) + feet_r_h = positions[:, :, fid_r, 1] + + feet_r = torch.logical_and( + feet_r_v < velfactor, + feet_r_h < heightfactor, + ).to(positions.dtype) + return feet_l, feet_r diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/heading.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/heading.py new file mode 100644 index 0000000000000000000000000000000000000000..ed5beb207d4186a8bf234d6129f07bbdf09ed9ef --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/heading.py @@ -0,0 +1,281 @@ +from typing import Optional + +import einops +import torch + +from motionbricks.motionlib.core.skeletons import SkeletonBase +from motionbricks.motionlib.core.utils.rotations import diff_angles, diff_between_two_angles, quat_apply +from motionbricks.motionlib.core.utils.torch_utils import normalize_vec + + +def calc_heading(compute_heading_method: str, **kwargs): + """Compute heading direction from various ways. + + Args: + input_tensor (torch.Tensor): [..., T, 4] quaternions or joints_pos [..., T, X, 3] + compute_heading_method (str): which function to use + Returns: + heading (torch.Tensor): [...] heading angle, or [..., 4] heading direction + """ + + if compute_heading_method == "hips_pos": + heading = calc_heading_from_joints_pos(**kwargs) + else: + if compute_heading_method == "quat": + heading = get_y_heading(**kwargs) + elif compute_heading_method == "refdir": + heading = calc_heading_refdir(**kwargs) + elif compute_heading_method == "refdir_inter": + heading = calc_heading_refdir(**kwargs) + else: + raise NotImplementedError + return heading + + +def calc_heading_refdir( + root_quat: torch.Tensor, + lengths: Optional[torch.Tensor] = None, + return_quat: Optional[bool] = False, + inverse: Optional[bool] = False, + fix_rot: Optional[bool] = False, + **kwargs, +): + """Compute the heading direction from the root quaternion, by computing the changes from a + reference direction. + + Args: + root_quat (torch.Tensor): [..., T, 4] global root rot quaternion + lengths (Optional[torch.Tensor]): [...] lengths of each motions (used only for the fix) + return_quat (bool): return quaternions or not + inverse (bool): return the inverse quaternion + fix_rot (bool): use the rotation interpolation fix + **kwargs (Dict): unecessary arguments + Returns: + heading (torch.Tensor): [...] heading angle, or [..., 4] heading quaternion + """ + + # type: (Tensor) -> Tensor + # calculate heading direction from quaternion + # the heading is the direction on the xz plane + # root_quat must be normalized + + assert root_quat.shape[-1] == 4 + + # make it [X, 4] + rquat, ps = einops.pack([root_quat], "* quat") + ref_dir = torch.zeros_like(rquat[..., 0:3]) + ref_dir[..., 0] = 1 + rot_dir = quat_apply(rquat, ref_dir) + heading = -torch.atan2(rot_dir[..., 2], rot_dir[..., 0]) + # negative value because of xz + + # get back original shape + [heading] = einops.unpack(heading, ps, "*") + + if fix_rot: + # ON GOING + __import__("ipdb").set_trace() + [rot_dir] = einops.unpack(rot_dir, ps, "* dim") + heading = fix_discountinuity_interpolation(heading, rot_dir, lengths) + + if inverse: + heading = -heading + + if return_quat: + heading_quat = torch.zeros_like(root_quat) + heading_quat[..., 0] = torch.cos(heading / 2) + heading_quat[..., 2] = torch.sin(heading / 2) + return heading_quat + + return heading + + +# moved from previous +# convert_joint_pos_to_rep function of global_root_local_joints_root_rot.py +def calc_heading_from_joints_pos( + posed_joints: torch.Tensor, + skeleton: SkeletonBase, + return_quat: Optional[bool] = False, + inverse: Optional[bool] = False, + **kargs, +): + """Compute the heading direction from the joint positions, by looking at the hip vector. + + Args: + posed_joints (torch.Tensor): [..., T, J, 3] global positions + skeleton (SkeletonBase): skeleton of the human, used to find location of hips + return_quat (bool): return quaternions or not + inverse (bool): return the inverse quaternion + **kwargs (Dict): unecessary arguments + Returns: + heading (torch.Tensor): [...] heading angle, or [..., 4] heading quaternion + """ + assert posed_joints.shape[-1] == 3 + + device = posed_joints.device + dtype = posed_joints.dtype + + # compute root heading for the sequence from hip positions + r_hip, l_hip = skeleton.hip_joint_idx + + skel2d = 1 * posed_joints + skel2d[..., 1] *= 0 # only need 2D (x,z) + + across = skel2d[:, :, r_hip] - skel2d[:, :, l_hip] + across = across / (torch.linalg.norm(across, axis=-1, keepdim=True) + 1e-6) + + root_heading = torch.cross( + torch.tensor([[[0.0, 1.0, 0.0]]]).to(across), across, dim=-1 + ) + root_heading = root_heading / torch.linalg.norm(root_heading, axis=-1, keepdim=True) + + # compute (inverse) quaternion from heading + root_heading = torch.atan2( + root_heading[..., 0], + root_heading[..., 2], + ) # z is the forward facing direction of the motion, so it is the second argument for atan2 + if inverse: + root_heading = -root_heading + + if return_quat: + root_quat = torch.zeros( + (*root_heading.shape, 4), + device=device, + dtype=dtype, + ) + + # NOTE: cos and sin here can crash with a floating point exception + # due to weird mkl issue on certain CPUs + root_quat[..., 0] = torch.cos(root_heading / 2) + root_quat[..., 2] = torch.sin(root_heading / 2) + return root_quat + + return root_heading + + +def get_y_heading( + root_quat: torch.Tensor, + return_quat: Optional[bool] = False, + inverse: Optional[bool] = False, + **kargs, +) -> torch.Tensor: + """Compute the heading direction from the root quaternion, by computing the changes from a + reference direction. + + Args: + root_quat (torch.Tensor): [..., T, 4] global root rot quaternion + return_quat (bool): return quaternions or not + inverse (bool): return the inverse quaternion + **kwargs (Dict): unecessary arguments + Returns: + heading (torch.Tensor): [...] heading angle, or [..., 4] heading quaternion + """ + + assert root_quat.shape[-1] == 4 + + root_quat = root_quat.clone() + root_quat[..., 1] = 0 + root_quat[..., 3] = 0 + + if inverse: + # reverse the sin in -sin + root_quat[..., 2] = -root_quat[..., 2] + + root_quat = normalize_vec(root_quat, dim=-1) + + if return_quat: + return root_quat + + root_heading = 2 * torch.atan2(root_quat[2], root_quat[0]) + return root_heading + + +def fix_discountinuity_interpolation( + heading: torch.Tensor, + rot_dir: torch.Tensor, + lengths: torch.Tensor, + threshold=0.5, +): + """Fix discountinuity in rotation + Args: + heading (torch.Tensor): [..., T] + rot_dir (torch.Tensor): [..., T, 3] + Returns: + heading (torch.Tensor): [..., T] fixed + """ + + # make it [X, T] + heading, ps = einops.pack([heading], "* nbframes") + # make it [X, T, 3] + rot_dir, _ = einops.pack([rot_dir], "* nbframes dim") + + # difference of angles + dangle = diff_angles(heading) + + unreliable_mask = rot_dir[..., 1].abs() > 0.5 + + # Find the indices where the mask changes value (True -> False or False -> True) + change_indices = torch.diff(unreliable_mask.to(int)) + + # Start of True intervals + starts = torch.where(change_indices == 1)[0] + 1 + + # End of True intervals + ends = torch.where(change_indices == -1)[0] + + # If the mask starts with True, include the start + if unreliable_mask[0]: + starts = torch.cat([torch.tensor([0]), starts]) + + # If the mask ends with True, include the end + if unreliable_mask[-1]: + ends = torch.cat([ends, torch.tensor([len(unreliable_mask) - 1])]) + + # Combine starts and ends into intervals + intervals = torch.column_stack((starts, ends)) + # close intervals + + # maximim index value of the array + N = len(unreliable_mask) - 1 + for a, b in intervals: + if a == 0: + # start (only info we have) + hstart = heading[a] + else: + # a >= 1 + # copy the last good heading + hstart = heading[a - 1] + if a >= 2: + # apply the last good velocity + # to the last heading + # (that's why "-2") + hstart += dangle[a - 2] + if b == N: + # end (only info we can take) + hend = heading[b] + else: + # b <= N-1 + # copy the first following good heading + hend = heading[b + 1] + + if b <= N - 2: + # apply the first good velocity + # to the first heading in reverse + # (that's why "+1", and "-") + hend -= dangle[b + 1] + + total_diff = diff_between_two_angles(hend, hstart) + total_elements = b - a + 1 + if total_elements > 1: + indexes = torch.arange(0, total_elements) + test_fill = indexes * total_diff / (total_elements - 1) + hstart + heading[a : b + 1] = test_fill + else: + # total_elements == 1 + # a = b + heading[a] = (hstart + hend) / 2 + + dangle = diff_angles(heading) + + # negative value because of xz + return -heading diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/motion_features.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/motion_features.py new file mode 100644 index 0000000000000000000000000000000000000000..a1288fc1c8a88c86f6f33f7a4be940f45c6ad7f1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/motion_features.py @@ -0,0 +1,1343 @@ +from typing import Dict, List, Optional + +import einops +import torch + +from motionbricks.motionlib.core.motion_reps.tools.changing_t_pose import ( + change_t_pose_global_mats, + change_t_pose_local_mats, + global_mats_to_local_mats, +) +from motionbricks.motionlib.core.skeletons import SkeletonBase +from motionbricks.motionlib.core.utils.rotations import ( + cont6d_to_matrix, + diff_angles, + matrix_to_quaternion, + quat_apply, + quat_conjugate, + quat_mul, + quat_unit, + quaternion_to_cont6d, + quaternion_to_matrix, +) +from motionbricks.motionlib.core.utils.torch_utils import batch_rigid_transform + +from .feature_info import tensor_needed +from .feet import foot_detect_from_pos_and_vel +from .heading import calc_heading + + +def compute_vel_angle( + root_rot_angles: torch.Tensor, + fps: float, + lengths: Optional[torch.Tensor] = None, +): + """Compute the local root rotation velocity: dtheta/dt. + + Args: + root_rot_angles (torch.Tensor): [..., T] rotation angle (in radian) + fps (float): frame per seconds + lengths (Optional[torch.Tensor]): [...] size of each input batched. If not provided, root_rot_angles should not be batched + + Returns: + local_root_rot_vel (torch.Tensor): [..., T] local root rotation velocity (in radian/s) + """ + device = root_rot_angles.device + # If the lengths is not provided, we do not assume full length + # the input should be a single sequence + if lengths is None: + # make sure it is a unique sequence input + assert len(root_rot_angles.shape) == 1 + lengths = torch.tensor([len(root_rot_angles)], device=device) + + root_rot_angles, ps = einops.pack([root_rot_angles], "* nbframes") + lengths, _ = einops.pack([lengths], "*") + + # useful for indexing + range_len = torch.arange(len(lengths)) + + local_root_rot_vel = diff_angles(root_rot_angles, fps) + pad_rot_vel_angles = torch.zeros_like(root_rot_angles[:, 0]) + local_root_rot_vel, _ = einops.pack( + [local_root_rot_vel, pad_rot_vel_angles], + "batch *", + ) + # repeat the last rotation angle + # with special care for different lengths with batches + local_root_rot_vel[(range_len, lengths - 1)] = local_root_rot_vel[ + (range_len, lengths - 2) + ] + + [local_root_rot_vel] = einops.unpack(local_root_rot_vel, ps, "* nbframes") + return local_root_rot_vel + + +def compute_vel_xyz( + positions: torch.Tensor, + fps: float, + lengths: Optional[torch.Tensor] = None, +): + """Compute the velocities from positions: dx/dt. Works with batches. The last velocity is duplicated to keep the same size. + + Args: + positions (torch.Tensor): [..., T, J, 3] xyz positions of a human skeleton + fps (float): frame per seconds + lengths (Optional[torch.Tensor]): [...] size of each input batched. If not provided, positions should not be batched + + Returns: + velocity (torch.Tensor): [..., T, J, 3] velocities computed from the positions + """ + device = positions.device + + # If the lengths is not provided, we do not assume full length + # the input should be a single sequence + if lengths is None: + # make sure it is a unique sequence input + assert len(positions.shape) == 3 + lengths = torch.tensor([len(positions)], device=device) + + positions, ps = einops.pack([positions], "* nbframes nbjoints xyz") + lengths, _ = einops.pack([lengths], "*") + + # useful for indexing + range_len = torch.arange(len(lengths)) + + # compute velocities with fps + velocity = fps * (positions[:, 1:] - positions[:, :-1]) + # pading the velocity vector + vel_pad = torch.zeros_like(velocity[:, 0]) + velocity, _ = einops.pack([velocity, vel_pad], "batch * nbjoints dim") + + # repeat the last velocities + # with special care for different lengths with batches + velocity[(range_len, lengths - 1)] = velocity[(range_len, lengths - 2)] + [velocity] = einops.unpack(velocity, ps, "* nbframes nbjoints xyz") + return velocity + + +def compute_heading_info( + heading_quat_raw: torch.Tensor, + nbjoints: int, + root_quat: Optional[torch.Tensor], + global_joint_quat: Optional[torch.Tensor], + **kwargs, # throw away unecessary args +): + """Compute heading info. From the raw output of calc_heading, compute a canonicalized heading + quaternion (first frame is 0 rotation), save the previous initial direction, and remove the + heading from the global root rotation if provided. + + Args: + heading_quat_raw: (torch.Tensor): [B, T, 4] heading direction in quaternion, direct output of calc_heading + nbjoints (int): number of joints of the skeleton + root_quat (Optional[torch.Tensor]): [B, T, 4] global rotation of the root + global_joint_quat (torch.Tensor): [B, T, J, 4] global joint quaternions of the input motion + **kwargs (Dict): unused arguments for easy function call + + Returns: + info (Dict): dictionnary which encapsulate all the output: heading_quat, init_heading_quat_inv, etc + """ + + nbframes = heading_quat_raw.shape[1] + init_heading_quat_raw = heading_quat_raw[:, 0] + + root_quat_wo_heading = None + root_quat_wo_first_heading = None + if root_quat is not None: + # root rotation without heading + root_quat_wo_heading = quat_mul( + quat_conjugate(heading_quat_raw), root_quat + ) # [X, T, 4] + + # root heading rotation on all joints + heading_quat = einops.repeat( + heading_quat_raw, + "batch nbframes quat -> batch nbframes nbjoints quat", + nbjoints=nbjoints, + ) # [X, T, J, 4] + + global_joint_quat_wo_heading = None + if global_joint_quat is not None: + # remove heading direction to all global rotations + global_joint_quat_wo_heading = quat_mul( + quat_conjugate(heading_quat), global_joint_quat + ) # [X, T, J, 4] + + # first frame root heading rotation on all joints + init_heading_quat_inv = quat_conjugate(heading_quat[:, 0]) # [X, D, 4] + init_heading_quat_inv = einops.repeat( + init_heading_quat_inv, + "batch nbjoints quat -> batch nbframes nbjoints quat", + nbframes=nbframes, + ) # [X, T, J, 4] + + root_quat_wo_first_heading = None + if root_quat is not None: + # root rotation without first heading + root_quat_wo_first_heading = quat_mul( + init_heading_quat_inv[:, :, 0], root_quat + ) # [X, T, 4] + + global_joint_quat_wo_first_heading = None + if global_joint_quat is not None: + global_joint_quat_wo_first_heading = quat_mul( + init_heading_quat_inv, global_joint_quat + ) # [X, T, J, 4] + + # root heading rotation on all joints, with first frame normalized to be 0 + heading_quat = quat_mul(heading_quat, init_heading_quat_inv) # [X, T, J, 4] + # fix some numerical issues: it is only a Y rotation axis rotation + heading_quat[..., 1] = 0 + heading_quat[..., 3] = 0 + # make it a unit quaternion agains + heading_quat = quat_unit(heading_quat) + heading_quat_inv = quat_conjugate(heading_quat) # [X, T, J, 4] + + info = { + "heading_quat": heading_quat, + "heading_quat_inv": heading_quat_inv, + "init_heading_quat_inv": init_heading_quat_inv, + "root_quat_wo_heading": root_quat_wo_heading, + "root_quat_wo_first_heading": root_quat_wo_first_heading, + "global_joint_quat_wo_heading": global_joint_quat_wo_heading, + "global_joint_quat_wo_first_heading": global_joint_quat_wo_first_heading, + "init_heading_quat_raw": init_heading_quat_raw, + } + return info + + +def compute_position_features( + posed_joints: torch.Tensor, + skeleton: SkeletonBase, + heading_quat_inv: torch.Tensor, + init_heading_quat_inv: torch.Tensor, + foot_contacts: Optional[torch.Tensor], + lengths: torch.Tensor, + fps: float, + local_root_vel_with_y: bool, + local_vel_without_root: bool, + removing_heading: bool = True, + **kwargs, # throw away unecessary args +): + """Compute local position features from the original joints position, and the heading direction. + Canonicalize each frame so that they all face in the same direction. + + Args: + posed_joints (torch.Tensor): [B, T, J, 3] joint positions of the input motion + skeleton (SkeletonBase): the skeleton corresponding to the human + heading_quat_inv (torch.Tensor): the inverse quaternion of the heading direction + init_heading_quat_inv (torch.Tensor): the first inverse direction (for canonicalization) + lengths (torch.Tensor): lengths of each motion for batch computation + fps (float): frame per seconds + local_root_vel_with_y (bool): if True: put Y (gravity axis) in the local_root_vel + local_vel_without_root (bool): if True: remove the root_idx from the local velocities + **kwargs (Dict): unused arguments for easy function call + + Returns: + info (Dict): dictionnary which encapsulate all the output: ric_data, local velocities, foot contacts etc. + """ + + root_idx = skeleton.root_idx + + global_positions = posed_joints.clone() + root_pos_init_xz = global_positions[:, 0, root_idx, [0, 2]].clone() + global_positions[..., [0, 2]] -= root_pos_init_xz[:, None, None] + + # all initially face Z+ + global_positions = quat_apply(init_heading_quat_inv, global_positions) + + # get root rotation/translation representation + # root linear velovity on xz plane (T, 2) + + velocity = compute_vel_xyz(global_positions, fps, lengths=lengths) + + if removing_heading: + # Rotate the velocity vector only if we remove heading + local_vel = quat_apply(heading_quat_inv, velocity) + else: + local_vel = velocity + + if local_root_vel_with_y: + root_local_vel = local_vel[:, :, root_idx].clone() + else: + root_local_vel = local_vel[:, :, root_idx, [0, 2]].clone() + + if local_vel_without_root: + # remove the root from the local velocities + local_vel, _ = einops.pack( + [ + local_vel[:, :, :root_idx], + local_vel[:, :, root_idx + 1 :], + ], + "batch time * dim", + ) + + # regroup data + local_vel = einops.rearrange( + local_vel, + "batch time joints dim -> batch time (joints dim)", + ) + + # root height (T, 1) + global_root_y = global_positions[:, :, root_idx, 1] + global_root_pos = global_positions[:, :, root_idx] # noqa + + # global_positions + # get joint position represention (T, (J-1)x3) + positions = global_positions.clone() + + # Root at the reference + # avoid "-=" for good results + positions[..., 0] = positions[..., 0] - positions[..., [root_idx], 0] + positions[..., 2] = positions[..., 2] - positions[..., [root_idx], 2] + + # all pose face Z+ if we remove the heading + if removing_heading: + positions = quat_apply(heading_quat_inv, positions) + + # remove the root index as it is all zeros (for x and z), and y is already saved + ric_data, _ = einops.pack( + [positions[:, :, :root_idx], positions[:, :, root_idx + 1 :]], + "batch time * dim", + ) + + # regroup data + ric_data = einops.rearrange( + ric_data, "batch time joints dim -> batch time (joints dim)" + ) + + if foot_contacts is None: + # compute them with the positions/velocities + + # get foot contact representation (T, 4) + # velocity is already padded correctly, with factor 1/dt + feet_l, feet_r = foot_detect_from_pos_and_vel( + global_positions, velocity, skeleton, 0.15, 0.10 + ) + foot_contacts = torch.cat((feet_l, feet_r), axis=-1) + + info = { + "ric_data": ric_data, + "local_root_vel": root_local_vel, + "local_vel": local_vel, + "global_root_y": global_root_y, + "global_root_pos": global_root_pos, + "root_pos_init_xz": root_pos_init_xz, + "foot_contacts": foot_contacts, + } + return info + + +def compute_position_features_with_smooth_root( + posed_joints: torch.Tensor, + smooth_translations: torch.Tensor, + skeleton: SkeletonBase, + heading_quat_inv: torch.Tensor, + init_heading_quat_inv: torch.Tensor, + foot_contacts: Optional[torch.Tensor], + lengths: torch.Tensor, + fps: float, + local_root_vel_with_y: bool, + local_vel_without_root: bool, + removing_heading: bool = True, + **kwargs, # throw away unecessary args +): + """Compute local position features from the original joints position, and the heading direction. + Canonicalize each frame so that they all face in the same direction. + + Args: + posed_joints (torch.Tensor): [B, T, J, 3] joint positions of the input motion + smooth_translations (torch.Tensor): [B, T, 3] smooth transltations of the input motion + skeleton (SkeletonBase): the skeleton corresponding to the human + heading_quat_inv (torch.Tensor): the inverse quaternion of the heading direction + init_heading_quat_inv (torch.Tensor): the first inverse direction (for canonicalization) + lengths (torch.Tensor): lengths of each motion for batch computation + fps (float): frame per seconds + local_root_vel_with_y (bool): if True: put Y (gravity axis) in the local_root_vel + local_vel_without_root (bool): if True: remove the root_idx from the local velocities + **kwargs (Dict): unused arguments for easy function call + + Returns: + info (Dict): dictionnary which encapsulate all the output: ric_data, local velocities, foot contacts etc. + """ + + root_idx = skeleton.root_idx + + global_positions = posed_joints.clone() + + # use the smooth root instead + # root_pos_init_xz = global_positions[:, 0, root_idx, [0, 2]].clone() + root_pos_init_xz = smooth_translations[:, 0, [0, 2]].clone() + global_positions[..., [0, 2]] -= root_pos_init_xz[:, None, None] + + # all initially face Z+ + global_positions = quat_apply(init_heading_quat_inv, global_positions) + + # also put the smooth translations at 0 and turn to face Z+ + smooth_translations[..., [0, 2]] -= root_pos_init_xz[:, None] + smooth_translations = quat_apply( + init_heading_quat_inv[:, :, root_idx], smooth_translations + ) + + # get root rotation/translation representation + # root linear velovity on xz plane (T, 2) + + velocity = compute_vel_xyz(global_positions, fps, lengths=lengths) + + if removing_heading: + # Rotate the velocity vector only if we remove heading + local_vel = quat_apply(heading_quat_inv, velocity) + else: + local_vel = velocity + + if local_root_vel_with_y: + root_local_vel = local_vel[:, :, root_idx].clone() + else: + root_local_vel = local_vel[:, :, root_idx, [0, 2]].clone() + + if local_vel_without_root: + # remove the root from the local velocities + local_vel, _ = einops.pack( + [ + local_vel[:, :, :root_idx], + local_vel[:, :, root_idx + 1 :], + ], + "batch time * dim", + ) + + # regroup data + local_vel = einops.rearrange( + local_vel, + "batch time joints dim -> batch time (joints dim)", + ) + + # root height (T, 1) + # + # same results for now + # global_root_y = global_positions[:, :, root_idx, 1] + global_root_y = smooth_translations[..., 1] + global_root_pos = smooth_translations + + # global_positions + # get joint position represention (T, (J-1)x3) + positions = global_positions.clone() + + # Root at the reference + # avoid "-=" for good results + positions[..., 0] = positions[..., 0] - smooth_translations[..., [0]] + positions[..., 2] = positions[..., 2] - smooth_translations[..., [2]] + + # all pose face Z+ if we remove the heading + if removing_heading: + positions = quat_apply(heading_quat_inv, positions) + + # does not remove the root index + # it is not all zeros anymore (for x and z) + # ric_data, _ = einops.pack( + # [positions[:, :, :root_idx], positions[:, :, root_idx + 1 :]], + # "batch time * dim", + # ) + ric_data = positions + + # regroup data + ric_data = einops.rearrange( + ric_data, "batch time joints dim -> batch time (joints dim)" + ) + + if foot_contacts is None: + # compute them with the positions/velocities + + # get foot contact representation (T, 4) + # velocity is already padded correctly, with factor 1/dt + feet_l, feet_r = foot_detect_from_pos_and_vel( + global_positions, velocity, skeleton, 0.15, 0.10 + ) + foot_contacts = torch.cat((feet_l, feet_r), axis=-1) + + info = { + "ric_data": ric_data, + "local_root_vel": root_local_vel, + "local_vel": local_vel, + "global_root_y": global_root_y, + "global_root_pos": global_root_pos, + "root_pos_init_xz": root_pos_init_xz, + "foot_contacts": foot_contacts, + } + return info + + +def compute_heading_features( + heading_quat: torch.Tensor, + root_idx: int, + fps: float, + lengths: Optional[torch.Tensor] = None, + **kwargs, # throw away unecessary args +): + """Compute heading features, local and global. + + Args: + heading_quat: (torch.Tensor): [B, T, 4] heading direction in quaternion + root_idx (int): index of the root in the skeleton + fps (float): frame per seconds + lengths (Optional[torch.Tensor]): [...] size of each input batched. If not provided, positions should not be batched + **kwargs (Dict): unused arguments for easy function call + + Returns: + info (Dict): dictionnary which encapsulate all the output: global_root_heading, local_root_rot_vel, root_rot + """ + # root rotation velocity along y-axis (T, 1) + root_rot = heading_quat[:, :, root_idx] + root_rot_angles = torch.arctan2(root_rot[..., 2], root_rot[..., 0]) * 2 + + local_root_rot_vel = compute_vel_angle(root_rot_angles, fps, lengths=lengths) + global_root_heading = torch.stack( + [torch.cos(root_rot_angles), torch.sin(root_rot_angles)], dim=-1 + ) + info = { + "global_root_heading": global_root_heading, + "local_root_rot_vel": local_root_rot_vel, + "root_rot": root_rot, + } + return info + + +def compute_local_rotation_features_wo_heading( + local_joint_quat: torch.Tensor, + root_quat_wo_heading: torch.Tensor, + lengths: torch.Tensor, + root_idx: int, + fps: int, + **kwargs, # throw away unecessary args +): + """Compute local rotational features from the original rotations, and the heading direction. + + Args: + local_joint_quat (torch.Tensor): [B, T, J, 4] local joint quaternions of the input motion + root_quat_wo_heading (torch.Tensor): the quaternion of the heading direction (after canonicalizing the first frame) + root_idx (int): index of the root + fps (float): frame per seconds + **kwargs (Dict): unused arguments for easy function call + + Returns: + info (Dict): dictionnary which encapsulate the output: rot_data + """ + + # get joint rotation representation using cont6d (T, Jx6) + # replace the root quat with the heading invariant one + rot_joint_quat, _ = einops.pack( + [ + local_joint_quat[:, :, :root_idx], + root_quat_wo_heading, + local_joint_quat[:, :, root_idx + 1 :], + ], + "batch time * dim", + ) + + cont_6d_params = quaternion_to_cont6d(rot_joint_quat) + rot_data = einops.rearrange( + cont_6d_params, "batch time joints dim -> batch time (joints dim)" + ) + info = { + "rot_data": rot_data, + } + return info + + +def compute_local_rotation_features( + local_joint_quat: torch.Tensor, + root_quat_wo_first_heading: torch.Tensor, + lengths: torch.Tensor, + root_idx: int, + fps: int, + **kwargs, # throw away unecessary args +): + """Compute local rotational features from the original rotations, and the heading direction. + + Args: + local_joint_quat (torch.Tensor): [B, T, J, 4] local joint quaternions of the input motion + root_quat_wo_heading (torch.Tensor): the quaternion of the heading direction (after canonicalizing the first frame) + root_idx (int): index of the root + fps (float): frame per seconds + **kwargs (Dict): unused arguments for easy function call + + Returns: + info (Dict): dictionnary which encapsulate the output: rot_data + """ + + # get joint rotation representation using cont6d (T, Jx6) + # replace the root quat with the heading invariant one + rot_joint_quat, _ = einops.pack( + [ + local_joint_quat[:, :, :root_idx], + root_quat_wo_first_heading, + local_joint_quat[:, :, root_idx + 1 :], + ], + "batch time * dim", + ) + + cont_6d_params = quaternion_to_cont6d(rot_joint_quat) + rot_data = einops.rearrange( + cont_6d_params, "batch time joints dim -> batch time (joints dim)" + ) + info = { + "rot_data": rot_data, + } + return info + + +def compute_global_rotation_features_wo_heading( + global_joint_quat_wo_heading: torch.Tensor, + lengths: torch.Tensor, + root_idx: int, + fps: int, + **kwargs, # throw away unecessary args +): + """Compute local rotational features from the original rotations, and the heading direction. + + Args: + global_joint_quat_wo_heading (torch.Tensor): [B, T, J, 4] global joint quaternions of the input motion without heading direction + root_idx (int): index of the root + fps (float): frame per seconds + **kwargs (Dict): unused arguments for easy function call + + Returns: + info (Dict): dictionnary which encapsulate the output: rot_data + """ + + # get joint rotation representation using cont6d [B, T, Jx6] + cont_6d_params = quaternion_to_cont6d(global_joint_quat_wo_heading) + global_rot_data = einops.rearrange( + cont_6d_params, "batch time joints dim -> batch time (joints dim)" + ) + info = { + "global_rot_data": global_rot_data, + } + return info + + +def compute_global_rotation_features( + global_joint_quat_wo_first_heading: torch.Tensor, + lengths: torch.Tensor, + root_idx: int, + fps: int, + **kwargs, # throw away unecessary args +): + """Compute local rotational features from the original rotations, and the heading direction. + + Args: + global_joint_quat_wo_first_heading (torch.Tensor): [B, T, J, 4] global joint quaternions of the input motion without heading direction for the first frame only + root_idx (int): index of the root + fps (float): frame per seconds + **kwargs (Dict): unused arguments for easy function call + + Returns: + info (Dict): dictionnary which encapsulate the output: rot_data + """ + + # get joint rotation representation using cont6d [B, T, Jx6] + cont_6d_params = quaternion_to_cont6d(global_joint_quat_wo_first_heading) + global_rot_data = einops.rearrange( + cont_6d_params, "batch time joints dim -> batch time (joints dim)" + ) + info = { + "global_rot_data": global_rot_data, + } + return info + + +def compute_motion_features( + input_tensor_dict: Dict[str, torch.Tensor], + motion_rep, + *, + # keywords mandatory arguments + local_vel_without_root: bool, + local_root_vel_with_y: bool, + compute_heading_method: str, + # keywords optional arguments + lengths: Optional[torch.Tensor] = None, + input_quat: Optional[bool] = False, + only_pos: Optional[bool] = False, + t_pose_from: Optional[str] = None, + return_init_heading_info: bool = False, + removing_heading: bool = True, + using_smooth_root: bool = False, + extra_skel: bool = False, +) -> torch.Tensor: + """Generate feature vector for one motion given joint rotation matrices and positions. + + Args: + input_tensor_dict (Dict[torch.Tensor]): contain all the input data (some can be optional) + posed_joints (torch.Tensor): [..., T, J, 3] joint positions of the input motion + local_joint_rots (torch.Tensor): [..., T, J, 3, 3] local joint rotation matrices of the input motion or [..., T, J, 4] quaternions + global_joint_rots (torch.Tensor): [..., T, J, 3, 3] global joint rotation matrices of the input motion or [..., T, J, 4] quaternions + foot_contacts (torch.Tensor): [..., T, 4] foot contacts (or None if we computed them from the positions) + lengths (torch.Tensor): [...] lengths of the motions + keys (List[str]): list of feature names in order, we want to concatenate in the motion rep + compute_heading_method (str): "quat" / "refdir" / "refdir_inter" + fps (float): frame per seconds + lengths (torch.Tensor): lengths of each motion if batched + local_root_vel_with_y (bool): if True: put Y (gravity axis) in the local_root_vel + local_vel_without_root (bool): if True: remove the root_idx from the local velocities + input_quat (bool): if True, consider the input to be quaternion, else matrices + only_pos (bool): if True, do not compute any rotation features (rot_data) + return_init_heading_info (bool): if True, return the canonicalization info + removing_heading (bool): if True, return the canonicalization info + using_smooth_root (bool): if True, compute a smooth trajectory for the root, and keep the hips joint in the positions data + extra_skel (bool): whether we use the extra position representation or not. This is not use in this script yet but necessary to avoid using **kwargs + """ + skeleton = motion_rep.skeleton + fps = motion_rep.fps + + # compute on the fly missing necessary elements if possible + + local_joint_rots = input_tensor_dict.get("local_joint_rots") + posed_joints = input_tensor_dict.get("posed_joints") + global_joint_rots = input_tensor_dict.get("global_joint_rots") + translation = input_tensor_dict.get("translation") + foot_contacts = input_tensor_dict.get("foot_contacts") + + # quick einpack for batch_rigid, extend joints + needs = tensor_needed(motion_rep) + + # Creating local joints rotations if it is not provided + if "local_joint_rots" in needs and local_joint_rots is None: + if global_joint_rots is None: + raise ValueError( + "Cannot create local joint rots, which is necessary for this motion rep." + ) + if global_joint_rots.shape[-1] == 4: + global_joint_rots = quaternion_to_matrix(global_joint_rots) + # compute the locals from the globals + local_joint_rots = global_mats_to_local_mats(global_joint_rots, skeleton) + + # Changing the local rotations / t_pose: + # do this Before FK, so that our skeleton is compatible with the input + if ( + local_joint_rots is not None + and t_pose_from is not None + and t_pose_from != motion_rep.skeleton.t_pose + ): + if local_joint_rots.shape[-1] == 4: + local_joint_rots = quaternion_to_matrix(local_joint_rots) + + # do this after FK, so that we can keep the old neutral joints + local_joint_rots, global_joint_rots = change_t_pose_local_mats( + local_joint_rots, + skeleton.t_pose, + skeleton, + t_pose_from=t_pose_from, + return_global_rots=True, + ) + + # Creating global joints rotations or posed joints if it is not provided + if ("global_joint_rots" in needs and global_joint_rots is None) or ( + "posed_joints" in needs and posed_joints is None + ): + if local_joint_rots is None: + raise ValueError( + "Cannot create global joint rots, which is necessary for this motion rep." + ) + if local_joint_rots.shape[-1] == 4: + local_joint_rots = quaternion_to_matrix(local_joint_rots) + + # one big chunk + local_joint_rots, ps = einops.pack([local_joint_rots], "* nbjoints dim1 dim2") + # run FK to compute global joints positions + _joints = einops.repeat( + skeleton.neutral_joints.to(dtype=local_joint_rots.dtype), + "j k -> b j k", + b=len(local_joint_rots), + ) + + _posed_joints, _global_joint_rots = batch_rigid_transform( + local_joint_rots, _joints, skeleton.joint_parents, skeleton.root_idx + ) + [local_joint_rots] = einops.unpack(local_joint_rots, ps, "* nbjoints dim1 dim2") + [_global_joint_rots] = einops.unpack( + _global_joint_rots, ps, "* nbjoints dim1 dim2" + ) + + if global_joint_rots is None and "global_joint_rots" in needs: + global_joint_rots = _global_joint_rots + + if posed_joints is None and "posed_joints" in needs: + if translation is None: + raise ValueError( + "You should provide at least translation if posed_joints are missing." + ) + [_posed_joints] = einops.unpack(_posed_joints, ps, "* nbjoints dim") + # add the translation to the posed joints + _posed_joints += translation[..., None, :] + posed_joints = _posed_joints + + # Converting the local rotations into quaternions + if local_joint_rots is not None and local_joint_rots.shape[-1] == 3: + local_joint_quat = matrix_to_quaternion(local_joint_rots) + else: + local_joint_quat = local_joint_rots + + # Converting the global rotations into quaternions + if global_joint_rots is not None and global_joint_rots.shape[-1] == 3: + global_joint_quat = matrix_to_quaternion(global_joint_rots) + else: + global_joint_quat = global_joint_rots + + if only_pos: + local_joint_quat = None + global_joint_quat = None + + if local_joint_quat is not None: + device = local_joint_quat.device + else: + assert posed_joints is not None + device = posed_joints.device + + # Store important info used for subfunction + info = { + "fps": fps, + "local_vel_without_root": local_vel_without_root, + "local_root_vel_with_y": local_root_vel_with_y, + "compute_heading_method": compute_heading_method, + "skeleton": skeleton, + "root_idx": skeleton.root_idx, + "device": device, + } + + # make it all [B, T, ...] + input_dict = { + "local_joint_quat": local_joint_quat, + "global_joint_quat": global_joint_quat, + "posed_joints": posed_joints, + "foot_contacts": foot_contacts, + } + universal_dict, lengths, original_ps = make_universal_input( + input_dict, lengths=lengths + ) + local_joint_quat = universal_dict["local_joint_quat"] + global_joint_quat = universal_dict["global_joint_quat"] + posed_joints = universal_dict["posed_joints"] + foot_contacts = universal_dict["foot_contacts"] + + if local_joint_quat is not None: + nbatch, nbframes, nbjoints = local_joint_quat.shape[:3] + root_quat = local_joint_quat[:, :, skeleton.root_idx] + else: + nbatch, nbframes, nbjoints = posed_joints.shape[:3] + root_quat = None + + if global_joint_quat is not None: + if local_joint_quat is None: + # take the info from the global one + # (it is the same as the local, as it is for the root) + nbatch, nbframes, nbjoints = global_joint_quat.shape[:3] + root_quat = global_joint_quat[:, :, skeleton.root_idx] + else: + # verify that the info is the same + assert local_joint_quat.shape[:3] == global_joint_quat.shape[:3] + assert ( + local_joint_quat[:, :, skeleton.root_idx] + == global_joint_quat[:, :, skeleton.root_idx] + ).all() + + info.update( + { + "local_joint_quat": local_joint_quat, + "global_joint_quat": global_joint_quat, + "root_quat": root_quat, + "posed_joints": posed_joints, + "foot_contacts": foot_contacts, + "lengths": lengths, + "nbatch": nbatch, + "nbframes": nbframes, + "nbjoints": nbjoints, + "removing_heading": removing_heading, + } + ) + + # compute raw root heading rotation # [B, T, 4] + info["heading_quat_raw"] = calc_heading(return_quat=True, **info) + + # + canonicalize it, compute the inverse, compute the global root without heading etc + info.update(compute_heading_info(**info)) + + # compute features from the heading: global root / local root + info.update(compute_heading_features(**info)) + + if posed_joints is not None: + # compute local positions features based on the heading + + if using_smooth_root: + from .smooth_root import get_smooth_root_pos + + # using the smooth root + # and store the hips pos in ric_data + hip_translations = posed_joints[:, :, skeleton.root_idx] + smooth_translations = get_smooth_root_pos(hip_translations) + info["smooth_translations"] = smooth_translations + info.update(compute_position_features_with_smooth_root(**info)) + else: + # using the hips pos as root, removing the hip from ric_data + info.update(compute_position_features(**info)) + + if local_joint_quat is not None: + # compute local rotation features based on heading + if removing_heading: + info.update(compute_local_rotation_features_wo_heading(**info)) + else: + info.update(compute_local_rotation_features(**info)) + + if global_joint_quat is not None: + # compute global rotation features based on heading + if removing_heading: + info.update(compute_global_rotation_features_wo_heading(**info)) + else: + info.update(compute_global_rotation_features(**info)) + + # verify all the dimensions + for key in motion_rep.keys: + dim_lst = motion_rep.keys_dim[key] + feat = info[key] + + if len(dim_lst) not in [0, 1]: + raise ValueError( + "In the key_dim dictionary, the lists should contain zero or one element." + ) + + # squeezed tensor + if not dim_lst and len(feat.shape) == 2: + continue + + # check the last dim + if len(feat.shape) == 3 and feat.shape[-1] == dim_lst[0]: + continue + + raise ValueError( + f"For the key {key}, the shape of the sub feature is {feat.shape[-1]} where it should be {dim_lst[0]}." + ) + + features, feats_ps = einops.pack( + [info[key] for key in motion_rep.keys], + "batch time *", + ) + # put back the original shape + # https://einops.rocks/4-pack-and-unpack/ + [features] = einops.unpack(features, original_ps, "* nbframes dim") + + # return extra info relative to canonicalization + if return_init_heading_info: + [init_heading_quat] = einops.unpack( + info["init_heading_quat_raw"], original_ps, "* dim" + ) + [root_pos_init_xz] = einops.unpack( + info["root_pos_init_xz"], original_ps, "* dim" + ) + init_heading_info = { + "init_heading_quat": init_heading_quat, + "root_pos_init_xz": root_pos_init_xz, + } + return features, init_heading_info + + return features + + +def make_universal_input( + input_tensor_dict: Dict[str, torch.Tensor], + lengths: Optional[torch.Tensor] = None, +): + """Make the input universal [B, T, J, X] from tensors of shape [..., T, J, X] + + Args: + input_tensor_dict (Dict[torch.Tensor]): contain all the input data (some can be optional) + lengths (torch.Tensor): lengths of each motion if batched + Return: + output_tensor_dict (Dict[torch.Tensor]): contain all the input data but with the same shape [B, T, J, X] + lengths (torch.Tensor): [B] + ps (Tuple): Save the indices for getting back the original shape + """ + output_tensor_dict = {} + keys = [] + for key, val in input_tensor_dict.items(): + if val is None: + output_tensor_dict[key] = None + else: + keys.append(key) + + # should not be empty + if not keys: + raise ValueError("At least one tensor should not be None.") + + no_joints_dim_keys = ["foot_contacts", "translation"] + candidate_first_keys = [key for key in keys if key not in no_joints_dim_keys] + + if not candidate_first_keys: + raise ValueError("At least one tensor should have the nbjoints dim.") + + first_key = candidate_first_keys[0] + first_el = input_tensor_dict[first_key] + device = first_el.device + + # If the lengths is not provided, we do not assume full length + # the input should be a single sequence + if lengths is None: + if len(first_el.shape) > 3: + raise ValueError("You should provide the lengths tensor using batching.") + elif len(first_el.shape) < 3: + raise ValueError("The tensor is not recognized") + # len(first_el.shape) == 3 + lengths = torch.tensor([len(first_el)], device=device) + + for key in keys: + val = input_tensor_dict[key] + if key in no_joints_dim_keys: + # make is universally: [X, T, Y] + val, _ = einops.pack([val], "* nbframes dim") + else: + # make is universally: [X, T, J, Y] + val, original_ps = einops.pack([val], "* nbframes nbjoints dim") + output_tensor_dict[key] = val + + # make is universally: [X] + lengths, _ = einops.pack([lengths], "*") + return output_tensor_dict, lengths, original_ps + + +def reconstruct_joint_rot_mats_from_ric_rots( + joints_ric_rot6d: torch.Tensor, + root_pos: torch.Tensor, + root_rot_quat: torch.Tensor, + skeleton: SkeletonBase, + removed_heading: bool, + init_heading_quat: Optional[torch.Tensor] = None, +): + """Recovers the local rotation matrices from the separated root heading quat and the other + rotations. + + Args: + joints_ric_rot6d (torch.Tensor): [..., T, nbjoints * 6] local 6D joint rotations + root_pos (torch.Tensor): [..., T, 3] global root position + root_quat (torch.Tensor): [..., T, 4] global root rot quaternion + removed_heading (bool): if True, the heading have been removed from the rotations + init_heading_quat (torch.Tensor): the first direction in case the heading is not removed. + Will just rotate by that, not overrided + Returns: + joint_rot_mats (torch.Tensor): [..., T, nbjoints, 3, 3] joint rotation matrices + """ + + root_idx = skeleton.root_idx + + joints_ric_rot6d, ps = einops.pack([joints_ric_rot6d], "* time dim") + root_pos, _ = einops.pack([root_pos], "* time dim") + + rot_6d = einops.rearrange( + joints_ric_rot6d, + "batch time (nbjoints six) -> batch time nbjoints six", + six=6, + ) + + rotmat = cont6d_to_matrix(rot_6d) # [B, T, 29, 3, 3] + + # deouble check + if removed_heading: + root_rot_quat, _ = einops.pack([root_rot_quat], "* time dim") + heading_rot_mat = quaternion_to_matrix(root_rot_quat) + # get global root rot by combining heading with local root rot + # do matrix product here + root_rot = torch.einsum( + "btik,btkj->btij", + heading_rot_mat, + rotmat[:, :, root_idx], + ) + # replace the root_rot by the full global one + joint_rot_mats, _ = einops.pack( + [ + rotmat[:, :, :root_idx], + root_rot, + rotmat[:, :, root_idx + 1 :], + ], + "batch time * dim1 dim2", + ) + elif init_heading_quat is not None: + init_heading_quat, _ = einops.pack([init_heading_quat], "* dim") # [B, 4] + + heading_rot_mat = quaternion_to_matrix(init_heading_quat) # [B, 3, 3] + root_rot = torch.einsum( + "bik,btkj->btij", + heading_rot_mat, + rotmat[:, :, root_idx], + ) + # replace the root_rot by the full global one + joint_rot_mats, _ = einops.pack( + [ + rotmat[:, :, :root_idx], + root_rot, + rotmat[:, :, root_idx + 1 :], + ], + "batch time * dim1 dim2", + ) + else: + # do not put back heading since it was not removed + joint_rot_mats = rotmat + + [joint_rot_mats] = einops.unpack(joint_rot_mats, ps, "* time nbjoints dim1 dim2") + return joint_rot_mats + + +def reconstruct_joint_rot_mats_from_ric_global_rots( + global_joints_ric_rots: torch.Tensor, + root_rot_quat: torch.Tensor, + skeleton: SkeletonBase, + removed_heading: bool, + init_heading_quat: Optional[torch.Tensor] = None, +): + """Recovers the local rotation matrices from the separated root heading quat and the other + global rotations without heading. + + Args: + global_joints_ric_rots (torch.Tensor): [..., T, 3, 3] or [..., T, 6] global 6D joint rotations + root_rot_quat (torch.Tensor): [..., T, 4] global root rot quaternion + removed_heading (bool): if True, the heading have been removed from the rotations + init_heading_quat (torch.Tensor): [..., 4] the first direction in case the heading is not removed. + Will just rotate by that, not overrided + Returns: + joint_rot_mats (torch.Tensor): [..., T, nbjoints, 3, 3] joint rotation matrices + """ + + # saving for shapes + _saved_root_quat = root_rot_quat + + # put batch and time together in a big batch + global_joints_ric_rots, ps = einops.pack([global_joints_ric_rots], "* dim") + + root_rot_quat, _ = einops.pack([root_rot_quat], "* dim") + + is_6d = global_joints_ric_rots.shape[-1] == skeleton.nbjoints * 6 + if is_6d: + global_rot = einops.rearrange( + global_joints_ric_rots, + "batch (nbjoints six) -> batch nbjoints six", + six=6, + ) + global_rot = cont6d_to_matrix(global_rot) # [B, J, 3, 3] + else: + global_rot = einops.rearrange( + global_joints_ric_rots, + "batch (nbjoints dim1 dim2) -> batch nbjoints dim1 dim2", + dim1=3, + dim2=3, + ) + + nbjoints = global_rot.shape[1] + + if removed_heading: + global_rotmat_wo_heading = global_rot + + heading_rot_mat = quaternion_to_matrix(root_rot_quat) # [B, 3, 3] + + # put back heading direction to all global rotations + global_rot_mats = torch.einsum( + "bik,bdkj->bdij", + heading_rot_mat, + global_rotmat_wo_heading, + ) + elif init_heading_quat is not None: + # repeat by time + init_heading_quat, _ = einops.pack([init_heading_quat], "* dim") # [B, 4] + + _saved_root_quat, _ = einops.pack([_saved_root_quat], "* time dim") + time = _saved_root_quat.shape[1] + + init_heading_quat = einops.repeat( + init_heading_quat, + "batch quat -> batch time quat", + time=time, + ) + + # joint batch and time + init_heading_quat, _ = einops.pack([init_heading_quat], "* dim") + # first init rotation + heading_rot_mat = quaternion_to_matrix(init_heading_quat) # [B, 3, 3] + + # put back heading direction to all global rotations + global_rot_mats = torch.einsum( + "bik,bdkj->bdij", + heading_rot_mat, + global_rot, + ) + else: + global_rot_mats = global_rot + + # obtain back the local rotations from the new global rotations + parent_rot_mats = global_rot_mats[:, skeleton.joint_parents] + parent_rot_mats[:, skeleton.root_idx] = torch.eye(3) # the root joint + parent_rot_mats_inv = parent_rot_mats.transpose(2, 3) + local_rot_mats = torch.einsum( + "T N m n, T N n o -> T N m o", parent_rot_mats_inv, global_rot_mats + ) + + # add dummy rotations if it is more than the number of joints + local_rot_mats[:, nbjoints:] = torch.eye(3) + + [local_rot_mats] = einops.unpack(local_rot_mats, ps, "* nbjoints dim1 dim2") + return local_rot_mats, global_rot_mats + + +def recover_joints_with_FK( + joint_rot_mats: torch.Tensor, + root_pos: torch.Tensor, + skeleton: SkeletonBase, + neutral_joints: Optional[torch.Tensor] = None, + return_global_rots: Optional[bool] = False, +): + """Recovers global joint positions given the global root motion and local joint rotations. + + Args: + joint_rot_mats (torch.Tensor): [..., T, J, 3, 3] joint rotation matrices + root_pos (torch.Tensor): [..., T, 3] positions xyz + skeleton (SkeletonBase) + return_global_rots (Optional[bool]=False): whether to return the global rotations in addition to positions + Returns: + torch.Tensor: [B, T, J, 3] global joint positions + """ + + original_shape = joint_rot_mats.shape + # big batch size for batch rigid transform + big_bs = torch.tensor(original_shape[:-3]).prod().item() + + device = joint_rot_mats.device + dtype = joint_rot_mats.dtype + + if neutral_joints is None: + neutral_joints = skeleton.neutral_joints.to(device=device, dtype=dtype) + joints = einops.repeat( + neutral_joints, + "nbjoints xyz -> big_batch nbjoints xyz", + big_batch=big_bs, + ) + else: + joints = neutral_joints.to(device=device, dtype=dtype) + # make it [B, J, 3] + joints, _ = einops.pack([joints], "* nbjoints dim1") + # make it [B, 1, J, 3] + joints = joints[:, None] + + joints = einops.repeat( + joints, + "bs 1 nbjoints xyz -> bs time nbjoints xyz", + time=big_bs // len(joints), + ) + joints = einops.rearrange( + joints, "bs time nbjoints xyz -> (bs time) nbjoints xyz" + ) + assert len(joints) == big_bs + + parents = skeleton.joint_parents.to(device) + root_idx = skeleton.root_idx + joint_rot_mats, ps = einops.pack([joint_rot_mats], "* nbjoints dim1 dim2") + + batch_size, nbframes = joint_rot_mats.shape[:2] + + # perform FK + positions, global_rots = batch_rigid_transform( + joint_rot_mats, joints, parents, root_idx + ) + [positions] = einops.unpack(positions, ps, "* nbjoints xyz") + # apply global root pos + positions = positions + root_pos[..., None, :] + + if return_global_rots: + [global_rots] = einops.unpack(global_rots, ps, "* nbjoints dim1 dim2") + return positions, global_rots + else: + return positions + + +def recover_joints_from_ric_pos( + joints_ric_pos: torch.Tensor, + root_pos: torch.Tensor, + root_quat: torch.Tensor, + skeleton, + removed_heading: bool, + init_heading_quat: Optional[torch.Tensor], + using_smooth_root: bool, +): + """Recovers global joint positions from global root motion and heading-invariant joint + positions. + + Args: + joints_ric_pos (torch.Tensor): [B, T, (J-1)*3] local joint positions, excluding root + root_pos (torch.Tensor): [B, T, 3] global root position + root_quat (torch.Tensor): [B, T, 4] global root rot quaternion + removed_heading (bool): if True, the heading have been removed from the rotations + init_heading_quat (torch.Tensor): the first direction in case the heading is not removed. + Will just rotate by that, not overrided + + Returns: + torch.Tensor: [B, T, J, 3] global joint positions + """ + + root_idx = skeleton.root_idx + + positions = einops.rearrange( + joints_ric_pos, + "batch time (nbjoints_minus_one xyz) -> batch time nbjoints_minus_one xyz", + xyz=3, + ) # [B, T, J-1, 3] + + if using_smooth_root: + # removing the hips joints + hips_positions = positions[:, :, root_idx].clone() + + positions, _ = einops.pack( + [ + positions[:, :, :root_idx], + positions[:, :, root_idx + 1 :], + ], + "batch time * dim", + ) + # removing the hips positions to all the positions + positions[..., [0, 2]] -= hips_positions[..., None, [0, 2]] + + time = positions.shape[1] + + if removed_heading: + root_quat = einops.repeat( + root_quat, + "batch time quat -> batch time nbjoints_minus_one quat", + nbjoints_minus_one=positions.shape[2], + ) + # apply root heading to the positions + positions = quat_apply( + root_quat, + positions, + ) + elif init_heading_quat is not None: + init_heading_all = einops.repeat( + init_heading_quat, + "batch quat -> batch time nbjoints_minus_one quat", + nbjoints_minus_one=positions.shape[2], + time=time, + ) + # apply first heading to the positions + positions = quat_apply( + init_heading_all, + positions, + ) + else: + pass + + # Concat root and joints + # add back the root joint (initialized to 0) + dummy_root = 0 * positions[:, :, 0] + positions, _ = einops.pack( + [ + positions[:, :, :root_idx], + dummy_root, + positions[:, :, root_idx:], + ], + "batch time * dim", + ) + # add the XZ to all the joints + positions[..., [0, 2]] += root_pos[..., None, [0, 2]] + + # put root_y + positions[:, :, root_idx, 1] += root_pos[..., 1] + return positions diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/utils.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..7c07f6f0d851828f4762f38427abd07cbad9c422 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/tools/utils.py @@ -0,0 +1,26 @@ +from typing import List, Optional, Union + +import torch + + +def length_to_mask( + length: Union[torch.Tensor, List], + max_len: Optional[int] = None, + device=None, +) -> torch.Tensor: + if isinstance(length, list): + if device is None: + device = "cpu" + length = torch.tensor(length, device=device) + + if device is not None: + assert device == length.device + device = length.device + + if max_len is None: + max_len = max(length) + + mask = torch.arange(max_len, device=device).expand( + len(length), max_len + ) < length.unsqueeze(1) + return mask diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/utils.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..37f83c3b6b5ab632420eea41d2f4c95575d04f24 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/motion_reps/utils.py @@ -0,0 +1,32 @@ +from typing import Optional + +import torch + +from motionbricks.motionlib.core.utils.rotations import quat_apply, quat_mul + + +def apply_base_rot( + joints_pos: Optional[torch.Tensor] = None, joints_rot: Optional[torch.Tensor] = None +): + """Flips output joint positions and/or rotations that is y-up to be z-up. + + Args: + joints_pos(Optional[torch.Tensor]): [B, T, J, 3] joint positions + joints_rot(Optional[torch.Tensor]): [B, T, J, 4] joint quaternions + """ + base_rot = torch.tensor([[0.5, 0.5, 0.5, 0.5]]) + if joints_pos is not None: + # rotate positions + joints_pos = quat_apply( + base_rot.to(joints_pos).expand(joints_pos.shape[:-1] + (4,)), joints_pos + ) + if joints_rot is not None: + # for rotations, apply base_rot to just the root + root_rot_quat = joints_rot[:, :, 0:1] + root_rot_quat = quat_mul( + base_rot[:, None, None].to(joints_rot).expand_as(root_rot_quat), + root_rot_quat, + ) + joints_rot = torch.cat([root_rot_quat, joints_rot[:, :, 1:]], dim=2) + + return joints_pos, joints_rot diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..21a95a2a32e0c33b010037040b74a77e56a6affa --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__init__.py @@ -0,0 +1,4 @@ +# flake8: noqa + +from .base import SkeletonBase +from .g1 import G1Skeleton, G1Skeleton34, G1Skeleton32 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f33feaf035e0be59f1f4e041fca3f294a90db6b1 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__pycache__/base.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__pycache__/base.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80eaca2c6011f7b9b2d8b040d033678d7afe9c5f Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__pycache__/base.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__pycache__/g1.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__pycache__/g1.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..74d52e3a40e0489059344d56f9d12ebace35370c Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/__pycache__/g1.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/base.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/base.py new file mode 100644 index 0000000000000000000000000000000000000000..d3351cdeb34d09ab0ad02dd7958dba0006fd86d0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/base.py @@ -0,0 +1,112 @@ +import os.path as osp +from typing import Optional + +import torch + + +class SkeletonBase(torch.nn.Module): + "Utility class to hold info about a skeleton" + + # these should be defined in the subclass + name = None + bone_order_names_with_parents = None + bone_order_names_no_root = None + root_idx = None + foot_joint_names = None + foot_joint_idx = None + hip_joint_names = None # in order [right, left] + hip_joint_idx = None # in order [right, left] + + def __init__( + self, + folder: Optional[str] = None, + name: Optional[str] = None, + load: bool = True, + t_pose: Optional[str] = None, + **kwargs, # to catch addition args in configs + ): + super().__init__() + + if name is not None: + assert self.name in name + + self.folder = folder + self.name = name + self.t_pose = t_pose + + self.dim = len(self.bone_order_names_with_parents) + + if load and folder is not None: + neutral_joints = torch.load(osp.join(folder, "joints.p")).squeeze() + self.register_buffer("neutral_joints", neutral_joints, persistent=False) + + joint_parents = torch.load(osp.join(folder, "parents.p")) + self.register_buffer("joint_parents", joint_parents, persistent=False) + + self.bone_order_names = [x for x, y in self.bone_order_names_with_parents] + + self.bone_parents = dict(self.bone_order_names_with_parents) + self.bone_index = {x: idx for idx, x in enumerate(self.bone_order_names)} + self.bone_order_names_index = self.bone_index + + # create the parents tensor on the fly + joint_parents = torch.tensor( + [ + -1 if (y := self.bone_parents[x]) is None else self.bone_index[y] + for x in self.bone_order_names + ] + ) + + if "joint_parents" not in self.__dict__: + self.register_buffer("joint_parents", joint_parents, persistent=False) + else: + # check the saved one is coherent with the class + assert (self.joint_parents == joint_parents).all() + + self.nbjoints = len(self.bone_order_names) + + # check lengths + assert self.nbjoints == len(self.joint_parents) + if "neutral_joints" in self.__dict__: + assert self.nbjoints == len(self.neutral_joints) + + root_indices = torch.where(joint_parents == -1)[0] + assert len(root_indices) == 1 # should be one root only + self.root_idx = root_indices[0].item() + + if "neutral_joints" in self.__dict__: + assert (self.neutral_joints[0] == 0).all() + + # remove the root + self.bone_order_names_no_root = ( + self.bone_order_names[: self.root_idx] + + self.bone_order_names[self.root_idx + 1 :] + ) + + self.foot_joint_names = self.left_foot_joint_names + self.right_foot_joint_names + self.foot_joint_names_index = { + x: idx for idx, x in enumerate(self.foot_joint_names) + } + + self.left_foot_joint_idx = [ + self.bone_order_names.index(foot_joint) + for foot_joint in self.left_foot_joint_names + ] + + self.right_foot_joint_idx = [ + self.bone_order_names.index(foot_joint) + for foot_joint in self.right_foot_joint_names + ] + + self.foot_joint_idx = self.left_foot_joint_idx + self.right_foot_joint_idx + + self.hip_joint_idx = [ + self.bone_order_names.index(hip_joint) for hip_joint in self.hip_joint_names + ] + + def __repr__(self): + if self.folder is None: + return f"{self.__class__.__name__}()" + return f'{self.__class__.__name__}(folder="{self.folder}")' + + diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/g1.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/g1.py new file mode 100644 index 0000000000000000000000000000000000000000..9bd7bee56d4cb6242e98b26e140125a862cf0a88 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/skeletons/g1.py @@ -0,0 +1,205 @@ +from .base import SkeletonBase + +# If a joint's channel is not in this list, it is a dead joint that is not activated +# This is the list of channels which does not include hand motions +ACTIVATED_JOINTS_CHANNELS_IN_G1 = [ + # pelvis + "pelvis_skel.translateX", + "pelvis_skel.translateY", + "pelvis_skel.translateZ", + "pelvis_skel.rotateX", + "pelvis_skel.rotateY", + "pelvis_skel.rotateZ", + # right hip & right leg & right foot + "right_hip_pitch_skel.rotateX", + "right_hip_roll_skel.rotateZ", + "right_hip_yaw_skel.rotateY", + "right_knee_skel.rotateX", + "right_ankle_pitch_skel.rotateX", + "right_ankle_roll_skel.rotateZ", + # waist + "waist_yaw_skel.rotateY", + "waist_roll_skel.rotateZ", + "waist_pitch_skel.rotateX", + # right shoulder & right arm & right hand + "right_shoulder_pitch_skel.rotateX", + "right_shoulder_roll_skel.rotateZ", + "right_shoulder_yaw_skel.rotateY", + "right_elbow_skel.rotateX", + # left shoulder & left arm & left hand + "left_shoulder_pitch_skel.rotateX", + "left_shoulder_roll_skel.rotateZ", + "left_shoulder_yaw_skel.rotateY", + "left_elbow_skel.rotateX", + # left hip & left leg & left foot + "left_hip_pitch_skel.rotateX", + "left_hip_roll_skel.rotateZ", + "left_hip_yaw_skel.rotateY", + "left_knee_skel.rotateX", + "left_ankle_pitch_skel.rotateX", + "left_ankle_roll_skel.rotateZ", +] + +# in total we have 32 joints; other than pelvis, each joint is a hinge joint with 1 degree of freedom (including the +# dead joints) +COMPLETE_JOINT_LIST_IN_G1 = [ + "pelvis_skel", + # left hip & left leg & left foot + "left_hip_pitch_skel", + "left_hip_roll_skel", + "left_hip_yaw_skel", + "left_knee_skel", + "left_ankle_pitch_skel", + "left_ankle_roll_skel", + # right hip & right leg & right foot + "right_hip_pitch_skel", + "right_hip_roll_skel", + "right_hip_yaw_skel", + "right_knee_skel", + "right_ankle_pitch_skel", + "right_ankle_roll_skel", + # waist + "waist_yaw_skel", + "waist_roll_skel", + "waist_pitch_skel", + # left shoulder & left arm & left hand + "left_shoulder_pitch_skel", + "left_shoulder_roll_skel", + "left_shoulder_yaw_skel", + "left_elbow_skel", + "left_wrist_roll_skel", + "left_wrist_pitch_skel", + "left_wrist_yaw_skel", + "left_hand_roll_skel", + # right shoulder & right arm & right hand + "right_shoulder_pitch_skel", + "right_shoulder_roll_skel", + "right_shoulder_yaw_skel", + "right_elbow_skel", + "right_wrist_roll_skel", + "right_wrist_pitch_skel", + "right_wrist_yaw_skel", + "right_hand_roll_skel", +] + + +class G1Skeleton(SkeletonBase): + bone_order_names_with_parents = [] + name = "g1skel" + right_hand_joint_names = ["right_hand_roll_skel"] + left_hand_joint_names = ["left_hand_roll_skel"] + hip_joint_names = [ + "right_hip_pitch_skel", + "left_hip_pitch_skel", + ] # used to calculate root orientation, only need 1 pair of hip joints + + def get_skel_slice(self, skeleton: SkeletonBase): + """Return a slice element so that we can slice the input data into our current skeleton.""" + try: + skel_slice = [skeleton.bone_index[x] for x in self.bone_order_names] + except KeyError: + raise ValueError( + "The current skeleton contain joints that are not in the input" + ) + return skel_slice + + +class G1Skeleton32(G1Skeleton): + """This is the full skeleton with all 32 joints. + + but no toe joints. + """ + + name = "g1skel32" + right_foot_joint_names = ["right_ankle_pitch_skel", "right_ankle_roll_skel"] + left_foot_joint_names = ["left_ankle_pitch_skel", "left_ankle_roll_skel"] + + bone_order_names_with_parents = [ + ("pelvis_skel", None), + # left hip & left leg & left foot + ("left_hip_pitch_skel", "pelvis_skel"), + ("left_hip_roll_skel", "left_hip_pitch_skel"), + ("left_hip_yaw_skel", "left_hip_roll_skel"), + ("left_knee_skel", "left_hip_yaw_skel"), + ("left_ankle_pitch_skel", "left_knee_skel"), + ("left_ankle_roll_skel", "left_ankle_pitch_skel"), + # right hip & right leg & right foot + ("right_hip_pitch_skel", "pelvis_skel"), + ("right_hip_roll_skel", "right_hip_pitch_skel"), + ("right_hip_yaw_skel", "right_hip_roll_skel"), + ("right_knee_skel", "right_hip_yaw_skel"), + ("right_ankle_pitch_skel", "right_knee_skel"), + ("right_ankle_roll_skel", "right_ankle_pitch_skel"), + # waist + ("waist_yaw_skel", "pelvis_skel"), + ("waist_roll_skel", "waist_yaw_skel"), + ("waist_pitch_skel", "waist_roll_skel"), + # left shoulder & left arm & left hand + ("left_shoulder_pitch_skel", "waist_pitch_skel"), + ("left_shoulder_roll_skel", "left_shoulder_pitch_skel"), + ("left_shoulder_yaw_skel", "left_shoulder_roll_skel"), + ("left_elbow_skel", "left_shoulder_yaw_skel"), + ("left_wrist_roll_skel", "left_elbow_skel"), + ("left_wrist_pitch_skel", "left_wrist_roll_skel"), + ("left_wrist_yaw_skel", "left_wrist_pitch_skel"), + ("left_hand_roll_skel", "left_wrist_yaw_skel"), + # right shoulder & right arm & right hand + ("right_shoulder_pitch_skel", "waist_pitch_skel"), + ("right_shoulder_roll_skel", "right_shoulder_pitch_skel"), + ("right_shoulder_yaw_skel", "right_shoulder_roll_skel"), + ("right_elbow_skel", "right_shoulder_yaw_skel"), + ("right_wrist_roll_skel", "right_elbow_skel"), + ("right_wrist_pitch_skel", "right_wrist_roll_skel"), + ("right_wrist_yaw_skel", "right_wrist_pitch_skel"), + ("right_hand_roll_skel", "right_wrist_yaw_skel"), + ] + + +class G1Skeleton34(G1Skeleton): + """This is the full skeleton with all 32 joints, + 2 dummy toe joints.""" + + name = "g1skel34" + + bone_order_names_with_parents = [ + ("pelvis_skel", None), + # left hip & left leg & left foot + ("left_hip_pitch_skel", "pelvis_skel"), + ("left_hip_roll_skel", "left_hip_pitch_skel"), + ("left_hip_yaw_skel", "left_hip_roll_skel"), + ("left_knee_skel", "left_hip_yaw_skel"), + ("left_ankle_pitch_skel", "left_knee_skel"), + ("left_ankle_roll_skel", "left_ankle_pitch_skel"), + ("left_toe_base", "left_ankle_roll_skel"), + # right hip & right leg & right foot + ("right_hip_pitch_skel", "pelvis_skel"), + ("right_hip_roll_skel", "right_hip_pitch_skel"), + ("right_hip_yaw_skel", "right_hip_roll_skel"), + ("right_knee_skel", "right_hip_yaw_skel"), + ("right_ankle_pitch_skel", "right_knee_skel"), + ("right_ankle_roll_skel", "right_ankle_pitch_skel"), + ("right_toe_base", "right_ankle_roll_skel"), + # waist + ("waist_yaw_skel", "pelvis_skel"), + ("waist_roll_skel", "waist_yaw_skel"), + ("waist_pitch_skel", "waist_roll_skel"), + # left shoulder & left arm & left hand + ("left_shoulder_pitch_skel", "waist_pitch_skel"), + ("left_shoulder_roll_skel", "left_shoulder_pitch_skel"), + ("left_shoulder_yaw_skel", "left_shoulder_roll_skel"), + ("left_elbow_skel", "left_shoulder_yaw_skel"), + ("left_wrist_roll_skel", "left_elbow_skel"), + ("left_wrist_pitch_skel", "left_wrist_roll_skel"), + ("left_wrist_yaw_skel", "left_wrist_pitch_skel"), + ("left_hand_roll_skel", "left_wrist_yaw_skel"), + # right shoulder & right arm & right hand + ("right_shoulder_pitch_skel", "waist_pitch_skel"), + ("right_shoulder_roll_skel", "right_shoulder_pitch_skel"), + ("right_shoulder_yaw_skel", "right_shoulder_roll_skel"), + ("right_elbow_skel", "right_shoulder_yaw_skel"), + ("right_wrist_roll_skel", "right_elbow_skel"), + ("right_wrist_pitch_skel", "right_wrist_roll_skel"), + ("right_wrist_yaw_skel", "right_wrist_pitch_skel"), + ("right_hand_roll_skel", "right_wrist_yaw_skel"), + ] + right_foot_joint_names = ["right_ankle_roll_skel", "right_toe_base"] + left_foot_joint_names = ["left_ankle_roll_skel", "left_toe_base"] diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7f5a98afc5b8b1c2abc427e856d0377778f366f Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/custom_logging.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/custom_logging.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..890ecf3e0fa0f7aa49e1b7b2b41d19bb5095d518 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/custom_logging.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/rotations.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/rotations.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3397880afe8c69ac50bb162bb434d06d88f3cef8 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/rotations.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/stats.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/stats.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bbd83afef85f4e2e24cbd4f73960e2a61fb786d7 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/stats.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/torch_utils.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/torch_utils.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e04836928f0cb0095312574ae806bc5b8f7c9c9f Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/__pycache__/torch_utils.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/custom_logging.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/custom_logging.py new file mode 100644 index 0000000000000000000000000000000000000000..4289267488509c15729b045fe71e39a8184b0a2a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/custom_logging.py @@ -0,0 +1,54 @@ +import logging +import os +from typing import Optional + +import colorlog + + +def setup_logging( + name: Optional[str] = None, + run_dir: Optional[str] = None, + rank: Optional[int] = 0, + level=logging.INFO, +): + # Get the root logger + root_logger = logging.getLogger() + + # Configure the root logger + root_logger.setLevel(level) + + # Ensure hydra or other libraries aren't adding handlers + root_logger.handlers.clear() + + # file handler only at rank 0, when we can create the path + if rank == 0 and run_dir is not None and name is not None: + # Create file handler: save to this file + file_handler = logging.FileHandler(os.path.join(run_dir, f"{name}.log")) + file_handler.setLevel(level) + file_formatter = logging.Formatter( + "[%(asctime)s] %(levelname)s %(message)s", + datefmt="%d/%m/%y %H:%M:%S", + ) + file_handler.setFormatter(file_formatter) + root_logger.addHandler(file_handler) + + # stdout logging, a bit more fancy + formatter = colorlog.ColoredFormatter( + "[%(white)s%(asctime)s%(reset)s] %(log_color)s%(levelname)s%(reset)s %(message)s", + datefmt="%d/%m/%y %H:%M:%S", + reset=True, + log_colors={ + "DEBUG": "purple", + "INFO": "blue", + "WARNING": "yellow", + "ERROR": "red", + "CRITICAL": "bg_white", + }, + secondary_log_colors={}, + style="%", + ) + stream_handler = colorlog.StreamHandler() + stream_handler.setLevel(level) + stream_handler.setFormatter(formatter) + root_logger.addHandler(stream_handler) + return root_logger diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/rotations.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/rotations.py new file mode 100644 index 0000000000000000000000000000000000000000..6d1cedaedc4d24def2406fed43d606cc1e2cc2db --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/rotations.py @@ -0,0 +1,393 @@ +import einops +import numpy as np +import torch +import torch.nn.functional as F + +from motionbricks.motionlib.core.utils.torch_utils import normalize_vec + + +def quat_mul(a, b): + assert a.shape == b.shape + shape = a.shape + a = a.reshape(-1, 4) + b = b.reshape(-1, 4) + + w1, x1, y1, z1 = a[:, 0], a[:, 1], a[:, 2], a[:, 3] + w2, x2, y2, z2 = b[:, 0], b[:, 1], b[:, 2], b[:, 3] + ww = (z1 + x1) * (x2 + y2) + yy = (w1 - y1) * (w2 + z2) + zz = (w1 + y1) * (w2 - z2) + xx = ww + yy + zz + qq = 0.5 * (xx + (z1 - x1) * (x2 - y2)) + w = qq - ww + (z1 - y1) * (y2 - z2) + x = qq - xx + (x1 + w1) * (x2 + w2) + y = qq - yy + (w1 - x1) * (y2 + z2) + z = qq - zz + (z1 + y1) * (w2 - x2) + return torch.stack([w, x, y, z], dim=-1).view(shape) + + +def quat_conjugate(a): + shape = a.shape + a = a.reshape(-1, 4) + return torch.cat((a[:, 0:1], -a[:, 1:]), dim=-1).view(shape) + + +def quat_apply(a, b): + shape = b.shape + a = a.reshape(-1, 4) + b = b.reshape(-1, 3) + xyz = a[:, 1:].clone() + t = xyz.cross(b, dim=-1) * 2 + return (b + a[:, 0:1].clone() * t + xyz.cross(t, dim=-1)).view(shape) + + +def cont6d_to_matrix(cont6d): + assert cont6d.shape[-1] == 6, "The last dimension must be 6" + x_raw = cont6d[..., 0:3] + y_raw = cont6d[..., 3:6] + + x = x_raw / torch.norm(x_raw, dim=-1, keepdim=True) + z = torch.cross(x, y_raw, dim=-1) + z = z / torch.norm(z, dim=-1, keepdim=True) + + y = torch.cross(z, x, dim=-1) + + x = x[..., None] + y = y[..., None] + z = z[..., None] + + mat = torch.cat([x, y, z], dim=-1) + return mat + + +def matrix_to_cont6d(matrix): + cont_6d = torch.concat([matrix[..., 0], matrix[..., 1]], dim=-1) + return cont_6d + + +def quaternion_to_matrix(quaternions): + """Convert rotations given as quaternions to rotation matrices. + + Args: + quaternions: quaternions with real part first, + as tensor of shape (..., 4). + Returns: + Rotation matrices as tensor of shape (..., 3, 3). + """ + r, i, j, k = torch.unbind(quaternions, -1) + two_s = 2.0 / (quaternions * quaternions).sum(-1) + + o = torch.stack( + ( + 1 - two_s * (j * j + k * k), + two_s * (i * j - k * r), + two_s * (i * k + j * r), + two_s * (i * j + k * r), + 1 - two_s * (i * i + k * k), + two_s * (j * k - i * r), + two_s * (i * k - j * r), + two_s * (j * k + i * r), + 1 - two_s * (i * i + j * j), + ), + -1, + ) + return o.reshape(quaternions.shape[:-1] + (3, 3)) + + +def quaternion_to_cont6d(quaternions: torch.Tensor) -> torch.Tensor: + rotation_mat = quaternion_to_matrix(quaternions) + cont_6d = matrix_to_cont6d(rotation_mat) + return cont_6d + + +def _sqrt_positive_part(x: torch.Tensor) -> torch.Tensor: + """Returns torch.sqrt(torch.max(0, x)) subgradient is zero where x is 0.""" + ret = torch.zeros_like(x) + positive_mask = x > 0 + ret[positive_mask] = torch.sqrt(x[positive_mask]) + return ret + + +def matrix_to_quaternion(matrix: torch.Tensor) -> torch.Tensor: + """Convert rotations given as rotation matrices to quaternions. + + Args: + matrix: Rotation matrices as tensor of shape (..., 3, 3). + Returns: + quaternions with real part first, as tensor of shape (..., 4). + """ + if matrix.size(-1) != 3 or matrix.size(-2) != 3: + raise ValueError(f"Invalid rotation matrix shape {matrix.shape}.") + + batch_dim = matrix.shape[:-2] + m00, m01, m02, m10, m11, m12, m20, m21, m22 = torch.unbind( + matrix.reshape(batch_dim + (9,)), dim=-1 + ) + + q_abs = _sqrt_positive_part( + torch.stack( + [ + 1.0 + m00 + m11 + m22, + 1.0 + m00 - m11 - m22, + 1.0 - m00 + m11 - m22, + 1.0 - m00 - m11 + m22, + ], + dim=-1, + ) + ) + + quat_by_rijk = torch.stack( + [ + torch.stack([q_abs[..., 0] ** 2, m21 - m12, m02 - m20, m10 - m01], dim=-1), + torch.stack([m21 - m12, q_abs[..., 1] ** 2, m10 + m01, m02 + m20], dim=-1), + torch.stack([m02 - m20, m10 + m01, q_abs[..., 2] ** 2, m12 + m21], dim=-1), + torch.stack([m10 - m01, m20 + m02, m21 + m12, q_abs[..., 3] ** 2], dim=-1), + ], + dim=-2, + ) + + flr = torch.tensor(0.1).to(dtype=q_abs.dtype, device=q_abs.device) + quat_candidates = quat_by_rijk / (2.0 * q_abs[..., None].max(flr)) + + return quat_candidates[ + F.one_hot(q_abs.argmax(dim=-1), num_classes=4) > 0.5, : + ].reshape(batch_dim + (4,)) + + +def cont6d_to_quaternion(cont6d): + assert cont6d.shape[-1] == 6, "The last dimension must be 6" + matrix = cont6d_to_matrix(cont6d) + return matrix_to_quaternion(matrix) + + +def exp_map_to_matrix(exp_map): + quat = exp_map_to_quat(exp_map) + return quaternion_to_matrix(quat) + + +# +# Extra utils only needed for visualization +# + + +def quat_unit(a: torch.Tensor): + return normalize_vec(a) + + +def angle_axis_to_quaternion(angle, axis): + theta = (angle / 2).unsqueeze(-1) + xyz = normalize_vec(axis) * theta.sin() + w = theta.cos() + return quat_unit(torch.cat([w, xyz], dim=-1)) + + +def quat_between_two_vec(v1, v2, eps: float = 1e-6): + """Quaternion for rotating v1 to v2.""" + orig_shape = v1.shape + v1 = v1.reshape(-1, 3) + v2 = v2.reshape(-1, 3) + dot = (v1 * v2).sum(-1) + cross = torch.cross(v1, v2, dim=-1) + out = torch.cat([(1 + dot).unsqueeze(-1), cross], dim=-1) + # handle v1 & v2 with same direction + sind = dot > 1 - eps + out[sind] = torch.tensor([1.0, 0.0, 0.0, 0.0], device=v1.device) + # handle v1 & v2 with opposite direction + nind = dot < -1 + eps + if torch.any(nind): + vx = torch.tensor([1.0, 0.0, 0.0], device=v1.device) + vxdot = (v1 * vx).sum(-1).abs() + nxind = nind & (vxdot < 1 - eps) + if torch.any(nxind): + out[nxind] = exp_map_to_quat( + normalize_vec(torch.cross(vx.expand_as(v1[nxind]), v1[nxind], dim=-1)) + * np.pi + ) + # handle v1 & v2 with opposite direction and they are parallel to x axis + pind = nind & (vxdot >= 1 - eps) + if torch.any(pind): + vy = torch.tensor([0.0, 1.0, 0.0], device=v1.device) + out[pind] = exp_map_to_quat( + normalize_vec(torch.cross(vy.expand_as(v1[pind]), v1[pind], dim=-1)) + * np.pi + ) + # normalize and reshape + out = normalize_vec(out).view(orig_shape[:-1] + (4,)) + return out + + +def quaternion_angle_diff(q1, q2, eps=1e-6): + """Calculate the angle difference between two quaternions in radians. Handles arbitrary input + shapes where the last dimension is 4. + + Args: + q1: First quaternion tensor [..., 4] + q2: Second quaternion tensor [..., 4] + + Returns: + Angle in radians between the two quaternions, shape [...] + """ + # Normalize quaternions + q1 = q1 / torch.norm(q1, dim=-1, keepdim=True) + q2 = q2 / torch.norm(q2, dim=-1, keepdim=True) + + # Compute dot product + dot = torch.clamp(torch.abs(torch.sum(q1 * q2, dim=-1)), -1.0, 1.0) + # Calculate angle in radians + angle = 2 * torch.acos(dot) + angle[angle < eps] = 0.0 + + return angle + + +def normalize_angle(x): + return torch.atan2(torch.sin(x), torch.cos(x)) + + +def exp_map_to_angle_axis(exp_map): + min_theta = 1e-5 + + angle = torch.norm(exp_map, dim=-1) + angle_exp = torch.unsqueeze(angle, dim=-1) + axis = exp_map / angle_exp + angle = normalize_angle(angle) + + default_axis = torch.zeros_like(exp_map) + default_axis[..., -1] = 1 + + mask = torch.abs(angle) > min_theta + angle = torch.where(mask, angle, torch.zeros_like(angle)) + mask_expand = mask.unsqueeze(-1) + axis = torch.where(mask_expand, axis, default_axis) + + return angle, axis + + +def exp_map_to_quat(exp_map): + angle, axis = exp_map_to_angle_axis(exp_map) + q = angle_axis_to_quaternion(angle, axis) + return q + + +def quat_to_angle_axis(q): + # type: (Tensor) -> Tuple[Tensor, Tensor] + # computes axis-angle representation from quaternion q + # q must be normalized + min_theta = 1e-5 + qw, qx = 0, 1 + + norms = torch.norm(q[..., qx:], p=2, dim=-1) + half_angles = torch.atan2( + norms, q[..., qw] + ) # half_angles: [0,pi] because norms >= 0 + angle = 2 * half_angles # angle: [0, 2pi] + sin_theta = torch.sin(half_angles) # sin_theta: [0, 1] + sin_theta_expand = sin_theta.unsqueeze(-1) + axis = q[..., qx:] / sin_theta_expand + + mask = sin_theta > min_theta + default_axis = torch.zeros_like(axis) + default_axis[..., -1] = 1 + + angle = torch.where(mask, angle, torch.zeros_like(angle)) + mask_expand = mask.unsqueeze(-1) + axis = torch.where(mask_expand, axis, default_axis) + + # angle is within [0, 2pi]. + # if angle > pi, use shorter side of the arc(2*pi-angle) and flip the rotation axis + flip_axis = angle > torch.pi + angle = torch.where(flip_axis, 2 * torch.pi - angle, angle) + axis = torch.where(flip_axis[..., None], -axis, axis) + + return angle, axis + + +def angle_axis_to_exp_map(angle, axis): + # type: (Tensor, Tensor) -> Tensor + # compute exponential map from axis-angle + angle_expand = angle.unsqueeze(-1) + exp_map = angle_expand * axis + return exp_map + + +def quat_to_exp_map(q): + # type: (Tensor) -> Tensor + # compute exponential map from quaternion + # q must be normalized + angle, axis = quat_to_angle_axis(q) + exp_map = angle_axis_to_exp_map(angle, axis) + return exp_map + + +def angle_to_Y_rotation_matrix(angle): + cos, sin = torch.cos(angle), torch.sin(angle) + one, zero = torch.ones_like(angle), torch.zeros_like(angle) + mat = torch.stack((cos, zero, sin, zero, one, zero, -sin, zero, cos), -1) + mat = mat.reshape(angle.shape + (3, 3)) + return mat + + +def diff_angles(angles, fps: float): + """Computes differences between angles. + + Args: + angles (Tensor): [..., T] the batched sequences of rotation angles in radians. + + Returns: + Tensor: [..., T-1] the difference between consecutive angles + """ + + cos = torch.cos(angles) + sin = torch.sin(angles) + + cos_diff = cos[..., 1:] * cos[..., :-1] + sin[..., 1:] * sin[..., :-1] + sin_diff = sin[..., 1:] * cos[..., :-1] - cos[..., 1:] * sin[..., :-1] + + # should be close to angles.diff() but more robust + # multiply by fps = 1 / dt + angles_diff = fps * torch.arctan2(sin_diff, cos_diff) + return angles_diff + + +def diff_between_two_angles(b, a, fps: float): + # angle: b - a + cos_a = np.cos(a) + sin_a = np.sin(a) + + cos_b = np.cos(b) + sin_b = np.sin(b) + + cos_diff = cos_b * cos_a + sin_b * sin_a + sin_diff = sin_b * cos_a - cos_b * sin_a + + return fps * np.arctan2(sin_diff, cos_diff) + + +# Numpy-backed utils + + +def diff_angles_np(angles: np.array, fps: float) -> np.array: + angles = torch.from_numpy(angles) + return diff_angles(angles, fps).numpy() + + +def qmul_np(q: np.array, r: np.array) -> np.array: + q = torch.from_numpy(q).contiguous().float() + r = torch.from_numpy(r).contiguous().float() + return quat_mul(q, r).numpy() + + +def qrot_np(q: np.array, v: np.array) -> np.array: + q = torch.from_numpy(q).contiguous().float() + v = torch.from_numpy(v).contiguous().float() + return quat_apply(q, v).numpy() + + +def qinv_np(q: np.array) -> np.array: + q = torch.from_numpy(q).contiguous().float() + return quat_conjugate(q).numpy() + + +def quaternion_to_cont6d_np(q: np.array) -> np.array: + q = torch.from_numpy(q).contiguous().float() + return quaternion_to_cont6d(q).numpy() diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/stats.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/stats.py new file mode 100644 index 0000000000000000000000000000000000000000..5764fd9095f06f4e544ed6276df3d90ab76adc1f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/stats.py @@ -0,0 +1,117 @@ +import logging +import os +from typing import Optional + +import numpy as np +import torch + +log = logging.getLogger(__name__) + + +class Stats(torch.nn.Module): + """Simple class to handle stats with pytorch. + + Similar to: + https://pytorch.org/docs/stable/generated/torch.nn.LayerNorm.html + for handling precision + + (data - mean) / np.sqrt(var + eps) + """ + + def __init__( + self, + folder: Optional[str] = None, + load: bool = True, + eps=1e-05, + legacy=False, + ): + super().__init__() + self.legacy = legacy + # for legacy behavior, the std stats are already cliped to 1e-3 + + self.folder = folder + self.eps = eps + if folder is not None and load: + self.load() + + def load(self): + mean = torch.from_numpy(np.load(os.path.join(self.folder, "mean.npy"))) + std = torch.from_numpy(np.load(os.path.join(self.folder, "std.npy"))) + self.register_from_tensors(mean, std) + + def register_from_tensors(self, mean: torch.Tensor, std: torch.Tensor): + self.register_buffer("mean", mean, persistent=False) + self.register_buffer("std", std, persistent=False) + + def normalize(self, data: torch.Tensor, index=None) -> torch.Tensor: + mean = self.mean.to(device=data.device, dtype=data.dtype) + std = self.std.to(device=data.device, dtype=data.dtype) + + if index is not None: + mean = mean[..., index] + std = std[..., index] + + if self.legacy: + return (data - mean) / torch.clip(std, 1e-3) + + # adjust std with eps + return (data - mean) / torch.sqrt(std**2 + self.eps) + + def unnormalize(self, data: torch.Tensor, index=None) -> torch.Tensor: + mean = self.mean.to(device=data.device, dtype=data.dtype) + std = self.std.to(device=data.device, dtype=data.dtype) + + if index is not None: + mean = mean[..., index] + std = std[..., index] + + if self.legacy: + return data * torch.clip(std, 1e-3) + mean + + # adjust std with eps + return data * torch.sqrt(std**2 + self.eps) + mean + + def is_loaded(self): + return hasattr(self, "mean") + + def get_dim(self): + return self.mean.shape[0] + + def save( + self, + folder: Optional[str] = None, + mean: Optional[torch.Tensor] = None, + std: Optional[torch.Tensor] = None, + ): + if folder is None: + folder = self.folder + if folder is None: + raise ValueError("No folder to save stats") + + if mean is None and std is None: + try: + mean = self.mean.cpu().numpy() + std = self.std.cpu().numpy() + except AttributeError: + raise ValueError("Stats were not loaded") + + # don't override stats folder + os.makedirs(folder, exist_ok=False) + + np.save(os.path.join(folder, "mean.npy"), mean) + np.save(os.path.join(folder, "std.npy"), std) + + def __eq__(self, other): + return (self.mean.cpu() == other.mean.cpu()).all() and ( + self.std.cpu() == other.std.cpu() + ).all() + + # should define a hash value for pytorch, as we defined __eq__ + def __hash__(self): + # Convert mean and std to bytes for a consistent hash value + mean_hash = hash(self.mean.detach().cpu().numpy().tobytes()) + std_hash = hash(self.std.detach().cpu().numpy().tobytes()) + return hash((mean_hash, std_hash)) + + def __repr__(self): + return f'Stats(folder="{self.folder}")' diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/torch_utils.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/torch_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..c0e19abf9f3549238bdaa7558f21af1676832d3f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/core/utils/torch_utils.py @@ -0,0 +1,136 @@ +from typing import List, Optional, Union + +import torch +import torch.nn.functional as F + + +def normalize_vec(x: torch.Tensor, dim: int = -1, eps: float = 1e-9): + return x / x.norm(p=2, dim=dim).clamp(min=eps, max=None).unsqueeze(-1) + + +@torch.jit.script +def transform_mat(R, t): + """Creates a batch of transformation matrices. + + Args: + - R: Bx3x3 array of a batch of rotation matrices + - t: Bx3x1 array of a batch of translation vectors + Returns: + - T: Bx4x4 Transformation matrix + """ + # No padding left or right, only add an extra row + return torch.cat([F.pad(R, [0, 0, 0, 1]), F.pad(t, [0, 0, 0, 1], value=1.0)], dim=2) + + +def compute_idx_levels(parents): + idx_levs = [[]] + lev_dicts = {0: -1} + for i in range(1, parents.shape[0]): + assert int(parents[i]) in lev_dicts + lev = lev_dicts[int(parents[i])] + 1 + if lev + 1 > len(idx_levs): + idx_levs.append([]) + idx_levs[lev].append(int(i)) + lev_dicts[int(i)] = lev + idx_levs = [torch.tensor(x).long() for x in idx_levs] + return idx_levs + + +def batch_rigid_transform(rot_mats, joints, parents, root_idx): + """Perform batch rigid transformation on a skeletal structure. + + Args: + rot_mats: Local rotation matrices for each joint: (B, J, 3, 3) + joints: Initial joint positions: (B, J, 3) + parents: Tensor indicating the parent of each joint: (J,) + root_idx (int): index of the root + + Returns: + Transformed joint positions after applying forward kinematics. + """ + + # Compute the hierarchical levels of joints based on their parent relationships + idx_levs = compute_idx_levels(parents) + + # Apply forward kinematics to transform the joints + return forward_kinematics(rot_mats, joints, parents, idx_levs, root_idx) + + +@torch.jit.script +def forward_kinematics( + rot_mats, + joints, + parents: torch.Tensor, + idx_levs: List[torch.Tensor], + root_idx: int, +): + """Perform forward kinematics to compute posed joints and global rotation matrices. + + Args: + rot_mats: Local rotation matrices for each joint: (B, J, 3, 3) + joints: Initial joint positions: (B, J, 3) + parents: Tensor indicating the parent of each joint: (J,) + idx_levs: List of tensors containing indices for each level in the kinematic tree + root_idx (int): index of the root + Returns: + Posed joints: (B, J, 3) + Global rotation matrices: (B, J, 3, 3) + """ + + # Add an extra dimension to joints + joints = torch.unsqueeze(joints, dim=-1) + + # Compute relative joint positions + rel_joints = joints.clone() + + mask_no_root = torch.ones(joints.shape[1], dtype=torch.bool) + mask_no_root[root_idx] = False + rel_joints[:, mask_no_root] -= joints[:, parents[mask_no_root]].clone() + + # Compute initial transformation matrices + # (B, J + 1, 4, 4) + transforms_mat = transform_mat( + rot_mats.reshape(-1, 3, 3), rel_joints.reshape(-1, 3, 1) + ).reshape(-1, joints.shape[1], 4, 4) + + # Initialize the root transformation matrices + transforms = torch.zeros_like(transforms_mat) + transforms[:, root_idx] = transforms_mat[:, root_idx] + + # Compute global transformations level by level + for indices in idx_levs: + curr_res = torch.matmul( + transforms[:, parents[indices]], transforms_mat[:, indices] + ) + transforms[:, indices] = curr_res + + # Extract posed joint positions from the transformation matrices + posed_joints = transforms[:, :, :3, 3] + + # Extract global rotation matrices from the transformation matrices + global_rot_mat = transforms[:, :, :3, :3] + + return posed_joints, global_rot_mat + + +def length_to_mask( + length: Union[torch.Tensor, List], + max_len: Optional[int] = None, + device=None, +) -> torch.Tensor: + if isinstance(length, list): + if device is None: + device = "cpu" + length = torch.tensor(length, device=device) + + if device is not None: + assert device == length.device + device = length.device + + if max_len is None: + max_len = max(length) + + mask = torch.arange(max_len, device=device).expand( + len(length), max_len + ) < length.unsqueeze(1) + return mask diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6cf6674d8fc6c17d0e41c10112ea896cacb107a7 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/__pycache__/utils.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/__pycache__/utils.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..050341766f5f8de7b5f0ce5c5b260301f7e7c748 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/__pycache__/utils.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/scheduler.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/scheduler.py new file mode 100644 index 0000000000000000000000000000000000000000..27b00401f36f01ab7c57ea8f207d84fd226ad3c7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/scheduler.py @@ -0,0 +1,37 @@ +import math +from torch.optim import Optimizer +from torch.optim.lr_scheduler import _LRScheduler + + +class WarmupCosineScheduler(_LRScheduler): + """Linear warmup followed by cosine annealing to a final learning rate.""" + + def __init__( + self, + optimizer: Optimizer, + num_warmup_steps: int, + num_training_steps: int, + final_lr: float = 0.0, + last_epoch: int = -1, + ): + self.num_warmup_steps = num_warmup_steps + self.num_training_steps = num_training_steps + self.final_lr = final_lr + super().__init__(optimizer, last_epoch) + + def get_lr(self): + current_step = self.last_epoch + if current_step < self.num_warmup_steps: + return [ + base_lr * float(current_step) / float(max(1, self.num_warmup_steps)) + for base_lr in self.base_lrs + ] + else: + progress = float(current_step - self.num_warmup_steps) / float( + max(1, self.num_training_steps - self.num_warmup_steps) + ) + cosine_decay = 0.5 * (1.0 + math.cos(math.pi * min(progress, 1.0))) + return [ + self.final_lr + (base_lr - self.final_lr) * cosine_decay + for base_lr in self.base_lrs + ] diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/utils.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..aebc00da99c0d3661da36c6e9bc1f281efa897ee --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/motionlib/train/utils.py @@ -0,0 +1,31 @@ +# numpy / torch / pytorch_lightning should not be imported +# even implicitely in the imports +# so that the logging behave properly +import logging +import os +from typing import Optional + +from motionbricks.motionlib.core.utils.custom_logging import setup_logging + + +# from lightning_fabric/utilities/rank_zero.py +# but return 0 +def get_rank() -> Optional[int]: + # SLURM_PROCID can be set even if SLURM is not managing the multiprocessing, + # therefore LOCAL_RANK needs to be checked first + rank_keys = ("RANK", "LOCAL_RANK", "SLURM_PROCID", "JSM_NAMESPACE_RANK") + for key in rank_keys: + rank = os.environ.get(key) + if rank is not None: + return int(rank) + # None to differentiate whether an environment variable was set at all + return 0 + + +def setup_train_logging(run_dir: str, rank: int, level=logging.INFO): + return setup_logging( + name="train", + run_dir=run_dir, + rank=rank, + level=level, + ) diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ce0db2724f47f6d7483642e045b6f73e881f9ede Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/models/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/models/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/models/motion_vqvae.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/models/motion_vqvae.py new file mode 100644 index 0000000000000000000000000000000000000000..60fe70af01c8f011a9db16eb58abf6999f54cd67 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/models/motion_vqvae.py @@ -0,0 +1,467 @@ +import numpy as np +import torch as t +import torch +import logging +from typing import Callable, Optional, Union, Dict +from pytorch_lightning import LightningModule +from motionbricks.motionlib.core.motion_reps import MotionRepBase +from motionbricks.motionlib.core.motion_reps.dual_root_global_joints import ( + GlobalRootGlobalJoints, + LocalRootGlobalJoints, +) +from motionbricks.helper.data_training_util import extract_feature_from_motion_rep +from motionbricks.helper.data_training_util import ( + sample_motion_segments_from_motion_clips, +) +from motionbricks.helper.data_training_util import sample_keyframes +from motionbricks.vqvae.neural_modules import vqvae as vqvae_module + +log = logging.getLogger(__name__) + + +class MotionVQVAEModel(LightningModule): + """VQVAE model for motion generation, wrapped in PyTorch Lightning. + + The pose VQVAE encodes local/global motion representations into discrete + codes and reconstructs them with optional keyframe conditioning and + external root-motion conditioning. + """ + + def __init__( + self, + pose_vqvae_network: vqvae_module.VQVAE, + root_vqvae_network: Optional[vqvae_module.VQVAE], + motion_rep: MotionRepBase, + optimizer: Callable[[list], torch.optim.Optimizer], + scheduler: Optional[ + Callable[[torch.optim.Optimizer], torch.optim.lr_scheduler.LRScheduler] + ], + device: Optional[Union[str, torch.device]] = None, + args: Dict = None, + **kwargs, + ): + super().__init__() + + self.optimizer = optimizer + self.scheduler = scheduler + + assert ( + motion_rep.dual_rep.local_motion_rep.num_joints + == motion_rep.dual_rep.global_motion_rep.num_joints + ), "The number of joints should be the same." + self.NUM_JOINTS = motion_rep.num_joints + + self.pose_net = pose_vqvae_network + self.root_net = root_vqvae_network + self.motion_rep: GlobalRootGlobalJoints = motion_rep + self.global_motion_rep: GlobalRootGlobalJoints = ( + motion_rep.dual_rep.global_motion_rep + ) + self.local_motion_rep: LocalRootGlobalJoints = ( + motion_rep.dual_rep.local_motion_rep + ) + self._args = args + + if device is not None: + self.pose_net = self.pose_net.to(device) + self.root_net = ( + self.root_net.to(device) if self.root_net is not None else None + ) + + def configure_optimizers(self): + optimizer = self.optimizer(self.parameters()) + if not self.scheduler: + return optimizer + + lt_kwargs = dict(self.scheduler.keywords.pop("lt_kwargs", {})) + lt_kwargs["scheduler"] = self.scheduler(optimizer) + return {"optimizer": optimizer, "lr_scheduler": lt_kwargs} + + def training_step(self, batch, batch_idx): + batch_size, device = batch["batch_size"], batch["motion"].device + motions, motion_lengths, _ = ( + batch.pop("motion"), + batch.pop("motion_len"), + batch.pop("motion_pad_mask"), + ) + + num_codes = np.random.choice( + np.arange(self._args["min_tokens"], self._args["max_tokens"] + 1) + ) + num_frames = num_codes * self.get_num_frames_per_code() + + # filter out short samples and truncate + valid_samples_id = motion_lengths >= num_frames + 1 + num_invalid_samples = batch_size - valid_samples_id.sum() + if num_invalid_samples > batch_size // 2: + return None + + motions = sample_motion_segments_from_motion_clips( + motions, + motion_lengths, + num_frames, + self.args["batchsize_mul_factor"], + motion_rep=self.global_motion_rep, + ) + actual_batch_size = int(batch_size * self.args["batchsize_mul_factor"]) + + # prepare global & local motion representations + first_frame_heading_angle = ( + t.rand(actual_batch_size).to(device) * np.pi * 2.0 + if not self.motion_rep.compute_kwargs["removing_heading"] + else 0.0 + ) + global_motions = self.global_motion_rep.change_first_heading( + motions, + first_frame_heading_angle, + is_normalized=True, + to_normalize=True, + ) + local_motions = self.motion_rep.dual_rep.global_to_local( + global_motions, + is_normalized=True, + to_normalize=True, + lengths=t.full([actual_batch_size], motions.shape[1]).to(device), + ) + local_motions, global_motions = ( + local_motions[:, :num_frames, :], + global_motions[:, :num_frames, :], + ) + + # keyframe conditioning + assert self.pose_net.motion_rep.name in [ + "local", + "global", + ], "should be using local or global rep." + prob_pose_num_keyframes, _ = self._construct_keyframe_prob() + pose_motions = ( + local_motions + if self.pose_net.motion_rep.name == "local" + else global_motions + ) + pose_has_target_cond, pose_target_cond = sample_keyframes( + pose_motions, + self._args["pose_vqvae_max_num_keyframes"], + prob_pose_num_keyframes, + ) + pose_external_cond = extract_feature_from_motion_rep( + pose_motions, + self.pose_net.motion_rep, + self.pose_net.decoder_external_cond_feature_mode, + ) + + batch["local_motions"], batch["global_motions"] = local_motions, global_motions + batch["pose_has_target_cond"] = pose_has_target_cond + pose_external_cond = self._construct_masked_pose_external_cond_if_needed( + pose_external_cond, batch + ) + + # network forward + if self.root_net is not None: + raise NotImplementedError("Root VQVAE is not implemented.") + else: + root_net_output = None + + pose_net_output = self.pose_net( + batch["local_motions"] + if self.pose_net.motion_rep.name == "local" + else batch["global_motions"], + target_cond=pose_target_cond, + has_target_cond=pose_has_target_cond, + external_cond=pose_external_cond, + ) + losses = self.loss(batch, pose_net_output, root_net_output) + + for key, val in losses.items(): + self.log( + f"loss/train_{key}", + val, + on_step=True, + on_epoch=True, + sync_dist=True, + batch_size=batch["batch_size"], + ) + return losses["loss"] + + def loss(self, batch, pose_net_output, root_net_output): + if self.root_net is not None: + raise NotImplementedError("Root VQVAE is not implemented.") + else: + global_root_recons_loss = local_root_recons_loss = 0.0 + + # pose reconstruction loss + if self.pose_net.motion_rep.name == "local": + local_pose_recons_loss = t.nn.SmoothL1Loss()( + pose_net_output["recon_state"], batch["local_motions"][:, :, :] + ) + global_pose_recons_loss = 0.0 + pose_recons_loss = local_pose_recons_loss + else: + global_pose_recons_loss = t.nn.SmoothL1Loss()( + pose_net_output["recon_state"], batch["global_motions"][:, :, :] + ) + pred_local_motions = self.motion_rep.dual_rep.global_to_local( + pose_net_output["recon_state"], + is_normalized=True, + to_normalize=True, + lengths=t.full( + [pose_net_output["recon_state"].shape[0]], + pose_net_output["recon_state"].shape[1], + ).to(pose_net_output["recon_state"].device), + ) + pred_local_motions = t.concat( + [ + pred_local_motions[:, :-1, :], + t.concat( + [ + batch["local_motions"][ + :, -1:, self.local_motion_rep.indices["root"] + ], + pred_local_motions[ + :, -1:, self.local_motion_rep.indices["body"] + ], + ], + dim=-1, + ), + ], + dim=1, + ) + local_pose_recons_loss = t.nn.SmoothL1Loss()( + pred_local_motions, batch["local_motions"] + ) + pose_recons_loss = ( + self.args["global_root_loss_coeff"] * global_pose_recons_loss + + self.args["local_root_loss_coeff"] * local_pose_recons_loss + ) + + global_root_recons_loss = t.nn.SmoothL1Loss()( + pose_net_output["recon_state"][ + :, :, self.global_motion_rep.indices["root"] + ], + batch["global_motions"][:, :, self.global_motion_rep.indices["root"]], + ) + local_root_recons_loss = t.nn.SmoothL1Loss()( + pred_local_motions[:, :, self.local_motion_rep.indices["root"]], + batch["local_motions"][:, :, self.local_motion_rep.indices["root"]], + ) + + # foot contact loss + if self.pose_net.motion_rep.name == "local": + pred_joints_output = self.local_motion_rep.inverse( + pose_net_output["recon_state"], + is_normalized=True, + return_quat=True, + return_all=True, + ) + else: + pred_joints_output = self.global_motion_rep.inverse( + pose_net_output["recon_state"], + is_normalized=True, + return_quat=True, + return_all=True, + ) + + pred_joints_pos = pred_joints_output["posed_joints"] + pred_foot_contacts = pred_joints_output.get("foot_contacts") + + fidx = self.motion_rep.skeleton.foot_joint_idx + feet_pos = pred_joints_pos[:, :, fidx] + dt = 1.0 / self.motion_rep.fps + foot_vel = torch.norm(feet_pos[:, 1:] - feet_pos[:, :-1], dim=-1) / dt + + foot_contacts = pred_foot_contacts[:, :-1] + vel_err = foot_vel * foot_contacts + mean_vel = torch.sum(vel_err, (1, 2)) / ( + torch.sum(foot_contacts, (1, 2)) + 1e-6 + ) + mean_vel = mean_vel.mean() + + # joint velocity loss + joint_vel_loss_coeff = self._args.get("joint_vel_loss_coeff", 0.0) + if joint_vel_loss_coeff > 0.0: + batch_size, num_frames = ( + pred_joints_pos.shape[0], + pred_joints_pos.shape[1], + ) + pred_joints_vel = ( + (pred_joints_pos[:, 1:] - pred_joints_pos[:, :-1]) / dt + ).view([batch_size, num_frames - 1, -1]) + gt_joints_pos = self.global_motion_rep.inverse( + batch["global_motions"], + is_normalized=True, + return_quat=False, + return_all=False, + joint_positions_from="ric_data", + )["posed_joints"] + gt_joints_vel = ( + (gt_joints_pos[:, 1:] - gt_joints_pos[:, :-1]) / dt + ).view([batch_size, num_frames - 1, -1]) + joint_vel_indices = self.global_motion_rep.indices["local_vel"] + vel_mean = self.global_motion_rep.stats.mean[joint_vel_indices] + vel_std = self.global_motion_rep.stats.std[joint_vel_indices] + + joint_vel_loss = t.nn.SmoothL1Loss()( + (pred_joints_vel - vel_mean) / torch.sqrt(vel_std**2 + 1e-5), + (gt_joints_vel - vel_mean) / torch.sqrt(vel_std**2 + 1e-5), + ) + joint_vel_loss = ( + joint_vel_loss + / len(self.local_motion_rep.indices["all"]) + * len(joint_vel_indices) + ) + else: + joint_vel_loss = 0.0 + + losses = {} + losses["perplexity_pose"] = pose_net_output["perplexity"] + losses["l_commit_pose"] = pose_net_output["l_commit"] + losses["l_recons_pose"] = pose_recons_loss + losses["l_recons_root_global"] = global_root_recons_loss + losses["l_recons_root_local"] = local_root_recons_loss + losses["l_joint_vel"] = joint_vel_loss + losses["l_recons_pose_global"] = global_pose_recons_loss + losses["l_recons_pose_local"] = local_pose_recons_loss + losses["l_skate_contact"] = mean_vel + skate_contact_loss_coeff = self._args.get("skate_contact_loss_coeff", 0.0) + + losses["loss"] = ( + pose_recons_loss + + self._args["commit_loss_coeff"] * losses["l_commit_pose"] + + skate_contact_loss_coeff * losses["l_skate_contact"] + + joint_vel_loss_coeff * losses["l_joint_vel"] + ) + return losses + + @property + def args(self): + return self._args + + def get_num_frames_per_code(self): + return 2 ** self._args["down_t"] + + def _construct_keyframe_prob(self): + probs = dict() + for module in ["pose", "root"]: + max_num_keyframes = self.args[f"{module}_vqvae_max_num_keyframes"] * ( + self.trainer.global_step / self.args["keyframe_num_warmup_steps"] + ) + max_num_keyframes = int( + max( + 1, + min( + max_num_keyframes, + self.args[f"{module}_vqvae_max_num_keyframes"], + ), + ) + ) + + prob_num_keyframes = [ + 1.0 if i > 0 and i <= max_num_keyframes else 0.0 + for i in range(self.args[f"{module}_vqvae_max_num_keyframes"] + 1) + ] + prob_no_keyframe = self.args[f"{module}_vqvae_no_keyframe_prob"] + prob_num_keyframes[0] = ( + sum(prob_num_keyframes) / (1 - prob_no_keyframe) * prob_no_keyframe + ) + prob_num_keyframes = np.array(prob_num_keyframes) + prob_num_keyframes /= prob_num_keyframes.sum() + probs[module] = prob_num_keyframes + + return probs["pose"], probs["root"] + + def _construct_masked_pose_external_cond_if_needed( + self, pose_external_cond: t.Tensor, batch: dict + ): + if self.pose_net.motion_rep.name != "global": + return pose_external_cond + if ( + self.pose_net.decoder_external_cond_feature_mode + != "root_without_hip_height_without_heading_with_mask" + ): + return pose_external_cond + + batch_size, motion_length = ( + batch["local_motions"].shape[0], + batch["local_motions"].shape[1], + ) + device = batch["local_motions"].device + unnorm_gt_local_motion = self.local_motion_rep.unnormalize( + batch["local_motions"] + ) + + max_perturb_angle = self.args.get("max_perturb_angle", 5.0) + max_vel_norm_perturb_ratio = self.args.get("max_vel_norm_perturb_ratio", 0.2) + norm_ratio = ( + torch.rand([batch_size, unnorm_gt_local_motion.shape[1], 1]) + * max_vel_norm_perturb_ratio + * 2 + + (1 - max_vel_norm_perturb_ratio) + ) + angle = ( + torch.rand([batch_size, unnorm_gt_local_motion.shape[1]]) + * max_perturb_angle + * 2 + - max_perturb_angle + ) * np.pi / 180.0 + norm_ratio, angle = norm_ratio.to(device), angle.to(device) + + accumulated_angle = torch.cumsum(angle, dim=1) + unnorm_gt_local_motion[ + :, :, self.local_motion_rep.indices["local_root_vel"] + ] *= norm_ratio[:, :, :] + cos, sin = torch.cos(accumulated_angle), torch.sin(accumulated_angle) + rotated_x = ( + unnorm_gt_local_motion[ + :, :, self.local_motion_rep.indices["local_root_vel"][0] + ] + * cos + - unnorm_gt_local_motion[ + :, :, self.local_motion_rep.indices["local_root_vel"][1] + ] + * sin + ) + rotated_z = ( + unnorm_gt_local_motion[ + :, :, self.local_motion_rep.indices["local_root_vel"][0] + ] + * sin + + unnorm_gt_local_motion[ + :, :, self.local_motion_rep.indices["local_root_vel"][1] + ] + * cos + ) + unnorm_gt_local_motion[ + :, :, self.local_motion_rep.indices["local_root_vel"][0] + ] = rotated_x + unnorm_gt_local_motion[ + :, :, self.local_motion_rep.indices["local_root_vel"][1] + ] = rotated_z + + perturbed_pose_external_cond = extract_feature_from_motion_rep( + self.motion_rep.dual_rep.local_to_global( + unnorm_gt_local_motion, + is_normalized=False, + to_normalize=True, + lengths=torch.full([batch_size], motion_length).to(device), + ), + self.pose_net.motion_rep, + self.pose_net.decoder_external_cond_feature_mode, + ) + + perturbed = torch.rand([batch_size]) < self.args.get( + "percentage_of_perturbed_samples", 0.2 + ) + perturbed_pose_external_cond = t.where( + batch["pose_has_target_cond"][:, :, None], + pose_external_cond, + perturbed_pose_external_cond, + ) + pose_external_cond = t.where( + perturbed[:, None, None].to(device), + perturbed_pose_external_cond, + pose_external_cond, + ) + pose_external_cond[:, :, -1] = batch["pose_has_target_cond"].float() + + batch["perturbed"] = perturbed + return pose_external_cond diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__init__.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/__init__.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8ab9325d09862f537f2fa7462b8365a3463a75f Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/__init__.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/encdec.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/encdec.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e5b9538c1ce13f771a9183495eecdff16c91be6 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/encdec.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/encdec_double_cond.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/encdec_double_cond.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80f83166f9c9240d5fd081e2c63557fa96a76130 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/encdec_double_cond.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/quantize_cnn_multihead.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/quantize_cnn_multihead.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8fdb236a6ac8dfa0b2a6b62d361291986c231e8 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/quantize_cnn_multihead.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/resnet.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/resnet.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af14098a151907c234b238d3b9dafe75ffcf5a5d Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/resnet.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/vqvae.cpython-312.pyc b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/vqvae.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b75b2718f408924924446d26a4e4411ebd311f0c Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/__pycache__/vqvae.cpython-312.pyc differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/encdec.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/encdec.py new file mode 100644 index 0000000000000000000000000000000000000000..fccdc96b3b8c4c3eafb5d4542564d0dcef584cf1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/encdec.py @@ -0,0 +1,37 @@ +import torch.nn as nn +import torch +from motionbricks.vqvae.neural_modules.resnet import Resnet1D + +class Encoder(nn.Module): + def __init__(self, + input_emb_width, # 251 + output_emb_width = 512, + down_t = 3, + stride_t = 2, + width = 512, + depth = 3, + dilation_growth_rate = 3, + activation='relu', + norm=None): + super().__init__() + + blocks = [] + filter_t, pad_t = stride_t * 2, stride_t // 2 # stride = 2 + blocks.append(nn.Conv1d(input_emb_width, width, 3, 1, 1)) + blocks.append(nn.ReLU()) + + input_dim = width + + for i in range(down_t): + input_dim = width + block = nn.Sequential( + nn.Conv1d(input_dim, width, filter_t, stride_t, pad_t), + Resnet1D(width, depth, dilation_growth_rate, activation=activation, norm=norm), + ) + blocks.append(block) + blocks.append(nn.Conv1d(width, output_emb_width, 3, 1, 1)) + self.model = nn.Sequential(*blocks) + + def forward(self, x): + return self.model(x) + diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/encdec_double_cond.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/encdec_double_cond.py new file mode 100644 index 0000000000000000000000000000000000000000..a2b529805ed908ff2f186786c0b781fddca0c183 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/encdec_double_cond.py @@ -0,0 +1,138 @@ +import torch.nn as nn +import torch +from motionbricks.vqvae.neural_modules.resnet import Resnet1D + +class DoubleCondDecoder(nn.Module): + def __init__(self, + input_emb_width: int = 3, + output_emb_width: int = 512, + down_t: int = 3, + width: int = 512, + depth: int = 3, + dilation_growth_rate: int = 3, + activation: str = 'relu', + norm: str = None, + target_cond_dim: int = -1, + external_cond_dim: int = -1, + cond_fusion_last_layer=False): + """ @brief: consider both the internal target condition and external target condition. + external condition is used to help generate the results, while target condition is directly the results + we want to reconstructed. + Target condition is a way to enforce strict constraints on the results. + """ + super().__init__() + + # log configurations + self._down_t, self._width, self._input_emb_width, self._output_emb_width = \ + down_t, width, input_emb_width, output_emb_width + self._target_cond_dim, self._external_cond_dim = \ + target_cond_dim, external_cond_dim + self._HAS_EXTERNAL_COND, self._HAS_TARGET_COND = external_cond_dim > 0, target_cond_dim > 0 + self._COND_FUSION_LAST_LAYER = cond_fusion_last_layer + + # step 1: the main model + blocks = [] + blocks.append(nn.Conv1d(output_emb_width, width, 3, 1, 1)) # this does not change sequence length + blocks.append(nn.ReLU()) + for i in range(down_t): + out_dim = width + block = nn.Sequential( + Resnet1D(width, depth, dilation_growth_rate, reverse_dilation=True, activation=activation, norm=norm), + nn.Upsample(scale_factor=2, mode='nearest'), + nn.Conv1d(width, out_dim, 3, 1, 1) + ) + blocks.append(block) + blocks.append(nn.Conv1d(width, width, 3, 1, 1)) + blocks.append(nn.ReLU()) + blocks.append(nn.Conv1d(width, input_emb_width, 3, 1, 1)) + self.model = nn.Sequential(*blocks) + + """ step 2: external cond embeddings. + At each layer, the external embedding will be merged with the hidden state. The external condition is dense + and expected to be always available in each frame. + """ + if self._HAS_EXTERNAL_COND: + external_cond_blocks = [] + for i in range(down_t + (1 if self._COND_FUSION_LAST_LAYER else 0)): + cond_feat_dim = (2 ** (down_t - i)) * self._external_cond_dim + external_cond_blocks.append(nn.Linear(cond_feat_dim + width, width)) + external_cond_blocks.append(nn.ReLU()) + self.external_cond_blocks = nn.ModuleList(external_cond_blocks) + + """ step 3: target cond embeddings. + The target condition is sparse and expected to be available in certain frames. + we replace the hidden state with the target condition embeddings for given frames. + In earlier layers where each position corresponds to multiple frames, we reshape the hidden states to map to + each frame position (see @forward method) + """ + if self._HAS_TARGET_COND: + target_cond_blocks = [] + assert width % (2 ** down_t) == 0, \ + "width % (2 ** down_t) needs to 0 so that hidden can be split for each frame in earlier layers." + for i in range(down_t + (1 if self._COND_FUSION_LAST_LAYER else 0)): + target_cond_blocks.append(nn.Linear(self._target_cond_dim, int(width / (2 ** (down_t - i))))) + target_cond_blocks.append(nn.ReLU()) + self.target_cond_blocks = nn.ModuleList(target_cond_blocks) + + def forward(self, x: torch.Tensor, external_cond: torch.Tensor = None, + target_cond: torch.Tensor = None, has_target_cond: torch.Tensor = None, + token_mask: torch.Tensor = None): + """ @brief: the decoder could take the external condition and target condition as input. + @params x: shape -> [batch, feat_dim, timesteps // (2 ** down_t)] + @params external_cond: shape -> [batch, timesteps, feat_dim] + @params target_cond: shape -> [batch, timesteps, feat_dim] + @params has_target_cond: shape -> [batch, timesteps] (dtype=bool) + """ + batch_size = x.shape[0] + + # preprocess + x = x * token_mask[:, None, :] if token_mask is not None else x # zeroing out the padded tokens' embeddings + h = self.model[0](x) # conv1d + h = self.model[1](h) # relu; h.shape = ([batch, width, timesteps // (2 ** down_t)]) + + for i in range(self._down_t + (1 if self._COND_FUSION_LAST_LAYER else 0)): + numFrames_per_position = 2 ** (self._down_t - i) + numPositions = h.shape[-1] # numPositions = timesteps // numFrames_per_position + timesteps = numPositions * numFrames_per_position + + # step 1: consider the target cond + if (not self._HAS_TARGET_COND) or target_cond is None or has_target_cond is None: + pass + else: + h_target_cond = self.target_cond_blocks[i * 2](target_cond) # [batch, timesteps, feat] + h_target_cond = self.target_cond_blocks[i * 2 + 1](h_target_cond) # [batch_size, timesteps, feat] + + # h had shape [batch, feat=self._width, numPositions] at the beginning of each loop + h = h.transpose(1, 2) # [batch, numPos, self._width] + h = h.reshape([batch_size, numPositions * numFrames_per_position, + self._width // numFrames_per_position]) # [batch, timesteps, feat] + h = torch.where(has_target_cond[:, :, None], h_target_cond, h) # [batch, timesteps, feat] + h = h.reshape([batch_size, numPositions, self._width]).transpose(1, 2) # [batch, feat, numPositions] + + # step 2: merge the emb from external cond and the original h + if self._HAS_EXTERNAL_COND: + assert external_cond is not None and external_cond.shape[1] == timesteps + + h_cond = external_cond.reshape([batch_size, numPositions, -1]) # [batch, numPosition, feat] + h = torch.cat([h.transpose(1, 2), h_cond], dim=-1) # [batch, numPosition, feat] + h = self.external_cond_blocks[i * 2](h).transpose(1, 2) # [batch, feat, numPosition] + h = self.external_cond_blocks[i * 2 + 1](h) # relu + + if i == self._down_t: # if fusion the cond at the last layer, skip the last main model + continue + + # step 3: the main model + h = self.model[i + 2][0](h, token_mask) + h = self.model[i + 2][1](h) # upsampling + token_mask = token_mask.repeat_interleave(2, 1) if token_mask is not None else None + h = h * token_mask[:, None, :] if token_mask is not None else h # zeroing out padded tokens' embeddings + h = self.model[i + 2][2](h) # conv1d # [batch, feat_dim, numPosition] + + # post process + h = h * token_mask[:, None, :] if token_mask is not None else h # zeroing out the padded tokens' embeddings + h = self.model[2 + self._down_t](h) # conv1d + h = self.model[2 + self._down_t + 1](h) # relu + h = h * token_mask[:, None, :] if token_mask is not None else h # zeroing out the padded tokens' embeddings + h = self.model[2 + self._down_t + 2](h) # conv1d + h = h * token_mask[:, None, :] if token_mask is not None else h # zeroing out the padded tokens' embeddings + return h diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/quantize_cnn_multihead.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/quantize_cnn_multihead.py new file mode 100644 index 0000000000000000000000000000000000000000..4db4a3333f920f55e1881463d15391bbaab783f6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/quantize_cnn_multihead.py @@ -0,0 +1,121 @@ +# NOTE: taken from MotionGPT code base +import numpy as np +import torch +import torch.nn as nn +import torch.nn.functional as F +from vector_quantize_pytorch import VectorQuantize + +class QuantizeEMAResetMultiHead(nn.Module): + def __init__(self, nb_code: int, code_dim: int, args): + super().__init__() + self.nb_code = nb_code + self.code_dim = code_dim + self.mu = args.mu # the decay for ema reset + self.num_heads = args.num_heads + assert self.code_dim % self.num_heads == 0, "code dim cannot be divided by the number of heads." + self.nb_code_per_head = int(round(2 ** (np.log2(self.nb_code) / self.num_heads))) + assert self.nb_code_per_head ** self.num_heads == self.nb_code, \ + "the specified number of code is not compatible with the number of heads." + self.vq = VectorQuantize( + dim=self.code_dim, + codebook_dim=self.code_dim // self.num_heads, # smaller codebook dimension is acceptable + heads=self.num_heads, # number of heads to vector quantize, codebook shared across all heads + separate_codebook_per_head=True, # whether to have a separate codebook per head. + codebook_size=self.nb_code_per_head, + accept_image_fmap=False, + threshold_ema_dead_code = 1, # if the number of code usage < 1; reset it + decay=self.mu, + kmeans_init=bool(args.kmeans_init) + ) # commitment loss coeff = 1.0 since we do that weighting outside # + self.init = True + self._calculate_per_head_perplexity = getattr(args, "calculate_per_head_perplexity", False) + + @torch.no_grad() + def compute_perplexity(self, code_idx, nb_code=None): + # Calculate new centres + code_onehot = torch.zeros(self.nb_code if nb_code is None else nb_code, + code_idx.shape[0], device=code_idx.device) # nb_code, N * L + code_onehot.scatter_(0, code_idx.view(1, code_idx.shape[0]), 1) + + code_count = code_onehot.sum(dim=-1) # nb_code + prob = code_count / torch.sum(code_count) + perplexity = torch.exp(-torch.sum(prob * torch.log(prob + 1e-7))) + return perplexity + + @torch.no_grad() + def compute_perplexity_per_head(self, code_idx): + # Calculate new centres + perplexity = 0.0 + for i in range(self.num_heads): + perplexity += self.compute_perplexity(code_idx[:, :, i].view(-1), nb_code=self.nb_code_per_head) + return perplexity / self.num_heads + + def from_mh_indices_to_overall_indices(self, mh_indices): + exponential_mul = \ + self.nb_code_per_head ** torch.arange(0, self.num_heads)[None, None, :].to(mh_indices.device) + overall_indices = (exponential_mul * mh_indices).sum(dim=-1) + return overall_indices + + def from_overall_indices_to_mh_indices(self, overall_indices): + exponential_mul = \ + self.nb_code_per_head ** torch.arange(0, self.num_heads)[None, None, :].to(overall_indices.device) + + mh_indices = (overall_indices[:, :, None] % (exponential_mul * self.nb_code_per_head)) // exponential_mul + return mh_indices + + def dequantize(self, code_idx, use_overall_indices = True): + if use_overall_indices: + mh_indices = self.from_overall_indices_to_mh_indices(code_idx) + else: + mh_indices = code_idx # [batch, numTokens, numHeads] + batch_size, numToken = code_idx.shape[0], code_idx.shape[1] + x = self.vq.get_codes_from_indices(mh_indices).view([batch_size, numToken, -1]) + return x + + def forward(self, x): + N, width, T = x.shape + # expected the shape of the input to vq: (1, 1024, 256) --> batch, Timesteps, feat_dim + # The input to x is batch, width(feat_dim), T + x = x.permute(0, 2, 1).contiguous() + + # quantize and dequantize through bottleneck + x_d, mh_indices, commit_loss = self.vq(x) + + # Update embeddings + if self._calculate_per_head_perplexity: + if self.num_heads == 1: + mh_indices = mh_indices[:, :, None] + perplexity = self.compute_perplexity_per_head(mh_indices) + else: + overall_indices = self.from_mh_indices_to_overall_indices(mh_indices) + perplexity = self.compute_perplexity(overall_indices.view([-1])) + + # Loss + commit_loss = F.mse_loss(x, x_d.detach()) + + # Passthrough + x_d = x + (x_d - x).detach() + + # Postprocess + x_d = x_d.view(N, T, -1).permute(0, 2, 1).contiguous() #(N, DIM, T) + + return x_d, commit_loss, perplexity + + def forward_into_idx(self, x, fetch_overall_indices: bool = True): + N, width, T = x.shape + + # expected the shape of the input: (1, 1024, 256) --> batch, T, width + # The input to x is batch, width, T + x = x.permute(0, 2, 1).contiguous() + + # quantize and dequantize through bottleneck + _, mh_indices, _ = self.vq(x) + overall_indices = self.from_mh_indices_to_overall_indices(mh_indices) + + if fetch_overall_indices: + return overall_indices + else: + return mh_indices + +class QuantizeEMAResetLFQ(nn.Module): + pass diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/resnet.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/resnet.py new file mode 100644 index 0000000000000000000000000000000000000000..428dac2836257ad01804fe20b5d50d1215535951 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/resnet.py @@ -0,0 +1,90 @@ +import torch.nn as nn +import torch + +class nonlinearity(nn.Module): + def __init__(self): + super().__init__() + + def forward(self, x): + # swish + return x * torch.sigmoid(x) + +class ResConv1DBlock(nn.Module): + def __init__(self, n_in, n_state, dilation=1, activation='silu', norm=None, dropout=None): + super().__init__() + padding = dilation + self.norm = norm + if norm == "LN": + self.norm1 = nn.LayerNorm(n_in) + self.norm2 = nn.LayerNorm(n_in) + elif norm == "GN": + self.norm1 = nn.GroupNorm(num_groups=32, num_channels=n_in, eps=1e-6, affine=True) + self.norm2 = nn.GroupNorm(num_groups=32, num_channels=n_in, eps=1e-6, affine=True) + elif norm == "BN": + self.norm1 = nn.BatchNorm1d(num_features=n_in, eps=1e-6, affine=True) + self.norm2 = nn.BatchNorm1d(num_features=n_in, eps=1e-6, affine=True) + else: + self.norm1 = nn.Identity() + self.norm2 = nn.Identity() + + if activation == "relu": + self.activation1 = nn.ReLU() + self.activation2 = nn.ReLU() + + elif activation == "silu": + self.activation1 = nonlinearity() + self.activation2 = nonlinearity() + + elif activation == "gelu": + self.activation1 = nn.GELU() + self.activation2 = nn.GELU() + + self.conv1 = nn.Conv1d(n_in, n_state, 3, 1, padding, dilation) + self.conv2 = nn.Conv1d(n_state, n_in, 1, 1, 0,) + + def forward(self, x: torch.Tensor, token_mask: torch.Tensor = None): + x = x * token_mask[:, None, :] if token_mask is not None else x + x_orig = x + if self.norm == "LN": + x = self.norm1(x.transpose(-2, -1)) + x = self.activation1(x.transpose(-2, -1)) + else: + x = self.norm1(x) + x = self.activation1(x) + + x = x * token_mask[:, None, :] if token_mask is not None else x + x = self.conv1(x) + + if self.norm == "LN": + x = self.norm2(x.transpose(-2, -1)) + x = self.activation2(x.transpose(-2, -1)) + else: + x = self.norm2(x) + x = self.activation2(x) + + x = x * token_mask[:, None, :] if token_mask is not None else x + x = self.conv2(x) + x = x + x_orig + x = x * token_mask[:, None, :] if token_mask is not None else x + return x + +class Resnet1D(nn.Module): + def __init__(self, n_in, n_depth, dilation_growth_rate=1, reverse_dilation=True, activation='relu', norm=None): + """ @brief: a n_depth-layer resnet structures. Each layer has different dilattion rate. For example The first + Three layer is 1, 3, 9 dilation respectively. + """ + super().__init__() + + blocks = [ResConv1DBlock(n_in, n_in, + dilation=dilation_growth_rate ** depth, + activation=activation, norm=norm) + for depth in range(n_depth)] + if reverse_dilation: + blocks = blocks[::-1] + + self.model = nn.Sequential(*blocks) + + def forward(self, x: torch.Tensor, token_mask: torch.Tensor = None): + for block in self.model: + x = block(x, token_mask) + return x diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/vqvae.py b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/vqvae.py new file mode 100644 index 0000000000000000000000000000000000000000..6c3dd9f8288a45f4468317d7f0d2eb11d6f27556 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/motionbricks/vqvae/neural_modules/vqvae.py @@ -0,0 +1,180 @@ +import torch as t +from torch import nn +import numpy as np +from motionbricks.vqvae.neural_modules.quantize_cnn_multihead import QuantizeEMAResetMultiHead +from motionbricks.vqvae.neural_modules.encdec_double_cond import DoubleCondDecoder +from motionbricks.vqvae.neural_modules.encdec import Encoder +from typing import Mapping, Tuple, List, Any +from types import SimpleNamespace +from motionbricks.motionlib.core.motion_reps import MotionRepBase +from motionbricks.helper.data_training_util import convert_sparse_cond_to_dense_cond_if_needed +from motionbricks.helper.data_training_util import extract_feature_from_motion_rep + +class VQVAE(nn.Module): + ALLOWED_FEATURE_MODE = [ + 'invalid', "pose", + "root", "root_without_hip_height", "root_without_hip_height_without_heading", "root_without_heading", + "root_without_hip_height_without_heading_with_mask", + "joint_positions_and_rotations", + "joint_positions_and_rotations_and_foot_contact", "joint_positions_and_rotations_and_hip_height" + ] + def __init__(self, + pose_root_mode: str, + motion_rep: MotionRepBase, + + # dim information + encoder_state_dim: int, + decoder_state_dim: int, + + decoder_target_cond_dim: int, + decoder_external_cond_dim: int, + feature_mode: List, + + # network config + quantizer_strategy: str = 'multihead_ema_reset', + quantizer_mu: float = 0.99, + nb_code: int = 512, + code_dim: int = 512, + output_emb_width: int = 512, + down_t: int = 2, + stride_t: int = 2, + width: int = 512, + depth: int = 3, + dilation_growth_rate: int = 3, + activation: str = 'relu', + num_heads: int = 4, + kmeans_init: bool = True, + norm: str = None, + calculate_per_head_perplexity: bool = True, + **kwargs): + """ @brief: + Both the root vqvae and pose vqvae use a similar structure where + 1) the encoder is a unconditional x -> z + 2) the decoder takes z, c-> x + The c is the condition vector. For root vqvae, it's the target condition (boundary root values). + And for pose vqvae, it's target condition (boundary pose values) as well as external + condition (root values). + """ + + super().__init__() + self.code_dim = code_dim + self.num_code = nb_code + self._num_heads = num_heads + self._motion_rep = motion_rep + self._pose_root_mode = pose_root_mode + self._down_t = down_t + self._calculate_per_head_perplexity = calculate_per_head_perplexity + + assert self._pose_root_mode in ['pose', 'root'], "Only support either provide local pose rep or root rep." + assert len(feature_mode) == 4 and np.all([f in self.ALLOWED_FEATURE_MODE for f in feature_mode]) + self.encoder_input_feature_mode, self.decoder_input_feature_mode, \ + self.decoder_target_cond_feature_mode, self.decoder_external_cond_feature_mode = feature_mode + + dummy_input = t.zeros([1, 1, len(motion_rep.indices['all'])]) + encoder_state_dim = extract_feature_from_motion_rep(dummy_input, motion_rep, + self.encoder_input_feature_mode).shape[-1] + decoder_state_dim = extract_feature_from_motion_rep(dummy_input, motion_rep, + self.decoder_input_feature_mode).shape[-1] + decoder_target_cond_dim = extract_feature_from_motion_rep(dummy_input, motion_rep, + self.decoder_target_cond_feature_mode).shape[-1] + decoder_external_cond_dim = extract_feature_from_motion_rep(dummy_input, motion_rep, + self.decoder_external_cond_feature_mode).shape[-1] + + self.encoder = Encoder(encoder_state_dim, output_emb_width, + down_t, stride_t, width, depth, + dilation_growth_rate, activation=activation, norm=norm) + self.decoder = DoubleCondDecoder(decoder_state_dim, output_emb_width, + down_t, width, depth, dilation_growth_rate, + activation=activation, norm=norm, + target_cond_dim=decoder_target_cond_dim, + external_cond_dim=decoder_external_cond_dim, + cond_fusion_last_layer=kwargs.get('cond_fusion_last_layer', False)) + + self.quant_strategy = quantizer_strategy + quant_args = SimpleNamespace(mu=quantizer_mu, num_heads=num_heads, kmeans_init=kmeans_init, + calculate_per_head_perplexity=calculate_per_head_perplexity) + if quantizer_strategy == "multihead_ema_reset": + self.quantizer = QuantizeEMAResetMultiHead(nb_code, code_dim, quant_args) + else: + assert False, "Invalid quantizer strategy for training." + + def extract_feature(self, x: t.Tensor, feature: str = ""): + """ @brief: extract the root / localPose / boundary features from the original full 353 feature + """ + feature = self._pose_root_mode if feature == "" else feature + return extract_feature_from_motion_rep(x, self._motion_rep, feature) + + def forward(self, x, target_cond: t.Tensor, has_target_cond: t.Tensor = None, external_cond: t.Tensor = None): + """ @brief: full encoder decoder path that goes from x to z to x + @params x: [batch_size, numFrames, feat_dim] + @params target_cond: [batch_size, numFrames, feat_dim] + @params has_target_cond: [batch_size, numFrames] + @params external_cond: [batch_size, numFrames, feat_dim] + + @returns x_out: [batch_size, numFrames, feat_dim] + """ + num_expected_frames = x.shape[1] + # encoder + x_in = self.extract_feature(x, self.encoder_input_feature_mode).permute(0, 2, 1) # from [B,T,F] to [B,F,T] + x_encoder = self.encoder(x_in) + + # quantization + x_quantized, loss, perplexity = self.quantizer(x_encoder) + + # decoder + if target_cond is not None: + target_cond, has_target_cond = \ + convert_sparse_cond_to_dense_cond_if_needed(target_cond, has_target_cond, num_expected_frames) + target_cond = self.extract_feature(target_cond, self.decoder_target_cond_feature_mode) + x_decoder = self.decoder(x_quantized, external_cond, target_cond, has_target_cond) + + x_out = x_decoder.permute(0, 2, 1) + return {'recon_state': x_out, 'l_commit': loss, 'perplexity': perplexity} + + def encode_into_idx(self, x, fetch_overall_indices: bool = True): + """ @brief: encoder part of the @forward function + @param x: the frame features. + """ + assert self.quant_strategy == "multihead_ema_reset" + x_in = self.extract_feature(x, self.encoder_input_feature_mode).permute(0, 2, 1) # from [B,T,F] to [B,F,T] + + x_encoder = self.encoder(x_in) + code_idx = self.quantizer.forward_into_idx(x_encoder, fetch_overall_indices=fetch_overall_indices) + return code_idx + + def forward_decoder(self, x, + target_cond: t.Tensor, has_target_cond: t.Tensor = None, external_cond: t.Tensor = None, + use_overall_indices: bool = True, token_mask: t.Tensor = None): + """ @brief: decoder part of the @forward function + @param x: the code indices. + """ + assert self.quant_strategy == "multihead_ema_reset" + num_expected_frames = x.shape[1] * (2 ** self._down_t) + x_d = self.quantizer.dequantize(x, use_overall_indices=use_overall_indices) + x_quantized = x_d.permute(0, 2, 1).contiguous() # [batch, feat_dim, T] + + # decoder + if target_cond is not None: + target_cond, has_target_cond = \ + convert_sparse_cond_to_dense_cond_if_needed(target_cond, has_target_cond, num_expected_frames) + target_cond = self.extract_feature(target_cond, self.decoder_target_cond_feature_mode) + x_decoder = self.decoder(x_quantized, external_cond, target_cond, has_target_cond, token_mask=token_mask) + + x_out = x_decoder.permute(0, 2, 1) + return {'recon_state': x_out} + + def get_codebook(self): + if self.quant_strategy == "ema_reset": + return self.quantizer.codebook.clone() + elif self.quant_strategy == "multihead_ema_reset": + return self.quantizer.vq.codebook.clone() + else: + raise NotImplementedError + + @property + def pose_root_mode(self): + return self._pose_root_mode + + @property + def motion_rep(self): + return self._motion_rep diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/G1-clip.ckpt b/third-party/GR00T-WholeBodyControl/motionbricks/out/G1-clip.ckpt new file mode 100644 index 0000000000000000000000000000000000000000..d0819aa65ed05f1da0ed37d46ece3375aa5f7567 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/G1-clip.ckpt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84afc7c229473351a24b0a7d79fc47be9dbb81bd12774285f2f60a3c0e9028df +size 7761041 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/checkpoints/model-step=2000000.ckpt b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/checkpoints/model-step=2000000.ckpt new file mode 100644 index 0000000000000000000000000000000000000000..3527b229a671dc8422290684db087d552a41757b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/checkpoints/model-step=2000000.ckpt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0223c352b308ba638a499cc5c92104da36cb1d04cea2f8ce61d54a2489f853f1 +size 1639126476 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/config.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..00d7fbc4b163892abb619d13be841a2ae6cc813a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/config.yaml @@ -0,0 +1,245 @@ +model: + backbone_network: + _target_: motionbricks.motion_backbone.neural_modules.pose_backbone.pose_backbone_network + motion_rep: ??? + args: + pose_root_mode: ${model.args.pose_root_mode} + min_tokens: ${model.args.min_tokens} + max_tokens: ${model.args.max_tokens} + down_t: ${model.args.down_t} + pose_token_mlp_num_layers: 2 + root_feat_width: 256 + pose_feat_width: 640 + token_length_feat_width: 128 + text_emb_dim: 4096 + text_embeddings: ${data.text_embeddings} + local_pose_feature: ${model.args.local_pose_feature} + cond_root_feature: ${model.args.cond_root_feature} + cond_root_feature_is_from_motion_rep: ${model.args.cond_root_feature_is_from_motion_rep} + n_embd: 1024 + n_head: 16 + n_layers: 16 + pose_vqvae: + nb_code: ${model.pose_vqvae_network.nb_code} + code_dim: ${model.pose_vqvae_network.code_dim} + num_heads: ${model.pose_vqvae_network.num_heads} + has_codebook: ${oc.select:model.pose_vqvae_network.has_codebook,true} + root_vqvae: + nb_code: 1024 + code_dim: 60 + num_heads: 1 + pose_vqvae_network: + _target_: motionbricks.vqvae.neural_modules.vqvae.VQVAE + pose_root_mode: pose + motion_rep: ??? + encoder_state_dim: 241 + decoder_state_dim: 329 + decoder_target_cond_dim: 241 + decoder_external_cond_dim: 2 + feature_mode: + - joint_positions_and_rotations_and_hip_height + - pose + - joint_positions_and_rotations_and_hip_height + - root_without_hip_height_without_heading + quantizer_strategy: multihead_ema_reset + quantizer_mu: 0.99 + nb_code: 100000000 + code_dim: 256 + output_emb_width: 256 + down_t: 2 + stride_t: 2 + width: 512 + depth: 4 + dilation_growth_rate: 3 + activation: relu + num_heads: 8 + kmeans_init: false + norm: None + calculate_per_head_perplexity: true + cond_fusion_last_layer: false + _target_: motionbricks.motion_backbone.models.pose_model.MotionModel + motion_rep: ??? + root_vqvae_network: null + pose_vqvae_motion_rep: local + denoiser: + backbone: + llm_shape: null + args: + min_tokens: 6 + max_tokens: 16 + down_t: 2 + vqvae_model_ckpt_path: out/motionbricks_vqvae/version_1/checkpoints/model-step=2000000.ckpt + pose_vqvae_motion_rep: ${model.pose_vqvae_motion_rep} + incorrect_token_ratio_min: 0.0 + incorrect_token_ratio_max: 1.0 + masked_token_ratio: 0.8 + batchsize_mul_factor: 2 + pose_root_mode: pose + local_pose_feature: joint_positions_and_rotations_and_hip_height + cond_root_feature: root_without_hip_height + cond_root_feature_is_from_motion_rep: global + max_num_start_keyframes: 4 + no_start_keyframe_prob: 0.0 + max_num_end_keyframes: 4 + no_end_keyframe_prob: 0.0 + max_num_middle_keyframes: 8 + no_middle_keyframe_prob: 0.5 + prob_provide_text_emb: 0.2 + keyframe_num_warmup_steps: 200000 + floor_estimation: min_joint_height_within_windows + floor_estimation_window_time: 1.0 + optimizer: + _target_: adam_atan2_pytorch.AdamAtan2 + _partial_: true + lr: 0.0001 + weight_decay: 0.0 + scheduler: + _target_: motionbricks.motionlib.train.scheduler.WarmupCosineScheduler + _partial_: true + num_warmup_steps: 10000 + num_training_steps: ${trainer.max_steps} + final_lr: 2.0e-06 + last_epoch: -1 + lt_kwargs: + interval: step + frequency: 1 +trainer: + _target_: pytorch_lightning.Trainer + precision: 32 + enable_progress_bar: false + profiler: null + check_val_every_n_epoch: null + detect_anomaly: false + num_sanity_val_steps: 0 + max_steps: 2000001 + gradient_clip_val: 0.5 + log_every_n_steps: 50 + val_check_interval: 50000 + devices: 8 + num_nodes: 4 + accelerator: gpu + strategy: ddp +loggers: + out_dir: ${out_dir} + cfg_id: ${id} + max_steps: ${trainer.max_steps} + log_nsteps: ${trainer.log_every_n_steps} + use_wandb: true + wandb_run: ${wandb_run} + wandb_group: null + wandb_project: motionbricks + wandb_entity: null + wandb_run_name: motionbricks_pose + logger_project: motionbricks +callbacks: + callback_dict: + checkpoint_epoch_cb: + _target_: motionbricks.motionlib.train.callbacks.ckpt.ReadPermissionModelCheckpoint + monitor: null + dirpath: out/motionbricks_pose/version_1/checkpoints + filename: model-{step:07d} + save_last: false + save_top_k: -1 + mode: min + every_n_train_steps: 50000 + learning_rate_monitor: + _target_: pytorch_lightning.callbacks.LearningRateMonitor + logging_interval: step + autoresume: + _target_: motionbricks.motionlib.train.callbacks.autoresume.AutoResumeCallback + autoresume_after: 1260000 + save_checkpoint_on_exception: true + pose_evaluate: + _target_: motionbricks.motion_backbone.callbacks.evaluation.PoseEvaluate + every_n_steps: 50001 + train_dataloader: ??? + val_dataloader: ??? + seed: 2333 + batch_size: 32 + max_num_data: 40000 + max_num_visualization: 32 + out_dir: ${run_dir}/vis + only_rank_zero: + - learning_rate_monitor + - pose_evaluate + need_version: [] + need_dataloaders: + - pose_evaluate + need_ema: [] + need_motionbricks_test: [] + need_log: + - pose_evaluate + need_autoresume: + - pose_evaluate + need_mask_cond_sampler: [] + need_one_logger_callback: + - autoresume +dataloader: + _target_: torch.utils.data.DataLoader + batch_size: 128 + num_workers: 11 + shuffle: ??? + persistent_workers: true + collate_fn: + _target_: motionbricks.motionlib.data.utils.collate_batch + _partial_: true + llm_shape: ${model.denoiser.backbone.llm_shape} + num_frames: null +data: + _target_: motionbricks.motionlib.data.motion_dataset.MotionDataset + name: motionbricks-G1 + folder: ../datasets/motionbricks-G1 + text_embeddings: null + split: ??? + motion_sampler: + _target_: motionbricks.motionlib.data.motion_sampler.MaxDurationRandomCrop + max_seconds: 30 + motion_loading_mode: memmap + use_natural_desc: true + use_short_desc: true + use_technical_desc: false + use_nv_overview_desc: false + nv_overview_prob: null + drop_text_prob: 0.1 + augment_text: false + aug_text_suffix: '' + aug_text_prob: 0.75 + aug_text_ind_range: + - 1 + - 61 + load_neutral_joints: false + timelines_mode: false + timelines_name: null + dataset_sampler: null + dataset_sampler_only_at_train: true + to_canonicalize: false + randomize_first_heading: true + loading_mode: motion_only +skeleton: + base_name: g1skel34 + folder: out/motionbricks_pose/version_1/skeleton + t_pose: capture + orig_prefix: '' + name: g1skel34 + _target_: motionbricks.motionlib.core.skeletons.g1.G1Skeleton34 +motion_rep: + name: ${skeleton.name}_dual_root_global_joints + stats: + _target_: motionbricks.motionlib.core.utils.stats.Stats + folder: out/motionbricks_pose/version_1/stats/motion + _target_: motionbricks.motionlib.core.motion_reps.dual_root_global_joints.GlobalRootGlobalJoints +fps: 30 +wandb_run: motionbricks_pose +resume: false +version: 1 +cp: last_epoch +matmul_precision: high +seed: 7 +id: ${hydra:runtime.choices.exp}_gpu${trainer.devices}_node${trainer.num_nodes} +out_dir: out/motionbricks_pose +run_dir: out/motionbricks_pose/version_1 +pure_testing: false +config_version: 4 +data_root: datasets +tmr_checkpoints_root: null +use_one_logger: false diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/hparams.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/hparams.yaml new file mode 100644 index 0000000000000000000000000000000000000000..54883f3a0ffd54996314d0fa87d422747686f3ce --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/hparams.yaml @@ -0,0 +1,245 @@ +model: + backbone_network: + _target_: motionbricks.motion_backbone.neural_modules.pose_backbone.pose_backbone_network + motion_rep: ??? + args: + pose_root_mode: ${model.args.pose_root_mode} + min_tokens: ${model.args.min_tokens} + max_tokens: ${model.args.max_tokens} + down_t: ${model.args.down_t} + pose_token_mlp_num_layers: 2 + root_feat_width: 256 + pose_feat_width: 640 + token_length_feat_width: 128 + text_emb_dim: 4096 + text_embeddings: ${data.text_embeddings} + local_pose_feature: ${model.args.local_pose_feature} + cond_root_feature: ${model.args.cond_root_feature} + cond_root_feature_is_from_motion_rep: ${model.args.cond_root_feature_is_from_motion_rep} + n_embd: 1024 + n_head: 16 + n_layers: 16 + pose_vqvae: + nb_code: ${model.pose_vqvae_network.nb_code} + code_dim: ${model.pose_vqvae_network.code_dim} + num_heads: ${model.pose_vqvae_network.num_heads} + has_codebook: ${oc.select:model.pose_vqvae_network.has_codebook,true} + root_vqvae: + nb_code: 1024 + code_dim: 60 + num_heads: 1 + pose_vqvae_network: + _target_: motionbricks.vqvae.neural_modules.vqvae.VQVAE + pose_root_mode: pose + motion_rep: ??? + encoder_state_dim: 241 + decoder_state_dim: 329 + decoder_target_cond_dim: 241 + decoder_external_cond_dim: 2 + feature_mode: + - joint_positions_and_rotations_and_hip_height + - pose + - joint_positions_and_rotations_and_hip_height + - root_without_hip_height_without_heading + quantizer_strategy: multihead_ema_reset + quantizer_mu: 0.99 + nb_code: 100000000 + code_dim: 256 + output_emb_width: 256 + down_t: 2 + stride_t: 2 + width: 512 + depth: 4 + dilation_growth_rate: 3 + activation: relu + num_heads: 8 + kmeans_init: false + norm: None + calculate_per_head_perplexity: true + cond_fusion_last_layer: false + _target_: motionbricks.motion_backbone.models.pose_model.MotionModel + motion_rep: ??? + root_vqvae_network: null + pose_vqvae_motion_rep: local + denoiser: + backbone: + llm_shape: null + args: + min_tokens: 6 + max_tokens: 16 + down_t: 2 + vqvae_model_ckpt_path: out/motionbricks_vqvae/version_1/checkpoints/model-step=2000000.ckpt + pose_vqvae_motion_rep: ${model.pose_vqvae_motion_rep} + incorrect_token_ratio_min: 0.0 + incorrect_token_ratio_max: 1.0 + masked_token_ratio: 0.8 + batchsize_mul_factor: 2 + pose_root_mode: pose + local_pose_feature: joint_positions_and_rotations_and_hip_height + cond_root_feature: root_without_hip_height + cond_root_feature_is_from_motion_rep: global + max_num_start_keyframes: 4 + no_start_keyframe_prob: 0.0 + max_num_end_keyframes: 4 + no_end_keyframe_prob: 0.0 + max_num_middle_keyframes: 8 + no_middle_keyframe_prob: 0.5 + prob_provide_text_emb: 0.2 + keyframe_num_warmup_steps: 200000 + floor_estimation: min_joint_height_within_windows + floor_estimation_window_time: 1.0 + optimizer: + _target_: adam_atan2_pytorch.AdamAtan2 + _partial_: true + lr: 0.0001 + weight_decay: 0.0 + scheduler: + _target_: motionbricks.motionlib.train.scheduler.WarmupCosineScheduler + _partial_: true + num_warmup_steps: 10000 + num_training_steps: ${trainer.max_steps} + final_lr: 2.0e-06 + last_epoch: -1 + lt_kwargs: + interval: step + frequency: 1 +trainer: + _target_: pytorch_lightning.Trainer + precision: 32 + enable_progress_bar: false + profiler: null + check_val_every_n_epoch: null + detect_anomaly: false + num_sanity_val_steps: 0 + max_steps: 2000001 + gradient_clip_val: 0.5 + log_every_n_steps: 50 + val_check_interval: 50000 + devices: 8 + num_nodes: 4 + accelerator: gpu + strategy: ddp +loggers: + out_dir: ${out_dir} + cfg_id: ${id} + max_steps: ${trainer.max_steps} + log_nsteps: ${trainer.log_every_n_steps} + use_wandb: true + wandb_run: ${wandb_run} + wandb_group: null + wandb_project: motionbricks + wandb_entity: null + wandb_run_name: motionbricks_pose + logger_project: motionbricks +callbacks: + callback_dict: + checkpoint_epoch_cb: + _target_: motionbricks.motionlib.train.callbacks.ckpt.ReadPermissionModelCheckpoint + monitor: null + dirpath: null + filename: model-{step:07d} + save_last: false + save_top_k: -1 + mode: min + every_n_train_steps: 50000 + learning_rate_monitor: + _target_: pytorch_lightning.callbacks.LearningRateMonitor + logging_interval: step + autoresume: + _target_: motionbricks.motionlib.train.callbacks.autoresume.AutoResumeCallback + autoresume_after: 1260000 + save_checkpoint_on_exception: true + pose_evaluate: + _target_: motionbricks.motion_backbone.callbacks.evaluation.PoseEvaluate + every_n_steps: 50001 + train_dataloader: ??? + val_dataloader: ??? + seed: 2333 + batch_size: 32 + max_num_data: 40000 + max_num_visualization: 32 + out_dir: ${run_dir}/vis + only_rank_zero: + - learning_rate_monitor + - pose_evaluate + need_version: [] + need_dataloaders: + - pose_evaluate + need_ema: [] + need_motionbricks_test: [] + need_log: + - pose_evaluate + need_autoresume: + - pose_evaluate + need_mask_cond_sampler: [] + need_one_logger_callback: + - autoresume +dataloader: + _target_: torch.utils.data.DataLoader + batch_size: 128 + num_workers: 11 + shuffle: ??? + persistent_workers: true + collate_fn: + _target_: motionbricks.motionlib.data.utils.collate_batch + _partial_: true + llm_shape: ${model.denoiser.backbone.llm_shape} + num_frames: null +data: + _target_: motionbricks.motionlib.data.motion_dataset.MotionDataset + name: motionbricks-G1 + folder: ../datasets/motionbricks-G1 + text_embeddings: null + split: ??? + motion_sampler: + _target_: motionbricks.motionlib.data.motion_sampler.MaxDurationRandomCrop + max_seconds: 30 + motion_loading_mode: memmap + use_natural_desc: true + use_short_desc: true + use_technical_desc: false + use_nv_overview_desc: false + nv_overview_prob: null + drop_text_prob: 0.1 + augment_text: false + aug_text_suffix: '' + aug_text_prob: 0.75 + aug_text_ind_range: + - 1 + - 61 + load_neutral_joints: false + timelines_mode: false + timelines_name: null + dataset_sampler: null + dataset_sampler_only_at_train: true + to_canonicalize: false + randomize_first_heading: true + loading_mode: motion_only +skeleton: + base_name: g1skel34 + folder: out/motionbricks_pose/version_1/skeleton + t_pose: capture + orig_prefix: '' + name: g1skel34 + _target_: motionbricks.motionlib.core.skeletons.g1.G1Skeleton34 +motion_rep: + name: ${skeleton.name}_dual_root_global_joints + stats: + _target_: motionbricks.motionlib.core.utils.stats.Stats + folder: out/motionbricks_pose/version_1/stats/motion + _target_: motionbricks.motionlib.core.motion_reps.dual_root_global_joints.GlobalRootGlobalJoints +fps: 30 +wandb_run: motionbricks_pose +resume: false +version: 1 +cp: last_epoch +matmul_precision: high +seed: 7 +id: ${hydra:runtime.choices.exp}_gpu${trainer.devices}_node${trainer.num_nodes} +out_dir: out/motionbricks_pose +run_dir: ??? +pure_testing: false +config_version: 4 +data_root: datasets +tmr_checkpoints_root: null +use_one_logger: false diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/meta.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/meta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ea3333db676ec38db1cd034e4fed9b5c5ce32b36 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/meta.yaml @@ -0,0 +1 @@ +wandb_run: motionbricks_pose diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/skeleton/joints.p b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/skeleton/joints.p new file mode 100644 index 0000000000000000000000000000000000000000..ed7b5816c26b8c72b6f4afd95a1504844a84a90f Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/skeleton/joints.p differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/skeleton/parents.p b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/skeleton/parents.p new file mode 100644 index 0000000000000000000000000000000000000000..10d16e22d12d42868d6a9e650fc3ab536d5b4974 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/skeleton/parents.p differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/skeleton/skeleton.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/skeleton/skeleton.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2600b68ec94feb9e2c643656e864ab8a2bba7941 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/skeleton/skeleton.yaml @@ -0,0 +1,6 @@ +base_name: g1skel34 +folder: ${data.folder}/features/motion_rep/${motion_rep.name}_fps_${fps}/skeleton +t_pose: capture +orig_prefix: '' +name: g1skel34 +_target_: motionbricks.motionlib.core.skeletons.g1.G1Skeleton34 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/stats/motion/mean.npy b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/stats/motion/mean.npy new file mode 100644 index 0000000000000000000000000000000000000000..85d2587039128f46ab7e4e85e34095b795fcc2d8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/stats/motion/mean.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca390f0081e2373ab71e860a3546cb70cc11fdfac6ce525155403e047b66fdea +size 3472 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/stats/motion/std.npy b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/stats/motion/std.npy new file mode 100644 index 0000000000000000000000000000000000000000..482321f0eef80efdb8f6dcccbb9a47158892d6ec --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_pose/version_1/stats/motion/std.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fca7dd6135cbe96504b1307a7db97e9004556937a2fc72d139077b962cee6bd7 +size 3472 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/checkpoints/model-step=2000000.ckpt b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/checkpoints/model-step=2000000.ckpt new file mode 100644 index 0000000000000000000000000000000000000000..66846112d9d18113e0bbf2b14b03c09fc0c93656 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/checkpoints/model-step=2000000.ckpt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7299a9b1f5aca35730c36dfe7ea28075708ac8266bf384fe8e2ef9c9aee69c7 +size 409551754 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/config.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3fb00ca3ff1b2df86427d4879fb4d4170bc54a5f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/config.yaml @@ -0,0 +1,223 @@ +model: + backbone_network: + _target_: motionbricks.motion_backbone.neural_modules.root_backbone.root_backbone_network + motion_rep: ??? + args: + min_tokens: ${model.args.min_tokens} + max_tokens: ${model.args.max_tokens} + down_t: ${model.args.down_t} + use_hard_num_token_emb_for_root_prediction: ${model.args.use_hard_num_token_emb_for_root_prediction} + local_root_feature: ${model.args.local_root_feature} + global_root_feature: ${model.args.global_root_feature} + local_pose_feature: ${model.args.local_pose_feature} + pose_feat_dim: 256 + local_root_feat_dim: 64 + global_root_feat_dim: 64 + text_emb_dim: 4096 + text_embeddings: ${data.text_embeddings} + input_feat_mlp_num_layers: 2 + n_embd: 512 + n_head: 16 + n_layers_shared: 3 + n_layers_root_token: 3 + width: 512 + depth: 4 + dilation_growth_rate: 3 + activation: relu + norm: None + pose_vqvae: + nb_code: 1024 + code_dim: 60 + num_heads: 1 + root_vqvae: + nb_code: 1024 + code_dim: 60 + num_heads: 1 + _target_: motionbricks.motion_backbone.models.root_model.MotionModel + motion_rep: ??? + root_vqvae_network: null + pose_vqvae_network: null + denoiser: + backbone: + llm_shape: null + args: + pose_root_mode: root + local_pose_feature: joint_positions_and_rotations_and_hip_height + local_root_feature: root + global_root_feature: root + min_tokens: 6 + max_tokens: 16 + use_hard_num_token_emb_for_root_prediction: true + min_off_target_tokens_to_sample: 25 + max_off_target_tokens_to_sample: 40 + prob_off_range_target_token: 0.0 + prob_provide_num_tokens: 0.0 + down_t: 2 + vqvae_model_ckpt_path: null + batchsize_mul_factor: 2 + max_num_start_keyframes: 4 + no_start_keyframe_prob: 0.0 + max_num_end_keyframes: 4 + no_end_keyframe_prob: 0.0 + prob_provide_text_emb: 0.0 + num_token_loss_coeff: 1.0 + global_root_loss_coeff: 2.0 + local_root_loss_coeff: 1.0 + keyframe_num_warmup_steps: 200000 + floor_estimation: min_joint_height_within_windows + floor_estimation_window_time: 1.0 + optimizer: + _target_: adam_atan2_pytorch.AdamAtan2 + _partial_: true + lr: 0.0001 + weight_decay: 0.0 + scheduler: + _target_: motionbricks.motionlib.train.scheduler.WarmupCosineScheduler + _partial_: true + num_warmup_steps: 10000 + num_training_steps: ${trainer.max_steps} + final_lr: 2.0e-06 + last_epoch: -1 + lt_kwargs: + interval: step + frequency: 1 +trainer: + _target_: pytorch_lightning.Trainer + precision: 32 + enable_progress_bar: false + profiler: null + check_val_every_n_epoch: null + detect_anomaly: false + num_sanity_val_steps: 0 + max_steps: 2000001 + gradient_clip_val: 0.5 + log_every_n_steps: 50 + val_check_interval: 50000 + devices: 8 + num_nodes: 2 + accelerator: gpu + strategy: ddp +loggers: + out_dir: ${out_dir} + cfg_id: ${id} + max_steps: ${trainer.max_steps} + log_nsteps: ${trainer.log_every_n_steps} + use_wandb: true + wandb_run: ${wandb_run} + wandb_group: null + wandb_project: motionbricks + wandb_entity: null + wandb_run_name: motionbricks_root + logger_project: motionbricks +callbacks: + callback_dict: + checkpoint_epoch_cb: + _target_: motionbricks.motionlib.train.callbacks.ckpt.ReadPermissionModelCheckpoint + monitor: null + dirpath: out/motionbricks_root/version_1/checkpoints + filename: model-{step:07d} + save_last: false + save_top_k: -1 + mode: min + every_n_train_steps: 50000 + learning_rate_monitor: + _target_: pytorch_lightning.callbacks.LearningRateMonitor + logging_interval: step + autoresume: + _target_: motionbricks.motionlib.train.callbacks.autoresume.AutoResumeCallback + autoresume_after: 1260000 + save_checkpoint_on_exception: true + pose_evaluate: + _target_: motionbricks.motion_backbone.callbacks.evaluation.PoseEvaluate + every_n_steps: 50001 + train_dataloader: ??? + val_dataloader: ??? + seed: 2333 + batch_size: 32 + max_num_data: 40000 + max_num_visualization: 32 + out_dir: ${run_dir}/vis + only_rank_zero: + - learning_rate_monitor + - pose_evaluate + need_version: [] + need_dataloaders: + - pose_evaluate + need_ema: [] + need_motionbricks_test: [] + need_log: + - pose_evaluate + need_autoresume: + - pose_evaluate + need_mask_cond_sampler: [] + need_one_logger_callback: + - autoresume +dataloader: + _target_: torch.utils.data.DataLoader + batch_size: 128 + num_workers: 11 + shuffle: ??? + persistent_workers: true + collate_fn: + _target_: motionbricks.motionlib.data.utils.collate_batch + _partial_: true + llm_shape: ${model.denoiser.backbone.llm_shape} + num_frames: null +data: + _target_: motionbricks.motionlib.data.motion_dataset.MotionDataset + name: motionbricks-G1 + folder: ../datasets/motionbricks-G1 + text_embeddings: null + split: ??? + motion_sampler: + _target_: motionbricks.motionlib.data.motion_sampler.MaxDurationRandomCrop + max_seconds: 30 + motion_loading_mode: memmap + use_natural_desc: true + use_short_desc: true + use_technical_desc: false + use_nv_overview_desc: false + nv_overview_prob: null + drop_text_prob: 0.1 + augment_text: false + aug_text_suffix: '' + aug_text_prob: 0.75 + aug_text_ind_range: + - 1 + - 61 + load_neutral_joints: false + timelines_mode: false + timelines_name: null + dataset_sampler: null + dataset_sampler_only_at_train: true + to_canonicalize: false + randomize_first_heading: true + loading_mode: motion_only +skeleton: + base_name: g1skel34 + folder: out/motionbricks_root/version_1/skeleton + t_pose: capture + orig_prefix: '' + name: g1skel34 + _target_: motionbricks.motionlib.core.skeletons.g1.G1Skeleton34 +motion_rep: + name: ${skeleton.name}_dual_root_global_joints + stats: + _target_: motionbricks.motionlib.core.utils.stats.Stats + folder: out/motionbricks_root/version_1/stats/motion + _target_: motionbricks.motionlib.core.motion_reps.dual_root_global_joints.GlobalRootGlobalJoints +fps: 30 +wandb_run: motionbricks_root +resume: false +version: 1 +cp: last_epoch +matmul_precision: high +seed: 7 +id: ${hydra:runtime.choices.exp}_gpu${trainer.devices}_node${trainer.num_nodes} +out_dir: out/motionbricks_root +run_dir: out/motionbricks_root/version_1 +pure_testing: false +config_version: 4 +data_root: datasets +tmr_checkpoints_root: null +use_one_logger: false diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/hparams.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/hparams.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e247ba7b4e854d0aff6c5ab259264d30b1d787e4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/hparams.yaml @@ -0,0 +1,223 @@ +model: + backbone_network: + _target_: motionbricks.motion_backbone.neural_modules.root_backbone.root_backbone_network + motion_rep: ??? + args: + min_tokens: ${model.args.min_tokens} + max_tokens: ${model.args.max_tokens} + down_t: ${model.args.down_t} + use_hard_num_token_emb_for_root_prediction: ${model.args.use_hard_num_token_emb_for_root_prediction} + local_root_feature: ${model.args.local_root_feature} + global_root_feature: ${model.args.global_root_feature} + local_pose_feature: ${model.args.local_pose_feature} + pose_feat_dim: 256 + local_root_feat_dim: 64 + global_root_feat_dim: 64 + text_emb_dim: 4096 + text_embeddings: ${data.text_embeddings} + input_feat_mlp_num_layers: 2 + n_embd: 512 + n_head: 16 + n_layers_shared: 3 + n_layers_root_token: 3 + width: 512 + depth: 4 + dilation_growth_rate: 3 + activation: relu + norm: None + pose_vqvae: + nb_code: 1024 + code_dim: 60 + num_heads: 1 + root_vqvae: + nb_code: 1024 + code_dim: 60 + num_heads: 1 + _target_: motionbricks.motion_backbone.models.root_model.MotionModel + motion_rep: ??? + root_vqvae_network: null + pose_vqvae_network: null + denoiser: + backbone: + llm_shape: null + args: + pose_root_mode: root + local_pose_feature: joint_positions_and_rotations_and_hip_height + local_root_feature: root + global_root_feature: root + min_tokens: 6 + max_tokens: 16 + use_hard_num_token_emb_for_root_prediction: true + min_off_target_tokens_to_sample: 25 + max_off_target_tokens_to_sample: 40 + prob_off_range_target_token: 0.0 + prob_provide_num_tokens: 0.0 + down_t: 2 + vqvae_model_ckpt_path: null + batchsize_mul_factor: 2 + max_num_start_keyframes: 4 + no_start_keyframe_prob: 0.0 + max_num_end_keyframes: 4 + no_end_keyframe_prob: 0.0 + prob_provide_text_emb: 0.0 + num_token_loss_coeff: 1.0 + global_root_loss_coeff: 2.0 + local_root_loss_coeff: 1.0 + keyframe_num_warmup_steps: 200000 + floor_estimation: min_joint_height_within_windows + floor_estimation_window_time: 1.0 + optimizer: + _target_: adam_atan2_pytorch.AdamAtan2 + _partial_: true + lr: 0.0001 + weight_decay: 0.0 + scheduler: + _target_: motionbricks.motionlib.train.scheduler.WarmupCosineScheduler + _partial_: true + num_warmup_steps: 10000 + num_training_steps: ${trainer.max_steps} + final_lr: 2.0e-06 + last_epoch: -1 + lt_kwargs: + interval: step + frequency: 1 +trainer: + _target_: pytorch_lightning.Trainer + precision: 32 + enable_progress_bar: false + profiler: null + check_val_every_n_epoch: null + detect_anomaly: false + num_sanity_val_steps: 0 + max_steps: 2000001 + gradient_clip_val: 0.5 + log_every_n_steps: 50 + val_check_interval: 50000 + devices: 8 + num_nodes: 2 + accelerator: gpu + strategy: ddp +loggers: + out_dir: ${out_dir} + cfg_id: ${id} + max_steps: ${trainer.max_steps} + log_nsteps: ${trainer.log_every_n_steps} + use_wandb: true + wandb_run: ${wandb_run} + wandb_group: null + wandb_project: motionbricks + wandb_entity: null + wandb_run_name: motionbricks_root + logger_project: motionbricks +callbacks: + callback_dict: + checkpoint_epoch_cb: + _target_: motionbricks.motionlib.train.callbacks.ckpt.ReadPermissionModelCheckpoint + monitor: null + dirpath: null + filename: model-{step:07d} + save_last: false + save_top_k: -1 + mode: min + every_n_train_steps: 50000 + learning_rate_monitor: + _target_: pytorch_lightning.callbacks.LearningRateMonitor + logging_interval: step + autoresume: + _target_: motionbricks.motionlib.train.callbacks.autoresume.AutoResumeCallback + autoresume_after: 1260000 + save_checkpoint_on_exception: true + pose_evaluate: + _target_: motionbricks.motion_backbone.callbacks.evaluation.PoseEvaluate + every_n_steps: 50001 + train_dataloader: ??? + val_dataloader: ??? + seed: 2333 + batch_size: 32 + max_num_data: 40000 + max_num_visualization: 32 + out_dir: ${run_dir}/vis + only_rank_zero: + - learning_rate_monitor + - pose_evaluate + need_version: [] + need_dataloaders: + - pose_evaluate + need_ema: [] + need_motionbricks_test: [] + need_log: + - pose_evaluate + need_autoresume: + - pose_evaluate + need_mask_cond_sampler: [] + need_one_logger_callback: + - autoresume +dataloader: + _target_: torch.utils.data.DataLoader + batch_size: 128 + num_workers: 11 + shuffle: ??? + persistent_workers: true + collate_fn: + _target_: motionbricks.motionlib.data.utils.collate_batch + _partial_: true + llm_shape: ${model.denoiser.backbone.llm_shape} + num_frames: null +data: + _target_: motionbricks.motionlib.data.motion_dataset.MotionDataset + name: motionbricks-G1 + folder: ../datasets/motionbricks-G1 + text_embeddings: null + split: ??? + motion_sampler: + _target_: motionbricks.motionlib.data.motion_sampler.MaxDurationRandomCrop + max_seconds: 30 + motion_loading_mode: memmap + use_natural_desc: true + use_short_desc: true + use_technical_desc: false + use_nv_overview_desc: false + nv_overview_prob: null + drop_text_prob: 0.1 + augment_text: false + aug_text_suffix: '' + aug_text_prob: 0.75 + aug_text_ind_range: + - 1 + - 61 + load_neutral_joints: false + timelines_mode: false + timelines_name: null + dataset_sampler: null + dataset_sampler_only_at_train: true + to_canonicalize: false + randomize_first_heading: true + loading_mode: motion_only +skeleton: + base_name: g1skel34 + folder: out/motionbricks_root/version_1/skeleton + t_pose: capture + orig_prefix: '' + name: g1skel34 + _target_: motionbricks.motionlib.core.skeletons.g1.G1Skeleton34 +motion_rep: + name: ${skeleton.name}_dual_root_global_joints + stats: + _target_: motionbricks.motionlib.core.utils.stats.Stats + folder: out/motionbricks_root/version_1/stats/motion + _target_: motionbricks.motionlib.core.motion_reps.dual_root_global_joints.GlobalRootGlobalJoints +fps: 30 +wandb_run: motionbricks_root +resume: false +version: 1 +cp: last_epoch +matmul_precision: high +seed: 7 +id: ${hydra:runtime.choices.exp}_gpu${trainer.devices}_node${trainer.num_nodes} +out_dir: out/motionbricks_root +run_dir: ??? +pure_testing: false +config_version: 4 +data_root: datasets +tmr_checkpoints_root: null +use_one_logger: false diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/meta.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/meta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..971f0d8e08ce9eb4479d1fd8e19bee2395f49951 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/meta.yaml @@ -0,0 +1 @@ +wandb_run: motionbricks_root diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/skeleton/joints.p b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/skeleton/joints.p new file mode 100644 index 0000000000000000000000000000000000000000..ed7b5816c26b8c72b6f4afd95a1504844a84a90f Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/skeleton/joints.p differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/skeleton/parents.p b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/skeleton/parents.p new file mode 100644 index 0000000000000000000000000000000000000000..10d16e22d12d42868d6a9e650fc3ab536d5b4974 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/skeleton/parents.p differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/skeleton/skeleton.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/skeleton/skeleton.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2600b68ec94feb9e2c643656e864ab8a2bba7941 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/skeleton/skeleton.yaml @@ -0,0 +1,6 @@ +base_name: g1skel34 +folder: ${data.folder}/features/motion_rep/${motion_rep.name}_fps_${fps}/skeleton +t_pose: capture +orig_prefix: '' +name: g1skel34 +_target_: motionbricks.motionlib.core.skeletons.g1.G1Skeleton34 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/stats/motion/mean.npy b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/stats/motion/mean.npy new file mode 100644 index 0000000000000000000000000000000000000000..85d2587039128f46ab7e4e85e34095b795fcc2d8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/stats/motion/mean.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca390f0081e2373ab71e860a3546cb70cc11fdfac6ce525155403e047b66fdea +size 3472 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/stats/motion/std.npy b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/stats/motion/std.npy new file mode 100644 index 0000000000000000000000000000000000000000..482321f0eef80efdb8f6dcccbb9a47158892d6ec --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_root/version_1/stats/motion/std.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fca7dd6135cbe96504b1307a7db97e9004556937a2fc72d139077b962cee6bd7 +size 3472 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/checkpoints/model-step=2000000.ckpt b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/checkpoints/model-step=2000000.ckpt new file mode 100644 index 0000000000000000000000000000000000000000..3913e1e30afa65d74c9e978c18231969a3dc99ef --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/checkpoints/model-step=2000000.ckpt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f12a09d46ad390a8e2eecbe7219b2472fcab6b59df0a13f6a40c35cb6da4d99a +size 285607244 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/config.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4edd11069c35c2ae1d28a7062fa4133b18c6b139 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/config.yaml @@ -0,0 +1,228 @@ +model: + pose_vqvae_network: + _target_: motionbricks.vqvae.neural_modules.vqvae.VQVAE + pose_root_mode: pose + motion_rep: ??? + encoder_state_dim: 241 + decoder_state_dim: 329 + decoder_target_cond_dim: 241 + decoder_external_cond_dim: 2 + feature_mode: + - joint_positions_and_rotations_and_hip_height + - pose + - joint_positions_and_rotations_and_hip_height + - root_without_hip_height_without_heading + quantizer_strategy: multihead_ema_reset + quantizer_mu: 0.99 + nb_code: 100000000 + code_dim: 256 + output_emb_width: 256 + down_t: 2 + stride_t: 2 + width: 512 + depth: 4 + dilation_growth_rate: 3 + activation: relu + num_heads: 8 + kmeans_init: false + norm: None + calculate_per_head_perplexity: true + cond_fusion_last_layer: false + _target_: motionbricks.vqvae.models.motion_vqvae.MotionVQVAEModel + motion_rep: ??? + pose_vqvae_motion_rep: local + root_vqvae_network: null + denoiser: + backbone: + llm_shape: null + args: + min_tokens: 6 + max_tokens: 16 + down_t: 2 + commit_loss_coeff: 0.02 + batchsize_mul_factor: 2 + root_vqvae_max_num_keyframes: 5 + root_vqvae_no_keyframe_prob: 0.25 + pose_vqvae_max_num_keyframes: 10 + pose_vqvae_no_keyframe_prob: 0.25 + keyframe_num_warmup_steps: 200000 + global_root_loss_coeff: 0.5 + local_root_loss_coeff: 0.5 + max_angle_diff: 5.0 + max_norm_ratio: 0.2 + percentage_of_perturbed_samples: 0.2 + floor_estimation: min_joint_height_within_windows + floor_estimation_window_time: 1.0 + skate_contact_loss_coeff: 0.01 + joint_vel_loss_coeff: 2.0 + optimizer: + _target_: adam_atan2_pytorch.AdamAtan2 + _partial_: true + lr: 0.0002 + weight_decay: 0.0 + scheduler: + _target_: motionbricks.motionlib.train.scheduler.WarmupCosineScheduler + _partial_: true + num_warmup_steps: 10000 + num_training_steps: ${trainer.max_steps} + final_lr: 4.0e-06 + last_epoch: -1 + lt_kwargs: + interval: step + frequency: 1 +trainer: + _target_: pytorch_lightning.Trainer + precision: 32 + enable_progress_bar: false + profiler: null + check_val_every_n_epoch: null + detect_anomaly: false + num_sanity_val_steps: 0 + max_steps: 2000001 + gradient_clip_val: 0.5 + log_every_n_steps: 50 + val_check_interval: 50000 + devices: 8 + num_nodes: 4 + accelerator: gpu + strategy: ddp +loggers: + out_dir: ${out_dir} + cfg_id: ${id} + max_steps: ${trainer.max_steps} + log_nsteps: ${trainer.log_every_n_steps} + use_wandb: true + wandb_run: ${wandb_run} + wandb_group: null + wandb_project: motionbricks + wandb_entity: null + wandb_run_name: motionbricks_vqvae + logger_project: motionbricks +callbacks: + callback_dict: + checkpoint_epoch_cb: + _target_: motionbricks.motionlib.train.callbacks.ckpt.ReadPermissionModelCheckpoint + monitor: null + dirpath: out/motionbricks_vqvae/version_1/checkpoints + filename: model-{step:07d} + save_last: false + save_top_k: -1 + mode: min + every_n_train_steps: 50000 + learning_rate_monitor: + _target_: pytorch_lightning.callbacks.LearningRateMonitor + logging_interval: step + autoresume: + _target_: motionbricks.motionlib.train.callbacks.autoresume.AutoResumeCallback + autoresume_after: 1260000 + save_checkpoint_on_exception: true + eval_visualize: + _target_: motionbricks.vqvae.callbacks.evaluation.VQVAE_Evaluate + every_n_steps: 50001 + train_dataloader: ??? + val_dataloader: ??? + seed: 2333 + batch_size: 32 + max_num_data: 40000 + max_num_visualization: 32 + out_dir: ${run_dir}/vis + metrics: + - _target_: motionbricks.eval.metrics.FootSkateFromHeight + - _target_: motionbricks.eval.metrics.FootSkateFromContacts + - _target_: motionbricks.eval.metrics.JointPosConsistency + train_end: + _target_: motionbricks.motionlib.train.callbacks.train_end.TrainEndCallback + only_rank_zero: + - eval_visualize + - learning_rate_monitor + - evaluate + - train_end + need_version: [] + need_dataloaders: + - eval_visualize + - evaluate + need_ema: [] + need_motionbricks_test: [] + need_log: + - eval_visualize + - evaluate + need_autoresume: [] + need_mask_cond_sampler: [] + need_one_logger_callback: + - autoresume +dataloader: + _target_: torch.utils.data.DataLoader + batch_size: 128 + num_workers: 11 + shuffle: ??? + persistent_workers: true + collate_fn: + _target_: motionbricks.motionlib.data.utils.collate_batch + _partial_: true + llm_shape: ${model.denoiser.backbone.llm_shape} + num_frames: null +data: + _target_: motionbricks.motionlib.data.motion_dataset.MotionDataset + name: motionbricks-G1 + folder: ../datasets/motionbricks-G1 + text_embeddings: null + split: ??? + motion_sampler: + _target_: motionbricks.motionlib.data.motion_sampler.MaxDurationRandomCrop + max_seconds: 30 + motion_loading_mode: memmap + use_natural_desc: true + use_short_desc: true + use_technical_desc: false + use_nv_overview_desc: false + nv_overview_prob: null + drop_text_prob: 0.1 + augment_text: false + aug_text_suffix: '' + aug_text_prob: 0.75 + aug_text_ind_range: + - 1 + - 61 + load_neutral_joints: false + timelines_mode: false + timelines_name: null + dataset_sampler: null + dataset_sampler_only_at_train: true + to_canonicalize: false + randomize_first_heading: true + loading_mode: motion_only +skeleton: + base_name: g1skel34 + folder: out/motionbricks_vqvae/version_1/skeleton + t_pose: capture + orig_prefix: '' + name: g1skel34 + _target_: motionbricks.motionlib.core.skeletons.g1.G1Skeleton34 +motion_rep: + name: ${skeleton.name}_dual_root_global_joints + stats: + _target_: motionbricks.motionlib.core.utils.stats.Stats + folder: out/motionbricks_vqvae/version_1/stats/motion + _target_: motionbricks.motionlib.core.motion_reps.dual_root_global_joints.GlobalRootGlobalJoints +fps: 30 +wandb_run: motionbricks_vqvae +resume: false +version: 1 +cp: last_epoch +matmul_precision: high +seed: 7 +id: ${hydra:runtime.choices.exp}_gpu${trainer.devices}_node${trainer.num_nodes} +out_dir: out/motionbricks_vqvae +run_dir: out/motionbricks_vqvae/version_1 +pure_testing: false +test: + unlimit_max_code: false + max_num_data: 16 + min_length: 10 + max_length: 60 + ckpt_dir: null + ckpt_name: null +config_version: 4 +data_root: datasets +tmr_checkpoints_root: null +use_one_logger: false diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/hparams.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/hparams.yaml new file mode 100644 index 0000000000000000000000000000000000000000..060c8027aebed3ed52de0ffa3fb569a488e953f3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/hparams.yaml @@ -0,0 +1,228 @@ +model: + pose_vqvae_network: + _target_: motionbricks.vqvae.neural_modules.vqvae.VQVAE + pose_root_mode: pose + motion_rep: ??? + encoder_state_dim: 241 + decoder_state_dim: 329 + decoder_target_cond_dim: 241 + decoder_external_cond_dim: 2 + feature_mode: + - joint_positions_and_rotations_and_hip_height + - pose + - joint_positions_and_rotations_and_hip_height + - root_without_hip_height_without_heading + quantizer_strategy: multihead_ema_reset + quantizer_mu: 0.99 + nb_code: 100000000 + code_dim: 256 + output_emb_width: 256 + down_t: 2 + stride_t: 2 + width: 512 + depth: 4 + dilation_growth_rate: 3 + activation: relu + num_heads: 8 + kmeans_init: false + norm: None + calculate_per_head_perplexity: true + cond_fusion_last_layer: false + _target_: motionbricks.vqvae.models.motion_vqvae.MotionVQVAEModel + motion_rep: ??? + pose_vqvae_motion_rep: local + root_vqvae_network: null + denoiser: + backbone: + llm_shape: null + args: + min_tokens: 6 + max_tokens: 16 + down_t: 2 + commit_loss_coeff: 0.02 + batchsize_mul_factor: 2 + root_vqvae_max_num_keyframes: 5 + root_vqvae_no_keyframe_prob: 0.25 + pose_vqvae_max_num_keyframes: 10 + pose_vqvae_no_keyframe_prob: 0.25 + keyframe_num_warmup_steps: 200000 + global_root_loss_coeff: 0.5 + local_root_loss_coeff: 0.5 + max_angle_diff: 5.0 + max_norm_ratio: 0.2 + percentage_of_perturbed_samples: 0.2 + floor_estimation: min_joint_height_within_windows + floor_estimation_window_time: 1.0 + skate_contact_loss_coeff: 0.01 + joint_vel_loss_coeff: 2.0 + optimizer: + _target_: adam_atan2_pytorch.AdamAtan2 + _partial_: true + lr: 0.0002 + weight_decay: 0.0 + scheduler: + _target_: motionbricks.motionlib.train.scheduler.WarmupCosineScheduler + _partial_: true + num_warmup_steps: 10000 + num_training_steps: ${trainer.max_steps} + final_lr: 4.0e-06 + last_epoch: -1 + lt_kwargs: + interval: step + frequency: 1 +trainer: + _target_: pytorch_lightning.Trainer + precision: 32 + enable_progress_bar: false + profiler: null + check_val_every_n_epoch: null + detect_anomaly: false + num_sanity_val_steps: 0 + max_steps: 2000001 + gradient_clip_val: 0.5 + log_every_n_steps: 50 + val_check_interval: 50000 + devices: 8 + num_nodes: 4 + accelerator: gpu + strategy: ddp +loggers: + out_dir: ${out_dir} + cfg_id: ${id} + max_steps: ${trainer.max_steps} + log_nsteps: ${trainer.log_every_n_steps} + use_wandb: true + wandb_run: ${wandb_run} + wandb_group: null + wandb_project: motionbricks + wandb_entity: null + wandb_run_name: motionbricks_vqvae + logger_project: motionbricks +callbacks: + callback_dict: + checkpoint_epoch_cb: + _target_: motionbricks.motionlib.train.callbacks.ckpt.ReadPermissionModelCheckpoint + monitor: null + dirpath: null + filename: model-{step:07d} + save_last: false + save_top_k: -1 + mode: min + every_n_train_steps: 50000 + learning_rate_monitor: + _target_: pytorch_lightning.callbacks.LearningRateMonitor + logging_interval: step + autoresume: + _target_: motionbricks.motionlib.train.callbacks.autoresume.AutoResumeCallback + autoresume_after: 1260000 + save_checkpoint_on_exception: true + eval_visualize: + _target_: motionbricks.vqvae.callbacks.evaluation.VQVAE_Evaluate + every_n_steps: 50001 + train_dataloader: ??? + val_dataloader: ??? + seed: 2333 + batch_size: 32 + max_num_data: 40000 + max_num_visualization: 32 + out_dir: ${run_dir}/vis + metrics: + - _target_: motionbricks.eval.metrics.FootSkateFromHeight + - _target_: motionbricks.eval.metrics.FootSkateFromContacts + - _target_: motionbricks.eval.metrics.JointPosConsistency + train_end: + _target_: motionbricks.motionlib.train.callbacks.train_end.TrainEndCallback + only_rank_zero: + - eval_visualize + - learning_rate_monitor + - evaluate + - train_end + need_version: [] + need_dataloaders: + - eval_visualize + - evaluate + need_ema: [] + need_motionbricks_test: [] + need_log: + - eval_visualize + - evaluate + need_autoresume: [] + need_mask_cond_sampler: [] + need_one_logger_callback: + - autoresume +dataloader: + _target_: torch.utils.data.DataLoader + batch_size: 128 + num_workers: 11 + shuffle: ??? + persistent_workers: true + collate_fn: + _target_: motionbricks.motionlib.data.utils.collate_batch + _partial_: true + llm_shape: ${model.denoiser.backbone.llm_shape} + num_frames: null +data: + _target_: motionbricks.motionlib.data.motion_dataset.MotionDataset + name: motionbricks-G1 + folder: ../datasets/motionbricks-G1 + text_embeddings: null + split: ??? + motion_sampler: + _target_: motionbricks.motionlib.data.motion_sampler.MaxDurationRandomCrop + max_seconds: 30 + motion_loading_mode: memmap + use_natural_desc: true + use_short_desc: true + use_technical_desc: false + use_nv_overview_desc: false + nv_overview_prob: null + drop_text_prob: 0.1 + augment_text: false + aug_text_suffix: '' + aug_text_prob: 0.75 + aug_text_ind_range: + - 1 + - 61 + load_neutral_joints: false + timelines_mode: false + timelines_name: null + dataset_sampler: null + dataset_sampler_only_at_train: true + to_canonicalize: false + randomize_first_heading: true + loading_mode: motion_only +skeleton: + base_name: g1skel34 + folder: out/motionbricks_vqvae/version_1/skeleton + t_pose: capture + orig_prefix: '' + name: g1skel34 + _target_: motionbricks.motionlib.core.skeletons.g1.G1Skeleton34 +motion_rep: + name: ${skeleton.name}_dual_root_global_joints + stats: + _target_: motionbricks.motionlib.core.utils.stats.Stats + folder: out/motionbricks_vqvae/version_1/stats/motion + _target_: motionbricks.motionlib.core.motion_reps.dual_root_global_joints.GlobalRootGlobalJoints +fps: 30 +wandb_run: motionbricks_vqvae +resume: false +version: 1 +cp: last_epoch +matmul_precision: high +seed: 7 +id: ${hydra:runtime.choices.exp}_gpu${trainer.devices}_node${trainer.num_nodes} +out_dir: out/motionbricks_vqvae +run_dir: ??? +pure_testing: false +test: + unlimit_max_code: false + max_num_data: 16 + min_length: 10 + max_length: 60 + ckpt_dir: null + ckpt_name: null +config_version: 4 +data_root: datasets +tmr_checkpoints_root: null +use_one_logger: false diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/meta.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/meta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..327cee4a946882f44127bb8bfb72136bbd63e9ab --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/meta.yaml @@ -0,0 +1 @@ +wandb_run: motionbricks_vqvae diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/skeleton/joints.p b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/skeleton/joints.p new file mode 100644 index 0000000000000000000000000000000000000000..ed7b5816c26b8c72b6f4afd95a1504844a84a90f Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/skeleton/joints.p differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/skeleton/parents.p b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/skeleton/parents.p new file mode 100644 index 0000000000000000000000000000000000000000..10d16e22d12d42868d6a9e650fc3ab536d5b4974 Binary files /dev/null and b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/skeleton/parents.p differ diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/skeleton/skeleton.yaml b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/skeleton/skeleton.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2600b68ec94feb9e2c643656e864ab8a2bba7941 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/skeleton/skeleton.yaml @@ -0,0 +1,6 @@ +base_name: g1skel34 +folder: ${data.folder}/features/motion_rep/${motion_rep.name}_fps_${fps}/skeleton +t_pose: capture +orig_prefix: '' +name: g1skel34 +_target_: motionbricks.motionlib.core.skeletons.g1.G1Skeleton34 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/stats/motion/mean.npy b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/stats/motion/mean.npy new file mode 100644 index 0000000000000000000000000000000000000000..85d2587039128f46ab7e4e85e34095b795fcc2d8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/stats/motion/mean.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca390f0081e2373ab71e860a3546cb70cc11fdfac6ce525155403e047b66fdea +size 3472 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/stats/motion/std.npy b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/stats/motion/std.npy new file mode 100644 index 0000000000000000000000000000000000000000..482321f0eef80efdb8f6dcccbb9a47158892d6ec --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/out/motionbricks_vqvae/version_1/stats/motion/std.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fca7dd6135cbe96504b1307a7db97e9004556937a2fc72d139077b962cee6bd7 +size 3472 diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/scripts/interactive_demo_g1.py b/third-party/GR00T-WholeBodyControl/motionbricks/scripts/interactive_demo_g1.py new file mode 100644 index 0000000000000000000000000000000000000000..410992756a7aca4988ed2bb9e270e70e455e4eeb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/scripts/interactive_demo_g1.py @@ -0,0 +1,173 @@ +import argparse +import torch as t +import time +import platform + +import mujoco +import mujoco.viewer +import numpy as np +from motionbricks.motion_backbone.demo.utils import navigation_demo + + +def _disable_mujoco_keyboard_shortcuts(controller_keys='wasdrtfgeqzxcvb'): + """Prevent MuJoCo's viewer from processing keyboard shortcuts that + conflict with the WASD motion controller. + + On Linux/X11: uses passive key grabs to intercept keys at the X server + level before GLFW sees them. pynput still captures keys via XRecord. + + On macOS/Windows: not yet supported — MuJoCo shortcuts may interfere. + """ + if platform.system() != 'Linux': + return + try: + from Xlib import display as xdisplay, X + _xdpy = xdisplay.Display() + _root = _xdpy.screen().root + + def _find_window_by_name(win, name_substr): + try: + name = win.get_wm_name() + if name and name_substr in name: + return win + except Exception: + pass + for child in win.query_tree().children: + r = _find_window_by_name(child, name_substr) + if r: + return r + return None + + time.sleep(0.5) + mj_win = _find_window_by_name(_root, 'MuJoCo') + if mj_win: + for ch in controller_keys: + keycode = _xdpy.keysym_to_keycode(ord(ch) - 32) + mj_win.grab_key(keycode, X.AnyModifier, + False, X.GrabModeAsync, X.GrabModeAsync) + _xdpy.sync() + except Exception as e: + print(f"Note: could not disable MuJoCo keyboard shortcuts: {e}") + + +def main(args) -> None: + demo_agent = navigation_demo(args) + + num_runs = 0 + while num_runs < args.num_runs: + num_runs += 1 + print(f"Running iteration {num_runs}... / {args.num_runs}") + random_seed = args.random_seed * (num_runs + 2333) * 2333 % (2 ** 32 - 1) + np.random.seed(random_seed) + t.manual_seed(random_seed) + demo_agent.full_agent.reset() + + steps = 0 + + if args.has_viewer: + with mujoco.viewer.launch_passive(demo_agent.mj_model, demo_agent.mj_data) as viewer: + _disable_mujoco_keyboard_shortcuts() + + while viewer.is_running() and steps < args.max_steps: + force_idle = steps + 100 > args.max_steps + steps += 1 + viewer.user_scn.ngeom = 0 + step_start = time.time() + qpos = demo_agent.full_agent.get_next_frame() + context_motion_features = demo_agent.full_agent.get_context_motion_features() + context_mujoco_qpos = demo_agent.full_agent.get_context_mujoco_qpos() + demo_agent.mj_data.qpos[:] = qpos + + control_signals = demo_agent.controller.generate_control_signals( + viewer, demo_agent.mj_model, demo_agent.mj_data, visualize=True, + control_info={"force_idle": force_idle, + 'allowed_mode': getattr(args, 'allowed_mode', None)} + ) + + if args.use_qpos: + control_signals['context_mujoco_qpos'] = context_mujoco_qpos + else: + control_signals['context_motion_features'] = context_motion_features + + with t.no_grad(): + demo_agent.full_agent.generate_new_frames( + control_signals, + demo_agent.controller.get_controller_dt() * args.generate_dt + ) + + mujoco.mj_forward(demo_agent.mj_model, demo_agent.mj_data) + viewer.cam.lookat[:] = demo_agent.controller.get_prev_qpos()[:, :3].mean(axis=0) + viewer.sync() + time_until_next_step = demo_agent.mj_model.opt.timestep - (time.time() - step_start) + if time_until_next_step > 0: + time.sleep(time_until_next_step) + else: + while steps < args.max_steps: + steps += 1 + force_idle = steps + 100 > args.max_steps + qpos = demo_agent.full_agent.get_next_frame() + context_motion_features = demo_agent.full_agent.get_context_motion_features() + context_mujoco_qpos = demo_agent.full_agent.get_context_mujoco_qpos() + demo_agent.mj_data.qpos[:] = qpos + + control_signals = demo_agent.controller.generate_control_signals( + None, demo_agent.mj_model, demo_agent.mj_data, visualize=False, + control_info={"force_idle": force_idle, 'allowed_mode': getattr(args, 'allowed_mode', None)} + ) + if args.use_qpos: + control_signals['context_mujoco_qpos'] = context_mujoco_qpos + else: + control_signals['context_motion_features'] = context_motion_features + + with t.no_grad(): + demo_agent.full_agent.generate_new_frames( + control_signals, demo_agent.controller.get_controller_dt() * args.generate_dt + ) + + mujoco.mj_forward(demo_agent.mj_model, demo_agent.mj_data) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Interactive demo for the G1 humanoid") + + # path configs + parser.add_argument("--humanoid_xml", type=str, default="assets/skeletons/g1/scene_29dof.xml") + parser.add_argument("--result_dir", type=str, default="./out") + parser.add_argument("--data_root", type=str, default="./datasets") + parser.add_argument("--explicit_dataset_folder", type=str, default=None) + parser.add_argument("--reprocess_clips", type=int, default=0) + + # controller config + parser.add_argument("--controller", type=str, default="wasd", + choices=["wasd", "random"]) + parser.add_argument("--lookat_movement_direction", type=int, default=0) + parser.add_argument("--has_viewer", type=int, default=1) + parser.add_argument("--pre_filter_qpos", type=int, default=1) + parser.add_argument("--source_root_realignment", type=int, default=1) + parser.add_argument("--target_root_realignment", type=int, default=1) + parser.add_argument("--force_canonicalization", type=int, default=1) + parser.add_argument("--skip_ending_target_cond", type=int, default=0) + parser.add_argument("--random_speed_scale", type=int, default=0) + parser.add_argument("--speed_scale", type=str, default="0.8,1.2") + parser.add_argument("--generate_dt", type=float, default=2.0) + + # run configs + parser.add_argument("--max_steps", type=int, default=10000) + parser.add_argument("--random_seed", type=int, default=1234) + parser.add_argument("--num_runs", type=int, default=1) + + # model configurations + parser.add_argument("--use_qpos", type=int, default=1) + parser.add_argument("--planner", type=str, default="default") + parser.add_argument("--allowed_mode", type=str, default=None) + parser.add_argument("--clips", type=str, default="G1") + + args = parser.parse_args() + + args.return_model_configs = True + args.return_dataloader = True + args.recording_dir = None + args.EXP = args.planner + args.speed_scale = [float(i) for i in args.speed_scale.split(",")] + + main(args) diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/scripts/train_pose.py b/third-party/GR00T-WholeBodyControl/motionbricks/scripts/train_pose.py new file mode 100644 index 0000000000000000000000000000000000000000..861f7aaf0cf1561a065e606d974c6f8a2b6d0f49 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/scripts/train_pose.py @@ -0,0 +1,160 @@ +"""Pose model training script using synthetic data. + +Demonstrates how the pose backbone training pipeline works without +requiring the actual motion dataset. Loads the saved model config from +the checkpoint directory and trains on randomly generated motion tensors. + +The pose model requires a pretrained VQVAE checkpoint to encode motions +into discrete tokens. The VQVAE weights are loaded automatically from +the path specified in the config. + +Usage: + python scripts/train_pose.py --max_steps 100 +""" + +import argparse +import copy +import os + +import pytorch_lightning as pl +import torch +from hydra.utils import instantiate +from omegaconf import DictConfig, OmegaConf, open_dict +from torch.utils.data import DataLoader + +from motionbricks.data.synthetic_dataset import SyntheticMotionDataset, collate_batch +from motionbricks.helper.pl_util import load_motion_rep + + +def load_config(result_dir: str, max_steps: int): + """Load and patch hparams.yaml for single-GPU training.""" + version_dir = os.path.join(result_dir, "motionbricks_pose", "version_1") + hparams_path = os.path.join(version_dir, "hparams.yaml") + conf = OmegaConf.load(hparams_path) + + with open_dict(conf): + # resolve data paths to the version directory (where skeleton/stats live) + conf.data = {"folder": version_dir, "text_embeddings": None} + conf.skeleton.folder = os.path.join(version_dir, "skeleton") + conf.motion_rep.stats.folder = os.path.join(version_dir, "stats", "motion") + + # single-GPU training overrides + conf.trainer.devices = 1 + conf.trainer.num_nodes = 1 + conf.trainer.max_steps = max_steps + conf.trainer.accelerator = "auto" + conf.trainer.strategy = "auto" + conf.trainer.enable_progress_bar = True + conf.trainer.log_every_n_steps = 10 + conf.trainer.val_check_interval = max_steps + conf.trainer.num_sanity_val_steps = 0 + + # resolve ${trainer.max_steps} in scheduler + conf.model.scheduler.num_training_steps = max_steps + + # remove keys with unresolvable ${hydra:...} interpolations + conf.id = "synthetic" + conf.run_dir = "." + conf.out_dir = result_dir + + # resolve all ${} interpolations, then re-wrap as DictConfig + resolved = OmegaConf.to_container(conf, resolve=True) + conf = OmegaConf.create(resolved) + + return conf, version_dir + + +def main(): + parser = argparse.ArgumentParser(description="Pose model training") + parser.add_argument("--result_dir", type=str, default="./out", + help="Directory containing pretrained checkpoints") + parser.add_argument("--max_steps", type=int, default=200, + help="Number of training steps") + parser.add_argument("--batch_size", type=int, default=8, + help="Batch size") + parser.add_argument("--num_samples", type=int, default=500, + help="Number of synthetic samples in dataset") + parser.add_argument("--seed", type=int, default=42) + args = parser.parse_args() + + pl.seed_everything(args.seed) + conf, version_dir = load_config(args.result_dir, args.max_steps) + + # instantiate skeleton and motion representation + motion_rep = load_motion_rep(conf) + feat_dim = len(motion_rep.indices['all']) + + # create synthetic dataset + dataset = SyntheticMotionDataset( + feat_dim=feat_dim, + num_samples=args.num_samples, + min_frames=80, + max_frames=200, + ) + dataloader = DataLoader( + dataset, + batch_size=args.batch_size, + shuffle=True, + num_workers=2, + collate_fn=collate_batch, + persistent_workers=True, + ) + + # instantiate networks and model + model_conf = copy.deepcopy(conf.model) + with open_dict(model_conf): + # instantiate pose VQVAE network (will be frozen; weights loaded by model) + pose_vqvae_net = instantiate( + model_conf.pose_vqvae_network, + motion_rep=motion_rep.dual_rep.local_motion_rep, + ) + + # instantiate backbone network (needs full motion_rep for dual_rep access) + backbone_net = instantiate( + model_conf.backbone_network, + motion_rep=motion_rep, + _recursive_=False, + ) + + # build optimizer and scheduler as partials + optimizer_fn = instantiate(model_conf.optimizer) + scheduler_fn = instantiate(model_conf.scheduler) if model_conf.scheduler else None + + model = instantiate( + model_conf, + pose_vqvae_network=pose_vqvae_net, + root_vqvae_network=None, + backbone_network=backbone_net, + motion_rep=motion_rep, + optimizer=optimizer_fn, + scheduler=scheduler_fn, + _recursive_=False, + ) + + # create trainer (no callbacks) + trainer = pl.Trainer( + max_steps=conf.trainer.max_steps, + devices=conf.trainer.devices, + num_nodes=conf.trainer.num_nodes, + accelerator=conf.trainer.accelerator, + strategy=conf.trainer.strategy, + precision=conf.trainer.precision, + gradient_clip_val=conf.trainer.gradient_clip_val, + enable_progress_bar=conf.trainer.enable_progress_bar, + log_every_n_steps=conf.trainer.log_every_n_steps, + num_sanity_val_steps=0, + enable_checkpointing=False, + logger=False, + ) + + print(f"Starting pose model training for {args.max_steps} steps...") + print(f" Feature dim: {feat_dim}") + print(f" Batch size: {args.batch_size}") + print(f" Dataset size: {args.num_samples}") + print(f" VQVAE loaded: {model.vqvae_model_loaded}") + trainer.fit(model, train_dataloaders=dataloader) + print("Training complete.") + + +if __name__ == "__main__": + main() diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/scripts/train_root.py b/third-party/GR00T-WholeBodyControl/motionbricks/scripts/train_root.py new file mode 100644 index 0000000000000000000000000000000000000000..147d4694a65eb9244da6e32ef6a81bc030d9d8d9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/scripts/train_root.py @@ -0,0 +1,152 @@ +"""Root model training script using synthetic data. + +Demonstrates how the root backbone training pipeline works without +requiring the actual motion dataset. Loads the saved model config from +the checkpoint directory and trains on randomly generated motion tensors. + +The root model does not require a pretrained VQVAE — it directly +predicts continuous root motion values. + +Usage: + python scripts/train_root.py --max_steps 100 +""" + +import argparse +import copy +import os + +import pytorch_lightning as pl +import torch +from hydra.utils import instantiate +from omegaconf import DictConfig, OmegaConf, open_dict +from torch.utils.data import DataLoader + +from motionbricks.data.synthetic_dataset import SyntheticMotionDataset, collate_batch +from motionbricks.helper.pl_util import load_motion_rep + + +def load_config(result_dir: str, max_steps: int): + """Load and patch hparams.yaml for single-GPU training.""" + version_dir = os.path.join(result_dir, "motionbricks_root", "version_1") + hparams_path = os.path.join(version_dir, "hparams.yaml") + conf = OmegaConf.load(hparams_path) + + with open_dict(conf): + # resolve data paths to the version directory (where skeleton/stats live) + conf.data = {"folder": version_dir, "text_embeddings": None} + conf.skeleton.folder = os.path.join(version_dir, "skeleton") + conf.motion_rep.stats.folder = os.path.join(version_dir, "stats", "motion") + + # single-GPU training overrides + conf.trainer.devices = 1 + conf.trainer.num_nodes = 1 + conf.trainer.max_steps = max_steps + conf.trainer.accelerator = "auto" + conf.trainer.strategy = "auto" + conf.trainer.enable_progress_bar = True + conf.trainer.log_every_n_steps = 10 + conf.trainer.val_check_interval = max_steps + conf.trainer.num_sanity_val_steps = 0 + + # resolve ${trainer.max_steps} in scheduler + conf.model.scheduler.num_training_steps = max_steps + + # remove keys with unresolvable ${hydra:...} interpolations + conf.id = "synthetic" + conf.run_dir = "." + conf.out_dir = result_dir + + # resolve all ${} interpolations, then re-wrap as DictConfig + resolved = OmegaConf.to_container(conf, resolve=True) + conf = OmegaConf.create(resolved) + + return conf, version_dir + + +def main(): + parser = argparse.ArgumentParser(description="Root model training") + parser.add_argument("--result_dir", type=str, default="./out", + help="Directory containing pretrained checkpoints") + parser.add_argument("--max_steps", type=int, default=200, + help="Number of training steps") + parser.add_argument("--batch_size", type=int, default=8, + help="Batch size") + parser.add_argument("--num_samples", type=int, default=500, + help="Number of synthetic samples in dataset") + parser.add_argument("--seed", type=int, default=42) + args = parser.parse_args() + + pl.seed_everything(args.seed) + conf, version_dir = load_config(args.result_dir, args.max_steps) + + # instantiate skeleton and motion representation + motion_rep = load_motion_rep(conf) + feat_dim = len(motion_rep.indices['all']) + + # create synthetic dataset + dataset = SyntheticMotionDataset( + feat_dim=feat_dim, + num_samples=args.num_samples, + min_frames=200, + max_frames=400, + ) + dataloader = DataLoader( + dataset, + batch_size=args.batch_size, + shuffle=True, + num_workers=2, + collate_fn=collate_batch, + persistent_workers=True, + ) + + # instantiate networks and model + model_conf = copy.deepcopy(conf.model) + with open_dict(model_conf): + # instantiate backbone network (needs full motion_rep for dual_rep access) + backbone_net = instantiate( + model_conf.backbone_network, + motion_rep=motion_rep, + _recursive_=False, + ) + + # build optimizer and scheduler as partials + optimizer_fn = instantiate(model_conf.optimizer) + scheduler_fn = instantiate(model_conf.scheduler) if model_conf.scheduler else None + + model = instantiate( + model_conf, + pose_vqvae_network=None, + root_vqvae_network=None, + backbone_network=backbone_net, + motion_rep=motion_rep, + optimizer=optimizer_fn, + scheduler=scheduler_fn, + _recursive_=False, + ) + + # create trainer (no callbacks) + trainer = pl.Trainer( + max_steps=conf.trainer.max_steps, + devices=conf.trainer.devices, + num_nodes=conf.trainer.num_nodes, + accelerator=conf.trainer.accelerator, + strategy=conf.trainer.strategy, + precision=conf.trainer.precision, + gradient_clip_val=conf.trainer.gradient_clip_val, + enable_progress_bar=conf.trainer.enable_progress_bar, + log_every_n_steps=conf.trainer.log_every_n_steps, + num_sanity_val_steps=0, + enable_checkpointing=False, + logger=False, + ) + + print(f"Starting root model training for {args.max_steps} steps...") + print(f" Feature dim: {feat_dim}") + print(f" Batch size: {args.batch_size}") + print(f" Dataset size: {args.num_samples}") + trainer.fit(model, train_dataloaders=dataloader) + print("Training complete.") + + +if __name__ == "__main__": + main() diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/scripts/train_vqvae.py b/third-party/GR00T-WholeBodyControl/motionbricks/scripts/train_vqvae.py new file mode 100644 index 0000000000000000000000000000000000000000..6fa259f95c41772ab330b68b5d76acf156d184d3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/scripts/train_vqvae.py @@ -0,0 +1,140 @@ +"""VQVAE training script using synthetic data. + +Demonstrates how the VQVAE training pipeline works without requiring +the actual motion dataset. Loads the saved model config from the +checkpoint directory and trains on randomly generated motion tensors. + +Usage: + python scripts/train_vqvae.py --max_steps 100 +""" + +import argparse +import copy +import os + +import pytorch_lightning as pl +import torch +from functools import partial +from hydra.utils import instantiate +from omegaconf import OmegaConf, open_dict +from torch.utils.data import DataLoader + +from motionbricks.data.synthetic_dataset import SyntheticMotionDataset, collate_batch +from motionbricks.helper.pl_util import load_motion_rep + + +def load_config(result_dir: str, max_steps: int): + """Load and patch hparams.yaml for single-GPU training.""" + version_dir = os.path.join(result_dir, "motionbricks_vqvae", "version_1") + hparams_path = os.path.join(version_dir, "hparams.yaml") + conf = OmegaConf.load(hparams_path) + + with open_dict(conf): + # resolve data paths to the version directory (where skeleton/stats live) + conf.data = {"folder": version_dir} + conf.skeleton.folder = os.path.join(version_dir, "skeleton") + conf.motion_rep.stats.folder = os.path.join(version_dir, "stats", "motion") + + # single-GPU training overrides + conf.trainer.devices = 1 + conf.trainer.num_nodes = 1 + conf.trainer.max_steps = max_steps + conf.trainer.accelerator = "auto" + conf.trainer.strategy = "auto" + conf.trainer.enable_progress_bar = True + conf.trainer.log_every_n_steps = 10 + conf.trainer.val_check_interval = max_steps # no validation + conf.trainer.num_sanity_val_steps = 0 + + # resolve ${trainer.max_steps} in scheduler + conf.model.scheduler.num_training_steps = max_steps + + return conf, version_dir + + +def main(): + parser = argparse.ArgumentParser(description="VQVAE training") + parser.add_argument("--result_dir", type=str, default="./out", + help="Directory containing pretrained checkpoints") + parser.add_argument("--max_steps", type=int, default=200, + help="Number of training steps") + parser.add_argument("--batch_size", type=int, default=8, + help="Batch size") + parser.add_argument("--num_samples", type=int, default=500, + help="Number of synthetic samples in dataset") + parser.add_argument("--seed", type=int, default=42) + args = parser.parse_args() + + pl.seed_everything(args.seed) + conf, version_dir = load_config(args.result_dir, args.max_steps) + + # instantiate skeleton and motion representation + motion_rep = load_motion_rep(conf) + feat_dim = len(motion_rep.indices['all']) + + # create synthetic dataset + # min_frames must exceed max possible num_frames + 1 used in training_step + # max_tokens=16, down_t=2 => max frames = 16 * 4 = 64, +1 for global->local = 65 + dataset = SyntheticMotionDataset( + feat_dim=feat_dim, + num_samples=args.num_samples, + min_frames=80, + max_frames=200, + ) + dataloader = DataLoader( + dataset, + batch_size=args.batch_size, + shuffle=True, + num_workers=2, + collate_fn=collate_batch, + persistent_workers=True, + ) + + # instantiate the VQVAE network and model + model_conf = copy.deepcopy(conf.model) + with open_dict(model_conf): + # inject the motion_rep into sub-configs that use ??? + pose_net = instantiate( + model_conf.pose_vqvae_network, + motion_rep=motion_rep.dual_rep.local_motion_rep, + ) + # build optimizer and scheduler as partials + optimizer_fn = instantiate(model_conf.optimizer) + scheduler_fn = instantiate(model_conf.scheduler) if model_conf.scheduler else None + + model = instantiate( + model_conf, + pose_vqvae_network=pose_net, + root_vqvae_network=None, + motion_rep=motion_rep, + optimizer=optimizer_fn, + scheduler=scheduler_fn, + _recursive_=False, + ) + + # create trainer (no callbacks needed) + trainer = pl.Trainer( + max_steps=conf.trainer.max_steps, + devices=conf.trainer.devices, + num_nodes=conf.trainer.num_nodes, + accelerator=conf.trainer.accelerator, + strategy=conf.trainer.strategy, + precision=conf.trainer.precision, + gradient_clip_val=conf.trainer.gradient_clip_val, + enable_progress_bar=conf.trainer.enable_progress_bar, + log_every_n_steps=conf.trainer.log_every_n_steps, + num_sanity_val_steps=0, + enable_checkpointing=False, + logger=False, + ) + + print(f"Starting VQVAE training for {args.max_steps} steps...") + print(f" Feature dim: {feat_dim}") + print(f" Batch size: {args.batch_size}") + print(f" Dataset size: {args.num_samples}") + trainer.fit(model, train_dataloaders=dataloader) + print("Training complete.") + + +if __name__ == "__main__": + main() diff --git a/third-party/GR00T-WholeBodyControl/motionbricks/setup.py b/third-party/GR00T-WholeBodyControl/motionbricks/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..e667a97e93329bbebc9cbf07da9ce1c602eeb2ab --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/motionbricks/setup.py @@ -0,0 +1,23 @@ +from setuptools import setup, find_packages + +setup( + name="motionbricks", + version="0.1.0", + packages=find_packages(), + python_requires=">=3.10", + install_requires=[ + "torch>=2.0", + "numpy", + "mujoco>=3.0", + "scipy", + "hydra-core", + "omegaconf", + "pytorch-lightning", + "transformers", + "pynput", + "matplotlib", + "vector-quantize-pytorch", + "colorlog", + "adam-atan2-pytorch", + ], +) diff --git a/third-party/GR00T-WholeBodyControl/pyproject.toml b/third-party/GR00T-WholeBodyControl/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..90f91774750cb7cd03977f252307ea31f6869a71 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/pyproject.toml @@ -0,0 +1,87 @@ +# Root pyproject.toml — tooling configuration only. +# To install packages, use: +# pip install -e decoupled_wbc/ (or decoupled_wbc[full], decoupled_wbc[dev]) +# pip install -e gear_sonic/ (or gear_sonic[teleop], gear_sonic[sim]) + +[tool.black] +line-length = 100 +include = '\.pyi?$' +exclude = ''' +( + __pycache__ + | \.git + | \.mypy_cache + | \.pytest_cache + | \.vscode + | \.venv + | \bdist\b + | \bdoc\b + | external_dependencies + | logs + | source + | /( + | external_dependencies/ + )/ +) +''' + +[tool.isort] +profile = "black" +multi_line_output = 3 +skip = [ + "external_dependencies", + "external_dependencies/**", +] +skip_glob = [ + "external_dependencies/*", +] + +[tool.pyright] +reportPrivateImportUsage = false + +[tool.ruff] +line-length = 115 +target-version = "py310" +exclude = [ + "gear_sonic/dexmg", + "external_dependencies", + "external_dependencies/**", + "./external_dependencies/**", + "*.ipynb", +] + + +[tool.ruff.lint] +select = ["E", "F", "I"] + +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["F401"] + +[tool.ruff.lint.isort] +case-sensitive = false +combine-as-imports = true +force-sort-within-sections = true +from-first = false +single-line-exclusions = ["typing"] +section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"] + +[tool.mypy] +ignore_missing_imports = true +no_site_packages = true +check_untyped_defs = true +exclude = [ + "external_dependencies", +] + +[[tool.mypy.overrides]] +module = "tests.*" +strict_optional = false + +[tool.pytest.ini_options] +testpaths = "decoupled_wbc/tests/" +python_classes = [ + "Test*", + "*Test" +] +log_format = "%(asctime)s - %(levelname)s - %(name)s - %(message)s" +log_level = "DEBUG" diff --git a/third-party/GR00T-WholeBodyControl/systemd/composed_camera_server.service b/third-party/GR00T-WholeBodyControl/systemd/composed_camera_server.service new file mode 100644 index 0000000000000000000000000000000000000000..3b5b350ab744fc4d4970bfafc2b0f0795d24e2ca --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/systemd/composed_camera_server.service @@ -0,0 +1,66 @@ +# systemd service for the SONIC composed camera server. +# +# Publishes JPEG-encoded camera frames over ZMQ so the data exporter +# (on the workstation) can subscribe and record. +# +# ── Setup ──────────────────────────────────────────────────────── +# The install script can generate and install this automatically: +# bash install_scripts/install_camera_server.sh +# +# Or manually: +# 1. Edit USER, HOME, REPO_DIR, and the ExecStart command below. +# 2. Copy to systemd: +# sudo cp systemd/composed_camera_server.service /etc/systemd/system/ +# 3. Enable and start: +# sudo systemctl daemon-reload +# sudo systemctl enable composed_camera_server.service +# sudo systemctl start composed_camera_server.service +# 4. Check status: +# sudo systemctl status composed_camera_server.service +# journalctl -u composed_camera_server.service -f +# +# ── Finding your device ID ─────────────────────────────────────── +# OAK cameras: +# python -c "import depthai as dai; print(dai.Device.getAllAvailableDevices())" +# RealSense: +# rs-enumerate-devices --short +# USB: +# ls /dev/video* # use the index number, e.g. "0" for /dev/video0 +# ───────────────────────────────────────────────────────────────── + +[Unit] +Description=SONIC Composed Camera Server (ZMQ) +After=network.target + +[Service] +Type=simple + +# ── EDIT THESE for your robot ──────────────────────────────────── +User=nvidia +Environment="HOME=/home/nvidia" +Environment="REPO_DIR=/home/nvidia/GR00T-WholeBodyControl" +# ───────────────────────────────────────────────────────────────── + +WorkingDirectory=${REPO_DIR} + +# Edit the ExecStart line to match your camera setup. +# Single ego-view OAK camera (device ID required when multiple OAK devices connected): +ExecStart=${REPO_DIR}/.venv_camera/bin/python -m gear_sonic.camera.composed_camera \ + --ego-view-camera oak \ + --ego-view-device-id YOUR_MXID_HERE \ + --port 5555 + +# Multi-camera example (ego + wrist cameras): +# ExecStart=${REPO_DIR}/.venv_camera/bin/python -m gear_sonic.camera.composed_camera \ +# --ego-view-camera oak --ego-view-device-id EGO_MXID \ +# --left-wrist-camera oak --left-wrist-device-id LEFT_MXID \ +# --right-wrist-camera oak --right-wrist-device-id RIGHT_MXID \ +# --port 5555 + +Restart=on-failure +RestartSec=5 +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=multi-user.target diff --git a/third-party/HOI4D-Instructions/.gitignore b/third-party/HOI4D-Instructions/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..b6e47617de110dea7ca47e087ff1347cc2646eda --- /dev/null +++ b/third-party/HOI4D-Instructions/.gitignore @@ -0,0 +1,129 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ diff --git a/third-party/HOI4D-Instructions/LICENSE b/third-party/HOI4D-Instructions/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..8c41f10608e09f4111523eceb699f80f00ff36c0 --- /dev/null +++ b/third-party/HOI4D-Instructions/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Yun Liu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/third-party/HOI4D-Instructions/README.md b/third-party/HOI4D-Instructions/README.md new file mode 100644 index 0000000000000000000000000000000000000000..417dee19155ba9d8f5cfedf60e4483ca06d20379 --- /dev/null +++ b/third-party/HOI4D-Instructions/README.md @@ -0,0 +1,169 @@ +# HOI4D +Please check out the HOI4D Challenge on the latest project website www.hoi4d.top ! + +HOI4D is a large-scale 4D egocentric dataset for category-level human-object interaction. The dataset and benchmarks were generally described in a CVPR 2022 paper: +**HOI4D: A 4D Egocentric Dataset for Category-Level Human-Object Interaction** + +[[project page](https://hoi4d.github.io/)] [[paper](https://hoi4d.github.io/HOI4D_cvpr2022.pdf)] [[supplementary](https://hoi4d.github.io/supp_cvpr2022.pdf)] [[arxiv](https://arxiv.org/pdf/2203.01577.pdf)] + +## Data Organization + +HOI4D is constructed by collected human-object interaction RGB-D videos and various annotations including object CAD models, action segmentation, 2D motion segmentation, 3D static scene panoptic segmentation, 4D dymanics scene panoptic segmentation, category-level object pose, and human hand pose. + +The data is organized below: +``` +./ZY2021080000*/H*/C*/N*/S*/s*/T*/ +|--align_rgb + |--image.mp4 +|--align_depth + |--depth_video.avi +|--objpose + |--*.json +|--action + |--color.json +|--3Dseg + |--raw_pc.pcd + |--output.log + |--label.pcd +|--2Dseg + |--mask +``` +- ZY2021080000* refers to the camera ID. +- H* refers to human ID. +- C* refers to object class. +``` +mapping = [ + '', 'ToyCar', 'Mug', 'Laptop', 'StorageFurniture', 'Bottle', + 'Safe', 'Bowl', 'Bucket', 'Scissors', '', 'Pliers', 'Kettle', + 'Knife', 'TrashCan', '', '', 'Lamp', 'Stapler', '', 'Chair' +] +``` +- N* refers to object instance ID. +- S* refers to the room ID. +- s* refers to the room layout ID. +- T* refers to the task ID. + +Please refer to ```definitions/task/task_definitions.csv``` for the definitions of C\* and T\*. + +The released data list refers to ```release.txt```. (The rest of the data is temporarily kept as a testset.) +## Data Formats + +### Human-object Interaction RGB-D Videos + +1. First you need to install [ffmpeg](https://ffmpeg.org/). +2. Then run ``` python utils/decode.py``` to generate RGB and depth images. + +### Object CAD Models + +For each rigid object, we provide a single object mesh ```{object category}/{object id}.obj```. The mesh itself is the canonical frame that defines the pose of the object. + +For each articulated object, we provide the articulated part meshes as well as joint annotations. We utilize [partnet_anno_system](https://github.com/daerduoCarey/partnet_anno_system) to segment articulated parts from the whole object mesh. The part hierarchy is defined in ```{object category}/{object id}/result.json```, and the part meshes involved in the part hierarchy are provided in ```{object category}/{object id}/{objs}/{part name}.obj```. We provide joint annotations ```{object category}/{object id}/mobility_v2.json``` including the origin, direction, and rotation (for revolute joint) or translation (for prismatic joint) limit for each joint axis. In addition to the CAD model annotations, we also provide the canonical frame of each articulated part ```{object category}/{object id}/{objs}/{part name}_align.obj``` that is used to define the part pose. + +### Action Segmentation + +We present Segmentation to record per-frame action class. ```duration```denotes the length of video, ```event```denotes the label of the clip, ```startTime and endTime```denotes the range of the clip. + + +### 2D Motion Segmentation + +We present 2D motion segmentation to annotate the human hands and the objects related to the interaction in each video. You can first use the ```get_color_map``` function in ```utils/color_map.py``` to convert the RGB labels to indices, and then refer to ```definitions/motion segmentation/label.csv``` to correlate each index to its corresponding semantic meaning. + +### 3D Static Scene Panoptic Segmentation + +- ```raw_pc.pcd and label.pcd```is the raw point cloud and the label of the reconstructed static scene. The detailed definitions refer to ```definitions/3D segmentation/labels.xlsx```. + +- ```output.log``` is the camera pose of each frame. + +>**Note**: You can easily use the camera pose using open3d. +```python +import open3d as o3d +outCam = o3d.io.read_pinhole_camera_trajectory(output.log).parameters +``` + +### 4D Dynamic Scene Panoptic Segmentation + +We provide scripts to generate 4D panoptic Segmentation labels. +```python +python prepare_4Dseg/prepare_4Dseg_dataset.py --data_dir /PATH/TO/HOI4D --output_dir /PATH/TO/HOI4D_4Dseg +``` +To save storage, you can delete intermediate files by: +``` +rm -rf ./HOI4D_4Dseg/*/*/*/*/*/*/*/background +rm -rf ./HOI4D_4Dseg/*/*/*/*/*/*/*/foreground_* +rm -f ./HOI4D_4Dseg/*/*/*/*/*/*/*/semantic_segmentation_label/*.ply +``` +The results are output in semantic_segmentation_label/*.txt. The penultimate column is the semantic label and the last column is the instance label. + +### Category-level Object Pose + +- ```anno``` refers to translation of the part. +- ```rotation``` refers to rotation of the part. +- ```dimensions``` refers to scale of the part. +Take rigid objects as an example, you can easily load the object pose using following code: + +```python +from scipy.spatial.transform import Rotation as Rt +import numpy as np + +def read_rtd(file, num=0): + with open(file, 'r') as f: + cont = f.read() + cont = eval(cont) + if "dataList" in cont: + anno = cont["dataList"][num] + else: + anno = cont["objects"][num] + + trans, rot, dim = anno["center"], anno["rotation"], anno["dimensions"] + trans = np.array([trans['x'], trans['y'], trans['z']], dtype=np.float32) + rot = np.array([rot['x'], rot['y'], rot['z']]) + dim = np.array([dim['length'], dim['width'], dim['height']], dtype=np.float32) + rot = Rt.from_euler('XYZ', rot).as_rotvec() + return np.array(rot, dtype=np.float32), trans, dim +``` + +### Human Hand Pose + +We present hand pose based on MANO parameters in each video. In each `.pickle` file: + +- `"poseCoeff"` : refers to 3 global rotation + 45 mano pose parameters +- `"beta"` : refers to 10 mano shape parameters. Shape of each human ID H* are the same. +- `"trans" ` : refers to translation of the hand in camera frame +- `"kps2D"` : refers to 21 keypoints projection coordination of rendered hand pose on each image. + +Install manopth from [here](https://github.com/hassony2/manopth.git) and put the whole `manopth` folder in the same place as your code. You may have reference problems when calling MANO. Please modify the first few lines of the corresponding files according to the actual situation. + +To get 3D keypoints and camera frame hand vertices, the following code might help: + +```python +from manopth.manopth.manolayer import ManoLayer +import pickle +import torch + +manolayer = ManoLayer( + mano_root='manopth/mano/models', use_pca=False, ncomps=45, flat_hand_mean=True, side='right') +f = open(${PKL_PATH}, 'rb') +hand_info = pickle.load(f, encoding='latin1') +f.close() + +theta = nn.Parameter(torch.FloatTensor(hand_info['poseCoeff']).unsqueeze(0)) +beta = nn.Parameter(torch.FloatTensor(hand_info['beta']).unsqueeze(0)) +trans = nn.Parameter(torch.FloatTensor(hand_info['trans']).unsqueeze(0)) +hand_verts, hand_joints = manolayer(theta, beta) +kps3d = hand_joints / 1000.0 + trans.unsqueeze(1) # in meters +hand_transformed_verts = hand_verts / 1000.0 + trans.unsqueeze(1) +``` + +## Citation + +Please cite HOI4D if it helps your research: + +```x +@inproceedings{liu2022hoi4d, + title={HOI4D: A 4D Egocentric Dataset for Category-Level Human-Object Interaction}, + author={Liu, Yunze and Liu, Yun and Jiang, Che and Lyu, Kangbo and Wan, Weikang and Shen, Hao and Liang, Boqiang and Fu, Zhoujie and Wang, He and Yi, Li}, + booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition}, + pages={21013--21022}, + year={2022} +} +``` diff --git a/third-party/HOI4D-Instructions/definitions/3D segmentation/labels.xlsx b/third-party/HOI4D-Instructions/definitions/3D segmentation/labels.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..eb267abfc4042552369f97c9c17a8065887e6e73 Binary files /dev/null and b/third-party/HOI4D-Instructions/definitions/3D segmentation/labels.xlsx differ diff --git a/third-party/HOI4D-Instructions/prepare_4Dseg/datalists/test_all.txt b/third-party/HOI4D-Instructions/prepare_4Dseg/datalists/test_all.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbf0fcdaf9b4d052961b3477611103ebceab0abf --- /dev/null +++ b/third-party/HOI4D-Instructions/prepare_4Dseg/datalists/test_all.txt @@ -0,0 +1,933 @@ +ZY20210800004/H4/C8/N03/S71/s01/T2 +ZY20210800004/H4/C8/N03/S71/s01/T1 +ZY20210800004/H4/C8/N10/S71/s03/T2 +ZY20210800004/H4/C8/N10/S71/s03/T1 +ZY20210800004/H4/C8/N01/S71/s01/T2 +ZY20210800004/H4/C8/N01/S71/s01/T1 +ZY20210800004/H4/C8/N03/S71/s01/T2 +ZY20210800004/H4/C8/N03/S71/s01/T1 +ZY20210800004/H4/C8/N01/S71/s01/T2 +ZY20210800004/H4/C8/N01/S71/s01/T1 +ZY20210800004/H4/C7/N08/S56/s03/T1 +ZY20210800004/H4/C7/N07/S56/s03/T1 +ZY20210800004/H4/C7/N03/S56/s01/T1 +ZY20210800004/H4/C7/N01/S57/s03/T1 +ZY20210800004/H4/C7/N08/S56/s03/T1 +ZY20210800004/H4/C7/N07/S56/s03/T1 +ZY20210800004/H4/C7/N05/S56/s02/T1 +ZY20210800004/H4/C7/N04/S56/s01/T1 +ZY20210800004/H4/C7/N03/S56/s01/T1 +ZY20210800004/H4/C7/N01/S57/s03/T1 +ZY20210800004/H4/C6/N09/S82/s05/T1 +ZY20210800004/H4/C6/N07/S82/s04/T2 +ZY20210800004/H4/C6/N07/S82/s04/T1 +ZY20210800004/H4/C6/N06/S82/s03/T2 +ZY20210800004/H4/C6/N06/S82/s03/T1 +ZY20210800004/H4/C6/N05/S82/s03/T1 +ZY20210800004/H4/C6/N04/S82/s02/T1 +ZY20210800004/H4/C6/N03/S82/s02/T2 +ZY20210800004/H4/C6/N03/S82/s02/T1 +ZY20210800004/H4/C6/N02/S82/s01/T2 +ZY20210800004/H4/C6/N02/S82/s01/T1 +ZY20210800004/H4/C6/N01/S82/s01/T2 +ZY20210800004/H4/C6/N01/S82/s01/T1 +ZY20210800004/H4/C5/N08/S56/s04/T1 +ZY20210800004/H4/C5/N10/S56/s05/T1 +ZY20210800004/H4/C5/N09/S366/s03/T1 +ZY20210800004/H4/C5/N09/S366/s02/T3 +ZY20210800004/H4/C5/N09/S366/s02/T1 +ZY20210800004/H4/C5/N08/S56/s04/T1 +ZY20210800004/H4/C4/N53/S372/s05/T1 +ZY20210800004/H4/C4/N53/S372/s04/T4 +ZY20210800004/H4/C4/N53/S372/s03/T3 +ZY20210800004/H4/C4/N53/S372/s02/T2 +ZY20210800004/H4/C4/N53/S372/s01/T1 +ZY20210800004/H4/C4/N52/S372/s05/T1 +ZY20210800004/H4/C4/N52/S372/s04/T4 +ZY20210800004/H4/C4/N52/S372/s03/T3 +ZY20210800004/H4/C4/N52/S372/s02/T2 +ZY20210800004/H4/C4/N52/S372/s01/T1 +ZY20210800004/H4/C4/N51/S372/s05/T1 +ZY20210800004/H4/C4/N51/S372/s04/T4 +ZY20210800004/H4/C4/N51/S372/s03/T3 +ZY20210800004/H4/C4/N51/S372/s02/T2 +ZY20210800004/H4/C4/N51/S372/s01/T1 +ZY20210800004/H4/C3/N08/S97/s04/T2 +ZY20210800004/H4/C20/N01/S301/s03/T2 +ZY20210800004/H4/C20/N01/S298/s04/T1 +ZY20210800004/H4/C2/N07/S10/s02/T1 +ZY20210800004/H4/C2/N05/S10/s01/T5 +ZY20210800004/H4/C2/N05/S10/s01/T1 +ZY20210800004/H4/C2/N04/S16/s01/T1 +ZY20210800004/H4/C2/N03/S16/s01/T1 +ZY20210800004/H4/C2/N02/S16/s01/T5 +ZY20210800004/H4/C2/N10/S11/s01/T5 +ZY20210800004/H4/C2/N01/S16/s01/T5 +ZY20210800004/H4/C2/N08/S364/s04/T1 +ZY20210800004/H4/C2/N07/S10/s02/T1 +ZY20210800004/H4/C2/N05/S10/s01/T5 +ZY20210800004/H4/C2/N05/S10/s01/T1 +ZY20210800004/H4/C2/N04/S364/s04/T1 +ZY20210800004/H4/C2/N04/S16/s01/T1 +ZY20210800004/H4/C2/N03/S16/s01/T1 +ZY20210800004/H4/C2/N02/S16/s01/T5 +ZY20210800004/H4/C2/N01/S16/s01/T5 +ZY20210800004/H4/C18/N10/S178/s03/T2 +ZY20210800004/H4/C18/N10/S160/s03/T1 +ZY20210800004/H4/C18/N09/S178/s03/T2 +ZY20210800004/H4/C18/N09/S160/s03/T1 +ZY20210800004/H4/C18/N08/S364/s02/T1 +ZY20210800004/H4/C18/N08/S178/s02/T2 +ZY20210800004/H4/C18/N08/S160/s02/T1 +ZY20210800004/H4/C18/N07/S178/s02/T2 +ZY20210800004/H4/C18/N07/S160/s02/T1 +ZY20210800004/H4/C18/N06/S178/s02/T2 +ZY20210800004/H4/C18/N06/S160/s02/T1 +ZY20210800004/H4/C18/N05/S178/s02/T2 +ZY20210800004/H4/C18/N05/S160/s02/T1 +ZY20210800004/H4/C18/N04/S364/s02/T1 +ZY20210800004/H4/C18/N04/S178/s01/T2 +ZY20210800004/H4/C18/N04/S160/s01/T1 +ZY20210800004/H4/C18/N03/S364/s03/T2 +ZY20210800004/H4/C18/N03/S178/s01/T2 +ZY20210800004/H4/C18/N03/S160/s01/T1 +ZY20210800004/H4/C18/N02/S178/s01/T2 +ZY20210800004/H4/C18/N02/S160/s01/T1 +ZY20210800004/H4/C18/N01/S178/s01/T2 +ZY20210800004/H4/C18/N01/S160/s01/T1 +ZY20210800004/H4/C17/N55/S259/s02/T1 +ZY20210800004/H4/C17/N54/S259/s01/T1 +ZY20210800004/H4/C17/N52/S259/s01/T1 +ZY20210800004/H4/C17/N51/S259/s01/T1 +ZY20210800004/H4/C17/N05/S190/s02/T3 +ZY20210800004/H4/C17/N05/S134/s05/T1 +ZY20210800004/H4/C17/N04/S190/s01/T3 +ZY20210800004/H4/C17/N04/S134/s03/T1 +ZY20210800004/H4/C17/N03/S190/s01/T2 +ZY20210800004/H4/C17/N03/S134/s03/T1 +ZY20210800004/H4/C17/N02/S134/s03/T1 +ZY20210800004/H4/C17/N01/S190/s01/T3 +ZY20210800004/H4/C17/N01/S134/s03/T1 +ZY20210800004/H4/C16/N49/S230/s01/T5 +ZY20210800004/H4/C16/N45/S281/s03/T3 +ZY20210800004/H4/C16/N44/S281/s03/T3 +ZY20210800004/H4/C16/N42/S281/s03/T3 +ZY20210800004/H4/C16/N41/S368/s01/T3 +ZY20210800004/H4/C16/N40/S230/s04/T4 +ZY20210800004/H4/C16/N39/S281/s02/T3 +ZY20210800004/H4/C16/N38/S230/s04/T2 +ZY20210800004/H4/C16/N37/S230/s03/T4 +ZY20210800004/H4/C16/N36/S230/s03/T5 +ZY20210800004/H4/C16/N35/S230/s03/T4 +ZY20210800004/H4/C16/N34/S281/s02/T3 +ZY20210800004/H4/C16/N32/S230/s02/T5 +ZY20210800004/H4/C16/N31/S281/s02/T3 +ZY20210800004/H4/C16/N30/S281/s02/T3 +ZY20210800004/H4/C16/N29/S281/s01/T3 +ZY20210800004/H4/C16/N28/S230/s01/T2 +ZY20210800004/H4/C16/N27/S281/s01/T3 +ZY20210800004/H4/C16/N25/S230/s05/T5 +ZY20210800004/H4/C16/N21/S230/s03/T5 +ZY20210800004/H4/C16/N19/S230/s02/T5 +ZY20210800004/H4/C16/N17/S230/s02/T2 +ZY20210800004/H4/C15/N50/S175/s03/T1 +ZY20210800004/H4/C15/N46/S175/s03/T1 +ZY20210800004/H4/C15/N44/S175/s02/T1 +ZY20210800004/H4/C15/N42/S175/s02/T1 +ZY20210800004/H4/C15/N25/S175/s02/T1 +ZY20210800004/H4/C15/N24/S175/s01/T1 +ZY20210800004/H4/C15/N23/S175/s01/T1 +ZY20210800004/H4/C15/N19/S172/s05/T1 +ZY20210800004/H4/C15/N18/S172/s05/T1 +ZY20210800004/H4/C15/N17/S172/s05/T1 +ZY20210800004/H4/C15/N14/S172/s04/T1 +ZY20210800004/H4/C15/N12/S172/s03/T1 +ZY20210800004/H4/C15/N11/S172/s03/T1 +ZY20210800004/H4/C15/N10/S172/s03/T1 +ZY20210800004/H4/C15/N08/S172/s02/T1 +ZY20210800004/H4/C15/N06/S172/s02/T1 +ZY20210800004/H4/C15/N04/S172/s01/T1 +ZY20210800004/H4/C14/N10/S210/s03/T2 +ZY20210800004/H4/C14/N10/S174/s04/T1 +ZY20210800004/H4/C14/N09/S210/s03/T2 +ZY20210800004/H4/C14/N09/S174/s05/T1 +ZY20210800004/H4/C14/N08/S210/s02/T2 +ZY20210800004/H4/C14/N07/S210/s02/T2 +ZY20210800004/H4/C14/N07/S174/s05/T1 +ZY20210800004/H4/C14/N06/S210/s02/T2 +ZY20210800004/H4/C14/N06/S174/s05/T1 +ZY20210800004/H4/C14/N05/S210/s02/T2 +ZY20210800004/H4/C14/N05/S177/s01/T1 +ZY20210800004/H4/C14/N04/S210/s01/T2 +ZY20210800004/H4/C14/N04/S177/s01/T1 +ZY20210800004/H4/C14/N03/S210/s01/T2 +ZY20210800004/H4/C14/N03/S177/s01/T1 +ZY20210800004/H4/C14/N02/S210/s01/T2 +ZY20210800004/H4/C14/N01/S210/s01/T2 +ZY20210800004/H4/C14/N01/S177/s02/T1 +ZY20210800004/H4/C13/N07/S365/s01/T1 +ZY20210800004/H4/C11/N66/S384/s05/T4 +ZY20210800004/H4/C11/N66/S384/s04/T4 +ZY20210800004/H4/C11/N66/S384/s03/T3 +ZY20210800004/H4/C11/N66/S384/s02/T2 +ZY20210800004/H4/C11/N66/S384/s01/T1 +ZY20210800004/H4/C11/N65/S384/s05/T4 +ZY20210800004/H4/C11/N65/S384/s04/T4 +ZY20210800004/H4/C11/N65/S384/s03/T3 +ZY20210800004/H4/C11/N65/S384/s02/T2 +ZY20210800004/H4/C11/N65/S384/s01/T1 +ZY20210800004/H4/C11/N64/S384/s05/T4 +ZY20210800004/H4/C11/N64/S384/s04/T4 +ZY20210800004/H4/C11/N64/S384/s03/T3 +ZY20210800004/H4/C11/N64/S384/s02/T2 +ZY20210800004/H4/C11/N64/S384/s01/T1 +ZY20210800004/H4/C11/N63/S383/s05/T4 +ZY20210800004/H4/C11/N63/S383/s04/T4 +ZY20210800004/H4/C11/N63/S383/s03/T3 +ZY20210800004/H4/C11/N63/S383/s01/T1 +ZY20210800004/H4/C1/N18/S242/s02/T2 +ZY20210800004/H4/C1/N18/S237/s05/T1 +ZY20210800004/H4/C1/N18/S194/s05/T4 +ZY20210800004/H4/C1/N17/S242/s02/T2 +ZY20210800004/H4/C1/N17/S237/s05/T1 +ZY20210800004/H4/C1/N17/S194/s05/T4 +ZY20210800004/H4/C1/N16/S9/s04/T3 +ZY20210800004/H4/C1/N16/S242/s02/T2 +ZY20210800004/H4/C1/N16/S237/s04/T1 +ZY20210800004/H4/C1/N16/S194/s04/T4 +ZY20210800004/H4/C1/N15/S242/s02/T2 +ZY20210800004/H4/C1/N15/S237/s04/T1 +ZY20210800004/H4/C1/N15/S194/s04/T4 +ZY20210800004/H4/C1/N12/S242/s01/T2 +ZY20210800004/H4/C1/N12/S237/s03/T1 +ZY20210800004/H4/C1/N12/S194/s03/T4 +ZY20210800004/H4/C1/N11/S242/s01/T2 +ZY20210800004/H4/C1/N11/S237/s03/T1 +ZY20210800004/H4/C1/N11/S194/s03/T4 +ZY20210800004/H4/C1/N10/S237/s03/T1 +ZY20210800004/H4/C1/N10/S194/s03/T4 +ZY20210800004/H4/C1/N09/S237/s03/T1 +ZY20210800004/H4/C1/N09/S194/s03/T4 +ZY20210800004/H4/C1/N09/S18/s01/T3 +ZY20210800004/H4/C1/N09/S18/s01/T1 +ZY20210800004/H4/C1/N08/S237/s02/T1 +ZY20210800004/H4/C1/N08/S194/s02/T4 +ZY20210800004/H4/C1/N07/S237/s02/T1 +ZY20210800004/H4/C1/N07/S194/s02/T4 +ZY20210800003/H3/C9/N10/S300/s01/T2 +ZY20210800003/H3/C9/N09/S306/s02/T2 +ZY20210800003/H3/C9/N09/S300/s01/T2 +ZY20210800003/H3/C9/N07/S306/s02/T2 +ZY20210800003/H3/C9/N05/S306/s02/T2 +ZY20210800003/H3/C9/N03/S306/s01/T2 +ZY20210800003/H3/C9/N01/S306/s01/T2 +ZY20210800003/H3/C5/N10/S57/s05/T4 +ZY20210800003/H3/C5/N06/S57/s03/T4 +ZY20210800003/H3/C5/N05/S57/s03/T1 +ZY20210800003/H3/C5/N03/S57/s02/T4 +ZY20210800003/H3/C5/N02/S57/s01/T1 +ZY20210800003/H3/C3/N44/S284/s01/T2 +ZY20210800003/H3/C20/N10/S284/s04/T4 +ZY20210800003/H3/C20/N10/S284/s01/T3 +ZY20210800003/H3/C20/N10/S282/s02/T2 +ZY20210800003/H3/C20/N10/S279/s03/T1 +ZY20210800003/H3/C20/N09/S279/s02/T1 +ZY20210800003/H3/C20/N08/S284/s04/T4 +ZY20210800003/H3/C20/N08/S282/s05/T3 +ZY20210800003/H3/C20/N08/S282/s01/T2 +ZY20210800003/H3/C20/N08/S279/s02/T1 +ZY20210800003/H3/C20/N07/S284/s04/T4 +ZY20210800003/H3/C20/N07/S282/s05/T3 +ZY20210800003/H3/C20/N07/S282/s01/T2 +ZY20210800003/H3/C20/N07/S279/s02/T1 +ZY20210800003/H3/C20/N06/S284/s03/T4 +ZY20210800003/H3/C20/N06/S282/s05/T3 +ZY20210800003/H3/C20/N06/S282/s01/T2 +ZY20210800003/H3/C20/N06/S279/s02/T1 +ZY20210800003/H3/C20/N05/S284/s03/T4 +ZY20210800003/H3/C20/N05/S282/s04/T3 +ZY20210800003/H3/C20/N05/S279/s05/T2 +ZY20210800003/H3/C20/N05/S279/s01/T1 +ZY20210800003/H3/C20/N04/S284/s03/T4 +ZY20210800003/H3/C20/N04/S282/s04/T3 +ZY20210800003/H3/C20/N04/S279/s05/T2 +ZY20210800003/H3/C20/N04/S279/s01/T1 +ZY20210800003/H3/C20/N03/S284/s03/T4 +ZY20210800003/H3/C20/N03/S282/s04/T3 +ZY20210800003/H3/C20/N03/S279/s05/T2 +ZY20210800003/H3/C20/N03/S279/s01/T1 +ZY20210800003/H3/C20/N02/S284/s02/T4 +ZY20210800003/H3/C20/N02/S282/s04/T3 +ZY20210800003/H3/C20/N02/S279/s01/T1 +ZY20210800003/H3/C2/N10/S215/s03/T5 +ZY20210800003/H3/C2/N09/S215/s03/T5 +ZY20210800003/H3/C2/N08/S215/s02/T4 +ZY20210800003/H3/C2/N07/S215/s02/T4 +ZY20210800003/H3/C2/N06/S215/s02/T4 +ZY20210800003/H3/C2/N05/S52/s04/T1 +ZY20210800003/H3/C2/N05/S215/s02/T4 +ZY20210800003/H3/C2/N04/S52/s03/T1 +ZY20210800003/H3/C2/N04/S215/s01/T4 +ZY20210800003/H3/C2/N03/S52/s03/T1 +ZY20210800003/H3/C2/N03/S215/s01/T4 +ZY20210800003/H3/C2/N02/S52/s02/T1 +ZY20210800003/H3/C2/N02/S215/s01/T4 +ZY20210800003/H3/C2/N01/S52/s02/T1 +ZY20210800003/H3/C2/N01/S215/s01/T4 +ZY20210800003/H3/C18/N10/S139/s03/T1 +ZY20210800003/H3/C18/N09/S139/s03/T1 +ZY20210800003/H3/C18/N08/S139/s02/T1 +ZY20210800003/H3/C18/N04/S139/s01/T1 +ZY20210800003/H3/C17/N55/S264/s02/T1 +ZY20210800003/H3/C17/N54/S264/s01/T1 +ZY20210800003/H3/C17/N52/S264/s01/T1 +ZY20210800003/H3/C17/N51/S264/s01/T1 +ZY20210800003/H3/C17/N05/S167/s02/T2 +ZY20210800003/H3/C17/N05/S126/s02/T1 +ZY20210800003/H3/C17/N04/S167/s01/T2 +ZY20210800003/H3/C17/N04/S126/s01/T1 +ZY20210800003/H3/C17/N03/S167/s01/T2 +ZY20210800003/H3/C17/N03/S126/s01/T1 +ZY20210800003/H3/C17/N02/S126/s01/T1 +ZY20210800003/H3/C17/N01/S167/s01/T2 +ZY20210800003/H3/C17/N01/S126/s01/T1 +ZY20210800003/H3/C16/N46/S229/s03/T5 +ZY20210800003/H3/C16/N24/S229/s01/T4 +ZY20210800003/H3/C16/N22/S229/s01/T4 +ZY20210800003/H3/C16/N21/S229/s01/T4 +ZY20210800003/H3/C16/N19/S228/s05/T4 +ZY20210800003/H3/C16/N18/S228/s05/T3 +ZY20210800003/H3/C16/N17/S228/s05/T3 +ZY20210800003/H3/C16/N16/S228/s04/T3 +ZY20210800003/H3/C16/N15/S228/s04/T3 +ZY20210800003/H3/C16/N14/S228/s04/T3 +ZY20210800003/H3/C16/N13/S228/s04/T3 +ZY20210800003/H3/C16/N11/S228/s03/T3 +ZY20210800003/H3/C16/N10/S228/s03/T3 +ZY20210800003/H3/C16/N03/S228/s01/T2 +ZY20210800003/H3/C16/N01/S228/s01/T2 +ZY20210800003/H3/C15/N34/S168/s03/T1 +ZY20210800003/H3/C15/N22/S168/s01/T1 +ZY20210800003/H3/C14/N09/S209/s03/T2 +ZY20210800003/H3/C14/N09/S170/s03/T1 +ZY20210800003/H3/C14/N07/S209/s03/T2 +ZY20210800003/H3/C14/N07/S170/s03/T1 +ZY20210800003/H3/C14/N05/S209/s02/T2 +ZY20210800003/H3/C14/N05/S170/s02/T1 +ZY20210800003/H3/C14/N03/S209/s02/T2 +ZY20210800003/H3/C14/N03/S170/s02/T1 +ZY20210800003/H3/C14/N01/S209/s02/T2 +ZY20210800003/H3/C14/N01/S170/s02/T1 +ZY20210800003/H3/C13/N09/S203/s03/T4 +ZY20210800003/H3/C13/N09/S144/s03/T1 +ZY20210800003/H3/C13/N07/S203/s03/T4 +ZY20210800003/H3/C13/N07/S144/s03/T1 +ZY20210800003/H3/C13/N05/S203/s02/T4 +ZY20210800003/H3/C13/N05/S144/s02/T1 +ZY20210800003/H3/C13/N03/S203/s02/T4 +ZY20210800003/H3/C13/N03/S144/s02/T1 +ZY20210800003/H3/C13/N01/S346/s02/T4 +ZY20210800003/H3/C13/N01/S144/s02/T1 +ZY20210800003/H3/C12/N10/S206/s03/T2 +ZY20210800003/H3/C12/N10/S173/s03/T1 +ZY20210800003/H3/C12/N09/S206/s03/T2 +ZY20210800003/H3/C12/N09/S173/s03/T1 +ZY20210800003/H3/C12/N08/S206/s02/T2 +ZY20210800003/H3/C12/N08/S173/s02/T1 +ZY20210800003/H3/C12/N07/S206/s02/T2 +ZY20210800003/H3/C12/N07/S173/s02/T1 +ZY20210800003/H3/C12/N06/S206/s02/T2 +ZY20210800003/H3/C12/N06/S173/s02/T1 +ZY20210800003/H3/C12/N05/S206/s02/T2 +ZY20210800003/H3/C12/N05/S173/s02/T1 +ZY20210800003/H3/C12/N04/S206/s01/T2 +ZY20210800003/H3/C12/N04/S173/s01/T1 +ZY20210800003/H3/C12/N03/S206/s01/T2 +ZY20210800003/H3/C12/N03/S173/s01/T1 +ZY20210800003/H3/C12/N02/S206/s01/T2 +ZY20210800003/H3/C12/N02/S173/s01/T1 +ZY20210800003/H3/C12/N01/S206/s01/T2 +ZY20210800003/H3/C12/N01/S173/s01/T1 +ZY20210800003/H3/C11/N05/S182/s02/T4 +ZY20210800003/H3/C11/N05/S151/s02/T1 +ZY20210800003/H3/C11/N03/S182/s02/T4 +ZY20210800003/H3/C11/N03/S151/s02/T1 +ZY20210800003/H3/C11/N01/S182/s02/T4 +ZY20210800003/H3/C11/N01/S151/s02/T1 +ZY20210800003/H3/C1/N17/S86/s05/T2 +ZY20210800003/H3/C1/N17/S86/s05/T1 +ZY20210800003/H3/C1/N11/S90/s03/T2 +ZY20210800003/H3/C1/N11/S90/s03/T1 +ZY20210800003/H3/C1/N10/S90/s01/T2 +ZY20210800003/H3/C1/N10/S90/s01/T1 +ZY20210800003/H3/C1/N09/S83/s01/T1 +ZY20210800002/H2/C9/N10/S350/s01/T2 +ZY20210800002/H2/C9/N09/S350/s01/T2 +ZY20210800002/H2/C9/N08/S344/s05/T2 +ZY20210800002/H2/C9/N07/S344/s05/T2 +ZY20210800002/H2/C9/N06/S347/s02/T1 +ZY20210800002/H2/C9/N06/S344/s05/T2 +ZY20210800002/H2/C9/N05/S344/s05/T2 +ZY20210800002/H2/C9/N04/S347/s01/T1 +ZY20210800002/H2/C9/N04/S344/s04/T2 +ZY20210800002/H2/C9/N03/S347/s01/T1 +ZY20210800002/H2/C9/N03/S344/s04/T2 +ZY20210800002/H2/C9/N02/S347/s01/T1 +ZY20210800002/H2/C9/N02/S344/s04/T2 +ZY20210800002/H2/C9/N01/S347/s01/T1 +ZY20210800002/H2/C9/N01/S344/s04/T2 +ZY20210800002/H2/C8/N10/S71/s05/T2 +ZY20210800002/H2/C8/N10/S71/s05/T1 +ZY20210800002/H2/C8/N09/S71/s05/T2 +ZY20210800002/H2/C8/N09/S71/s05/T1 +ZY20210800002/H2/C8/N08/S71/s04/T2 +ZY20210800002/H2/C8/N08/S71/s04/T1 +ZY20210800002/H2/C8/N07/S71/s04/T2 +ZY20210800002/H2/C8/N07/S71/s04/T1 +ZY20210800002/H2/C8/N06/S71/s03/T2 +ZY20210800002/H2/C8/N06/S71/s03/T1 +ZY20210800002/H2/C8/N05/S71/s03/T2 +ZY20210800002/H2/C8/N05/S71/s03/T1 +ZY20210800002/H2/C8/N04/S71/s02/T2 +ZY20210800002/H2/C8/N04/S71/s02/T1 +ZY20210800002/H2/C8/N03/S71/s02/T2 +ZY20210800002/H2/C8/N03/S71/s02/T1 +ZY20210800002/H2/C8/N02/S71/s01/T2 +ZY20210800002/H2/C8/N02/S71/s01/T1 +ZY20210800002/H2/C8/N01/S71/s01/T1 +ZY20210800002/H2/C7/N10/S55/s05/T3 +ZY20210800002/H2/C7/N10/S55/s05/T1 +ZY20210800002/H2/C7/N09/S55/s05/T3 +ZY20210800002/H2/C7/N09/S55/s05/T1 +ZY20210800002/H2/C7/N08/S55/s04/T3 +ZY20210800002/H2/C7/N08/S55/s04/T1 +ZY20210800002/H2/C7/N06/S55/s03/T3 +ZY20210800002/H2/C7/N06/S55/s03/T1 +ZY20210800002/H2/C7/N05/S55/s03/T3 +ZY20210800002/H2/C7/N05/S55/s03/T1 +ZY20210800002/H2/C7/N04/S55/s02/T3 +ZY20210800002/H2/C7/N04/S55/s02/T1 +ZY20210800002/H2/C7/N03/S55/s02/T3 +ZY20210800002/H2/C7/N03/S55/s02/T1 +ZY20210800002/H2/C7/N02/S55/s01/T3 +ZY20210800002/H2/C7/N02/S55/s01/T1 +ZY20210800002/H2/C7/N01/S55/s01/T3 +ZY20210800002/H2/C7/N01/S55/s01/T1 +ZY20210800002/H2/C5/N10/S267/s03/T5 +ZY20210800002/H2/C5/N10/S261/s05/T3 +ZY20210800002/H2/C5/N10/S255/s03/T1 +ZY20210800002/H2/C5/N10/S122/s05/T1 +ZY20210800002/H2/C5/N09/S267/s03/T5 +ZY20210800002/H2/C5/N09/S261/s05/T3 +ZY20210800002/H2/C5/N09/S255/s03/T1 +ZY20210800002/H2/C5/N09/S122/s02/T1 +ZY20210800002/H2/C5/N08/S267/s02/T5 +ZY20210800002/H2/C5/N08/S261/s05/T3 +ZY20210800002/H2/C5/N08/S255/s02/T1 +ZY20210800002/H2/C5/N08/S122/s04/T3 +ZY20210800002/H2/C5/N08/S122/s04/T1 +ZY20210800002/H2/C5/N07/S267/s02/T5 +ZY20210800002/H2/C5/N07/S261/s05/T3 +ZY20210800002/H2/C5/N07/S255/s02/T1 +ZY20210800002/H2/C5/N07/S122/s04/T3 +ZY20210800002/H2/C5/N07/S122/s04/T1 +ZY20210800002/H2/C5/N06/S267/s02/T5 +ZY20210800002/H2/C5/N06/S261/s04/T3 +ZY20210800002/H2/C5/N06/S255/s02/T1 +ZY20210800002/H2/C5/N06/S122/s03/T1 +ZY20210800002/H2/C5/N05/S267/s02/T5 +ZY20210800002/H2/C5/N05/S261/s04/T3 +ZY20210800002/H2/C5/N05/S255/s02/T1 +ZY20210800002/H2/C5/N04/S267/s01/T5 +ZY20210800002/H2/C5/N04/S261/s04/T3 +ZY20210800002/H2/C5/N04/S255/s01/T1 +ZY20210800002/H2/C5/N04/S122/s02/T3 +ZY20210800002/H2/C5/N04/S122/s02/T1 +ZY20210800002/H2/C5/N03/S267/s01/T5 +ZY20210800002/H2/C5/N03/S261/s04/T3 +ZY20210800002/H2/C5/N03/S255/s01/T1 +ZY20210800002/H2/C5/N02/S267/s01/T5 +ZY20210800002/H2/C5/N02/S261/s03/T3 +ZY20210800002/H2/C5/N02/S255/s01/T1 +ZY20210800002/H2/C5/N02/S122/s01/T3 +ZY20210800002/H2/C5/N02/S122/s01/T1 +ZY20210800002/H2/C5/N01/S267/s01/T5 +ZY20210800002/H2/C5/N01/S261/s03/T3 +ZY20210800002/H2/C5/N01/S255/s01/T1 +ZY20210800002/H2/C5/N01/S122/s01/T1 +ZY20210800002/H2/C20/N10/S275/s05/T4 +ZY20210800002/H2/C20/N10/S275/s01/T2 +ZY20210800002/H2/C20/N10/S273/s02/T3 +ZY20210800002/H2/C20/N10/S271/s03/T1 +ZY20210800002/H2/C20/N09/S273/s02/T3 +ZY20210800002/H2/C20/N08/S275/s04/T4 +ZY20210800002/H2/C20/N08/S273/s05/T2 +ZY20210800002/H2/C20/N08/S273/s01/T3 +ZY20210800002/H2/C20/N08/S271/s02/T1 +ZY20210800002/H2/C20/N07/S275/s04/T4 +ZY20210800002/H2/C20/N07/S273/s05/T2 +ZY20210800002/H2/C20/N07/S273/s01/T3 +ZY20210800002/H2/C20/N06/S275/s04/T4 +ZY20210800002/H2/C20/N06/S273/s05/T2 +ZY20210800002/H2/C20/N06/S273/s01/T3 +ZY20210800002/H2/C20/N06/S271/s02/T1 +ZY20210800002/H2/C20/N05/S275/s03/T4 +ZY20210800002/H2/C20/N05/S273/s04/T2 +ZY20210800002/H2/C20/N05/S273/s01/T3 +ZY20210800002/H2/C20/N04/S275/s03/T4 +ZY20210800002/H2/C20/N04/S273/s04/T2 +ZY20210800002/H2/C20/N04/S271/s05/T3 +ZY20210800002/H2/C20/N04/S271/s01/T1 +ZY20210800002/H2/C20/N03/S275/s03/T4 +ZY20210800002/H2/C20/N03/S273/s04/T2 +ZY20210800002/H2/C20/N03/S271/s05/T3 +ZY20210800002/H2/C20/N03/S271/s01/T1 +ZY20210800002/H2/C20/N02/S275/s03/T4 +ZY20210800002/H2/C20/N02/S273/s04/T2 +ZY20210800002/H2/C20/N02/S271/s05/T3 +ZY20210800002/H2/C20/N02/S271/s01/T1 +ZY20210800002/H2/C20/N01/S275/s02/T4 +ZY20210800002/H2/C20/N01/S273/s03/T2 +ZY20210800002/H2/C20/N01/S271/s05/T3 +ZY20210800002/H2/C2/N10/S28/s05/T3 +ZY20210800002/H2/C2/N10/S28/s05/T1 +ZY20210800002/H2/C2/N09/S28/s05/T3 +ZY20210800002/H2/C2/N09/S28/s05/T1 +ZY20210800002/H2/C2/N06/S28/s03/T3 +ZY20210800002/H2/C2/N05/S28/s03/T3 +ZY20210800002/H2/C2/N04/S28/s02/T1 +ZY20210800002/H2/C2/N02/S28/s01/T1 +ZY20210800002/H2/C18/N09/S241/s03/T2 +ZY20210800002/H2/C18/N09/S135/s03/T1 +ZY20210800002/H2/C18/N07/S241/s03/T2 +ZY20210800002/H2/C18/N07/S135/s03/T1 +ZY20210800002/H2/C18/N05/S241/s02/T2 +ZY20210800002/H2/C18/N05/S135/s02/T1 +ZY20210800002/H2/C18/N03/S135/s02/T1 +ZY20210800002/H2/C18/N01/S135/s02/T1 +ZY20210800002/H2/C17/N55/S256/s03/T3 +ZY20210800002/H2/C17/N55/S253/s02/T1 +ZY20210800002/H2/C17/N54/S256/s03/T3 +ZY20210800002/H2/C17/N54/S253/s01/T1 +ZY20210800002/H2/C17/N52/S256/s02/T3 +ZY20210800002/H2/C17/N52/S253/s01/T1 +ZY20210800002/H2/C17/N51/S256/s02/T3 +ZY20210800002/H2/C17/N51/S253/s01/T1 +ZY20210800002/H2/C17/N05/S159/s02/T3 +ZY20210800002/H2/C17/N05/S152/s02/T1 +ZY20210800002/H2/C17/N04/S356/s01/T1 +ZY20210800002/H2/C17/N03/S159/s02/T3 +ZY20210800002/H2/C17/N03/S152/s02/T1 +ZY20210800002/H2/C17/N01/S159/s02/T3 +ZY20210800002/H2/C17/N01/S152/s02/T1 +ZY20210800002/H2/C16/N34/S227/s03/T3 +ZY20210800002/H2/C16/N32/S227/s03/T2 +ZY20210800002/H2/C16/N30/S227/s02/T3 +ZY20210800002/H2/C16/N28/S227/s02/T3 +ZY20210800002/H2/C16/N25/S227/s02/T3 +ZY20210800002/H2/C16/N22/S227/s01/T3 +ZY20210800002/H2/C16/N21/S227/s01/T2 +ZY20210800002/H2/C16/N19/S226/s05/T2 +ZY20210800002/H2/C16/N16/S226/s04/T2 +ZY20210800002/H2/C16/N15/S226/s04/T4 +ZY20210800002/H2/C16/N14/S226/s04/T5 +ZY20210800002/H2/C16/N10/S226/s03/T4 +ZY20210800002/H2/C16/N06/S226/s02/T2 +ZY20210800002/H2/C15/N25/S156/s03/T1 +ZY20210800002/H2/C14/N10/S185/s03/T2 +ZY20210800002/H2/C14/N10/S161/s03/T1 +ZY20210800002/H2/C14/N09/S185/s03/T2 +ZY20210800002/H2/C14/N09/S161/s03/T1 +ZY20210800002/H2/C14/N08/S185/s02/T2 +ZY20210800002/H2/C14/N08/S161/s02/T1 +ZY20210800002/H2/C14/N07/S185/s02/T2 +ZY20210800002/H2/C14/N07/S161/s02/T1 +ZY20210800002/H2/C14/N06/S185/s02/T2 +ZY20210800002/H2/C14/N06/S161/s02/T1 +ZY20210800002/H2/C14/N05/S185/s02/T2 +ZY20210800002/H2/C14/N05/S161/s02/T1 +ZY20210800002/H2/C14/N04/S185/s01/T2 +ZY20210800002/H2/C14/N04/S161/s01/T1 +ZY20210800002/H2/C14/N03/S185/s01/T2 +ZY20210800002/H2/C14/N03/S161/s01/T1 +ZY20210800002/H2/C14/N02/S185/s01/T2 +ZY20210800002/H2/C14/N02/S161/s01/T1 +ZY20210800002/H2/C14/N01/S185/s01/T2 +ZY20210800002/H2/C14/N01/S161/s01/T1 +ZY20210800002/H2/C13/N10/S189/s03/T4 +ZY20210800002/H2/C13/N10/S124/s03/T1 +ZY20210800002/H2/C13/N09/S189/s03/T4 +ZY20210800002/H2/C13/N09/S124/s03/T1 +ZY20210800002/H2/C13/N08/S189/s02/T4 +ZY20210800002/H2/C13/N08/S124/s02/T1 +ZY20210800002/H2/C13/N07/S189/s02/T4 +ZY20210800002/H2/C13/N07/S124/s02/T1 +ZY20210800002/H2/C13/N06/S189/s02/T4 +ZY20210800002/H2/C13/N06/S124/s02/T1 +ZY20210800002/H2/C13/N05/S189/s02/T4 +ZY20210800002/H2/C13/N05/S124/s02/T1 +ZY20210800002/H2/C13/N04/S189/s01/T4 +ZY20210800002/H2/C13/N04/S124/s01/T1 +ZY20210800002/H2/C13/N03/S189/s01/T4 +ZY20210800002/H2/C13/N03/S124/s01/T1 +ZY20210800002/H2/C13/N02/S189/s01/T4 +ZY20210800002/H2/C13/N02/S124/s01/T1 +ZY20210800002/H2/C13/N01/S189/s01/T4 +ZY20210800002/H2/C13/N01/S124/s01/T1 +ZY20210800002/H2/C12/N10/S346/s02/T2 +ZY20210800002/H2/C12/N10/S196/s03/T2 +ZY20210800002/H2/C12/N10/S154/s03/T1 +ZY20210800002/H2/C12/N09/S196/s03/T2 +ZY20210800002/H2/C12/N09/S154/s03/T1 +ZY20210800002/H2/C12/N08/S196/s02/T2 +ZY20210800002/H2/C12/N08/S154/s02/T1 +ZY20210800002/H2/C12/N07/S196/s02/T2 +ZY20210800002/H2/C12/N07/S154/s02/T1 +ZY20210800002/H2/C12/N06/S196/s02/T2 +ZY20210800002/H2/C12/N06/S154/s02/T1 +ZY20210800002/H2/C12/N05/S196/s02/T2 +ZY20210800002/H2/C12/N05/S154/s02/T1 +ZY20210800002/H2/C12/N04/S346/s01/T1 +ZY20210800002/H2/C12/N04/S196/s01/T2 +ZY20210800002/H2/C12/N04/S154/s01/T1 +ZY20210800002/H2/C12/N03/S196/s01/T2 +ZY20210800002/H2/C12/N03/S154/s01/T1 +ZY20210800002/H2/C12/N02/S196/s01/T2 +ZY20210800002/H2/C12/N02/S154/s01/T1 +ZY20210800002/H2/C12/N01/S346/s02/T1 +ZY20210800002/H2/C12/N01/S196/s01/T2 +ZY20210800002/H2/C12/N01/S154/s01/T1 +ZY20210800002/H2/C11/N06/S201/s02/T4 +ZY20210800002/H2/C11/N06/S133/s02/T1 +ZY20210800002/H2/C11/N05/S201/s02/T4 +ZY20210800002/H2/C11/N05/S133/s02/T1 +ZY20210800002/H2/C11/N04/S359/s01/T4 +ZY20210800002/H2/C11/N04/S201/s01/T4 +ZY20210800002/H2/C11/N04/S133/s01/T1 +ZY20210800002/H2/C11/N03/S201/s01/T4 +ZY20210800002/H2/C11/N03/S133/s01/T1 +ZY20210800002/H2/C11/N02/S201/s01/T4 +ZY20210800002/H2/C11/N02/S133/s01/T1 +ZY20210800002/H2/C11/N01/S359/s01/T4 +ZY20210800002/H2/C11/N01/S201/s01/T4 +ZY20210800002/H2/C11/N01/S133/s01/T1 +ZY20210800002/H2/C10/N48/S329/s05/T3 +ZY20210800002/H2/C10/N33/S329/s01/T3 +ZY20210800002/H2/C1/N09/S88/s01/T1 +ZY20210800001/H1/C9/N10/S32/s05/T2 +ZY20210800001/H1/C9/N10/S32/s05/T1 +ZY20210800001/H1/C9/N09/S32/s05/T2 +ZY20210800001/H1/C9/N09/S32/s05/T1 +ZY20210800001/H1/C9/N08/S32/s04/T2 +ZY20210800001/H1/C9/N08/S32/s04/T1 +ZY20210800001/H1/C9/N07/S32/s04/T2 +ZY20210800001/H1/C9/N07/S32/s04/T1 +ZY20210800001/H1/C9/N05/S32/s03/T2 +ZY20210800001/H1/C9/N05/S32/s03/T1 +ZY20210800001/H1/C9/N04/S32/s02/T2 +ZY20210800001/H1/C9/N04/S32/s02/T1 +ZY20210800001/H1/C9/N03/S32/s02/T2 +ZY20210800001/H1/C9/N03/S32/s02/T1 +ZY20210800001/H1/C9/N02/S32/s01/T2 +ZY20210800001/H1/C9/N01/S32/s03/T2 +ZY20210800001/H1/C8/N09/S72/s05/T2 +ZY20210800001/H1/C8/N09/S72/s05/T1 +ZY20210800001/H1/C8/N08/S72/s04/T2 +ZY20210800001/H1/C8/N08/S72/s04/T1 +ZY20210800001/H1/C8/N07/S72/s04/T2 +ZY20210800001/H1/C8/N07/S72/s04/T1 +ZY20210800001/H1/C8/N06/S72/s03/T2 +ZY20210800001/H1/C8/N06/S72/s03/T1 +ZY20210800001/H1/C8/N05/S72/s03/T2 +ZY20210800001/H1/C8/N05/S72/s03/T1 +ZY20210800001/H1/C8/N04/S72/s02/T2 +ZY20210800001/H1/C8/N04/S72/s02/T1 +ZY20210800001/H1/C8/N03/S72/s02/T2 +ZY20210800001/H1/C8/N03/S72/s02/T1 +ZY20210800001/H1/C8/N02/S72/s01/T2 +ZY20210800001/H1/C8/N02/S72/s01/T1 +ZY20210800001/H1/C8/N10/S72/s05/T2 +ZY20210800001/H1/C8/N10/S72/s05/T1 +ZY20210800001/H1/C8/N10/S321/s03/T2 +ZY20210800001/H1/C8/N10/S315/s05/T1 +ZY20210800001/H1/C8/N10/S311/s03/T1 +ZY20210800001/H1/C8/N01/S72/s01/T2 +ZY20210800001/H1/C8/N01/S72/s01/T1 +ZY20210800001/H1/C8/N09/S72/s05/T2 +ZY20210800001/H1/C8/N09/S72/s05/T1 +ZY20210800001/H1/C8/N09/S321/s03/T2 +ZY20210800001/H1/C8/N09/S315/s05/T1 +ZY20210800001/H1/C8/N09/S311/s03/T1 +ZY20210800001/H1/C8/N08/S72/s04/T2 +ZY20210800001/H1/C8/N08/S72/s04/T1 +ZY20210800001/H1/C8/N08/S321/s02/T2 +ZY20210800001/H1/C8/N08/S315/s05/T1 +ZY20210800001/H1/C8/N08/S311/s02/T1 +ZY20210800001/H1/C8/N07/S72/s04/T2 +ZY20210800001/H1/C8/N07/S72/s04/T1 +ZY20210800001/H1/C8/N07/S321/s02/T2 +ZY20210800001/H1/C8/N07/S315/s05/T1 +ZY20210800001/H1/C8/N07/S311/s02/T1 +ZY20210800001/H1/C8/N06/S72/s03/T2 +ZY20210800001/H1/C8/N06/S72/s03/T1 +ZY20210800001/H1/C8/N06/S321/s02/T2 +ZY20210800001/H1/C8/N06/S315/s04/T1 +ZY20210800001/H1/C8/N06/S311/s02/T1 +ZY20210800001/H1/C8/N05/S72/s03/T2 +ZY20210800001/H1/C8/N05/S72/s03/T1 +ZY20210800001/H1/C8/N05/S321/s02/T2 +ZY20210800001/H1/C8/N05/S315/s04/T1 +ZY20210800001/H1/C8/N05/S311/s02/T1 +ZY20210800001/H1/C8/N04/S72/s02/T2 +ZY20210800001/H1/C8/N04/S72/s02/T1 +ZY20210800001/H1/C8/N04/S321/s01/T2 +ZY20210800001/H1/C8/N04/S315/s04/T1 +ZY20210800001/H1/C8/N04/S311/s01/T1 +ZY20210800001/H1/C8/N03/S72/s02/T2 +ZY20210800001/H1/C8/N03/S72/s02/T1 +ZY20210800001/H1/C8/N03/S321/s01/T2 +ZY20210800001/H1/C8/N03/S315/s04/T1 +ZY20210800001/H1/C8/N03/S311/s01/T1 +ZY20210800001/H1/C8/N02/S72/s01/T2 +ZY20210800001/H1/C8/N02/S72/s01/T1 +ZY20210800001/H1/C8/N02/S315/s03/T1 +ZY20210800001/H1/C8/N02/S311/s01/T1 +ZY20210800001/H1/C8/N01/S72/s01/T2 +ZY20210800001/H1/C8/N01/S72/s01/T1 +ZY20210800001/H1/C8/N01/S321/s01/T2 +ZY20210800001/H1/C8/N01/S315/s03/T1 +ZY20210800001/H1/C8/N01/S311/s01/T1 +ZY20210800001/H1/C7/N10/S280/s03/T5 +ZY20210800001/H1/C7/N10/S274/s05/T3 +ZY20210800001/H1/C7/N10/S270/s03/T1 +ZY20210800001/H1/C7/N01/S59/s01/T2 +ZY20210800001/H1/C7/N01/S59/s01/T1 +ZY20210800001/H1/C7/N09/S280/s03/T5 +ZY20210800001/H1/C7/N09/S274/s05/T3 +ZY20210800001/H1/C7/N09/S270/s03/T1 +ZY20210800001/H1/C7/N08/S280/s02/T5 +ZY20210800001/H1/C7/N08/S274/s05/T3 +ZY20210800001/H1/C7/N08/S270/s02/T1 +ZY20210800001/H1/C7/N07/S280/s02/T5 +ZY20210800001/H1/C7/N07/S274/s05/T3 +ZY20210800001/H1/C7/N07/S270/s02/T1 +ZY20210800001/H1/C7/N06/S280/s02/T5 +ZY20210800001/H1/C7/N06/S274/s04/T3 +ZY20210800001/H1/C7/N06/S270/s02/T1 +ZY20210800001/H1/C7/N05/S280/s02/T5 +ZY20210800001/H1/C7/N05/S274/s04/T3 +ZY20210800001/H1/C7/N05/S270/s02/T1 +ZY20210800001/H1/C7/N04/S280/s01/T5 +ZY20210800001/H1/C7/N04/S274/s04/T3 +ZY20210800001/H1/C7/N04/S270/s01/T1 +ZY20210800001/H1/C7/N03/S280/s01/T5 +ZY20210800001/H1/C7/N03/S274/s04/T3 +ZY20210800001/H1/C7/N03/S270/s01/T1 +ZY20210800001/H1/C7/N02/S59/s01/T1 +ZY20210800001/H1/C7/N02/S280/s01/T5 +ZY20210800001/H1/C7/N02/S274/s03/T3 +ZY20210800001/H1/C7/N02/S270/s01/T1 +ZY20210800001/H1/C7/N01/S59/s01/T2 +ZY20210800001/H1/C7/N01/S59/s01/T1 +ZY20210800001/H1/C7/N01/S280/s01/T5 +ZY20210800001/H1/C7/N01/S274/s03/T3 +ZY20210800001/H1/C7/N01/S270/s01/T1 +ZY20210800001/H1/C6/N07/S82/s04/T2 +ZY20210800001/H1/C6/N07/S82/s04/T1 +ZY20210800001/H1/C6/N06/S82/s03/T2 +ZY20210800001/H1/C6/N56/S390/s05/T2 +ZY20210800001/H1/C6/N56/S390/s04/T3 +ZY20210800001/H1/C6/N56/S390/s03/T2 +ZY20210800001/H1/C6/N56/S390/s02/T1 +ZY20210800001/H1/C6/N56/S390/s01/T1 +ZY20210800001/H1/C6/N55/S390/s05/T2 +ZY20210800001/H1/C6/N55/S390/s04/T3 +ZY20210800001/H1/C6/N55/S390/s03/T2 +ZY20210800001/H1/C6/N55/S390/s02/T1 +ZY20210800001/H1/C6/N55/S390/s01/T1 +ZY20210800001/H1/C6/N53/S390/s04/T3 +ZY20210800001/H1/C6/N53/S390/s03/T2 +ZY20210800001/H1/C6/N53/S390/s02/T1 +ZY20210800001/H1/C6/N53/S390/s01/T1 +ZY20210800001/H1/C6/N03/S82/s02/T2 +ZY20210800001/H1/C6/N03/S82/s02/T1 +ZY20210800001/H1/C6/N02/S82/s01/T2 +ZY20210800001/H1/C6/N01/S82/s01/T2 +ZY20210800001/H1/C5/N10/S57/s03/T1 +ZY20210800001/H1/C5/N09/S369/s04/T4 +ZY20210800001/H1/C5/N09/S369/s03/T1 +ZY20210800001/H1/C5/N09/S369/s02/T2 +ZY20210800001/H1/C5/N09/S369/s01/T1 +ZY20210800001/H1/C5/N05/S57/s01/T1 +ZY20210800001/H1/C5/N04/S57/s02/T1 +ZY20210800001/H1/C5/N02/S57/s02/T2 +ZY20210800001/H1/C5/N01/S57/s01/T2 +ZY20210800001/H1/C4/N08/S20/s01/T1 +ZY20210800001/H1/C4/N60/S388/s05/T3 +ZY20210800001/H1/C4/N60/S388/s04/T4 +ZY20210800001/H1/C4/N60/S388/s03/T3 +ZY20210800001/H1/C4/N60/S388/s02/T2 +ZY20210800001/H1/C4/N60/S388/s01/T1 +ZY20210800001/H1/C4/N59/S388/s05/T3 +ZY20210800001/H1/C4/N59/S388/s04/T4 +ZY20210800001/H1/C4/N59/S388/s02/T2 +ZY20210800001/H1/C4/N59/S388/s01/T1 +ZY20210800001/H1/C4/N58/S388/s05/T3 +ZY20210800001/H1/C4/N58/S388/s04/T4 +ZY20210800001/H1/C4/N58/S388/s03/T3 +ZY20210800001/H1/C4/N58/S388/s02/T2 +ZY20210800001/H1/C4/N58/S388/s01/T1 +ZY20210800001/H1/C4/N57/S388/s05/T3 +ZY20210800001/H1/C4/N57/S388/s04/T4 +ZY20210800001/H1/C4/N57/S388/s03/T3 +ZY20210800001/H1/C4/N57/S388/s02/T2 +ZY20210800001/H1/C4/N57/S388/s01/T1 +ZY20210800001/H1/C4/N56/S388/s05/T3 +ZY20210800001/H1/C4/N56/S388/s04/T4 +ZY20210800001/H1/C4/N56/S388/s03/T3 +ZY20210800001/H1/C4/N56/S388/s02/T2 +ZY20210800001/H1/C4/N56/S388/s01/T1 +ZY20210800001/H1/C4/N55/S388/s05/T3 +ZY20210800001/H1/C4/N55/S388/s04/T4 +ZY20210800001/H1/C4/N55/S388/s03/T3 +ZY20210800001/H1/C4/N55/S388/s02/T2 +ZY20210800001/H1/C4/N55/S388/s01/T1 +ZY20210800001/H1/C4/N54/S388/s05/T3 +ZY20210800001/H1/C4/N54/S388/s04/T4 +ZY20210800001/H1/C4/N54/S388/s03/T3 +ZY20210800001/H1/C4/N54/S388/s02/T2 +ZY20210800001/H1/C4/N54/S388/s01/T1 +ZY20210800001/H1/C4/N05/S20/s03/T2 +ZY20210800001/H1/C4/N05/S20/s03/T1 +ZY20210800001/H1/C4/N04/S20/s02/T2 +ZY20210800001/H1/C4/N04/S20/s02/T1 +ZY20210800001/H1/C4/N03/S20/s01/T2 +ZY20210800001/H1/C4/N02/S20/s04/T2 +ZY20210800001/H1/C4/N02/S20/s04/T1 +ZY20210800001/H1/C4/N01/S19/s05/T2 +ZY20210800001/H1/C4/N01/S19/s05/T1 +ZY20210800001/H1/C3/N70/S389/s05/T1 +ZY20210800001/H1/C3/N70/S389/s03/T2 +ZY20210800001/H1/C3/N70/S389/s02/T1 +ZY20210800001/H1/C3/N70/S389/s01/T1 +ZY20210800001/H1/C3/N69/S389/s05/T2 +ZY20210800001/H1/C3/N69/S389/s02/T1 +ZY20210800001/H1/C3/N69/S389/s01/T1 +ZY20210800001/H1/C3/N60/S377/s03/T1 +ZY20210800001/H1/C3/N60/S377/s02/T1 +ZY20210800001/H1/C3/N60/S377/s01/T1 +ZY20210800001/H1/C3/N51/S380/s05/T2 +ZY20210800001/H1/C3/N51/S380/s04/T2 +ZY20210800001/H1/C3/N51/S380/s03/T1 +ZY20210800001/H1/C3/N51/S380/s02/T1 +ZY20210800001/H1/C3/N51/S380/s01/T1 +ZY20210800001/H1/C2/N10/S214/s03/T1 +ZY20210800001/H1/C2/N10/S212/s03/T2 +ZY20210800001/H1/C2/N09/S337/s04/T2 +ZY20210800001/H1/C2/N09/S337/s04/T1 +ZY20210800001/H1/C2/N09/S214/s04/T1 +ZY20210800001/H1/C2/N09/S212/s03/T2 +ZY20210800001/H1/C2/N08/S337/s03/T1 +ZY20210800001/H1/C2/N08/S212/s02/T5 +ZY20210800001/H1/C2/N07/S337/s03/T2 +ZY20210800001/H1/C2/N07/S212/s02/T1 +ZY20210800001/H1/C2/N06/S212/s02/T1 +ZY20210800001/H1/C2/N05/S212/s02/T1 +ZY20210800001/H1/C2/N04/S337/s01/T1 +ZY20210800001/H1/C2/N04/S212/s01/T1 +ZY20210800001/H1/C2/N03/S337/s01/T2 +ZY20210800001/H1/C2/N03/S337/s01/T1 +ZY20210800001/H1/C2/N03/S212/s01/T1 +ZY20210800001/H1/C2/N02/S338/s01/T1 +ZY20210800001/H1/C2/N02/S212/s01/T1 +ZY20210800001/H1/C2/N01/S338/s01/T2 +ZY20210800001/H1/C18/N10/S199/s03/T2 +ZY20210800001/H1/C18/N09/S199/s03/T2 +ZY20210800001/H1/C18/N08/S199/s02/T2 +ZY20210800001/H1/C18/N07/S199/s02/T2 +ZY20210800001/H1/C18/N06/S199/s02/T2 +ZY20210800001/H1/C18/N05/S199/s02/T2 +ZY20210800001/H1/C18/N04/S199/s01/T2 +ZY20210800001/H1/C18/N03/S199/s01/T2 +ZY20210800001/H1/C18/N02/S199/s01/T2 +ZY20210800001/H1/C18/N01/S199/s01/T2 +ZY20210800001/H1/C17/N55/S264/s02/T1 +ZY20210800001/H1/C17/N54/S264/s01/T1 +ZY20210800001/H1/C17/N53/S363/s03/T3 +ZY20210800001/H1/C17/N53/S363/s02/T2 +ZY20210800001/H1/C17/N53/S363/s01/T1 +ZY20210800001/H1/C17/N52/S264/s01/T1 +ZY20210800001/H1/C17/N51/S264/s01/T1 +ZY20210800001/H1/C16/N50/S232/s02/T2 +ZY20210800001/H1/C16/N49/S232/s01/T5 +ZY20210800001/H1/C16/N47/S232/s01/T4 +ZY20210800001/H1/C16/N45/S231/s05/T3 +ZY20210800001/H1/C16/N44/S231/s05/T3 +ZY20210800001/H1/C16/N42/S231/s05/T3 +ZY20210800001/H1/C16/N38/S231/s04/T2 +ZY20210800001/H1/C16/N37/S231/s03/T4 +ZY20210800001/H1/C16/N35/S231/s05/T3 +ZY20210800001/H1/C16/N34/S231/s03/T3 +ZY20210800001/H1/C16/N32/S231/s02/T5 +ZY20210800001/H1/C16/N31/S231/s02/T3 +ZY20210800001/H1/C16/N30/S231/s02/T3 +ZY20210800001/H1/C16/N29/S231/s01/T3 +ZY20210800001/H1/C16/N28/S231/s01/T2 +ZY20210800001/H1/C16/N11/S232/s03/T2 +ZY20210800001/H1/C16/N09/S232/s03/T2 +ZY20210800001/H1/C16/N07/S232/s03/T4 +ZY20210800001/H1/C16/N05/S232/s02/T4 +ZY20210800001/H1/C16/N03/S232/s02/T2 +ZY20210800001/H1/C14/N09/S367/s01/T2 +ZY20210800001/H1/C13/N10/S179/s03/T4 +ZY20210800001/H1/C13/N10/S132/s03/T1 +ZY20210800001/H1/C13/N09/S132/s03/T1 +ZY20210800001/H1/C13/N08/S179/s02/T4 +ZY20210800001/H1/C13/N08/S132/s02/T1 +ZY20210800001/H1/C13/N07/S179/s02/T4 +ZY20210800001/H1/C13/N07/S132/s02/T1 +ZY20210800001/H1/C13/N06/S179/s02/T2 +ZY20210800001/H1/C13/N06/S132/s02/T1 +ZY20210800001/H1/C13/N05/S179/s02/T2 +ZY20210800001/H1/C13/N05/S132/s02/T1 +ZY20210800001/H1/C13/N04/S179/s01/T2 +ZY20210800001/H1/C13/N04/S132/s01/T1 +ZY20210800001/H1/C13/N03/S179/s01/T2 +ZY20210800001/H1/C13/N03/S132/s01/T1 +ZY20210800001/H1/C13/N02/S179/s01/T2 +ZY20210800001/H1/C13/N02/S132/s01/T1 +ZY20210800001/H1/C13/N01/S179/s01/T2 +ZY20210800001/H1/C13/N01/S132/s01/T1 +ZY20210800001/H1/C12/N09/S203/s03/T2 +ZY20210800001/H1/C12/N09/S169/s03/T1 +ZY20210800001/H1/C12/N07/S203/s03/T2 +ZY20210800001/H1/C12/N07/S169/s03/T1 +ZY20210800001/H1/C12/N05/S203/s02/T2 +ZY20210800001/H1/C12/N05/S169/s02/T1 +ZY20210800001/H1/C12/N03/S203/s02/T2 +ZY20210800001/H1/C12/N03/S169/s02/T1 +ZY20210800001/H1/C12/N01/S203/s02/T2 +ZY20210800001/H1/C12/N01/S169/s02/T1 +ZY20210800001/H1/C11/N06/S185/s02/T2 +ZY20210800001/H1/C11/N05/S185/s02/T2 +ZY20210800001/H1/C11/N04/S367/s02/T3 +ZY20210800001/H1/C11/N04/S185/s01/T2 +ZY20210800001/H1/C11/N03/S185/s01/T2 +ZY20210800001/H1/C11/N02/S185/s01/T2 +ZY20210800001/H1/C11/N01/S185/s01/T2 +ZY20210800001/H1/C10/N52/S384/s05/T1 +ZY20210800001/H1/C10/N52/S384/s04/T4 +ZY20210800001/H1/C10/N52/S384/s03/T3 +ZY20210800001/H1/C10/N52/S384/s02/T2 +ZY20210800001/H1/C10/N52/S384/s01/T1 +ZY20210800001/H1/C10/N51/S384/s05/T4 +ZY20210800001/H1/C10/N51/S384/s04/T4 +ZY20210800001/H1/C10/N51/S384/s02/T2 +ZY20210800001/H1/C10/N51/S384/s01/T1 +ZY20210800001/H1/C1/N18/S108/s01/T2 +ZY20210800001/H1/C1/N18/S108/s01/T1 +ZY20210800001/H1/C1/N17/S100/s04/T2 +ZY20210800001/H1/C1/N17/S100/s04/T1 +ZY20210800001/H1/C1/N16/S100/s04/T2 +ZY20210800001/H1/C1/N16/S100/s04/T1 +ZY20210800001/H1/C1/N15/S99/s04/T1 \ No newline at end of file diff --git a/third-party/HOI4D-Instructions/prepare_4Dseg/datalists/train_all.txt b/third-party/HOI4D-Instructions/prepare_4Dseg/datalists/train_all.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a68a6d2a49fd6d0d291177b34f3eae105fb374f --- /dev/null +++ b/third-party/HOI4D-Instructions/prepare_4Dseg/datalists/train_all.txt @@ -0,0 +1,2973 @@ +ZY20210800004/H4/C8/N14/S71/s03/T2 +ZY20210800004/H4/C8/N14/S71/s03/T1 +ZY20210800004/H4/C8/N13/S71/s02/T2 +ZY20210800004/H4/C8/N13/S71/s02/T1 +ZY20210800004/H4/C8/N12/S71/s02/T2 +ZY20210800004/H4/C8/N12/S71/s02/T1 +ZY20210800004/H4/C7/N15/S56/s02/T1 +ZY20210800004/H4/C7/N13/S57/s01/T1 +ZY20210800004/H4/C6/N54/S378/s05/T2 +ZY20210800004/H4/C6/N54/S378/s04/T1 +ZY20210800004/H4/C6/N54/S378/s03/T3 +ZY20210800004/H4/C6/N54/S378/s02/T2 +ZY20210800004/H4/C6/N54/S378/s01/T1 +ZY20210800004/H4/C6/N52/S378/s05/T2 +ZY20210800004/H4/C6/N52/S378/s04/T1 +ZY20210800004/H4/C6/N52/S378/s03/T3 +ZY20210800004/H4/C6/N52/S378/s02/T2 +ZY20210800004/H4/C6/N52/S378/s01/T1 +ZY20210800004/H4/C6/N51/S378/s05/T2 +ZY20210800004/H4/C6/N51/S378/s04/T1 +ZY20210800004/H4/C6/N51/S378/s03/T3 +ZY20210800004/H4/C6/N51/S378/s02/T2 +ZY20210800004/H4/C6/N51/S378/s01/T1 +ZY20210800004/H4/C6/N50/S250/s05/T1 +ZY20210800004/H4/C6/N47/S250/s04/T1 +ZY20210800004/H4/C6/N43/S250/s03/T1 +ZY20210800004/H4/C6/N39/S250/s02/T1 +ZY20210800004/H4/C6/N24/S250/s01/T3 +ZY20210800004/H4/C6/N21/S250/s01/T3 +ZY20210800004/H4/C6/N20/S249/s05/T3 +ZY20210800004/H4/C6/N19/S249/s05/T3 +ZY20210800004/H4/C6/N16/S249/s04/T3 +ZY20210800004/H4/C6/N15/S82/s03/T2 +ZY20210800004/H4/C6/N15/S82/s03/T1 +ZY20210800004/H4/C6/N15/S249/s04/T3 +ZY20210800004/H4/C6/N14/S82/s02/T2 +ZY20210800004/H4/C6/N14/S82/s02/T1 +ZY20210800004/H4/C6/N14/S249/s04/T3 +ZY20210800004/H4/C6/N11/S82/s01/T2 +ZY20210800004/H4/C6/N11/S82/s01/T1 +ZY20210800004/H4/C6/N11/S249/s03/T2 +ZY20210800004/H4/C6/N10/S82/s05/T2 +ZY20210800004/H4/C6/N10/S82/s05/T1 +ZY20210800004/H4/C6/N10/S249/s03/T2 +ZY20210800004/H4/C6/N09/S82/s05/T1 +ZY20210800004/H4/C6/N09/S249/s03/T2 +ZY20210800004/H4/C6/N07/S82/s04/T2 +ZY20210800004/H4/C6/N07/S82/s04/T1 +ZY20210800004/H4/C6/N07/S249/s02/T2 +ZY20210800004/H4/C6/N06/S82/s03/T2 +ZY20210800004/H4/C6/N06/S82/s03/T1 +ZY20210800004/H4/C6/N06/S249/s02/T2 +ZY20210800004/H4/C6/N05/S82/s03/T2 +ZY20210800004/H4/C6/N05/S82/s03/T1 +ZY20210800004/H4/C6/N05/S249/s02/T2 +ZY20210800004/H4/C6/N04/S82/s02/T1 +ZY20210800004/H4/C6/N04/S249/s01/T2 +ZY20210800004/H4/C6/N03/S82/s02/T2 +ZY20210800004/H4/C6/N03/S82/s02/T1 +ZY20210800004/H4/C6/N03/S249/s01/T2 +ZY20210800004/H4/C6/N02/S82/s01/T2 +ZY20210800004/H4/C6/N02/S82/s01/T1 +ZY20210800004/H4/C6/N02/S249/s01/T2 +ZY20210800004/H4/C6/N01/S82/s01/T2 +ZY20210800004/H4/C6/N01/S82/s01/T1 +ZY20210800004/H4/C6/N01/S249/s01/T2 +ZY20210800004/H4/C5/N32/S56/s03/T1 +ZY20210800004/H4/C5/N31/S56/s03/T1 +ZY20210800004/H4/C5/N29/S113/s02/T5 +ZY20210800004/H4/C5/N29/S113/s02/T1 +ZY20210800004/H4/C5/N28/S113/s02/T5 +ZY20210800004/H4/C5/N27/S113/s01/T5 +ZY20210800004/H4/C5/N26/S113/s01/T1 +ZY20210800004/H4/C5/N23/S109/s04/T5 +ZY20210800004/H4/C5/N20/S109/s03/T5 +ZY20210800004/H4/C5/N18/S109/s02/T1 +ZY20210800004/H4/C5/N17/S109/s01/T1 +ZY20210800004/H4/C5/N16/S109/s01/T5 +ZY20210800004/H4/C5/N16/S109/s01/T1 +ZY20210800004/H4/C5/N15/S56/s02/T1 +ZY20210800004/H4/C5/N14/S56/s02/T1 +ZY20210800004/H4/C5/N13/S56/s01/T1 +ZY20210800004/H4/C5/N12/S56/s01/T1 +ZY20210800004/H4/C5/N11/S56/s05/T1 +ZY20210800004/H4/C4/N50/S260/s03/T2 +ZY20210800004/H4/C4/N50/S217/s05/T3 +ZY20210800004/H4/C4/N49/S260/s03/T2 +ZY20210800004/H4/C4/N49/S223/s03/T4 +ZY20210800004/H4/C4/N49/S217/s05/T3 +ZY20210800004/H4/C4/N48/S260/s02/T2 +ZY20210800004/H4/C4/N48/S223/s02/T4 +ZY20210800004/H4/C4/N48/S217/s05/T3 +ZY20210800004/H4/C4/N45/S260/s02/T2 +ZY20210800004/H4/C4/N45/S223/s02/T4 +ZY20210800004/H4/C4/N45/S217/s04/T3 +ZY20210800004/H4/C4/N44/S260/s01/T2 +ZY20210800004/H4/C4/N44/S223/s01/T4 +ZY20210800004/H4/C4/N44/S217/s04/T3 +ZY20210800004/H4/C4/N43/S260/s01/T2 +ZY20210800004/H4/C4/N43/S223/s01/T4 +ZY20210800004/H4/C4/N43/S217/s04/T3 +ZY20210800004/H4/C4/N42/S260/s01/T2 +ZY20210800004/H4/C4/N42/S223/s01/T4 +ZY20210800004/H4/C4/N42/S217/s03/T3 +ZY20210800004/H4/C4/N41/S260/s01/T2 +ZY20210800004/H4/C4/N41/S223/s01/T4 +ZY20210800004/H4/C4/N41/S217/s03/T3 +ZY20210800004/H4/C4/N40/S257/s05/T2 +ZY20210800004/H4/C4/N40/S217/s03/T3 +ZY20210800004/H4/C4/N39/S257/s05/T2 +ZY20210800004/H4/C4/N37/S217/s02/T3 +ZY20210800004/H4/C4/N36/S217/s02/T3 +ZY20210800004/H4/C4/N35/S221/s04/T4 +ZY20210800004/H4/C4/N35/S217/s02/T3 +ZY20210800004/H4/C4/N34/S221/s04/T4 +ZY20210800004/H4/C4/N34/S217/s01/T3 +ZY20210800004/H4/C4/N33/S257/s04/T1 +ZY20210800004/H4/C4/N33/S221/s04/T4 +ZY20210800004/H4/C4/N33/S217/s01/T3 +ZY20210800004/H4/C4/N27/S65/s01/T4 +ZY20210800004/H4/C4/N27/S221/s02/T4 +ZY20210800004/H4/C4/N27/S215/s05/T3 +ZY20210800004/H4/C4/N14/S254/s04/T1 +ZY20210800004/H4/C4/N14/S219/s04/T4 +ZY20210800004/H4/C4/N14/S215/s01/T2 +ZY20210800004/H4/C4/N10/S260/s05/T2 +ZY20210800004/H4/C4/N10/S254/s03/T1 +ZY20210800004/H4/C4/N08/S260/s05/T2 +ZY20210800004/H4/C4/N08/S254/s02/T1 +ZY20210800004/H4/C4/N08/S219/s02/T3 +ZY20210800004/H4/C4/N05/S260/s04/T2 +ZY20210800004/H4/C4/N05/S254/s02/T1 +ZY20210800004/H4/C4/N04/S260/s04/T2 +ZY20210800004/H4/C4/N04/S254/s01/T1 +ZY20210800004/H4/C4/N04/S219/s01/T3 +ZY20210800004/H4/C4/N03/S260/s04/T2 +ZY20210800004/H4/C4/N03/S254/s01/T1 +ZY20210800004/H4/C4/N03/S219/s01/T3 +ZY20210800004/H4/C4/N02/S260/s03/T2 +ZY20210800004/H4/C4/N02/S254/s01/T1 +ZY20210800004/H4/C4/N01/S260/s03/T2 +ZY20210800004/H4/C4/N01/S254/s01/T1 +ZY20210800004/H4/C4/N01/S219/s01/T3 +ZY20210800004/H4/C3/N68/S380/s05/T2 +ZY20210800004/H4/C3/N68/S380/s03/T2 +ZY20210800004/H4/C3/N68/S380/s02/T1 +ZY20210800004/H4/C3/N68/S380/s01/T1 +ZY20210800004/H4/C3/N67/S380/s05/T2 +ZY20210800004/H4/C3/N67/S380/s04/T2 +ZY20210800004/H4/C3/N67/S380/s03/T2 +ZY20210800004/H4/C3/N67/S380/s02/T1 +ZY20210800004/H4/C3/N67/S380/s01/T1 +ZY20210800004/H4/C3/N66/S380/s05/T1 +ZY20210800004/H4/C3/N66/S380/s04/T2 +ZY20210800004/H4/C3/N66/S380/s03/T2 +ZY20210800004/H4/C3/N66/S380/s02/T1 +ZY20210800004/H4/C3/N66/S380/s01/T1 +ZY20210800004/H4/C3/N65/S380/s05/T1 +ZY20210800004/H4/C3/N65/S380/s04/T2 +ZY20210800004/H4/C3/N65/S380/s03/T2 +ZY20210800004/H4/C3/N65/S380/s02/T1 +ZY20210800004/H4/C3/N65/S380/s01/T1 +ZY20210800004/H4/C3/N64/S379/s05/T2 +ZY20210800004/H4/C3/N64/S379/s04/T2 +ZY20210800004/H4/C3/N64/S379/s03/T2 +ZY20210800004/H4/C3/N64/S379/s02/T1 +ZY20210800004/H4/C3/N64/S379/s01/T1 +ZY20210800004/H4/C3/N63/S379/s05/T2 +ZY20210800004/H4/C3/N63/S379/s03/T2 +ZY20210800004/H4/C3/N63/S379/s02/T1 +ZY20210800004/H4/C3/N63/S379/s01/T1 +ZY20210800004/H4/C3/N62/S379/s05/T1 +ZY20210800004/H4/C3/N62/S379/s04/T2 +ZY20210800004/H4/C3/N62/S379/s03/T2 +ZY20210800004/H4/C3/N62/S379/s01/T1 +ZY20210800004/H4/C3/N61/S379/s05/T2 +ZY20210800004/H4/C3/N61/S379/s04/T2 +ZY20210800004/H4/C3/N61/S379/s03/T2 +ZY20210800004/H4/C3/N61/S379/s02/T1 +ZY20210800004/H4/C3/N61/S379/s01/T1 +ZY20210800004/H4/C3/N60/S377/s05/T2 +ZY20210800004/H4/C3/N60/S377/s04/T2 +ZY20210800004/H4/C3/N59/S375/s03/T2 +ZY20210800004/H4/C3/N59/S375/s02/T2 +ZY20210800004/H4/C3/N59/S374/s02/T1 +ZY20210800004/H4/C3/N59/S373/s05/T2 +ZY20210800004/H4/C3/N59/S373/s03/T1 +ZY20210800004/H4/C3/N58/S375/s03/T2 +ZY20210800004/H4/C3/N58/S375/s01/T2 +ZY20210800004/H4/C3/N58/S374/s02/T1 +ZY20210800004/H4/C3/N58/S373/s05/T2 +ZY20210800004/H4/C3/N58/S373/s02/T1 +ZY20210800004/H4/C3/N57/S375/s01/T2 +ZY20210800004/H4/C3/N57/S374/s02/T1 +ZY20210800004/H4/C3/N57/S373/s05/T2 +ZY20210800004/H4/C3/N57/S373/s04/T2 +ZY20210800004/H4/C3/N57/S373/s02/T1 +ZY20210800004/H4/C3/N56/S375/s01/T2 +ZY20210800004/H4/C3/N56/S374/s02/T1 +ZY20210800004/H4/C3/N56/S373/s05/T2 +ZY20210800004/H4/C3/N56/S373/s04/T2 +ZY20210800004/H4/C3/N56/S373/s02/T1 +ZY20210800004/H4/C3/N55/S375/s03/T1 +ZY20210800004/H4/C3/N55/S375/s01/T2 +ZY20210800004/H4/C3/N55/S374/s01/T1 +ZY20210800004/H4/C3/N55/S373/s04/T2 +ZY20210800004/H4/C3/N55/S373/s02/T1 +ZY20210800004/H4/C3/N54/S375/s03/T1 +ZY20210800004/H4/C3/N54/S374/s03/T2 +ZY20210800004/H4/C3/N54/S374/s01/T1 +ZY20210800004/H4/C3/N54/S373/s04/T2 +ZY20210800004/H4/C3/N54/S373/s01/T1 +ZY20210800004/H4/C3/N53/S375/s02/T1 +ZY20210800004/H4/C3/N53/S374/s03/T2 +ZY20210800004/H4/C3/N53/S374/s01/T1 +ZY20210800004/H4/C3/N53/S373/s03/T2 +ZY20210800004/H4/C3/N52/S375/s02/T1 +ZY20210800004/H4/C3/N52/S374/s03/T2 +ZY20210800004/H4/C3/N52/S374/s01/T1 +ZY20210800004/H4/C3/N52/S373/s03/T2 +ZY20210800004/H4/C3/N52/S373/s01/T1 +ZY20210800004/H4/C3/N46/S111/s05/T1 +ZY20210800004/H4/C3/N08/S97/s04/T2 +ZY20210800004/H4/C20/N50/S301/s03/T2 +ZY20210800004/H4/C20/N50/S298/s04/T1 +ZY20210800004/H4/C20/N49/S301/s03/T2 +ZY20210800004/H4/C20/N46/S304/s05/T4 +ZY20210800004/H4/C20/N46/S304/s01/T3 +ZY20210800004/H4/C20/N46/S301/s02/T2 +ZY20210800004/H4/C20/N46/S298/s03/T1 +ZY20210800004/H4/C20/N45/S304/s05/T4 +ZY20210800004/H4/C20/N45/S304/s01/T3 +ZY20210800004/H4/C20/N45/S301/s02/T2 +ZY20210800004/H4/C20/N45/S298/s03/T1 +ZY20210800004/H4/C20/N44/S304/s04/T4 +ZY20210800004/H4/C20/N44/S304/s01/T3 +ZY20210800004/H4/C20/N44/S301/s02/T2 +ZY20210800004/H4/C20/N44/S298/s03/T1 +ZY20210800004/H4/C20/N43/S304/s04/T4 +ZY20210800004/H4/C20/N43/S301/s05/T3 +ZY20210800004/H4/C20/N43/S301/s01/T2 +ZY20210800004/H4/C20/N43/S298/s02/T1 +ZY20210800004/H4/C20/N42/S304/s04/T4 +ZY20210800004/H4/C20/N42/S301/s05/T3 +ZY20210800004/H4/C20/N42/S301/s01/T2 +ZY20210800004/H4/C20/N42/S298/s02/T1 +ZY20210800004/H4/C20/N41/S304/s04/T4 +ZY20210800004/H4/C20/N41/S301/s05/T3 +ZY20210800004/H4/C20/N41/S301/s01/T2 +ZY20210800004/H4/C20/N41/S298/s02/T1 +ZY20210800004/H4/C20/N40/S304/s03/T4 +ZY20210800004/H4/C20/N40/S301/s05/T3 +ZY20210800004/H4/C20/N40/S301/s01/T2 +ZY20210800004/H4/C20/N40/S298/s02/T1 +ZY20210800004/H4/C20/N39/S304/s03/T4 +ZY20210800004/H4/C20/N39/S301/s04/T3 +ZY20210800004/H4/C20/N39/S298/s05/T2 +ZY20210800004/H4/C20/N39/S298/s01/T1 +ZY20210800004/H4/C20/N38/S304/s03/T4 +ZY20210800004/H4/C20/N38/S301/s04/T3 +ZY20210800004/H4/C20/N38/S298/s05/T2 +ZY20210800004/H4/C20/N38/S298/s01/T1 +ZY20210800004/H4/C20/N37/S304/s03/T4 +ZY20210800004/H4/C20/N37/S301/s04/T3 +ZY20210800004/H4/C20/N37/S298/s05/T2 +ZY20210800004/H4/C20/N37/S298/s01/T1 +ZY20210800004/H4/C20/N36/S304/s02/T4 +ZY20210800004/H4/C20/N36/S301/s04/T3 +ZY20210800004/H4/C20/N36/S298/s05/T2 +ZY20210800004/H4/C20/N36/S298/s01/T1 +ZY20210800004/H4/C2/N49/S16/s03/T5 +ZY20210800004/H4/C2/N49/S16/s03/T1 +ZY20210800004/H4/C2/N48/S16/s02/T5 +ZY20210800004/H4/C2/N48/S16/s02/T1 +ZY20210800004/H4/C2/N47/S16/s02/T1 +ZY20210800004/H4/C2/N45/S5/s01/T5 +ZY20210800004/H4/C2/N45/S5/s01/T1 +ZY20210800004/H4/C2/N44/S364/s05/T6 +ZY20210800004/H4/C2/N43/S15/s01/T5 +ZY20210800004/H4/C2/N40/S10/s05/T1 +ZY20210800004/H4/C2/N39/S364/s05/T4 +ZY20210800004/H4/C2/N39/S10/s05/T5 +ZY20210800004/H4/C2/N39/S10/s05/T1 +ZY20210800004/H4/C2/N36/S364/s05/T3 +ZY20210800004/H4/C2/N36/S10/s04/T5 +ZY20210800004/H4/C2/N33/S10/s03/T5 +ZY20210800004/H4/C2/N33/S10/s03/T1 +ZY20210800004/H4/C2/N32/S364/s04/T2 +ZY20210800004/H4/C2/N32/S14/s02/T1 +ZY20210800004/H4/C2/N30/S14/s01/T1 +ZY20210800004/H4/C2/N29/S14/s01/T1 +ZY20210800004/H4/C2/N27/S13/s05/T5 +ZY20210800004/H4/C2/N27/S13/s05/T1 +ZY20210800004/H4/C2/N23/S13/s03/T5 +ZY20210800004/H4/C2/N21/S13/s02/T1 +ZY20210800004/H4/C2/N19/S13/s01/T5 +ZY20210800004/H4/C2/N17/S364/s04/T2 +ZY20210800004/H4/C2/N16/S11/s04/T1 +ZY20210800004/H4/C2/N15/S11/s04/T5 +ZY20210800004/H4/C18/N50/S364/s03/T2 +ZY20210800004/H4/C18/N50/S162/s03/T1 +ZY20210800004/H4/C18/N48/S364/s03/T2 +ZY20210800004/H4/C18/N48/S162/s03/T1 +ZY20210800004/H4/C18/N47/S364/s03/T2 +ZY20210800004/H4/C18/N46/S162/s03/T1 +ZY20210800004/H4/C18/N42/S162/s02/T1 +ZY20210800004/H4/C18/N40/S162/s02/T1 +ZY20210800004/H4/C18/N36/S181/s03/T2 +ZY20210800004/H4/C18/N36/S162/s03/T1 +ZY20210800004/H4/C18/N34/S181/s03/T2 +ZY20210800004/H4/C18/N34/S162/s03/T1 +ZY20210800004/H4/C18/N32/S364/s02/T1 +ZY20210800004/H4/C18/N32/S181/s03/T2 +ZY20210800004/H4/C18/N32/S162/s03/T1 +ZY20210800004/H4/C18/N30/S181/s02/T2 +ZY20210800004/H4/C18/N30/S162/s02/T1 +ZY20210800004/H4/C18/N28/S181/s02/T2 +ZY20210800004/H4/C18/N28/S162/s02/T1 +ZY20210800004/H4/C18/N26/S181/s02/T2 +ZY20210800004/H4/C18/N26/S162/s02/T1 +ZY20210800004/H4/C18/N25/S181/s02/T2 +ZY20210800004/H4/C18/N25/S162/s02/T1 +ZY20210800004/H4/C18/N24/S181/s01/T2 +ZY20210800004/H4/C18/N24/S162/s01/T1 +ZY20210800004/H4/C18/N23/S181/s01/T2 +ZY20210800004/H4/C18/N23/S162/s01/T1 +ZY20210800004/H4/C18/N22/S181/s01/T2 +ZY20210800004/H4/C18/N22/S162/s01/T1 +ZY20210800004/H4/C18/N21/S181/s01/T2 +ZY20210800004/H4/C18/N21/S162/s01/T1 +ZY20210800004/H4/C18/N20/S178/s05/T2 +ZY20210800004/H4/C18/N20/S160/s05/T1 +ZY20210800004/H4/C18/N19/S178/s05/T2 +ZY20210800004/H4/C18/N19/S160/s05/T1 +ZY20210800004/H4/C18/N18/S178/s05/T2 +ZY20210800004/H4/C18/N18/S160/s05/T1 +ZY20210800004/H4/C18/N17/S178/s05/T2 +ZY20210800004/H4/C18/N17/S160/s05/T1 +ZY20210800004/H4/C18/N16/S178/s04/T2 +ZY20210800004/H4/C18/N16/S160/s04/T1 +ZY20210800004/H4/C18/N15/S178/s04/T2 +ZY20210800004/H4/C18/N15/S160/s04/T1 +ZY20210800004/H4/C18/N14/S178/s04/T2 +ZY20210800004/H4/C18/N14/S160/s04/T1 +ZY20210800004/H4/C18/N13/S178/s04/T2 +ZY20210800004/H4/C18/N13/S160/s04/T1 +ZY20210800004/H4/C18/N12/S178/s03/T2 +ZY20210800004/H4/C18/N12/S160/s03/T1 +ZY20210800004/H4/C18/N11/S178/s03/T2 +ZY20210800004/H4/C18/N11/S160/s03/T1 +ZY20210800004/H4/C17/N75/S262/s03/T2 +ZY20210800004/H4/C17/N75/S262/s02/T3 +ZY20210800004/H4/C17/N74/S262/s03/T2 +ZY20210800004/H4/C17/N74/S262/s01/T3 +ZY20210800004/H4/C17/N73/S262/s02/T3 +ZY20210800004/H4/C17/N73/S262/s01/T2 +ZY20210800004/H4/C17/N72/S262/s02/T3 +ZY20210800004/H4/C17/N72/S262/s01/T2 +ZY20210800004/H4/C17/N71/S262/s02/T3 +ZY20210800004/H4/C17/N71/S262/s01/T2 +ZY20210800004/H4/C17/N70/S259/s05/T2 +ZY20210800004/H4/C17/N69/S259/s05/T3 +ZY20210800004/H4/C17/N67/S259/s05/T3 +ZY20210800004/H4/C17/N66/S259/s04/T3 +ZY20210800004/H4/C17/N65/S259/s04/T2 +ZY20210800004/H4/C17/N64/S259/s04/T2 +ZY20210800004/H4/C17/N63/S259/s04/T2 +ZY20210800004/H4/C17/N62/S259/s03/T2 +ZY20210800004/H4/C17/N61/S259/s03/T1 +ZY20210800004/H4/C17/N60/S259/s03/T1 +ZY20210800004/H4/C17/N59/S259/s03/T1 +ZY20210800004/H4/C17/N58/S259/s02/T1 +ZY20210800004/H4/C17/N57/S259/s02/T1 +ZY20210800004/H4/C17/N56/S259/s02/T1 +ZY20210800004/H4/C17/N25/S194/s02/T2 +ZY20210800004/H4/C17/N25/S134/s02/T1 +ZY20210800004/H4/C17/N24/S194/s01/T2 +ZY20210800004/H4/C17/N24/S134/s02/T1 +ZY20210800004/H4/C17/N23/S194/s01/T2 +ZY20210800004/H4/C17/N23/S134/s04/T1 +ZY20210800004/H4/C17/N22/S194/s01/T2 +ZY20210800004/H4/C17/N22/S134/s02/T1 +ZY20210800004/H4/C17/N21/S194/s01/T2 +ZY20210800004/H4/C17/N21/S134/s02/T1 +ZY20210800004/H4/C17/N20/S190/s05/T2 +ZY20210800004/H4/C17/N20/S134/s01/T1 +ZY20210800004/H4/C17/N19/S190/s05/T2 +ZY20210800004/H4/C17/N19/S134/s01/T1 +ZY20210800004/H4/C17/N18/S190/s05/T2 +ZY20210800004/H4/C17/N18/S134/s01/T1 +ZY20210800004/H4/C17/N17/S190/s05/T2 +ZY20210800004/H4/C17/N17/S134/s01/T1 +ZY20210800004/H4/C17/N16/S190/s04/T2 +ZY20210800004/H4/C17/N16/S134/s04/T1 +ZY20210800004/H4/C17/N15/S190/s04/T3 +ZY20210800004/H4/C17/N14/S190/s04/T3 +ZY20210800004/H4/C17/N14/S134/s04/T1 +ZY20210800004/H4/C17/N13/S190/s04/T3 +ZY20210800004/H4/C17/N13/S138/s02/T1 +ZY20210800004/H4/C17/N12/S190/s03/T3 +ZY20210800004/H4/C17/N12/S138/s01/T1 +ZY20210800004/H4/C17/N11/S190/s03/T3 +ZY20210800004/H4/C17/N11/S138/s01/T1 +ZY20210800004/H4/C17/N10/S190/s03/T3 +ZY20210800004/H4/C17/N10/S138/s01/T1 +ZY20210800004/H4/C17/N09/S190/s03/T3 +ZY20210800004/H4/C17/N09/S138/s01/T1 +ZY20210800004/H4/C17/N08/S190/s02/T3 +ZY20210800004/H4/C17/N07/S190/s02/T3 +ZY20210800004/H4/C17/N07/S134/s05/T1 +ZY20210800004/H4/C17/N06/S190/s02/T3 +ZY20210800004/H4/C17/N06/S134/s05/T1 +ZY20210800004/H4/C14/N36/S335/s02/T2 +ZY20210800004/H4/C14/N36/S335/s01/T1 +ZY20210800004/H4/C14/N34/S211/s03/T2 +ZY20210800004/H4/C14/N34/S177/s03/T1 +ZY20210800004/H4/C14/N32/S211/s03/T2 +ZY20210800004/H4/C14/N32/S177/s03/T1 +ZY20210800004/H4/C14/N30/S335/s02/T2 +ZY20210800004/H4/C14/N30/S335/s01/T1 +ZY20210800004/H4/C14/N28/S211/s02/T2 +ZY20210800004/H4/C14/N28/S177/s02/T1 +ZY20210800004/H4/C14/N26/S335/s02/T2 +ZY20210800004/H4/C14/N26/S335/s01/T1 +ZY20210800004/H4/C14/N25/S211/s02/T2 +ZY20210800004/H4/C14/N25/S174/s01/T1 +ZY20210800004/H4/C14/N24/S211/s01/T2 +ZY20210800004/H4/C14/N23/S211/s01/T2 +ZY20210800004/H4/C14/N23/S174/s01/T1 +ZY20210800004/H4/C14/N22/S211/s01/T2 +ZY20210800004/H4/C14/N22/S174/s01/T1 +ZY20210800004/H4/C14/N21/S211/s01/T2 +ZY20210800004/H4/C14/N21/S174/s02/T1 +ZY20210800004/H4/C14/N20/S210/s05/T2 +ZY20210800004/H4/C14/N20/S174/s02/T1 +ZY20210800004/H4/C14/N19/S210/s05/T2 +ZY20210800004/H4/C14/N18/S210/s05/T2 +ZY20210800004/H4/C14/N18/S174/s02/T1 +ZY20210800004/H4/C14/N17/S210/s05/T2 +ZY20210800004/H4/C14/N17/S174/s03/T1 +ZY20210800004/H4/C14/N16/S210/s04/T2 +ZY20210800004/H4/C14/N16/S174/s03/T1 +ZY20210800004/H4/C14/N15/S210/s04/T2 +ZY20210800004/H4/C14/N15/S174/s03/T1 +ZY20210800004/H4/C14/N14/S210/s04/T2 +ZY20210800004/H4/C14/N14/S174/s03/T1 +ZY20210800004/H4/C14/N13/S210/s04/T2 +ZY20210800004/H4/C14/N13/S174/s04/T1 +ZY20210800004/H4/C14/N12/S210/s03/T2 +ZY20210800004/H4/C14/N12/S174/s04/T1 +ZY20210800004/H4/C14/N11/S174/s04/T1 +ZY20210800004/H4/C13/N50/S234/s02/T1 +ZY20210800004/H4/C13/N50/S186/s02/T3 +ZY20210800004/H4/C13/N49/S234/s01/T1 +ZY20210800004/H4/C13/N49/S186/s01/T3 +ZY20210800004/H4/C13/N48/S234/s01/T1 +ZY20210800004/H4/C13/N48/S186/s01/T3 +ZY20210800004/H4/C13/N47/S234/s01/T1 +ZY20210800004/H4/C13/N47/S186/s01/T3 +ZY20210800004/H4/C13/N46/S186/s01/T3 +ZY20210800004/H4/C13/N45/S233/s05/T1 +ZY20210800004/H4/C13/N44/S233/s05/T1 +ZY20210800004/H4/C13/N44/S184/s05/T4 +ZY20210800004/H4/C13/N43/S233/s05/T1 +ZY20210800004/H4/C13/N43/S184/s05/T4 +ZY20210800004/H4/C13/N42/S233/s05/T1 +ZY20210800004/H4/C13/N42/S184/s05/T4 +ZY20210800004/H4/C13/N41/S233/s04/T1 +ZY20210800004/H4/C13/N41/S184/s04/T4 +ZY20210800004/H4/C13/N40/S233/s04/T1 +ZY20210800004/H4/C13/N40/S184/s04/T4 +ZY20210800004/H4/C13/N39/S233/s04/T1 +ZY20210800004/H4/C13/N39/S184/s04/T4 +ZY20210800004/H4/C13/N38/S233/s04/T1 +ZY20210800004/H4/C13/N38/S184/s04/T4 +ZY20210800004/H4/C13/N37/S233/s03/T1 +ZY20210800004/H4/C13/N37/S184/s03/T4 +ZY20210800004/H4/C13/N36/S233/s03/T1 +ZY20210800004/H4/C13/N36/S184/s03/T4 +ZY20210800004/H4/C13/N35/S233/s03/T1 +ZY20210800004/H4/C13/N35/S184/s03/T4 +ZY20210800004/H4/C13/N34/S233/s03/T1 +ZY20210800004/H4/C13/N34/S184/s03/T4 +ZY20210800004/H4/C13/N33/S233/s02/T1 +ZY20210800004/H4/C13/N33/S184/s02/T4 +ZY20210800004/H4/C13/N32/S233/s02/T1 +ZY20210800004/H4/C13/N32/S184/s02/T4 +ZY20210800004/H4/C13/N31/S233/s02/T1 +ZY20210800004/H4/C13/N31/S184/s02/T4 +ZY20210800004/H4/C13/N30/S365/s01/T3 +ZY20210800004/H4/C13/N30/S233/s02/T1 +ZY20210800004/H4/C13/N30/S184/s02/T4 +ZY20210800004/H4/C13/N29/S184/s01/T4 +ZY20210800004/H4/C13/N28/S233/s01/T1 +ZY20210800004/H4/C13/N28/S184/s01/T4 +ZY20210800004/H4/C13/N27/S365/s01/T2 +ZY20210800004/H4/C13/N27/S233/s01/T1 +ZY20210800004/H4/C13/N27/S184/s01/T4 +ZY20210800004/H4/C13/N26/S233/s01/T1 +ZY20210800004/H4/C13/N26/S184/s01/T4 +ZY20210800004/H4/C13/N25/S234/s03/T1 +ZY20210800004/H4/C13/N25/S186/s03/T2 +ZY20210800004/H4/C13/N23/S234/s03/T1 +ZY20210800004/H4/C13/N23/S186/s03/T2 +ZY20210800004/H4/C13/N21/S234/s03/T1 +ZY20210800004/H4/C13/N21/S186/s02/T2 +ZY20210800004/H4/C13/N19/S234/s02/T1 +ZY20210800004/H4/C13/N19/S186/s02/T2 +ZY20210800004/H4/C13/N17/S234/s02/T1 +ZY20210800004/H4/C13/N17/S186/s02/T2 +ZY20210800004/H4/C13/N15/S234/s02/T1 +ZY20210800004/H4/C13/N15/S186/s02/T2 +ZY20210800004/H4/C13/N11/S365/s01/T1 +ZY20210800004/H4/C12/N50/S236/s02/T1 +ZY20210800004/H4/C12/N50/S186/s02/T2 +ZY20210800004/H4/C12/N49/S236/s02/T1 +ZY20210800004/H4/C12/N49/S186/s01/T2 +ZY20210800004/H4/C12/N48/S236/s01/T1 +ZY20210800004/H4/C12/N48/S186/s01/T2 +ZY20210800004/H4/C12/N47/S236/s01/T1 +ZY20210800004/H4/C12/N47/S186/s01/T2 +ZY20210800004/H4/C12/N46/S236/s01/T1 +ZY20210800004/H4/C12/N46/S186/s01/T2 +ZY20210800004/H4/C12/N45/S236/s01/T1 +ZY20210800004/H4/C12/N45/S184/s05/T2 +ZY20210800004/H4/C12/N44/S235/s05/T1 +ZY20210800004/H4/C12/N44/S184/s05/T2 +ZY20210800004/H4/C12/N43/S235/s05/T1 +ZY20210800004/H4/C12/N43/S184/s05/T2 +ZY20210800004/H4/C12/N42/S235/s05/T1 +ZY20210800004/H4/C12/N42/S184/s05/T2 +ZY20210800004/H4/C12/N41/S235/s05/T1 +ZY20210800004/H4/C12/N41/S184/s04/T2 +ZY20210800004/H4/C12/N40/S235/s04/T1 +ZY20210800004/H4/C12/N40/S184/s04/T2 +ZY20210800004/H4/C12/N39/S235/s04/T1 +ZY20210800004/H4/C12/N39/S184/s04/T2 +ZY20210800004/H4/C12/N38/S235/s04/T1 +ZY20210800004/H4/C12/N38/S184/s04/T2 +ZY20210800004/H4/C12/N37/S235/s04/T1 +ZY20210800004/H4/C12/N37/S184/s03/T2 +ZY20210800004/H4/C12/N36/S235/s03/T1 +ZY20210800004/H4/C12/N36/S184/s03/T2 +ZY20210800004/H4/C12/N35/S235/s03/T1 +ZY20210800004/H4/C12/N35/S184/s03/T2 +ZY20210800004/H4/C12/N34/S235/s03/T1 +ZY20210800004/H4/C12/N34/S184/s03/T2 +ZY20210800004/H4/C12/N33/S235/s03/T1 +ZY20210800004/H4/C12/N33/S184/s02/T2 +ZY20210800004/H4/C12/N32/S235/s02/T1 +ZY20210800004/H4/C12/N32/S184/s02/T2 +ZY20210800004/H4/C12/N31/S235/s02/T1 +ZY20210800004/H4/C12/N31/S184/s02/T2 +ZY20210800004/H4/C12/N30/S235/s02/T1 +ZY20210800004/H4/C12/N30/S184/s02/T2 +ZY20210800004/H4/C12/N29/S235/s02/T1 +ZY20210800004/H4/C12/N29/S184/s01/T2 +ZY20210800004/H4/C12/N28/S235/s01/T1 +ZY20210800004/H4/C12/N28/S184/s01/T2 +ZY20210800004/H4/C12/N27/S235/s01/T1 +ZY20210800004/H4/C12/N27/S184/s01/T2 +ZY20210800004/H4/C12/N26/S235/s01/T1 +ZY20210800004/H4/C12/N26/S184/s01/T2 +ZY20210800004/H4/C12/N25/S235/s01/T1 +ZY20210800004/H4/C12/N25/S186/s03/T2 +ZY20210800004/H4/C12/N23/S236/s03/T1 +ZY20210800004/H4/C12/N23/S186/s02/T2 +ZY20210800004/H4/C12/N21/S236/s03/T1 +ZY20210800004/H4/C12/N21/S186/s02/T2 +ZY20210800004/H4/C12/N19/S236/s03/T1 +ZY20210800004/H4/C12/N19/S186/s02/T2 +ZY20210800004/H4/C12/N17/S236/s02/T1 +ZY20210800004/H4/C12/N17/S186/s02/T2 +ZY20210800004/H4/C12/N15/S236/s05/T2 +ZY20210800004/H4/C12/N15/S236/s02/T1 +ZY20210800004/H4/C12/N15/S186/s02/T2 +ZY20210800004/H4/C12/N13/S236/s03/T1 +ZY20210800004/H4/C12/N13/S186/s02/T2 +ZY20210800004/H4/C11/N62/S383/s05/T3 +ZY20210800004/H4/C11/N62/S383/s04/T4 +ZY20210800004/H4/C11/N62/S383/s03/T3 +ZY20210800004/H4/C11/N62/S383/s02/T2 +ZY20210800004/H4/C11/N62/S383/s01/T1 +ZY20210800004/H4/C11/N57/S368/s05/T2 +ZY20210800004/H4/C11/N57/S368/s04/T4 +ZY20210800004/H4/C11/N57/S368/s03/T3 +ZY20210800004/H4/C11/N57/S368/s02/T2 +ZY20210800004/H4/C11/N57/S368/s01/T1 +ZY20210800004/H4/C11/N56/S368/s05/T2 +ZY20210800004/H4/C11/N56/S368/s04/T4 +ZY20210800004/H4/C11/N56/S368/s03/T3 +ZY20210800004/H4/C11/N56/S368/s02/T2 +ZY20210800004/H4/C11/N56/S368/s01/T1 +ZY20210800004/H4/C11/N55/S368/s05/T2 +ZY20210800004/H4/C11/N55/S368/s04/T4 +ZY20210800004/H4/C11/N55/S368/s03/T3 +ZY20210800004/H4/C11/N55/S368/s02/T2 +ZY20210800004/H4/C11/N55/S368/s01/T1 +ZY20210800004/H4/C11/N54/S368/s05/T1 +ZY20210800004/H4/C11/N54/S368/s03/T3 +ZY20210800004/H4/C11/N54/S368/s02/T2 +ZY20210800004/H4/C11/N54/S368/s01/T1 +ZY20210800004/H4/C11/N50/S193/s02/T3 +ZY20210800004/H4/C11/N50/S193/s02/T2 +ZY20210800004/H4/C11/N49/S193/s01/T3 +ZY20210800004/H4/C11/N47/S193/s01/T3 +ZY20210800004/H4/C11/N47/S193/s01/T2 +ZY20210800004/H4/C11/N43/S243/s05/T3 +ZY20210800004/H4/C11/N42/S243/s05/T4 +ZY20210800004/H4/C11/N41/S243/s04/T4 +ZY20210800004/H4/C11/N40/S243/s04/T4 +ZY20210800004/H4/C11/N39/S243/s04/T4 +ZY20210800004/H4/C11/N33/S243/s02/T4 +ZY20210800004/H4/C11/N25/S193/s03/T2 +ZY20210800004/H4/C11/N21/S193/s03/T3 +ZY20210800004/H4/C11/N21/S193/s03/T2 +ZY20210800004/H4/C11/N19/S193/s02/T3 +ZY20210800004/H4/C11/N19/S193/s02/T2 +ZY20210800004/H4/C11/N17/S193/s02/T3 +ZY20210800004/H4/C11/N17/S193/s02/T2 +ZY20210800004/H4/C11/N15/S193/s02/T3 +ZY20210800004/H4/C11/N15/S193/s02/T2 +ZY20210800004/H4/C1/N50/S6/s02/T1 +ZY20210800004/H4/C1/N50/S240/s03/T2 +ZY20210800004/H4/C1/N49/S240/s03/T2 +ZY20210800004/H4/C1/N48/S240/s02/T2 +ZY20210800004/H4/C1/N47/S240/s02/T2 +ZY20210800004/H4/C1/N46/S240/s02/T2 +ZY20210800004/H4/C1/N46/S17/s03/T1 +ZY20210800004/H4/C1/N45/S240/s02/T2 +ZY20210800004/H4/C1/N45/S17/s02/T3 +ZY20210800004/H4/C1/N45/S17/s02/T1 +ZY20210800004/H4/C1/N44/S240/s01/T2 +ZY20210800004/H4/C1/N43/S240/s01/T2 +ZY20210800004/H4/C1/N42/S240/s01/T2 +ZY20210800004/H4/C1/N42/S17/s01/T3 +ZY20210800004/H4/C1/N41/S240/s01/T2 +ZY20210800004/H4/C1/N41/S190/s03/T3 +ZY20210800004/H4/C1/N41/S17/s01/T3 +ZY20210800004/H4/C1/N41/S17/s01/T1 +ZY20210800004/H4/C1/N40/S239/s05/T2 +ZY20210800004/H4/C1/N40/S190/s03/T3 +ZY20210800004/H4/C1/N39/S244/s05/T4 +ZY20210800004/H4/C1/N39/S239/s05/T2 +ZY20210800004/H4/C1/N39/S190/s03/T3 +ZY20210800004/H4/C1/N38/S244/s05/T4 +ZY20210800004/H4/C1/N38/S239/s05/T2 +ZY20210800004/H4/C1/N38/S190/s02/T3 +ZY20210800004/H4/C1/N38/S18/s04/T1 +ZY20210800004/H4/C1/N37/S244/s05/T4 +ZY20210800004/H4/C1/N37/S239/s05/T2 +ZY20210800004/H4/C1/N37/S190/s02/T3 +ZY20210800004/H4/C1/N37/S18/s04/T3 +ZY20210800004/H4/C1/N36/S244/s04/T4 +ZY20210800004/H4/C1/N36/S239/s04/T2 +ZY20210800004/H4/C1/N36/S190/s02/T3 +ZY20210800004/H4/C1/N35/S244/s04/T4 +ZY20210800004/H4/C1/N35/S239/s04/T1 +ZY20210800004/H4/C1/N35/S190/s02/T3 +ZY20210800004/H4/C1/N35/S18/s03/T3 +ZY20210800004/H4/C1/N34/S244/s04/T4 +ZY20210800004/H4/C1/N34/S239/s04/T1 +ZY20210800004/H4/C1/N34/S190/s01/T3 +ZY20210800004/H4/C1/N33/S6/s05/T1 +ZY20210800004/H4/C1/N33/S244/s04/T4 +ZY20210800004/H4/C1/N33/S239/s04/T1 +ZY20210800004/H4/C1/N33/S190/s01/T3 +ZY20210800004/H4/C1/N32/S244/s03/T4 +ZY20210800004/H4/C1/N32/S239/s03/T1 +ZY20210800004/H4/C1/N32/S190/s01/T3 +ZY20210800004/H4/C1/N31/S244/s03/T4 +ZY20210800004/H4/C1/N31/S239/s03/T1 +ZY20210800004/H4/C1/N31/S190/s01/T3 +ZY20210800004/H4/C1/N30/S244/s03/T4 +ZY20210800004/H4/C1/N30/S242/s05/T3 +ZY20210800004/H4/C1/N30/S239/s03/T1 +ZY20210800004/H4/C1/N29/S244/s03/T4 +ZY20210800004/H4/C1/N29/S242/s05/T3 +ZY20210800004/H4/C1/N29/S239/s03/T1 +ZY20210800004/H4/C1/N29/S18/s01/T3 +ZY20210800004/H4/C1/N28/S244/s02/T4 +ZY20210800004/H4/C1/N28/S242/s05/T3 +ZY20210800004/H4/C1/N28/S239/s02/T1 +ZY20210800004/H4/C1/N27/S244/s02/T4 +ZY20210800004/H4/C1/N27/S242/s05/T3 +ZY20210800004/H4/C1/N27/S239/s02/T1 +ZY20210800004/H4/C1/N26/S242/s04/T3 +ZY20210800004/H4/C1/N26/S239/s02/T1 +ZY20210800004/H4/C1/N25/S244/s02/T4 +ZY20210800004/H4/C1/N25/S242/s04/T3 +ZY20210800004/H4/C1/N25/S239/s02/T1 +ZY20210800004/H4/C1/N24/S244/s01/T4 +ZY20210800004/H4/C1/N24/S242/s04/T3 +ZY20210800004/H4/C1/N24/S239/s01/T1 +ZY20210800004/H4/C1/N23/S244/s01/T4 +ZY20210800004/H4/C1/N23/S242/s04/T3 +ZY20210800004/H4/C1/N23/S239/s01/T1 +ZY20210800004/H4/C1/N22/S242/s03/T3 +ZY20210800004/H4/C1/N22/S239/s01/T1 +ZY20210800004/H4/C1/N21/S244/s01/T4 +ZY20210800004/H4/C1/N21/S242/s03/T3 +ZY20210800004/H4/C1/N21/S239/s01/T1 +ZY20210800004/H4/C1/N20/S242/s03/T2 +ZY20210800004/H4/C1/N20/S237/s05/T1 +ZY20210800004/H4/C1/N20/S194/s05/T4 +ZY20210800004/H4/C1/N19/S9/s04/T1 +ZY20210800004/H4/C1/N19/S242/s03/T2 +ZY20210800004/H4/C1/N19/S237/s05/T1 +ZY20210800004/H4/C1/N19/S194/s05/T4 +ZY20210800004/H4/C1/N14/S242/s01/T2 +ZY20210800004/H4/C1/N14/S237/s04/T1 +ZY20210800004/H4/C1/N14/S194/s04/T4 +ZY20210800004/H4/C1/N13/S242/s01/T2 +ZY20210800004/H4/C1/N13/S237/s04/T1 +ZY20210800004/H4/C1/N13/S194/s04/T4 +ZY20210800004/H4/C1/N06/S237/s02/T1 +ZY20210800004/H4/C1/N06/S194/s02/T4 +ZY20210800004/H4/C1/N05/S237/s02/T1 +ZY20210800004/H4/C1/N04/S237/s01/T1 +ZY20210800004/H4/C1/N03/S237/s01/T1 +ZY20210800004/H4/C1/N02/S240/s03/T2 +ZY20210800004/H4/C1/N02/S237/s01/T1 +ZY20210800004/H4/C1/N01/S240/s03/T2 +ZY20210800004/H4/C1/N01/S237/s01/T1 +ZY20210800003/H3/C9/N50/S306/s01/T2 +ZY20210800003/H3/C9/N49/S306/s01/T2 +ZY20210800003/H3/C9/N48/S303/s05/T2 +ZY20210800003/H3/C9/N47/S303/s05/T2 +ZY20210800003/H3/C9/N46/S303/s05/T2 +ZY20210800003/H3/C9/N45/S309/s02/T2 +ZY20210800003/H3/C9/N45/S303/s05/T2 +ZY20210800003/H3/C9/N44/S303/s04/T2 +ZY20210800003/H3/C9/N43/S45/s04/T2 +ZY20210800003/H3/C9/N43/S45/s04/T1 +ZY20210800003/H3/C9/N43/S309/s02/T2 +ZY20210800003/H3/C9/N43/S303/s04/T2 +ZY20210800003/H3/C9/N42/S303/s04/T2 +ZY20210800003/H3/C9/N41/S45/s05/T1 +ZY20210800003/H3/C9/N41/S309/s02/T2 +ZY20210800003/H3/C9/N41/S303/s04/T2 +ZY20210800003/H3/C9/N40/S45/s05/T2 +ZY20210800003/H3/C9/N40/S303/s03/T2 +ZY20210800003/H3/C9/N39/S309/s01/T2 +ZY20210800003/H3/C9/N39/S303/s03/T2 +ZY20210800003/H3/C9/N38/S303/s03/T2 +ZY20210800003/H3/C9/N37/S309/s01/T2 +ZY20210800003/H3/C9/N37/S303/s03/T2 +ZY20210800003/H3/C9/N35/S306/s05/T2 +ZY20210800003/H3/C9/N35/S303/s02/T2 +ZY20210800003/H3/C9/N33/S306/s05/T2 +ZY20210800003/H3/C9/N33/S303/s02/T2 +ZY20210800003/H3/C9/N32/S303/s01/T2 +ZY20210800003/H3/C9/N31/S306/s05/T2 +ZY20210800003/H3/C9/N31/S303/s01/T2 +ZY20210800003/H3/C9/N30/S303/s01/T2 +ZY20210800003/H3/C9/N29/S306/s05/T2 +ZY20210800003/H3/C9/N29/S303/s01/T2 +ZY20210800003/H3/C9/N28/S47/s01/T2 +ZY20210800003/H3/C9/N28/S300/s05/T2 +ZY20210800003/H3/C9/N27/S47/s02/T2 +ZY20210800003/H3/C9/N27/S306/s04/T2 +ZY20210800003/H3/C9/N27/S300/s05/T2 +ZY20210800003/H3/C9/N26/S300/s05/T2 +ZY20210800003/H3/C9/N25/S306/s04/T2 +ZY20210800003/H3/C9/N25/S300/s05/T2 +ZY20210800003/H3/C9/N24/S300/s04/T2 +ZY20210800003/H3/C9/N23/S306/s04/T2 +ZY20210800003/H3/C9/N23/S300/s04/T2 +ZY20210800003/H3/C9/N22/S300/s04/T2 +ZY20210800003/H3/C9/N21/S306/s04/T2 +ZY20210800003/H3/C9/N21/S300/s04/T2 +ZY20210800003/H3/C9/N20/S300/s03/T2 +ZY20210800003/H3/C9/N19/S45/s04/T2 +ZY20210800003/H3/C9/N19/S45/s04/T1 +ZY20210800003/H3/C9/N19/S306/s03/T2 +ZY20210800003/H3/C9/N19/S300/s03/T2 +ZY20210800003/H3/C9/N18/S300/s03/T2 +ZY20210800003/H3/C9/N17/S306/s03/T2 +ZY20210800003/H3/C9/N17/S300/s03/T2 +ZY20210800003/H3/C9/N16/S300/s02/T2 +ZY20210800003/H3/C9/N15/S306/s03/T2 +ZY20210800003/H3/C9/N15/S300/s02/T2 +ZY20210800003/H3/C9/N14/S300/s02/T2 +ZY20210800003/H3/C9/N13/S306/s03/T2 +ZY20210800003/H3/C9/N13/S300/s02/T2 +ZY20210800003/H3/C9/N12/S300/s01/T2 +ZY20210800003/H3/C9/N11/S306/s02/T2 +ZY20210800003/H3/C9/N11/S300/s01/T2 +ZY20210800003/H3/C8/N42/S74/s04/T2 +ZY20210800003/H3/C8/N42/S74/s04/T1 +ZY20210800003/H3/C8/N41/S74/s03/T2 +ZY20210800003/H3/C8/N40/S74/s03/T2 +ZY20210800003/H3/C8/N39/S74/s02/T2 +ZY20210800003/H3/C8/N39/S74/s02/T1 +ZY20210800003/H3/C8/N38/S74/s02/T2 +ZY20210800003/H3/C8/N38/S74/s02/T1 +ZY20210800003/H3/C6/N50/S252/s05/T1 +ZY20210800003/H3/C6/N47/S252/s04/T1 +ZY20210800003/H3/C6/N45/S252/s03/T1 +ZY20210800003/H3/C6/N43/S252/s03/T1 +ZY20210800003/H3/C6/N39/S252/s02/T1 +ZY20210800003/H3/C6/N28/S82/s05/T2 +ZY20210800003/H3/C6/N25/S82/s04/T2 +ZY20210800003/H3/C6/N25/S82/s04/T1 +ZY20210800003/H3/C6/N24/S82/s03/T1 +ZY20210800003/H3/C6/N24/S252/s01/T3 +ZY20210800003/H3/C6/N21/S252/s01/T3 +ZY20210800003/H3/C6/N20/S251/s05/T3 +ZY20210800003/H3/C6/N19/S251/s05/T3 +ZY20210800003/H3/C6/N16/S251/s04/T3 +ZY20210800003/H3/C6/N15/S251/s04/T3 +ZY20210800003/H3/C6/N14/S251/s04/T3 +ZY20210800003/H3/C6/N11/S251/s03/T2 +ZY20210800003/H3/C6/N10/S251/s03/T2 +ZY20210800003/H3/C6/N09/S251/s03/T2 +ZY20210800003/H3/C6/N07/S251/s02/T2 +ZY20210800003/H3/C6/N06/S251/s02/T2 +ZY20210800003/H3/C6/N05/S85/s05/T2 +ZY20210800003/H3/C6/N05/S85/s05/T1 +ZY20210800003/H3/C6/N05/S251/s02/T2 +ZY20210800003/H3/C6/N04/S85/s05/T2 +ZY20210800003/H3/C6/N04/S251/s01/T2 +ZY20210800003/H3/C6/N03/S85/s04/T1 +ZY20210800003/H3/C6/N03/S251/s01/T2 +ZY20210800003/H3/C6/N02/S85/s04/T1 +ZY20210800003/H3/C6/N02/S251/s01/T2 +ZY20210800003/H3/C6/N01/S85/s03/T2 +ZY20210800003/H3/C6/N01/S85/s03/T1 +ZY20210800003/H3/C6/N01/S251/s01/T2 +ZY20210800003/H3/C5/N49/S61/s05/T4 +ZY20210800003/H3/C5/N48/S61/s04/T1 +ZY20210800003/H3/C5/N47/S61/s04/T1 +ZY20210800003/H3/C5/N46/S61/s03/T1 +ZY20210800003/H3/C5/N45/S61/s03/T4 +ZY20210800003/H3/C5/N40/S60/s05/T4 +ZY20210800003/H3/C5/N40/S60/s05/T1 +ZY20210800003/H3/C5/N31/S58/s03/T1 +ZY20210800003/H3/C5/N18/S58/s04/T4 +ZY20210800003/H3/C5/N18/S58/s04/T1 +ZY20210800003/H3/C5/N13/S58/s02/T4 +ZY20210800003/H3/C5/N11/S58/s01/T1 +ZY20210800003/H3/C4/N45/S48/s03/T2 +ZY20210800003/H3/C4/N45/S48/s03/T1 +ZY20210800003/H3/C4/N44/S48/s02/T2 +ZY20210800003/H3/C4/N43/S48/s02/T2 +ZY20210800003/H3/C4/N43/S48/s02/T1 +ZY20210800003/H3/C4/N42/S48/s01/T2 +ZY20210800003/H3/C4/N42/S48/s01/T1 +ZY20210800003/H3/C4/N41/S48/s01/T2 +ZY20210800003/H3/C4/N41/S48/s01/T1 +ZY20210800003/H3/C4/N40/S53/s05/T2 +ZY20210800003/H3/C4/N40/S53/s05/T1 +ZY20210800003/H3/C4/N39/S53/s05/T2 +ZY20210800003/H3/C4/N39/S53/s05/T1 +ZY20210800003/H3/C4/N08/S119/s05/T2 +ZY20210800003/H3/C4/N08/S119/s05/T1 +ZY20210800003/H3/C4/N05/S50/s01/T4 +ZY20210800003/H3/C4/N05/S50/s01/T3 +ZY20210800003/H3/C4/N04/S50/s01/T4 +ZY20210800003/H3/C4/N04/S50/s01/T3 +ZY20210800003/H3/C4/N03/S50/s05/T4 +ZY20210800003/H3/C4/N03/S50/s05/T3 +ZY20210800003/H3/C4/N02/S50/s05/T4 +ZY20210800003/H3/C4/N02/S50/s05/T3 +ZY20210800003/H3/C3/N50/S284/s03/T2 +ZY20210800003/H3/C3/N50/S282/s02/T2 +ZY20210800003/H3/C3/N49/S284/s03/T2 +ZY20210800003/H3/C3/N49/S282/s01/T2 +ZY20210800003/H3/C3/N48/S284/s02/T2 +ZY20210800003/H3/C3/N48/S282/s01/T2 +ZY20210800003/H3/C3/N46/S284/s02/T2 +ZY20210800003/H3/C3/N46/S282/s01/T2 +ZY20210800003/H3/C3/N45/S284/s02/T2 +ZY20210800003/H3/C3/N45/S279/s05/T2 +ZY20210800003/H3/C3/N44/S284/s01/T2 +ZY20210800003/H3/C3/N44/S279/s05/T2 +ZY20210800003/H3/C3/N40/S282/s05/T2 +ZY20210800003/H3/C3/N40/S279/s04/T2 +ZY20210800003/H3/C3/N36/S282/s04/T2 +ZY20210800003/H3/C3/N36/S279/s03/T2 +ZY20210800003/H3/C3/N34/S282/s04/T2 +ZY20210800003/H3/C3/N34/S279/s03/T2 +ZY20210800003/H3/C3/N33/S282/s04/T2 +ZY20210800003/H3/C3/N33/S279/s02/T2 +ZY20210800003/H3/C3/N32/S282/s03/T2 +ZY20210800003/H3/C3/N32/S279/s02/T2 +ZY20210800003/H3/C3/N31/S282/s03/T2 +ZY20210800003/H3/C3/N31/S279/s02/T2 +ZY20210800003/H3/C3/N28/S282/s02/T2 +ZY20210800003/H3/C3/N28/S279/s01/T2 +ZY20210800003/H3/C3/N26/S282/s02/T2 +ZY20210800003/H3/C3/N26/S279/s01/T2 +ZY20210800003/H3/C3/N25/S277/s05/T2 +ZY20210800003/H3/C3/N24/S277/s05/T2 +ZY20210800003/H3/C3/N23/S277/s05/T2 +ZY20210800003/H3/C3/N22/S277/s05/T2 +ZY20210800003/H3/C3/N20/S277/s04/T2 +ZY20210800003/H3/C3/N15/S277/s03/T2 +ZY20210800003/H3/C3/N13/S107/s04/T2 +ZY20210800003/H3/C3/N13/S107/s04/T1 +ZY20210800003/H3/C3/N10/S277/s02/T2 +ZY20210800003/H3/C3/N08/S277/s01/T2 +ZY20210800003/H3/C3/N07/S277/s01/T2 +ZY20210800003/H3/C3/N06/S277/s01/T2 +ZY20210800003/H3/C3/N03/S275/s05/T2 +ZY20210800003/H3/C3/N02/S275/s05/T2 +ZY20210800003/H3/C3/N01/S275/s04/T2 +ZY20210800003/H3/C20/N35/S307/s02/T1 +ZY20210800003/H3/C20/N17/S282/s03/T2 +ZY20210800003/H3/C20/N17/S279/s04/T1 +ZY20210800003/H3/C20/N16/S284/s02/T3 +ZY20210800003/H3/C20/N16/S284/s01/T4 +ZY20210800003/H3/C20/N16/S282/s03/T2 +ZY20210800003/H3/C20/N16/S279/s04/T1 +ZY20210800003/H3/C20/N15/S284/s02/T3 +ZY20210800003/H3/C20/N15/S284/s01/T4 +ZY20210800003/H3/C20/N15/S282/s03/T2 +ZY20210800003/H3/C20/N15/S279/s04/T1 +ZY20210800003/H3/C20/N14/S284/s05/T4 +ZY20210800003/H3/C20/N14/S284/s02/T3 +ZY20210800003/H3/C20/N14/S282/s03/T2 +ZY20210800003/H3/C20/N14/S279/s04/T1 +ZY20210800003/H3/C20/N13/S284/s05/T4 +ZY20210800003/H3/C20/N13/S284/s01/T3 +ZY20210800003/H3/C20/N13/S282/s02/T2 +ZY20210800003/H3/C20/N13/S279/s03/T1 +ZY20210800003/H3/C20/N12/S284/s05/T4 +ZY20210800003/H3/C20/N12/S284/s01/T3 +ZY20210800003/H3/C20/N12/S282/s02/T2 +ZY20210800003/H3/C20/N12/S279/s03/T2 +ZY20210800003/H3/C20/N11/S284/s05/T4 +ZY20210800003/H3/C20/N11/S284/s01/T3 +ZY20210800003/H3/C20/N11/S282/s02/T2 +ZY20210800003/H3/C20/N11/S279/s03/T1 +ZY20210800003/H3/C2/N49/S219/s02/T3 +ZY20210800003/H3/C2/N48/S219/s02/T3 +ZY20210800003/H3/C2/N47/S219/s02/T3 +ZY20210800003/H3/C2/N46/S219/s01/T3 +ZY20210800003/H3/C2/N45/S219/s01/T3 +ZY20210800003/H3/C2/N44/S51/s03/T1 +ZY20210800003/H3/C2/N44/S219/s01/T3 +ZY20210800003/H3/C2/N43/S219/s01/T3 +ZY20210800003/H3/C2/N42/S217/s05/T2 +ZY20210800003/H3/C2/N41/S217/s05/T2 +ZY20210800003/H3/C2/N40/S217/s05/T2 +ZY20210800003/H3/C2/N39/S217/s05/T2 +ZY20210800003/H3/C2/N38/S217/s04/T2 +ZY20210800003/H3/C2/N37/S217/s04/T2 +ZY20210800003/H3/C2/N36/S217/s04/T2 +ZY20210800003/H3/C2/N35/S217/s04/T2 +ZY20210800003/H3/C2/N34/S217/s03/T1 +ZY20210800003/H3/C2/N33/S217/s03/T1 +ZY20210800003/H3/C2/N32/S50/s02/T1 +ZY20210800003/H3/C2/N32/S217/s03/T1 +ZY20210800003/H3/C2/N31/S217/s03/T1 +ZY20210800003/H3/C2/N30/S217/s02/T1 +ZY20210800003/H3/C2/N29/S217/s02/T1 +ZY20210800003/H3/C2/N28/S217/s02/T1 +ZY20210800003/H3/C2/N27/S217/s02/T1 +ZY20210800003/H3/C2/N23/S217/s01/T6 +ZY20210800003/H3/C2/N22/S217/s01/T6 +ZY20210800003/H3/C2/N21/S215/s05/T6 +ZY20210800003/H3/C2/N20/S215/s05/T6 +ZY20210800003/H3/C2/N19/S215/s05/T6 +ZY20210800003/H3/C2/N18/S215/s05/T6 +ZY20210800003/H3/C2/N17/S215/s05/T6 +ZY20210800003/H3/C2/N16/S215/s04/T6 +ZY20210800003/H3/C2/N15/S215/s04/T5 +ZY20210800003/H3/C2/N14/S215/s04/T5 +ZY20210800003/H3/C2/N13/S215/s04/T5 +ZY20210800003/H3/C2/N12/S215/s03/T5 +ZY20210800003/H3/C2/N11/S215/s03/T5 +ZY20210800003/H3/C18/N50/S197/s02/T2 +ZY20210800003/H3/C18/N49/S197/s01/T2 +ZY20210800003/H3/C18/N48/S197/s01/T2 +ZY20210800003/H3/C18/N47/S197/s01/T2 +ZY20210800003/H3/C18/N46/S197/s01/T1 +ZY20210800003/H3/C18/N45/S195/s05/T2 +ZY20210800003/H3/C18/N43/S195/s05/T2 +ZY20210800003/H3/C18/N42/S195/s05/T2 +ZY20210800003/H3/C18/N41/S195/s04/T2 +ZY20210800003/H3/C18/N40/S195/s04/T2 +ZY20210800003/H3/C18/N39/S195/s04/T2 +ZY20210800003/H3/C18/N37/S195/s03/T2 +ZY20210800003/H3/C18/N36/S195/s03/T2 +ZY20210800003/H3/C18/N35/S195/s03/T2 +ZY20210800003/H3/C18/N34/S195/s03/T2 +ZY20210800003/H3/C18/N33/S195/s02/T2 +ZY20210800003/H3/C18/N32/S195/s02/T2 +ZY20210800003/H3/C18/N31/S195/s02/T2 +ZY20210800003/H3/C18/N30/S195/s02/T2 +ZY20210800003/H3/C18/N29/S195/s01/T2 +ZY20210800003/H3/C18/N28/S195/s01/T2 +ZY20210800003/H3/C18/N28/S143/s02/T1 +ZY20210800003/H3/C18/N27/S195/s01/T2 +ZY20210800003/H3/C18/N26/S195/s01/T2 +ZY20210800003/H3/C18/N25/S197/s03/T2 +ZY20210800003/H3/C18/N23/S197/s03/T2 +ZY20210800003/H3/C18/N21/S197/s03/T2 +ZY20210800003/H3/C18/N19/S197/s02/T2 +ZY20210800003/H3/C18/N17/S197/s02/T2 +ZY20210800003/H3/C18/N16/S139/s04/T1 +ZY20210800003/H3/C18/N15/S197/s02/T1 +ZY20210800003/H3/C18/N14/S139/s04/T1 +ZY20210800003/H3/C18/N13/S139/s04/T1 +ZY20210800003/H3/C18/N12/S139/s03/T1 +ZY20210800003/H3/C18/N11/S139/s03/T1 +ZY20210800003/H3/C17/N75/S266/s02/T3 +ZY20210800003/H3/C17/N74/S266/s01/T3 +ZY20210800003/H3/C17/N73/S266/s01/T3 +ZY20210800003/H3/C17/N72/S266/s01/T2 +ZY20210800003/H3/C17/N71/S266/s01/T2 +ZY20210800003/H3/C17/N70/S264/s05/T2 +ZY20210800003/H3/C17/N69/S266/s03/T3 +ZY20210800003/H3/C17/N69/S264/s05/T2 +ZY20210800003/H3/C17/N67/S266/s03/T3 +ZY20210800003/H3/C17/N67/S264/s05/T2 +ZY20210800003/H3/C17/N66/S266/s03/T3 +ZY20210800003/H3/C17/N66/S264/s04/T2 +ZY20210800003/H3/C17/N65/S266/s02/T3 +ZY20210800003/H3/C17/N65/S264/s04/T2 +ZY20210800003/H3/C17/N64/S266/s02/T3 +ZY20210800003/H3/C17/N64/S264/s04/T2 +ZY20210800003/H3/C17/N63/S266/s02/T3 +ZY20210800003/H3/C17/N63/S264/s04/T2 +ZY20210800003/H3/C17/N62/S264/s03/T2 +ZY20210800003/H3/C17/N61/S264/s03/T1 +ZY20210800003/H3/C17/N60/S264/s03/T1 +ZY20210800003/H3/C17/N59/S264/s03/T1 +ZY20210800003/H3/C17/N58/S264/s02/T1 +ZY20210800003/H3/C17/N57/S264/s02/T1 +ZY20210800003/H3/C17/N25/S171/s02/T3 +ZY20210800003/H3/C17/N25/S130/s02/T1 +ZY20210800003/H3/C17/N24/S171/s01/T3 +ZY20210800003/H3/C17/N24/S130/s01/T1 +ZY20210800003/H3/C17/N23/S171/s01/T3 +ZY20210800003/H3/C17/N23/S130/s01/T1 +ZY20210800003/H3/C17/N22/S130/s01/T1 +ZY20210800003/H3/C17/N21/S171/s01/T3 +ZY20210800003/H3/C17/N21/S130/s01/T1 +ZY20210800003/H3/C17/N20/S167/s05/T3 +ZY20210800003/H3/C17/N20/S126/s05/T1 +ZY20210800003/H3/C17/N19/S167/s05/T2 +ZY20210800003/H3/C17/N19/S126/s05/T1 +ZY20210800003/H3/C17/N18/S167/s05/T2 +ZY20210800003/H3/C17/N18/S126/s05/T1 +ZY20210800003/H3/C17/N17/S167/s05/T2 +ZY20210800003/H3/C17/N17/S126/s05/T1 +ZY20210800003/H3/C17/N16/S167/s04/T2 +ZY20210800003/H3/C17/N16/S126/s04/T1 +ZY20210800003/H3/C17/N15/S167/s04/T2 +ZY20210800003/H3/C17/N15/S126/s04/T1 +ZY20210800003/H3/C17/N14/S167/s04/T2 +ZY20210800003/H3/C17/N14/S126/s04/T1 +ZY20210800003/H3/C17/N13/S167/s04/T2 +ZY20210800003/H3/C17/N13/S126/s04/T1 +ZY20210800003/H3/C17/N12/S167/s03/T2 +ZY20210800003/H3/C17/N12/S126/s03/T1 +ZY20210800003/H3/C17/N11/S167/s03/T2 +ZY20210800003/H3/C17/N11/S126/s03/T1 +ZY20210800003/H3/C17/N10/S167/s03/T2 +ZY20210800003/H3/C17/N10/S126/s03/T1 +ZY20210800003/H3/C17/N09/S167/s03/T2 +ZY20210800003/H3/C17/N09/S126/s03/T1 +ZY20210800003/H3/C17/N08/S167/s02/T2 +ZY20210800003/H3/C17/N08/S126/s02/T1 +ZY20210800003/H3/C17/N07/S167/s02/T2 +ZY20210800003/H3/C17/N07/S126/s02/T1 +ZY20210800003/H3/C17/N06/S167/s02/T2 +ZY20210800003/H3/C17/N06/S126/s02/T1 +ZY20210800003/H3/C14/N50/S170/s02/T1 +ZY20210800003/H3/C14/N49/S209/s01/T2 +ZY20210800003/H3/C14/N49/S170/s01/T1 +ZY20210800003/H3/C14/N48/S209/s01/T2 +ZY20210800003/H3/C14/N48/S170/s01/T1 +ZY20210800003/H3/C14/N47/S209/s01/T2 +ZY20210800003/H3/C14/N47/S170/s01/T1 +ZY20210800003/H3/C14/N46/S209/s01/T2 +ZY20210800003/H3/C14/N46/S170/s01/T1 +ZY20210800003/H3/C14/N45/S166/s05/T1 +ZY20210800003/H3/C14/N44/S207/s05/T2 +ZY20210800003/H3/C14/N44/S166/s05/T1 +ZY20210800003/H3/C14/N43/S207/s05/T2 +ZY20210800003/H3/C14/N43/S166/s05/T1 +ZY20210800003/H3/C14/N42/S207/s05/T2 +ZY20210800003/H3/C14/N42/S166/s05/T1 +ZY20210800003/H3/C14/N41/S207/s04/T2 +ZY20210800003/H3/C14/N41/S166/s04/T1 +ZY20210800003/H3/C14/N40/S207/s04/T2 +ZY20210800003/H3/C14/N40/S166/s04/T1 +ZY20210800003/H3/C14/N39/S207/s04/T2 +ZY20210800003/H3/C14/N38/S207/s04/T2 +ZY20210800003/H3/C14/N38/S166/s04/T1 +ZY20210800003/H3/C14/N37/S334/s03/T2 +ZY20210800003/H3/C14/N37/S334/s02/T1 +ZY20210800003/H3/C14/N36/S334/s03/T2 +ZY20210800003/H3/C14/N36/S334/s02/T1 +ZY20210800003/H3/C14/N35/S207/s03/T2 +ZY20210800003/H3/C14/N35/S166/s03/T1 +ZY20210800003/H3/C14/N34/S207/s03/T2 +ZY20210800003/H3/C14/N34/S166/s03/T1 +ZY20210800003/H3/C14/N33/S334/s03/T2 +ZY20210800003/H3/C14/N33/S334/s01/T1 +ZY20210800003/H3/C14/N32/S207/s02/T2 +ZY20210800003/H3/C14/N32/S166/s02/T1 +ZY20210800003/H3/C14/N31/S207/s02/T2 +ZY20210800003/H3/C14/N31/S166/s02/T1 +ZY20210800003/H3/C14/N30/S334/s03/T2 +ZY20210800003/H3/C14/N30/S334/s01/T1 +ZY20210800003/H3/C14/N29/S207/s01/T2 +ZY20210800003/H3/C14/N29/S166/s01/T1 +ZY20210800003/H3/C14/N28/S207/s01/T2 +ZY20210800003/H3/C14/N28/S166/s01/T1 +ZY20210800003/H3/C14/N27/S334/s02/T2 +ZY20210800003/H3/C14/N27/S334/s01/T1 +ZY20210800003/H3/C14/N26/S334/s02/T2 +ZY20210800003/H3/C14/N26/S334/s01/T1 +ZY20210800003/H3/C14/N13/S209/s03/T2 +ZY20210800003/H3/C14/N13/S170/s03/T1 +ZY20210800003/H3/C14/N11/S209/s03/T2 +ZY20210800003/H3/C14/N11/S170/s03/T1 +ZY20210800003/H3/C13/N50/S203/s02/T4 +ZY20210800003/H3/C13/N50/S144/s02/T1 +ZY20210800003/H3/C13/N49/S203/s01/T4 +ZY20210800003/H3/C13/N49/S144/s01/T1 +ZY20210800003/H3/C13/N48/S203/s01/T4 +ZY20210800003/H3/C13/N48/S144/s01/T1 +ZY20210800003/H3/C13/N47/S203/s01/T4 +ZY20210800003/H3/C13/N47/S144/s01/T1 +ZY20210800003/H3/C13/N46/S203/s01/T4 +ZY20210800003/H3/C13/N46/S144/s01/T1 +ZY20210800003/H3/C13/N45/S200/s05/T4 +ZY20210800003/H3/C13/N45/S140/s05/T1 +ZY20210800003/H3/C13/N44/S200/s05/T4 +ZY20210800003/H3/C13/N43/S140/s05/T1 +ZY20210800003/H3/C13/N42/S200/s05/T4 +ZY20210800003/H3/C13/N42/S140/s05/T1 +ZY20210800003/H3/C13/N41/S200/s04/T4 +ZY20210800003/H3/C13/N41/S140/s04/T1 +ZY20210800003/H3/C13/N40/S200/s04/T4 +ZY20210800003/H3/C13/N39/S200/s04/T4 +ZY20210800003/H3/C13/N39/S140/s04/T1 +ZY20210800003/H3/C13/N38/S200/s04/T3 +ZY20210800003/H3/C13/N38/S140/s04/T1 +ZY20210800003/H3/C13/N37/S200/s03/T3 +ZY20210800003/H3/C13/N36/S200/s03/T3 +ZY20210800003/H3/C13/N36/S140/s03/T1 +ZY20210800003/H3/C13/N35/S200/s03/T3 +ZY20210800003/H3/C13/N35/S140/s03/T1 +ZY20210800003/H3/C13/N34/S200/s03/T3 +ZY20210800003/H3/C13/N34/S140/s03/T1 +ZY20210800003/H3/C13/N33/S200/s02/T3 +ZY20210800003/H3/C13/N33/S140/s02/T1 +ZY20210800003/H3/C13/N32/S200/s02/T3 +ZY20210800003/H3/C13/N32/S140/s02/T1 +ZY20210800003/H3/C13/N31/S200/s02/T2 +ZY20210800003/H3/C13/N31/S140/s02/T1 +ZY20210800003/H3/C13/N30/S200/s02/T2 +ZY20210800003/H3/C13/N30/S140/s02/T1 +ZY20210800003/H3/C13/N29/S200/s01/T2 +ZY20210800003/H3/C13/N29/S140/s01/T1 +ZY20210800003/H3/C13/N28/S200/s01/T2 +ZY20210800003/H3/C13/N28/S140/s01/T1 +ZY20210800003/H3/C13/N27/S200/s01/T2 +ZY20210800003/H3/C13/N27/S140/s01/T1 +ZY20210800003/H3/C13/N26/S200/s01/T2 +ZY20210800003/H3/C13/N26/S140/s01/T1 +ZY20210800003/H3/C13/N13/S144/s03/T1 +ZY20210800003/H3/C13/N11/S203/s03/T4 +ZY20210800003/H3/C13/N11/S144/s03/T1 +ZY20210800003/H3/C12/N48/S342/s03/T2 +ZY20210800003/H3/C12/N42/S342/s02/T2 +ZY20210800003/H3/C12/N36/S176/s03/T1 +ZY20210800003/H3/C12/N34/S176/s03/T1 +ZY20210800003/H3/C12/N32/S176/s03/T1 +ZY20210800003/H3/C12/N30/S176/s02/T1 +ZY20210800003/H3/C12/N28/S176/s02/T1 +ZY20210800003/H3/C12/N26/S176/s02/T1 +ZY20210800003/H3/C12/N25/S176/s02/T1 +ZY20210800003/H3/C12/N24/S342/s01/T2 +ZY20210800003/H3/C12/N24/S176/s03/T1 +ZY20210800003/H3/C12/N23/S176/s01/T1 +ZY20210800003/H3/C12/N22/S176/s01/T1 +ZY20210800003/H3/C12/N21/S176/s01/T1 +ZY20210800003/H3/C12/N20/S206/s05/T2 +ZY20210800003/H3/C12/N20/S173/s05/T1 +ZY20210800003/H3/C12/N19/S206/s05/T2 +ZY20210800003/H3/C12/N19/S173/s05/T1 +ZY20210800003/H3/C12/N18/S206/s05/T2 +ZY20210800003/H3/C12/N18/S173/s05/T1 +ZY20210800003/H3/C12/N17/S173/s05/T1 +ZY20210800003/H3/C12/N16/S206/s04/T2 +ZY20210800003/H3/C12/N16/S173/s04/T1 +ZY20210800003/H3/C12/N15/S206/s04/T2 +ZY20210800003/H3/C12/N15/S173/s04/T1 +ZY20210800003/H3/C12/N14/S206/s04/T2 +ZY20210800003/H3/C12/N14/S173/s04/T1 +ZY20210800003/H3/C12/N13/S206/s04/T2 +ZY20210800003/H3/C12/N13/S173/s04/T1 +ZY20210800003/H3/C12/N12/S206/s03/T2 +ZY20210800003/H3/C12/N12/S173/s03/T1 +ZY20210800003/H3/C12/N11/S206/s03/T2 +ZY20210800003/H3/C12/N11/S173/s03/T1 +ZY20210800003/H3/C11/N50/S182/s02/T4 +ZY20210800003/H3/C11/N50/S151/s02/T1 +ZY20210800003/H3/C11/N49/S182/s01/T4 +ZY20210800003/H3/C11/N49/S151/s01/T1 +ZY20210800003/H3/C11/N48/S182/s01/T4 +ZY20210800003/H3/C11/N47/S182/s01/T4 +ZY20210800003/H3/C11/N47/S151/s01/T1 +ZY20210800003/H3/C11/N43/S148/s05/T1 +ZY20210800003/H3/C11/N42/S180/s05/T4 +ZY20210800003/H3/C11/N42/S148/s05/T1 +ZY20210800003/H3/C11/N41/S180/s04/T4 +ZY20210800003/H3/C11/N41/S148/s04/T1 +ZY20210800003/H3/C11/N40/S180/s04/T4 +ZY20210800003/H3/C11/N40/S148/s04/T1 +ZY20210800003/H3/C11/N39/S180/s04/T4 +ZY20210800003/H3/C11/N39/S148/s04/T1 +ZY20210800003/H3/C11/N33/S180/s02/T3 +ZY20210800003/H3/C11/N33/S148/s02/T1 +ZY20210800003/H3/C11/N11/S182/s03/T4 +ZY20210800003/H3/C11/N11/S151/s03/T1 +ZY20210800003/H3/C11/N09/S182/s03/T4 +ZY20210800003/H3/C11/N09/S151/s03/T1 +ZY20210800003/H3/C11/N07/S182/s03/T4 +ZY20210800003/H3/C11/N07/S151/s03/T1 +ZY20210800003/H3/C1/N50/S83/s04/T2 +ZY20210800003/H3/C1/N50/S83/s04/T1 +ZY20210800003/H3/C1/N49/S83/s04/T2 +ZY20210800003/H3/C1/N49/S83/s04/T1 +ZY20210800003/H3/C1/N48/S83/s05/T2 +ZY20210800003/H3/C1/N48/S83/s05/T1 +ZY20210800003/H3/C1/N46/S84/s01/T1 +ZY20210800003/H3/C1/N45/S84/s02/T1 +ZY20210800003/H3/C1/N44/S84/s01/T2 +ZY20210800003/H3/C1/N42/S84/s03/T1 +ZY20210800003/H3/C1/N35/S83/s03/T1 +ZY20210800003/H3/C1/N33/S83/s02/T1 +ZY20210800003/H3/C1/N32/S83/s02/T2 +ZY20210800003/H3/C1/N32/S83/s02/T1 +ZY20210800003/H3/C1/N31/S83/s03/T1 +ZY20210800003/H3/C1/N30/S83/s01/T2 +ZY20210800003/H3/C1/N30/S83/s01/T1 +ZY20210800003/H3/C1/N29/S90/s05/T1 +ZY20210800003/H3/C1/N28/S90/s03/T2 +ZY20210800003/H3/C1/N27/S90/s02/T1 +ZY20210800003/H3/C1/N24/S87/s04/T1 +ZY20210800003/H3/C1/N21/S87/s02/T1 +ZY20210800003/H3/C1/N19/S87/s01/T2 +ZY20210800003/H3/C1/N08/S90/s01/T2 +ZY20210800003/H3/C1/N08/S90/s01/T1 +ZY20210800003/H3/C1/N03/S86/s02/T2 +ZY20210800003/H3/C1/N03/S86/s02/T1 +ZY20210800003/H3/C1/N02/S86/s01/T2 +ZY20210800003/H3/C1/N02/S86/s01/T1 +ZY20210800002/H2/C9/N50/S72/s02/T2 +ZY20210800002/H2/C9/N50/S72/s02/T1 +ZY20210800002/H2/C9/N50/S344/s03/T2 +ZY20210800002/H2/C9/N49/S344/s03/T2 +ZY20210800002/H2/C9/N48/S344/s03/T2 +ZY20210800002/H2/C9/N47/S344/s03/T2 +ZY20210800002/H2/C9/N46/S344/s02/T2 +ZY20210800002/H2/C9/N45/S344/s02/T2 +ZY20210800002/H2/C9/N44/S344/s02/T2 +ZY20210800002/H2/C9/N43/S344/s02/T2 +ZY20210800002/H2/C9/N42/S344/s01/T2 +ZY20210800002/H2/C9/N41/S344/s01/T2 +ZY20210800002/H2/C9/N40/S344/s01/T2 +ZY20210800002/H2/C9/N39/S344/s01/T2 +ZY20210800002/H2/C9/N37/S349/s04/T1 +ZY20210800002/H2/C9/N36/S349/s04/T1 +ZY20210800002/H2/C9/N35/S349/s04/T1 +ZY20210800002/H2/C9/N34/S349/s04/T1 +ZY20210800002/H2/C9/N32/S349/s03/T1 +ZY20210800002/H2/C9/N31/S349/s03/T1 +ZY20210800002/H2/C9/N28/S349/s02/T1 +ZY20210800002/H2/C9/N27/S349/s02/T1 +ZY20210800002/H2/C9/N26/S349/s02/T1 +ZY20210800002/H2/C9/N25/S350/s05/T2 +ZY20210800002/H2/C9/N25/S349/s02/T1 +ZY20210800002/H2/C9/N24/S350/s04/T2 +ZY20210800002/H2/C9/N24/S349/s01/T1 +ZY20210800002/H2/C9/N23/S350/s04/T2 +ZY20210800002/H2/C9/N23/S349/s01/T1 +ZY20210800002/H2/C9/N22/S350/s04/T2 +ZY20210800002/H2/C9/N22/S349/s01/T1 +ZY20210800002/H2/C9/N21/S350/s04/T2 +ZY20210800002/H2/C9/N21/S349/s01/T1 +ZY20210800002/H2/C9/N20/S350/s03/T2 +ZY20210800002/H2/C9/N20/S347/s05/T1 +ZY20210800002/H2/C9/N19/S350/s03/T2 +ZY20210800002/H2/C9/N19/S347/s05/T1 +ZY20210800002/H2/C9/N18/S350/s03/T2 +ZY20210800002/H2/C9/N18/S347/s05/T1 +ZY20210800002/H2/C9/N17/S350/s03/T2 +ZY20210800002/H2/C9/N17/S347/s05/T1 +ZY20210800002/H2/C9/N16/S350/s02/T2 +ZY20210800002/H2/C9/N15/S350/s02/T2 +ZY20210800002/H2/C9/N14/S350/s02/T2 +ZY20210800002/H2/C9/N13/S350/s02/T2 +ZY20210800002/H2/C9/N12/S350/s01/T2 +ZY20210800002/H2/C9/N11/S350/s01/T2 +ZY20210800002/H2/C8/N15/S80/s03/T2 +ZY20210800002/H2/C8/N15/S80/s03/T1 +ZY20210800002/H2/C8/N14/S80/s02/T2 +ZY20210800002/H2/C8/N14/S80/s02/T1 +ZY20210800002/H2/C8/N13/S80/s02/T2 +ZY20210800002/H2/C8/N13/S80/s02/T1 +ZY20210800002/H2/C8/N12/S80/s01/T2 +ZY20210800002/H2/C8/N12/S80/s01/T1 +ZY20210800002/H2/C8/N11/S80/s01/T2 +ZY20210800002/H2/C8/N11/S80/s01/T1 +ZY20210800002/H2/C7/N50/S58/s04/T1 +ZY20210800002/H2/C7/N49/S58/s03/T1 +ZY20210800002/H2/C7/N48/S58/s03/T1 +ZY20210800002/H2/C7/N47/S58/s02/T1 +ZY20210800002/H2/C7/N46/S58/s02/T1 +ZY20210800002/H2/C7/N45/S58/s01/T1 +ZY20210800002/H2/C7/N42/S57/s05/T1 +ZY20210800002/H2/C7/N41/S57/s04/T1 +ZY20210800002/H2/C7/N40/S57/s04/T1 +ZY20210800002/H2/C7/N39/S57/s03/T1 +ZY20210800002/H2/C7/N38/S57/s03/T1 +ZY20210800002/H2/C7/N37/S57/s02/T1 +ZY20210800002/H2/C7/N35/S57/s01/T1 +ZY20210800002/H2/C7/N34/S57/s01/T1 +ZY20210800002/H2/C7/N31/S81/s03/T3 +ZY20210800002/H2/C7/N31/S81/s03/T1 +ZY20210800002/H2/C7/N30/S81/s02/T3 +ZY20210800002/H2/C7/N30/S81/s02/T1 +ZY20210800002/H2/C7/N29/S81/s02/T3 +ZY20210800002/H2/C7/N29/S81/s02/T1 +ZY20210800002/H2/C7/N28/S81/s01/T3 +ZY20210800002/H2/C7/N28/S81/s01/T1 +ZY20210800002/H2/C7/N27/S79/s05/T1 +ZY20210800002/H2/C7/N26/S79/s05/T1 +ZY20210800002/H2/C7/N25/S81/s01/T1 +ZY20210800002/H2/C7/N24/S79/s04/T1 +ZY20210800002/H2/C7/N23/S79/s04/T1 +ZY20210800002/H2/C7/N22/S79/s03/T1 +ZY20210800002/H2/C7/N21/S79/s03/T1 +ZY20210800002/H2/C7/N20/S79/s02/T1 +ZY20210800002/H2/C7/N19/S79/s02/T1 +ZY20210800002/H2/C7/N18/S79/s01/T1 +ZY20210800002/H2/C7/N17/S55/s04/T3 +ZY20210800002/H2/C7/N16/S64/s03/T1 +ZY20210800002/H2/C7/N15/S64/s03/T3 +ZY20210800002/H2/C7/N15/S64/s03/T1 +ZY20210800002/H2/C7/N14/S64/s02/T3 +ZY20210800002/H2/C7/N14/S64/s02/T1 +ZY20210800002/H2/C7/N13/S64/s02/T3 +ZY20210800002/H2/C7/N13/S64/s02/T1 +ZY20210800002/H2/C7/N12/S64/s01/T3 +ZY20210800002/H2/C7/N12/S64/s01/T1 +ZY20210800002/H2/C7/N11/S64/s01/T3 +ZY20210800002/H2/C7/N11/S64/s01/T1 +ZY20210800002/H2/C6/N37/S246/s05/T3 +ZY20210800002/H2/C6/N33/S246/s04/T3 +ZY20210800002/H2/C6/N32/S246/s03/T3 +ZY20210800002/H2/C6/N30/S246/s03/T3 +ZY20210800002/H2/C6/N29/S246/s03/T3 +ZY20210800002/H2/C6/N28/S246/s02/T3 +ZY20210800002/H2/C6/N25/S43/s04/T1 +ZY20210800002/H2/C6/N25/S246/s02/T2 +ZY20210800002/H2/C6/N24/S43/s03/T1 +ZY20210800002/H2/C6/N24/S246/s01/T2 +ZY20210800002/H2/C6/N21/S43/s02/T1 +ZY20210800002/H2/C6/N21/S246/s01/T2 +ZY20210800002/H2/C6/N20/S245/s05/T2 +ZY20210800002/H2/C6/N19/S43/s01/T1 +ZY20210800002/H2/C6/N19/S245/s05/T2 +ZY20210800002/H2/C6/N16/S40/s03/T2 +ZY20210800002/H2/C6/N16/S40/s03/T1 +ZY20210800002/H2/C6/N16/S245/s04/T2 +ZY20210800002/H2/C6/N15/S40/s03/T1 +ZY20210800002/H2/C6/N15/S245/s04/T2 +ZY20210800002/H2/C6/N14/S40/s02/T1 +ZY20210800002/H2/C6/N14/S245/s04/T2 +ZY20210800002/H2/C6/N11/S245/s03/T1 +ZY20210800002/H2/C6/N10/S42/s05/T1 +ZY20210800002/H2/C6/N10/S245/s03/T1 +ZY20210800002/H2/C6/N09/S42/s05/T2 +ZY20210800002/H2/C6/N09/S42/s05/T1 +ZY20210800002/H2/C6/N09/S245/s03/T1 +ZY20210800002/H2/C6/N07/S42/s04/T2 +ZY20210800002/H2/C6/N07/S245/s02/T1 +ZY20210800002/H2/C6/N06/S245/s02/T1 +ZY20210800002/H2/C6/N05/S42/s03/T1 +ZY20210800002/H2/C6/N05/S245/s02/T1 +ZY20210800002/H2/C6/N04/S245/s01/T1 +ZY20210800002/H2/C6/N03/S245/s01/T1 +ZY20210800002/H2/C6/N02/S245/s01/T1 +ZY20210800002/H2/C6/N01/S245/s01/T1 +ZY20210800002/H2/C5/N50/S37/s02/T2 +ZY20210800002/H2/C5/N50/S265/s05/T5 +ZY20210800002/H2/C5/N50/S261/s03/T3 +ZY20210800002/H2/C5/N49/S37/s02/T2 +ZY20210800002/H2/C5/N49/S37/s02/T1 +ZY20210800002/H2/C5/N49/S265/s05/T5 +ZY20210800002/H2/C5/N49/S261/s03/T3 +ZY20210800002/H2/C5/N48/S37/s01/T2 +ZY20210800002/H2/C5/N48/S37/s01/T1 +ZY20210800002/H2/C5/N48/S265/s05/T5 +ZY20210800002/H2/C5/N48/S261/s02/T2 +ZY20210800002/H2/C5/N47/S37/s01/T2 +ZY20210800002/H2/C5/N47/S265/s05/T5 +ZY20210800002/H2/C5/N47/S261/s02/T2 +ZY20210800002/H2/C5/N46/S39/s05/T2 +ZY20210800002/H2/C5/N46/S265/s04/T4 +ZY20210800002/H2/C5/N46/S261/s02/T2 +ZY20210800002/H2/C5/N45/S39/s05/T2 +ZY20210800002/H2/C5/N45/S265/s04/T4 +ZY20210800002/H2/C5/N45/S261/s02/T2 +ZY20210800002/H2/C5/N44/S39/s04/T1 +ZY20210800002/H2/C5/N44/S269/s01/T6 +ZY20210800002/H2/C5/N44/S265/s04/T4 +ZY20210800002/H2/C5/N44/S261/s01/T2 +ZY20210800002/H2/C5/N43/S269/s01/T6 +ZY20210800002/H2/C5/N43/S265/s04/T4 +ZY20210800002/H2/C5/N43/S261/s01/T2 +ZY20210800002/H2/C5/N42/S269/s01/T6 +ZY20210800002/H2/C5/N42/S265/s03/T4 +ZY20210800002/H2/C5/N42/S261/s01/T2 +ZY20210800002/H2/C5/N41/S269/s01/T6 +ZY20210800002/H2/C5/N41/S265/s03/T4 +ZY20210800002/H2/C5/N41/S261/s01/T2 +ZY20210800002/H2/C5/N40/S268/s05/T6 +ZY20210800002/H2/C5/N40/S265/s03/T4 +ZY20210800002/H2/C5/N40/S258/s05/T2 +ZY20210800002/H2/C5/N39/S268/s05/T6 +ZY20210800002/H2/C5/N39/S265/s03/T4 +ZY20210800002/H2/C5/N39/S258/s05/T2 +ZY20210800002/H2/C5/N38/S268/s05/T6 +ZY20210800002/H2/C5/N38/S265/s02/T4 +ZY20210800002/H2/C5/N38/S258/s05/T2 +ZY20210800002/H2/C5/N37/S268/s05/T6 +ZY20210800002/H2/C5/N37/S265/s02/T4 +ZY20210800002/H2/C5/N37/S258/s05/T2 +ZY20210800002/H2/C5/N36/S41/s05/T2 +ZY20210800002/H2/C5/N36/S268/s04/T6 +ZY20210800002/H2/C5/N36/S265/s02/T4 +ZY20210800002/H2/C5/N36/S258/s04/T2 +ZY20210800002/H2/C5/N35/S41/s05/T2 +ZY20210800002/H2/C5/N35/S41/s05/T1 +ZY20210800002/H2/C5/N35/S268/s04/T6 +ZY20210800002/H2/C5/N35/S265/s02/T4 +ZY20210800002/H2/C5/N35/S258/s04/T2 +ZY20210800002/H2/C5/N34/S41/s04/T2 +ZY20210800002/H2/C5/N34/S41/s04/T1 +ZY20210800002/H2/C5/N34/S268/s04/T6 +ZY20210800002/H2/C5/N34/S265/s01/T4 +ZY20210800002/H2/C5/N34/S258/s04/T2 +ZY20210800002/H2/C5/N33/S41/s04/T2 +ZY20210800002/H2/C5/N33/S268/s04/T6 +ZY20210800002/H2/C5/N33/S265/s01/T4 +ZY20210800002/H2/C5/N33/S258/s04/T2 +ZY20210800002/H2/C5/N32/S41/s03/T2 +ZY20210800002/H2/C5/N32/S268/s03/T6 +ZY20210800002/H2/C5/N32/S265/s01/T4 +ZY20210800002/H2/C5/N32/S258/s03/T2 +ZY20210800002/H2/C5/N31/S268/s03/T6 +ZY20210800002/H2/C5/N31/S265/s01/T4 +ZY20210800002/H2/C5/N31/S258/s03/T2 +ZY20210800002/H2/C5/N31/S121/s03/T1 +ZY20210800002/H2/C5/N30/S41/s03/T2 +ZY20210800002/H2/C5/N30/S268/s03/T6 +ZY20210800002/H2/C5/N30/S263/s05/T4 +ZY20210800002/H2/C5/N30/S258/s03/T2 +ZY20210800002/H2/C5/N29/S41/s02/T1 +ZY20210800002/H2/C5/N29/S268/s03/T6 +ZY20210800002/H2/C5/N29/S263/s05/T4 +ZY20210800002/H2/C5/N29/S258/s03/T2 +ZY20210800002/H2/C5/N28/S41/s02/T2 +ZY20210800002/H2/C5/N28/S41/s02/T1 +ZY20210800002/H2/C5/N28/S268/s02/T6 +ZY20210800002/H2/C5/N28/S263/s05/T4 +ZY20210800002/H2/C5/N28/S258/s02/T2 +ZY20210800002/H2/C5/N27/S41/s01/T2 +ZY20210800002/H2/C5/N27/S41/s01/T1 +ZY20210800002/H2/C5/N27/S268/s02/T6 +ZY20210800002/H2/C5/N27/S263/s05/T4 +ZY20210800002/H2/C5/N27/S258/s02/T2 +ZY20210800002/H2/C5/N26/S41/s01/T2 +ZY20210800002/H2/C5/N26/S268/s02/T6 +ZY20210800002/H2/C5/N26/S263/s04/T4 +ZY20210800002/H2/C5/N26/S258/s02/T2 +ZY20210800002/H2/C5/N25/S268/s02/T6 +ZY20210800002/H2/C5/N25/S263/s04/T4 +ZY20210800002/H2/C5/N25/S258/s02/T2 +ZY20210800002/H2/C5/N24/S268/s01/T6 +ZY20210800002/H2/C5/N24/S263/s04/T4 +ZY20210800002/H2/C5/N24/S258/s01/T1 +ZY20210800002/H2/C5/N23/S56/s04/T2 +ZY20210800002/H2/C5/N23/S56/s04/T1 +ZY20210800002/H2/C5/N23/S268/s01/T6 +ZY20210800002/H2/C5/N23/S263/s04/T4 +ZY20210800002/H2/C5/N23/S258/s01/T1 +ZY20210800002/H2/C5/N22/S56/s04/T2 +ZY20210800002/H2/C5/N22/S56/s04/T1 +ZY20210800002/H2/C5/N22/S268/s01/T6 +ZY20210800002/H2/C5/N22/S263/s03/T3 +ZY20210800002/H2/C5/N22/S258/s01/T1 +ZY20210800002/H2/C5/N21/S56/s03/T2 +ZY20210800002/H2/C5/N21/S56/s03/T1 +ZY20210800002/H2/C5/N21/S268/s01/T6 +ZY20210800002/H2/C5/N21/S263/s03/T3 +ZY20210800002/H2/C5/N21/S258/s01/T1 +ZY20210800002/H2/C5/N20/S56/s03/T2 +ZY20210800002/H2/C5/N20/S267/s05/T5 +ZY20210800002/H2/C5/N20/S263/s03/T3 +ZY20210800002/H2/C5/N20/S255/s05/T1 +ZY20210800002/H2/C5/N19/S267/s05/T5 +ZY20210800002/H2/C5/N19/S263/s03/T3 +ZY20210800002/H2/C5/N19/S255/s05/T1 +ZY20210800002/H2/C5/N18/S56/s02/T2 +ZY20210800002/H2/C5/N18/S56/s02/T1 +ZY20210800002/H2/C5/N18/S267/s05/T5 +ZY20210800002/H2/C5/N18/S263/s02/T3 +ZY20210800002/H2/C5/N18/S255/s05/T1 +ZY20210800002/H2/C5/N17/S267/s05/T5 +ZY20210800002/H2/C5/N17/S263/s02/T3 +ZY20210800002/H2/C5/N17/S255/s05/T1 +ZY20210800002/H2/C5/N16/S56/s01/T2 +ZY20210800002/H2/C5/N16/S267/s04/T5 +ZY20210800002/H2/C5/N16/S263/s02/T3 +ZY20210800002/H2/C5/N16/S255/s04/T1 +ZY20210800002/H2/C5/N15/S267/s04/T5 +ZY20210800002/H2/C5/N15/S263/s02/T3 +ZY20210800002/H2/C5/N15/S255/s04/T1 +ZY20210800002/H2/C5/N15/S121/s03/T3 +ZY20210800002/H2/C5/N15/S121/s03/T1 +ZY20210800002/H2/C5/N14/S267/s04/T5 +ZY20210800002/H2/C5/N14/S263/s01/T3 +ZY20210800002/H2/C5/N14/S255/s04/T1 +ZY20210800002/H2/C5/N14/S121/s02/T3 +ZY20210800002/H2/C5/N13/S267/s04/T5 +ZY20210800002/H2/C5/N13/S263/s01/T3 +ZY20210800002/H2/C5/N13/S255/s04/T1 +ZY20210800002/H2/C5/N13/S121/s02/T1 +ZY20210800002/H2/C5/N12/S267/s03/T5 +ZY20210800002/H2/C5/N12/S263/s01/T3 +ZY20210800002/H2/C5/N12/S255/s03/T1 +ZY20210800002/H2/C5/N12/S121/s01/T3 +ZY20210800002/H2/C5/N11/S267/s03/T5 +ZY20210800002/H2/C5/N11/S263/s01/T3 +ZY20210800002/H2/C5/N11/S255/s03/T1 +ZY20210800002/H2/C5/N11/S121/s01/T3 +ZY20210800002/H2/C4/N27/S24/s01/T2 +ZY20210800002/H2/C4/N27/S24/s01/T1 +ZY20210800002/H2/C4/N10/S105/s02/T1 +ZY20210800002/H2/C4/N08/S105/s03/T2 +ZY20210800002/H2/C4/N08/S105/s03/T1 +ZY20210800002/H2/C4/N01/S105/s01/T2 +ZY20210800002/H2/C3/N50/S355/s01/T1 +ZY20210800002/H2/C3/N50/S354/s05/T2 +ZY20210800002/H2/C3/N50/S353/s05/T1 +ZY20210800002/H2/C3/N28/S354/s05/T2 +ZY20210800002/H2/C3/N28/S353/s05/T1 +ZY20210800002/H2/C3/N26/S353/s04/T1 +ZY20210800002/H2/C3/N25/S353/s04/T1 +ZY20210800002/H2/C3/N24/S353/s03/T1 +ZY20210800002/H2/C3/N23/S353/s03/T1 +ZY20210800002/H2/C3/N23/S103/s03/T2 +ZY20210800002/H2/C3/N23/S103/s03/T1 +ZY20210800002/H2/C3/N22/S353/s03/T1 +ZY20210800002/H2/C3/N20/S353/s03/T1 +ZY20210800002/H2/C3/N17/S353/s02/T1 +ZY20210800002/H2/C3/N15/S353/s02/T1 +ZY20210800002/H2/C3/N14/S353/s02/T1 +ZY20210800002/H2/C3/N06/S354/s01/T2 +ZY20210800002/H2/C3/N06/S353/s04/T1 +ZY20210800002/H2/C3/N03/S96/s01/T1 +ZY20210800002/H2/C3/N02/S354/s01/T2 +ZY20210800002/H2/C20/N16/S277/s01/T4 +ZY20210800002/H2/C20/N16/S275/s02/T2 +ZY20210800002/H2/C20/N15/S277/s01/T4 +ZY20210800002/H2/C20/N15/S275/s02/T2 +ZY20210800002/H2/C20/N15/S273/s03/T3 +ZY20210800002/H2/C20/N15/S271/s04/T1 +ZY20210800002/H2/C20/N14/S277/s01/T4 +ZY20210800002/H2/C20/N14/S275/s02/T2 +ZY20210800002/H2/C20/N14/S273/s03/T3 +ZY20210800002/H2/C20/N14/S271/s04/T1 +ZY20210800002/H2/C20/N13/S275/s05/T4 +ZY20210800002/H2/C20/N13/S275/s01/T2 +ZY20210800002/H2/C20/N13/S273/s03/T3 +ZY20210800002/H2/C20/N13/S271/s04/T1 +ZY20210800002/H2/C20/N12/S275/s05/T4 +ZY20210800002/H2/C20/N12/S275/s01/T2 +ZY20210800002/H2/C20/N12/S273/s02/T3 +ZY20210800002/H2/C20/N12/S271/s03/T1 +ZY20210800002/H2/C20/N11/S275/s05/T4 +ZY20210800002/H2/C20/N11/S275/s01/T2 +ZY20210800002/H2/C20/N11/S273/s02/T3 +ZY20210800002/H2/C20/N11/S271/s03/T1 +ZY20210800002/H2/C2/N50/S29/s05/T3 +ZY20210800002/H2/C2/N49/S29/s05/T3 +ZY20210800002/H2/C2/N49/S29/s05/T1 +ZY20210800002/H2/C2/N48/S29/s04/T3 +ZY20210800002/H2/C2/N48/S29/s04/T1 +ZY20210800002/H2/C2/N47/S29/s04/T3 +ZY20210800002/H2/C2/N47/S29/s04/T1 +ZY20210800002/H2/C2/N46/S29/s03/T1 +ZY20210800002/H2/C2/N45/S29/s03/T3 +ZY20210800002/H2/C2/N45/S29/s03/T1 +ZY20210800002/H2/C2/N44/S29/s02/T1 +ZY20210800002/H2/C2/N43/S29/s02/T3 +ZY20210800002/H2/C2/N39/S30/s05/T3 +ZY20210800002/H2/C2/N39/S30/s05/T1 +ZY20210800002/H2/C2/N37/S30/s04/T3 +ZY20210800002/H2/C2/N36/S30/s03/T3 +ZY20210800002/H2/C2/N36/S30/s03/T1 +ZY20210800002/H2/C2/N32/S30/s01/T1 +ZY20210800002/H2/C2/N30/S2/s05/T1 +ZY20210800002/H2/C2/N29/S2/s05/T3 +ZY20210800002/H2/C2/N27/S2/s04/T1 +ZY20210800002/H2/C2/N24/S2/s02/T3 +ZY20210800002/H2/C2/N24/S2/s02/T1 +ZY20210800002/H2/C2/N22/S2/s01/T3 +ZY20210800002/H2/C2/N21/S2/s01/T3 +ZY20210800002/H2/C2/N20/S25/s05/T1 +ZY20210800002/H2/C2/N19/S25/s05/T3 +ZY20210800002/H2/C2/N19/S25/s05/T1 +ZY20210800002/H2/C2/N18/S25/s04/T3 +ZY20210800002/H2/C2/N18/S25/s04/T1 +ZY20210800002/H2/C2/N17/S25/s04/T3 +ZY20210800002/H2/C2/N17/S25/s04/T1 +ZY20210800002/H2/C2/N16/S25/s03/T3 +ZY20210800002/H2/C2/N16/S25/s03/T1 +ZY20210800002/H2/C2/N15/S25/s03/T3 +ZY20210800002/H2/C2/N15/S25/s03/T1 +ZY20210800002/H2/C2/N14/S25/s02/T3 +ZY20210800002/H2/C2/N13/S25/s02/T3 +ZY20210800002/H2/C2/N11/S25/s01/T3 +ZY20210800002/H2/C2/N11/S25/s01/T1 +ZY20210800002/H2/C18/N50/S241/s02/T2 +ZY20210800002/H2/C18/N50/S135/s02/T1 +ZY20210800002/H2/C18/N49/S241/s01/T2 +ZY20210800002/H2/C18/N49/S135/s01/T1 +ZY20210800002/H2/C18/N48/S241/s01/T2 +ZY20210800002/H2/C18/N48/S135/s01/T1 +ZY20210800002/H2/C18/N47/S241/s01/T2 +ZY20210800002/H2/C18/N47/S135/s01/T1 +ZY20210800002/H2/C18/N46/S241/s01/T2 +ZY20210800002/H2/C18/N46/S135/s01/T1 +ZY20210800002/H2/C18/N45/S131/s05/T1 +ZY20210800002/H2/C18/N43/S183/s05/T2 +ZY20210800002/H2/C18/N43/S131/s05/T1 +ZY20210800002/H2/C18/N42/S183/s05/T2 +ZY20210800002/H2/C18/N42/S131/s05/T1 +ZY20210800002/H2/C18/N41/S183/s04/T2 +ZY20210800002/H2/C18/N41/S131/s04/T1 +ZY20210800002/H2/C18/N40/S183/s04/T2 +ZY20210800002/H2/C18/N40/S131/s04/T1 +ZY20210800002/H2/C18/N39/S183/s04/T2 +ZY20210800002/H2/C18/N39/S131/s04/T1 +ZY20210800002/H2/C18/N37/S131/s03/T1 +ZY20210800002/H2/C18/N36/S183/s03/T2 +ZY20210800002/H2/C18/N36/S131/s03/T1 +ZY20210800002/H2/C18/N35/S183/s03/T2 +ZY20210800002/H2/C18/N35/S131/s03/T1 +ZY20210800002/H2/C18/N34/S183/s03/T2 +ZY20210800002/H2/C18/N34/S131/s03/T1 +ZY20210800002/H2/C18/N33/S183/s02/T2 +ZY20210800002/H2/C18/N33/S131/s02/T1 +ZY20210800002/H2/C18/N32/S183/s02/T2 +ZY20210800002/H2/C18/N32/S131/s02/T1 +ZY20210800002/H2/C18/N31/S183/s02/T2 +ZY20210800002/H2/C18/N31/S131/s02/T1 +ZY20210800002/H2/C18/N30/S183/s02/T2 +ZY20210800002/H2/C18/N30/S131/s02/T1 +ZY20210800002/H2/C18/N29/S183/s01/T2 +ZY20210800002/H2/C18/N29/S131/s01/T1 +ZY20210800002/H2/C18/N28/S183/s01/T2 +ZY20210800002/H2/C18/N28/S131/s01/T1 +ZY20210800002/H2/C18/N27/S183/s01/T2 +ZY20210800002/H2/C18/N27/S131/s01/T1 +ZY20210800002/H2/C18/N26/S183/s01/T2 +ZY20210800002/H2/C18/N26/S131/s01/T1 +ZY20210800002/H2/C18/N13/S241/s03/T2 +ZY20210800002/H2/C18/N13/S135/s03/T1 +ZY20210800002/H2/C18/N11/S241/s03/T2 +ZY20210800002/H2/C18/N11/S135/s03/T1 +ZY20210800002/H2/C17/N75/S256/s02/T3 +ZY20210800002/H2/C17/N74/S256/s01/T3 +ZY20210800002/H2/C17/N73/S256/s01/T3 +ZY20210800002/H2/C17/N72/S256/s01/T3 +ZY20210800002/H2/C17/N71/S256/s01/T2 +ZY20210800002/H2/C17/N70/S253/s05/T2 +ZY20210800002/H2/C17/N69/S253/s05/T2 +ZY20210800002/H2/C17/N67/S253/s05/T2 +ZY20210800002/H2/C17/N66/S253/s04/T2 +ZY20210800002/H2/C17/N65/S253/s04/T2 +ZY20210800002/H2/C17/N64/S253/s04/T2 +ZY20210800002/H2/C17/N63/S253/s04/T2 +ZY20210800002/H2/C17/N62/S253/s03/T2 +ZY20210800002/H2/C17/N61/S253/s03/T1 +ZY20210800002/H2/C17/N60/S253/s03/T1 +ZY20210800002/H2/C17/N59/S253/s03/T1 +ZY20210800002/H2/C17/N58/S253/s02/T1 +ZY20210800002/H2/C17/N57/S253/s02/T1 +ZY20210800002/H2/C17/N56/S256/s03/T3 +ZY20210800002/H2/C17/N56/S253/s02/T1 +ZY20210800002/H2/C17/N16/S341/s01/T1 +ZY20210800002/H2/C17/N12/S356/s02/T3 +ZY20210800002/H2/C17/N12/S356/s01/T1 +ZY20210800002/H2/C17/N11/S159/s03/T3 +ZY20210800002/H2/C17/N11/S152/s03/T1 +ZY20210800002/H2/C17/N10/S341/s01/T1 +ZY20210800002/H2/C17/N09/S356/s02/T3 +ZY20210800002/H2/C17/N09/S356/s01/T1 +ZY20210800002/H2/C17/N09/S159/s03/T3 +ZY20210800002/H2/C17/N09/S152/s03/T1 +ZY20210800002/H2/C17/N08/S356/s01/T1 +ZY20210800002/H2/C17/N07/S159/s03/T3 +ZY20210800002/H2/C17/N07/S152/s03/T1 +ZY20210800002/H2/C14/N50/S187/s03/T2 +ZY20210800002/H2/C14/N50/S163/s03/T1 +ZY20210800002/H2/C14/N48/S187/s03/T2 +ZY20210800002/H2/C14/N48/S163/s03/T1 +ZY20210800002/H2/C14/N46/S187/s03/T2 +ZY20210800002/H2/C14/N46/S163/s03/T1 +ZY20210800002/H2/C14/N44/S187/s02/T2 +ZY20210800002/H2/C14/N44/S163/s02/T1 +ZY20210800002/H2/C14/N42/S187/s02/T2 +ZY20210800002/H2/C14/N42/S163/s02/T1 +ZY20210800002/H2/C14/N40/S187/s02/T2 +ZY20210800002/H2/C14/N40/S163/s02/T1 +ZY20210800002/H2/C14/N25/S187/s02/T2 +ZY20210800002/H2/C14/N25/S163/s02/T1 +ZY20210800002/H2/C14/N24/S359/s03/T2 +ZY20210800002/H2/C14/N24/S359/s02/T1 +ZY20210800002/H2/C14/N24/S163/s01/T1 +ZY20210800002/H2/C14/N23/S187/s01/T2 +ZY20210800002/H2/C14/N23/S163/s01/T1 +ZY20210800002/H2/C14/N22/S163/s01/T1 +ZY20210800002/H2/C14/N21/S187/s01/T2 +ZY20210800002/H2/C14/N21/S163/s01/T1 +ZY20210800002/H2/C14/N20/S185/s05/T2 +ZY20210800002/H2/C14/N20/S161/s05/T1 +ZY20210800002/H2/C14/N19/S185/s05/T2 +ZY20210800002/H2/C14/N19/S161/s05/T1 +ZY20210800002/H2/C14/N18/S185/s05/T2 +ZY20210800002/H2/C14/N18/S161/s05/T1 +ZY20210800002/H2/C14/N17/S185/s05/T2 +ZY20210800002/H2/C14/N17/S161/s05/T1 +ZY20210800002/H2/C14/N16/S185/s04/T2 +ZY20210800002/H2/C14/N16/S161/s04/T1 +ZY20210800002/H2/C14/N15/S185/s04/T2 +ZY20210800002/H2/C14/N15/S161/s04/T1 +ZY20210800002/H2/C14/N14/S185/s04/T2 +ZY20210800002/H2/C14/N14/S161/s04/T1 +ZY20210800002/H2/C14/N13/S185/s04/T2 +ZY20210800002/H2/C14/N13/S161/s04/T1 +ZY20210800002/H2/C14/N12/S185/s03/T2 +ZY20210800002/H2/C14/N12/S161/s03/T1 +ZY20210800002/H2/C14/N11/S185/s03/T2 +ZY20210800002/H2/C14/N11/S161/s03/T1 +ZY20210800002/H2/C13/N38/S192/s03/T2 +ZY20210800002/H2/C13/N38/S128/s03/T1 +ZY20210800002/H2/C13/N36/S192/s03/T2 +ZY20210800002/H2/C13/N36/S128/s03/T1 +ZY20210800002/H2/C13/N34/S192/s03/T2 +ZY20210800002/H2/C13/N34/S128/s03/T1 +ZY20210800002/H2/C13/N32/S192/s03/T2 +ZY20210800002/H2/C13/N32/S128/s03/T1 +ZY20210800002/H2/C13/N30/S192/s02/T2 +ZY20210800002/H2/C13/N30/S128/s02/T1 +ZY20210800002/H2/C13/N28/S192/s02/T2 +ZY20210800002/H2/C13/N28/S128/s02/T1 +ZY20210800002/H2/C13/N26/S192/s02/T2 +ZY20210800002/H2/C13/N26/S128/s02/T1 +ZY20210800002/H2/C13/N25/S189/s05/T4 +ZY20210800002/H2/C13/N25/S128/s02/T1 +ZY20210800002/H2/C13/N24/S192/s02/T3 +ZY20210800002/H2/C13/N24/S128/s01/T1 +ZY20210800002/H2/C13/N23/S192/s01/T3 +ZY20210800002/H2/C13/N23/S128/s01/T1 +ZY20210800002/H2/C13/N22/S189/s05/T4 +ZY20210800002/H2/C13/N22/S128/s01/T1 +ZY20210800002/H2/C13/N21/S192/s01/T3 +ZY20210800002/H2/C13/N21/S128/s01/T1 +ZY20210800002/H2/C13/N20/S192/s01/T3 +ZY20210800002/H2/C13/N20/S124/s05/T1 +ZY20210800002/H2/C13/N19/S189/s05/T4 +ZY20210800002/H2/C13/N19/S124/s05/T1 +ZY20210800002/H2/C13/N18/S192/s01/T3 +ZY20210800002/H2/C13/N18/S124/s05/T1 +ZY20210800002/H2/C13/N17/S189/s05/T3 +ZY20210800002/H2/C13/N17/S124/s05/T1 +ZY20210800002/H2/C13/N16/S189/s04/T4 +ZY20210800002/H2/C13/N16/S124/s04/T1 +ZY20210800002/H2/C13/N15/S346/s01/T1 +ZY20210800002/H2/C13/N15/S189/s04/T4 +ZY20210800002/H2/C13/N15/S124/s04/T1 +ZY20210800002/H2/C13/N14/S189/s04/T4 +ZY20210800002/H2/C13/N14/S124/s04/T1 +ZY20210800002/H2/C13/N13/S189/s04/T4 +ZY20210800002/H2/C13/N13/S124/s04/T1 +ZY20210800002/H2/C13/N12/S189/s03/T4 +ZY20210800002/H2/C13/N12/S124/s03/T1 +ZY20210800002/H2/C13/N11/S189/s03/T4 +ZY20210800002/H2/C13/N11/S124/s03/T1 +ZY20210800002/H2/C12/N46/S346/s03/T2 +ZY20210800002/H2/C12/N39/S346/s03/T2 +ZY20210800002/H2/C12/N36/S346/s03/T2 +ZY20210800002/H2/C12/N36/S198/s03/T2 +ZY20210800002/H2/C12/N36/S157/s03/T1 +ZY20210800002/H2/C12/N35/S346/s03/T1 +ZY20210800002/H2/C12/N34/S198/s03/T2 +ZY20210800002/H2/C12/N34/S157/s03/T1 +ZY20210800002/H2/C12/N33/S346/s01/T1 +ZY20210800002/H2/C12/N32/S198/s03/T2 +ZY20210800002/H2/C12/N32/S157/s03/T1 +ZY20210800002/H2/C12/N31/S346/s01/T1 +ZY20210800002/H2/C12/N30/S198/s02/T2 +ZY20210800002/H2/C12/N30/S157/s02/T1 +ZY20210800002/H2/C12/N28/S198/s02/T2 +ZY20210800002/H2/C12/N28/S157/s02/T1 +ZY20210800002/H2/C12/N26/S198/s02/T2 +ZY20210800002/H2/C12/N26/S157/s02/T1 +ZY20210800002/H2/C12/N25/S198/s02/T2 +ZY20210800002/H2/C12/N25/S157/s02/T1 +ZY20210800002/H2/C12/N24/S198/s01/T2 +ZY20210800002/H2/C12/N24/S157/s01/T1 +ZY20210800002/H2/C12/N23/S198/s01/T2 +ZY20210800002/H2/C12/N23/S157/s01/T1 +ZY20210800002/H2/C12/N22/S198/s01/T2 +ZY20210800002/H2/C12/N22/S157/s01/T1 +ZY20210800002/H2/C12/N21/S198/s01/T2 +ZY20210800002/H2/C12/N21/S157/s01/T1 +ZY20210800002/H2/C12/N20/S196/s05/T2 +ZY20210800002/H2/C12/N20/S154/s05/T1 +ZY20210800002/H2/C12/N19/S346/s02/T2 +ZY20210800002/H2/C12/N19/S196/s05/T2 +ZY20210800002/H2/C12/N19/S154/s05/T1 +ZY20210800002/H2/C12/N18/S196/s05/T2 +ZY20210800002/H2/C12/N18/S154/s05/T1 +ZY20210800002/H2/C12/N17/S196/s05/T2 +ZY20210800002/H2/C12/N17/S154/s05/T1 +ZY20210800002/H2/C12/N16/S346/s02/T1 +ZY20210800002/H2/C12/N16/S196/s04/T2 +ZY20210800002/H2/C12/N16/S154/s05/T1 +ZY20210800002/H2/C12/N15/S196/s04/T2 +ZY20210800002/H2/C12/N15/S154/s04/T1 +ZY20210800002/H2/C12/N14/S196/s04/T2 +ZY20210800002/H2/C12/N14/S154/s04/T1 +ZY20210800002/H2/C12/N13/S196/s04/T2 +ZY20210800002/H2/C12/N13/S154/s04/T1 +ZY20210800002/H2/C12/N12/S196/s03/T2 +ZY20210800002/H2/C12/N12/S154/s04/T1 +ZY20210800002/H2/C12/N11/S196/s03/T2 +ZY20210800002/H2/C12/N11/S154/s03/T1 +ZY20210800002/H2/C11/N50/S204/s03/T2 +ZY20210800002/H2/C11/N50/S137/s03/T1 +ZY20210800002/H2/C11/N48/S204/s03/T2 +ZY20210800002/H2/C11/N48/S137/s03/T1 +ZY20210800002/H2/C11/N42/S204/s02/T2 +ZY20210800002/H2/C11/N42/S137/s02/T1 +ZY20210800002/H2/C11/N40/S204/s02/T2 +ZY20210800002/H2/C11/N40/S137/s02/T1 +ZY20210800002/H2/C11/N24/S204/s01/T3 +ZY20210800002/H2/C11/N24/S137/s01/T1 +ZY20210800002/H2/C11/N23/S204/s01/T3 +ZY20210800002/H2/C11/N23/S137/s01/T1 +ZY20210800002/H2/C11/N22/S204/s01/T3 +ZY20210800002/H2/C11/N22/S137/s01/T1 +ZY20210800002/H2/C11/N21/S204/s01/T3 +ZY20210800002/H2/C11/N21/S137/s01/T1 +ZY20210800002/H2/C11/N20/S201/s05/T3 +ZY20210800002/H2/C11/N20/S133/s05/T1 +ZY20210800002/H2/C11/N19/S201/s05/T3 +ZY20210800002/H2/C11/N19/S133/s05/T1 +ZY20210800002/H2/C11/N18/S201/s05/T4 +ZY20210800002/H2/C11/N18/S133/s05/T1 +ZY20210800002/H2/C11/N17/S201/s05/T4 +ZY20210800002/H2/C11/N17/S133/s05/T1 +ZY20210800002/H2/C11/N16/S201/s04/T4 +ZY20210800002/H2/C11/N16/S133/s04/T1 +ZY20210800002/H2/C11/N15/S201/s04/T4 +ZY20210800002/H2/C11/N15/S133/s04/T1 +ZY20210800002/H2/C11/N14/S201/s04/T4 +ZY20210800002/H2/C11/N14/S133/s04/T1 +ZY20210800002/H2/C11/N13/S201/s04/T4 +ZY20210800002/H2/C11/N13/S133/s04/T1 +ZY20210800002/H2/C11/N12/S359/s02/T1 +ZY20210800002/H2/C11/N12/S201/s03/T4 +ZY20210800002/H2/C11/N12/S133/s03/T1 +ZY20210800002/H2/C11/N11/S359/s02/T1 +ZY20210800002/H2/C11/N11/S201/s03/T4 +ZY20210800002/H2/C11/N11/S133/s03/T1 +ZY20210800002/H2/C11/N10/S201/s03/T4 +ZY20210800002/H2/C11/N10/S133/s03/T1 +ZY20210800002/H2/C11/N09/S201/s03/T4 +ZY20210800002/H2/C11/N09/S133/s03/T1 +ZY20210800002/H2/C11/N08/S201/s02/T4 +ZY20210800002/H2/C11/N08/S133/s02/T1 +ZY20210800002/H2/C11/N07/S359/s01/T3 +ZY20210800002/H2/C11/N07/S201/s02/T4 +ZY20210800002/H2/C11/N07/S133/s02/T1 +ZY20210800002/H2/C1/N50/S89/s05/T3 +ZY20210800002/H2/C1/N49/S89/s05/T1 +ZY20210800002/H2/C1/N48/S89/s04/T3 +ZY20210800002/H2/C1/N48/S89/s04/T1 +ZY20210800002/H2/C1/N47/S89/s04/T3 +ZY20210800002/H2/C1/N47/S89/s04/T1 +ZY20210800002/H2/C1/N46/S89/s03/T3 +ZY20210800002/H2/C1/N46/S89/s03/T1 +ZY20210800002/H2/C1/N45/S94/s02/T3 +ZY20210800002/H2/C1/N42/S94/s01/T3 +ZY20210800002/H2/C1/N41/S94/s01/T3 +ZY20210800002/H2/C1/N39/S88/s05/T3 +ZY20210800002/H2/C1/N39/S88/s05/T1 +ZY20210800002/H2/C1/N38/S88/s04/T3 +ZY20210800002/H2/C1/N37/S88/s04/T3 +ZY20210800002/H2/C1/N37/S88/s04/T1 +ZY20210800002/H2/C1/N36/S94/s03/T3 +ZY20210800002/H2/C1/N35/S94/s03/T3 +ZY20210800002/H2/C1/N34/S94/s02/T1 +ZY20210800002/H2/C1/N34/S336/s01/T1 +ZY20210800002/H2/C1/N32/S88/s01/T3 +ZY20210800002/H2/C1/N32/S88/s01/T1 +ZY20210800002/H2/C1/N30/S94/s05/T3 +ZY20210800002/H2/C1/N29/S87/s05/T3 +ZY20210800002/H2/C1/N28/S87/s04/T3 +ZY20210800002/H2/C1/N28/S87/s04/T1 +ZY20210800002/H2/C1/N26/S94/s03/T3 +ZY20210800002/H2/C1/N24/S87/s02/T3 +ZY20210800002/H2/C1/N24/S87/s02/T1 +ZY20210800002/H2/C1/N23/S87/s02/T3 +ZY20210800002/H2/C1/N23/S87/s02/T1 +ZY20210800002/H2/C1/N21/S87/s01/T3 +ZY20210800002/H2/C1/N20/S339/s05/T2 +ZY20210800002/H2/C1/N20/S339/s05/T1 +ZY20210800002/H2/C1/N19/S339/s05/T2 +ZY20210800002/H2/C1/N19/S339/s05/T1 +ZY20210800002/H2/C1/N18/S339/s04/T2 +ZY20210800002/H2/C1/N16/S339/s03/T2 +ZY20210800002/H2/C1/N14/S339/s03/T1 +ZY20210800002/H2/C1/N13/S339/s02/T1 +ZY20210800002/H2/C1/N12/S339/s01/T2 +ZY20210800002/H2/C1/N12/S339/s01/T1 +ZY20210800002/H2/C1/N11/S339/s02/T2 +ZY20210800002/H2/C1/N10/S336/s01/T2 +ZY20210800002/H2/C1/N07/S336/s04/T2 +ZY20210800002/H2/C1/N06/S336/s04/T1 +ZY20210800002/H2/C1/N04/S336/s03/T2 +ZY20210800002/H2/C1/N03/S336/s02/T1 +ZY20210800002/H2/C1/N02/S336/s03/T2 +ZY20210800002/H2/C1/N01/S336/s02/T1 +ZY20210800001/H1/C9/N49/S36/s05/T2 +ZY20210800001/H1/C9/N49/S36/s05/T1 +ZY20210800001/H1/C9/N48/S36/s04/T2 +ZY20210800001/H1/C9/N48/S36/s04/T1 +ZY20210800001/H1/C9/N47/S36/s04/T2 +ZY20210800001/H1/C9/N47/S36/s04/T1 +ZY20210800001/H1/C9/N46/S36/s03/T2 +ZY20210800001/H1/C9/N45/S385/s04/T1 +ZY20210800001/H1/C9/N44/S36/s02/T2 +ZY20210800001/H1/C9/N43/S36/s02/T1 +ZY20210800001/H1/C9/N42/S33/s05/T2 +ZY20210800001/H1/C9/N42/S33/s05/T1 +ZY20210800001/H1/C9/N41/S36/s01/T2 +ZY20210800001/H1/C9/N41/S36/s01/T1 +ZY20210800001/H1/C9/N40/S35/s05/T2 +ZY20210800001/H1/C9/N40/S35/s05/T1 +ZY20210800001/H1/C9/N39/S35/s05/T2 +ZY20210800001/H1/C9/N39/S35/s05/T1 +ZY20210800001/H1/C9/N38/S35/s04/T2 +ZY20210800001/H1/C9/N38/S35/s04/T1 +ZY20210800001/H1/C9/N37/S35/s04/T1 +ZY20210800001/H1/C9/N36/S35/s03/T2 +ZY20210800001/H1/C9/N36/S35/s03/T1 +ZY20210800001/H1/C9/N35/S35/s03/T2 +ZY20210800001/H1/C9/N35/S35/s03/T1 +ZY20210800001/H1/C9/N34/S35/s02/T2 +ZY20210800001/H1/C9/N34/S35/s02/T1 +ZY20210800001/H1/C9/N33/S35/s02/T2 +ZY20210800001/H1/C9/N33/S35/s02/T1 +ZY20210800001/H1/C9/N32/S35/s01/T2 +ZY20210800001/H1/C9/N32/S35/s01/T1 +ZY20210800001/H1/C9/N31/S35/s01/T2 +ZY20210800001/H1/C9/N31/S35/s01/T1 +ZY20210800001/H1/C9/N30/S34/s05/T2 +ZY20210800001/H1/C9/N29/S34/s05/T2 +ZY20210800001/H1/C9/N28/S34/s04/T2 +ZY20210800001/H1/C9/N27/S34/s04/T2 +ZY20210800001/H1/C9/N26/S34/s03/T2 +ZY20210800001/H1/C9/N25/S34/s03/T2 +ZY20210800001/H1/C9/N24/S34/s02/T2 +ZY20210800001/H1/C9/N23/S34/s02/T2 +ZY20210800001/H1/C9/N23/S34/s02/T1 +ZY20210800001/H1/C9/N21/S34/s01/T2 +ZY20210800001/H1/C9/N20/S33/s05/T1 +ZY20210800001/H1/C9/N19/S36/s01/T2 +ZY20210800001/H1/C9/N19/S36/s01/T1 +ZY20210800001/H1/C9/N18/S33/s04/T2 +ZY20210800001/H1/C9/N18/S33/s04/T1 +ZY20210800001/H1/C9/N17/S33/s04/T1 +ZY20210800001/H1/C9/N16/S33/s03/T2 +ZY20210800001/H1/C9/N16/S33/s03/T1 +ZY20210800001/H1/C9/N15/S33/s03/T2 +ZY20210800001/H1/C9/N15/S33/s03/T1 +ZY20210800001/H1/C9/N14/S33/s02/T2 +ZY20210800001/H1/C9/N14/S33/s02/T1 +ZY20210800001/H1/C9/N13/S33/s02/T2 +ZY20210800001/H1/C9/N13/S33/s02/T1 +ZY20210800001/H1/C9/N12/S33/s01/T2 +ZY20210800001/H1/C9/N12/S33/s01/T1 +ZY20210800001/H1/C9/N11/S33/s01/T2 +ZY20210800001/H1/C9/N11/S33/s01/T1 +ZY20210800001/H1/C8/N49/S319/s05/T2 +ZY20210800001/H1/C8/N48/S324/s02/T2 +ZY20210800001/H1/C8/N48/S319/s05/T2 +ZY20210800001/H1/C8/N47/S324/s02/T2 +ZY20210800001/H1/C8/N47/S319/s05/T2 +ZY20210800001/H1/C8/N46/S324/s02/T2 +ZY20210800001/H1/C8/N46/S319/s04/T2 +ZY20210800001/H1/C8/N45/S324/s02/T2 +ZY20210800001/H1/C8/N45/S319/s04/T2 +ZY20210800001/H1/C8/N44/S324/s01/T2 +ZY20210800001/H1/C8/N44/S319/s04/T2 +ZY20210800001/H1/C8/N43/S324/s01/T2 +ZY20210800001/H1/C8/N43/S319/s04/T2 +ZY20210800001/H1/C8/N42/S77/s02/T2 +ZY20210800001/H1/C8/N42/S77/s02/T1 +ZY20210800001/H1/C8/N42/S324/s01/T2 +ZY20210800001/H1/C8/N42/S319/s03/T2 +ZY20210800001/H1/C8/N42/S315/s01/T1 +ZY20210800001/H1/C8/N41/S77/s02/T2 +ZY20210800001/H1/C8/N41/S77/s02/T1 +ZY20210800001/H1/C8/N41/S324/s01/T2 +ZY20210800001/H1/C8/N41/S319/s03/T2 +ZY20210800001/H1/C8/N41/S315/s01/T1 +ZY20210800001/H1/C8/N40/S77/s01/T2 +ZY20210800001/H1/C8/N40/S77/s01/T1 +ZY20210800001/H1/C8/N40/S323/s05/T2 +ZY20210800001/H1/C8/N40/S319/s03/T2 +ZY20210800001/H1/C8/N40/S313/s05/T1 +ZY20210800001/H1/C8/N39/S77/s01/T2 +ZY20210800001/H1/C8/N39/S77/s01/T1 +ZY20210800001/H1/C8/N39/S323/s05/T2 +ZY20210800001/H1/C8/N39/S319/s03/T2 +ZY20210800001/H1/C8/N39/S313/s05/T1 +ZY20210800001/H1/C8/N38/S76/s05/T2 +ZY20210800001/H1/C8/N38/S323/s05/T2 +ZY20210800001/H1/C8/N38/S319/s02/T2 +ZY20210800001/H1/C8/N38/S313/s05/T1 +ZY20210800001/H1/C8/N37/S323/s05/T2 +ZY20210800001/H1/C8/N37/S319/s02/T2 +ZY20210800001/H1/C8/N37/S313/s05/T1 +ZY20210800001/H1/C8/N36/S323/s04/T2 +ZY20210800001/H1/C8/N36/S319/s02/T2 +ZY20210800001/H1/C8/N36/S313/s04/T1 +ZY20210800001/H1/C8/N35/S76/s04/T1 +ZY20210800001/H1/C8/N35/S323/s04/T2 +ZY20210800001/H1/C8/N35/S319/s02/T2 +ZY20210800001/H1/C8/N35/S313/s04/T1 +ZY20210800001/H1/C8/N34/S77/s04/T2 +ZY20210800001/H1/C8/N34/S77/s04/T1 +ZY20210800001/H1/C8/N34/S323/s04/T2 +ZY20210800001/H1/C8/N34/S319/s01/T2 +ZY20210800001/H1/C8/N34/S313/s04/T1 +ZY20210800001/H1/C8/N33/S77/s03/T2 +ZY20210800001/H1/C8/N33/S77/s03/T1 +ZY20210800001/H1/C8/N33/S323/s04/T2 +ZY20210800001/H1/C8/N33/S319/s01/T2 +ZY20210800001/H1/C8/N33/S313/s04/T1 +ZY20210800001/H1/C8/N32/S77/s03/T2 +ZY20210800001/H1/C8/N32/S77/s03/T1 +ZY20210800001/H1/C8/N32/S313/s03/T1 +ZY20210800001/H1/C8/N31/S77/s04/T2 +ZY20210800001/H1/C8/N31/S77/s04/T1 +ZY20210800001/H1/C8/N31/S323/s03/T2 +ZY20210800001/H1/C8/N31/S319/s01/T2 +ZY20210800001/H1/C8/N31/S313/s03/T1 +ZY20210800001/H1/C8/N30/S77/s05/T2 +ZY20210800001/H1/C8/N30/S77/s05/T1 +ZY20210800001/H1/C8/N30/S317/s05/T2 +ZY20210800001/H1/C8/N30/S313/s03/T1 +ZY20210800001/H1/C8/N29/S77/s05/T2 +ZY20210800001/H1/C8/N29/S77/s05/T1 +ZY20210800001/H1/C8/N29/S323/s03/T2 +ZY20210800001/H1/C8/N29/S317/s05/T2 +ZY20210800001/H1/C8/N29/S313/s03/T1 +ZY20210800001/H1/C8/N28/S78/s01/T2 +ZY20210800001/H1/C8/N28/S78/s01/T1 +ZY20210800001/H1/C8/N28/S323/s02/T2 +ZY20210800001/H1/C8/N28/S317/s05/T2 +ZY20210800001/H1/C8/N28/S313/s02/T1 +ZY20210800001/H1/C8/N27/S76/s03/T2 +ZY20210800001/H1/C8/N27/S76/s03/T1 +ZY20210800001/H1/C8/N27/S323/s02/T2 +ZY20210800001/H1/C8/N27/S317/s05/T2 +ZY20210800001/H1/C8/N27/S313/s02/T1 +ZY20210800001/H1/C8/N26/S76/s03/T2 +ZY20210800001/H1/C8/N26/S76/s03/T1 +ZY20210800001/H1/C8/N26/S323/s02/T2 +ZY20210800001/H1/C8/N26/S317/s04/T2 +ZY20210800001/H1/C8/N26/S313/s02/T1 +ZY20210800001/H1/C8/N25/S76/s02/T2 +ZY20210800001/H1/C8/N25/S76/s02/T1 +ZY20210800001/H1/C8/N25/S323/s02/T2 +ZY20210800001/H1/C8/N25/S321/s01/T2 +ZY20210800001/H1/C8/N25/S313/s02/T1 +ZY20210800001/H1/C8/N24/S76/s02/T2 +ZY20210800001/H1/C8/N24/S76/s02/T1 +ZY20210800001/H1/C8/N24/S323/s01/T2 +ZY20210800001/H1/C8/N24/S313/s01/T1 +ZY20210800001/H1/C8/N23/S76/s01/T2 +ZY20210800001/H1/C8/N23/S76/s01/T1 +ZY20210800001/H1/C8/N23/S323/s01/T2 +ZY20210800001/H1/C8/N23/S313/s01/T1 +ZY20210800001/H1/C8/N22/S76/s01/T1 +ZY20210800001/H1/C8/N22/S313/s01/T1 +ZY20210800001/H1/C8/N21/S74/s03/T2 +ZY20210800001/H1/C8/N21/S74/s03/T1 +ZY20210800001/H1/C8/N21/S323/s01/T2 +ZY20210800001/H1/C8/N21/S313/s01/T1 +ZY20210800001/H1/C8/N20/S321/s05/T2 +ZY20210800001/H1/C8/N20/S311/s05/T1 +ZY20210800001/H1/C8/N19/S74/s02/T2 +ZY20210800001/H1/C8/N19/S74/s02/T1 +ZY20210800001/H1/C8/N19/S321/s05/T2 +ZY20210800001/H1/C8/N19/S311/s05/T1 +ZY20210800001/H1/C8/N18/S74/s02/T2 +ZY20210800001/H1/C8/N18/S74/s02/T1 +ZY20210800001/H1/C8/N18/S321/s05/T2 +ZY20210800001/H1/C8/N18/S311/s05/T1 +ZY20210800001/H1/C8/N17/S368/s01/T1 +ZY20210800001/H1/C8/N17/S367/s03/T2 +ZY20210800001/H1/C8/N17/S367/s03/T1 +ZY20210800001/H1/C8/N17/S321/s05/T2 +ZY20210800001/H1/C8/N17/S311/s05/T1 +ZY20210800001/H1/C8/N16/S74/s01/T2 +ZY20210800001/H1/C8/N16/S321/s04/T2 +ZY20210800001/H1/C8/N16/S311/s04/T1 +ZY20210800001/H1/C8/N15/S73/s03/T2 +ZY20210800001/H1/C8/N15/S73/s03/T1 +ZY20210800001/H1/C8/N15/S321/s04/T2 +ZY20210800001/H1/C8/N15/S311/s04/T1 +ZY20210800001/H1/C8/N14/S73/s02/T2 +ZY20210800001/H1/C8/N14/S73/s02/T1 +ZY20210800001/H1/C8/N14/S321/s04/T2 +ZY20210800001/H1/C8/N14/S311/s04/T1 +ZY20210800001/H1/C8/N13/S73/s02/T2 +ZY20210800001/H1/C8/N13/S73/s02/T1 +ZY20210800001/H1/C8/N13/S321/s04/T2 +ZY20210800001/H1/C8/N13/S311/s04/T1 +ZY20210800001/H1/C8/N12/S73/s01/T2 +ZY20210800001/H1/C8/N12/S73/s01/T1 +ZY20210800001/H1/C8/N12/S321/s03/T2 +ZY20210800001/H1/C8/N12/S311/s03/T1 +ZY20210800001/H1/C8/N11/S73/s01/T2 +ZY20210800001/H1/C8/N11/S73/s01/T1 +ZY20210800001/H1/C8/N11/S321/s03/T2 +ZY20210800001/H1/C8/N11/S311/s03/T1 +ZY20210800001/H1/C7/N50/S278/s05/T4 +ZY20210800001/H1/C7/N50/S274/s03/T2 +ZY20210800001/H1/C7/N49/S278/s05/T4 +ZY20210800001/H1/C7/N49/S274/s03/T2 +ZY20210800001/H1/C7/N48/S285/s02/T6 +ZY20210800001/H1/C7/N48/S278/s05/T4 +ZY20210800001/H1/C7/N48/S274/s02/T2 +ZY20210800001/H1/C7/N47/S285/s02/T6 +ZY20210800001/H1/C7/N47/S278/s05/T4 +ZY20210800001/H1/C7/N47/S274/s02/T2 +ZY20210800001/H1/C7/N46/S285/s02/T6 +ZY20210800001/H1/C7/N46/S278/s04/T4 +ZY20210800001/H1/C7/N46/S274/s02/T2 +ZY20210800001/H1/C7/N45/S285/s02/T6 +ZY20210800001/H1/C7/N45/S278/s04/T4 +ZY20210800001/H1/C7/N45/S274/s02/T2 +ZY20210800001/H1/C7/N44/S285/s01/T6 +ZY20210800001/H1/C7/N44/S278/s04/T4 +ZY20210800001/H1/C7/N44/S274/s01/T2 +ZY20210800001/H1/C7/N43/S285/s01/T6 +ZY20210800001/H1/C7/N43/S278/s04/T4 +ZY20210800001/H1/C7/N43/S274/s01/T2 +ZY20210800001/H1/C7/N42/S285/s01/T6 +ZY20210800001/H1/C7/N42/S278/s03/T4 +ZY20210800001/H1/C7/N42/S274/s01/T2 +ZY20210800001/H1/C7/N41/S285/s01/T6 +ZY20210800001/H1/C7/N41/S278/s03/T4 +ZY20210800001/H1/C7/N41/S274/s01/T2 +ZY20210800001/H1/C7/N40/S283/s05/T6 +ZY20210800001/H1/C7/N40/S278/s03/T4 +ZY20210800001/H1/C7/N40/S272/s05/T2 +ZY20210800001/H1/C7/N39/S61/s03/T2 +ZY20210800001/H1/C7/N39/S61/s03/T1 +ZY20210800001/H1/C7/N39/S283/s05/T6 +ZY20210800001/H1/C7/N39/S278/s03/T4 +ZY20210800001/H1/C7/N39/S272/s05/T2 +ZY20210800001/H1/C7/N38/S61/s03/T2 +ZY20210800001/H1/C7/N38/S61/s03/T1 +ZY20210800001/H1/C7/N38/S278/s02/T4 +ZY20210800001/H1/C7/N38/S272/s05/T2 +ZY20210800001/H1/C7/N37/S61/s02/T2 +ZY20210800001/H1/C7/N37/S61/s02/T1 +ZY20210800001/H1/C7/N37/S278/s02/T4 +ZY20210800001/H1/C7/N37/S272/s05/T2 +ZY20210800001/H1/C7/N36/S61/s02/T2 +ZY20210800001/H1/C7/N36/S61/s02/T1 +ZY20210800001/H1/C7/N36/S278/s02/T4 +ZY20210800001/H1/C7/N36/S272/s04/T2 +ZY20210800001/H1/C7/N35/S61/s01/T2 +ZY20210800001/H1/C7/N35/S61/s01/T1 +ZY20210800001/H1/C7/N35/S278/s02/T4 +ZY20210800001/H1/C7/N35/S272/s04/T2 +ZY20210800001/H1/C7/N34/S61/s01/T2 +ZY20210800001/H1/C7/N34/S61/s01/T1 +ZY20210800001/H1/C7/N34/S278/s01/T4 +ZY20210800001/H1/C7/N34/S272/s04/T2 +ZY20210800001/H1/C7/N33/S60/s05/T2 +ZY20210800001/H1/C7/N33/S60/s05/T1 +ZY20210800001/H1/C7/N33/S278/s01/T4 +ZY20210800001/H1/C7/N33/S272/s04/T2 +ZY20210800001/H1/C7/N32/S60/s05/T2 +ZY20210800001/H1/C7/N32/S60/s05/T1 +ZY20210800001/H1/C7/N32/S278/s01/T4 +ZY20210800001/H1/C7/N32/S272/s03/T2 +ZY20210800001/H1/C7/N31/S60/s04/T2 +ZY20210800001/H1/C7/N31/S60/s04/T1 +ZY20210800001/H1/C7/N31/S278/s01/T4 +ZY20210800001/H1/C7/N31/S272/s03/T2 +ZY20210800001/H1/C7/N30/S60/s04/T2 +ZY20210800001/H1/C7/N30/S60/s04/T1 +ZY20210800001/H1/C7/N30/S276/s05/T4 +ZY20210800001/H1/C7/N30/S272/s03/T2 +ZY20210800001/H1/C7/N29/S60/s02/T2 +ZY20210800001/H1/C7/N29/S60/s02/T1 +ZY20210800001/H1/C7/N29/S276/s05/T4 +ZY20210800001/H1/C7/N29/S272/s03/T2 +ZY20210800001/H1/C7/N28/S60/s02/T2 +ZY20210800001/H1/C7/N28/S60/s02/T1 +ZY20210800001/H1/C7/N28/S276/s05/T4 +ZY20210800001/H1/C7/N28/S272/s02/T2 +ZY20210800001/H1/C7/N27/S60/s03/T2 +ZY20210800001/H1/C7/N27/S60/s03/T1 +ZY20210800001/H1/C7/N27/S276/s05/T4 +ZY20210800001/H1/C7/N27/S272/s02/T2 +ZY20210800001/H1/C7/N26/S60/s03/T2 +ZY20210800001/H1/C7/N26/S60/s03/T1 +ZY20210800001/H1/C7/N26/S276/s04/T4 +ZY20210800001/H1/C7/N26/S272/s02/T2 +ZY20210800001/H1/C7/N25/S60/s01/T2 +ZY20210800001/H1/C7/N25/S60/s01/T1 +ZY20210800001/H1/C7/N25/S276/s04/T3 +ZY20210800001/H1/C7/N25/S272/s02/T1 +ZY20210800001/H1/C7/N24/S59/s03/T2 +ZY20210800001/H1/C7/N24/S59/s03/T1 +ZY20210800001/H1/C7/N24/S276/s04/T3 +ZY20210800001/H1/C7/N24/S272/s01/T1 +ZY20210800001/H1/C7/N23/S59/s03/T2 +ZY20210800001/H1/C7/N23/S59/s03/T1 +ZY20210800001/H1/C7/N23/S276/s04/T3 +ZY20210800001/H1/C7/N23/S272/s01/T1 +ZY20210800001/H1/C7/N22/S60/s01/T2 +ZY20210800001/H1/C7/N22/S60/s01/T1 +ZY20210800001/H1/C7/N22/S276/s03/T3 +ZY20210800001/H1/C7/N22/S272/s01/T1 +ZY20210800001/H1/C7/N21/S59/s04/T1 +ZY20210800001/H1/C7/N21/S276/s03/T3 +ZY20210800001/H1/C7/N21/S272/s01/T1 +ZY20210800001/H1/C7/N20/S59/s02/T2 +ZY20210800001/H1/C7/N20/S59/s02/T1 +ZY20210800001/H1/C7/N20/S276/s03/T3 +ZY20210800001/H1/C7/N20/S270/s05/T1 +ZY20210800001/H1/C7/N19/S59/s05/T2 +ZY20210800001/H1/C7/N19/S59/s05/T1 +ZY20210800001/H1/C7/N19/S276/s03/T3 +ZY20210800001/H1/C7/N19/S270/s05/T1 +ZY20210800001/H1/C7/N18/S59/s05/T2 +ZY20210800001/H1/C7/N18/S59/s05/T1 +ZY20210800001/H1/C7/N18/S276/s02/T3 +ZY20210800001/H1/C7/N18/S270/s05/T1 +ZY20210800001/H1/C7/N17/S59/s04/T2 +ZY20210800001/H1/C7/N17/S59/s04/T1 +ZY20210800001/H1/C7/N17/S276/s02/T3 +ZY20210800001/H1/C7/N17/S270/s05/T1 +ZY20210800001/H1/C7/N16/S59/s02/T2 +ZY20210800001/H1/C7/N16/S59/s02/T1 +ZY20210800001/H1/C7/N16/S276/s02/T3 +ZY20210800001/H1/C7/N16/S270/s04/T1 +ZY20210800001/H1/C7/N15/S276/s02/T3 +ZY20210800001/H1/C7/N15/S270/s04/T1 +ZY20210800001/H1/C7/N14/S280/s04/T5 +ZY20210800001/H1/C7/N14/S276/s01/T3 +ZY20210800001/H1/C7/N14/S270/s04/T1 +ZY20210800001/H1/C7/N13/S280/s04/T5 +ZY20210800001/H1/C7/N13/S276/s01/T3 +ZY20210800001/H1/C7/N13/S270/s04/T1 +ZY20210800001/H1/C7/N12/S280/s03/T5 +ZY20210800001/H1/C7/N12/S276/s01/T3 +ZY20210800001/H1/C7/N12/S270/s03/T1 +ZY20210800001/H1/C7/N11/S280/s03/T5 +ZY20210800001/H1/C7/N11/S276/s01/T3 +ZY20210800001/H1/C7/N11/S270/s03/T1 +ZY20210800001/H1/C6/N37/S248/s05/T3 +ZY20210800001/H1/C6/N33/S87/s03/T2 +ZY20210800001/H1/C6/N33/S248/s04/T3 +ZY20210800001/H1/C6/N32/S87/s02/T1 +ZY20210800001/H1/C6/N32/S248/s03/T3 +ZY20210800001/H1/C6/N30/S248/s03/T3 +ZY20210800001/H1/C6/N29/S248/s03/T3 +ZY20210800001/H1/C6/N28/S87/s01/T2 +ZY20210800001/H1/C6/N25/S86/s01/T1 +ZY20210800001/H1/C6/N25/S248/s02/T2 +ZY20210800001/H1/C6/N24/S248/s01/T2 +ZY20210800001/H1/C6/N21/S86/s03/T1 +ZY20210800001/H1/C6/N21/S248/s01/T2 +ZY20210800001/H1/C6/N20/S247/s05/T2 +ZY20210800001/H1/C6/N19/S86/s01/T2 +ZY20210800001/H1/C6/N19/S247/s05/T2 +ZY20210800001/H1/C6/N16/S85/s03/T1 +ZY20210800001/H1/C6/N16/S247/s04/T2 +ZY20210800001/H1/C6/N15/S85/s03/T2 +ZY20210800001/H1/C6/N15/S247/s04/T2 +ZY20210800001/H1/C6/N14/S85/s02/T2 +ZY20210800001/H1/C6/N14/S247/s04/T2 +ZY20210800001/H1/C6/N11/S247/s03/T1 +ZY20210800001/H1/C6/N10/S247/s03/T1 +ZY20210800001/H1/C6/N09/S247/s03/T1 +ZY20210800001/H1/C6/N07/S82/s04/T2 +ZY20210800001/H1/C6/N07/S82/s04/T1 +ZY20210800001/H1/C6/N07/S247/s02/T1 +ZY20210800001/H1/C6/N06/S82/s03/T2 +ZY20210800001/H1/C6/N06/S247/s02/T1 +ZY20210800001/H1/C6/N05/S247/s02/T1 +ZY20210800001/H1/C6/N04/S247/s01/T1 +ZY20210800001/H1/C6/N03/S82/s02/T2 +ZY20210800001/H1/C6/N03/S82/s02/T1 +ZY20210800001/H1/C6/N03/S247/s01/T1 +ZY20210800001/H1/C6/N02/S82/s01/T2 +ZY20210800001/H1/C6/N02/S247/s01/T1 +ZY20210800001/H1/C6/N01/S82/s01/T2 +ZY20210800001/H1/C6/N01/S247/s01/T1 +ZY20210800001/H1/C5/N47/S57/s05/T2 +ZY20210800001/H1/C5/N47/S57/s05/T1 +ZY20210800001/H1/C5/N46/S57/s05/T2 +ZY20210800001/H1/C5/N46/S57/s05/T1 +ZY20210800001/H1/C5/N15/S57/s03/T2 +ZY20210800001/H1/C5/N15/S57/s03/T1 +ZY20210800001/H1/C4/N75/S387/s05/T2 +ZY20210800001/H1/C4/N75/S387/s04/T4 +ZY20210800001/H1/C4/N75/S387/s03/T3 +ZY20210800001/H1/C4/N75/S387/s02/T2 +ZY20210800001/H1/C4/N75/S387/s01/T1 +ZY20210800001/H1/C4/N74/S387/s05/T2 +ZY20210800001/H1/C4/N74/S387/s04/T4 +ZY20210800001/H1/C4/N74/S387/s03/T3 +ZY20210800001/H1/C4/N74/S387/s02/T2 +ZY20210800001/H1/C4/N74/S387/s01/T1 +ZY20210800001/H1/C4/N73/S386/s05/T2 +ZY20210800001/H1/C4/N73/S386/s04/T4 +ZY20210800001/H1/C4/N73/S386/s03/T3 +ZY20210800001/H1/C4/N73/S386/s02/T2 +ZY20210800001/H1/C4/N73/S386/s01/T1 +ZY20210800001/H1/C4/N72/S386/s05/T2 +ZY20210800001/H1/C4/N72/S386/s04/T4 +ZY20210800001/H1/C4/N72/S386/s03/T3 +ZY20210800001/H1/C4/N72/S386/s02/T2 +ZY20210800001/H1/C4/N72/S386/s01/T1 +ZY20210800001/H1/C4/N71/S386/s05/T2 +ZY20210800001/H1/C4/N71/S386/s04/T4 +ZY20210800001/H1/C4/N71/S386/s03/T3 +ZY20210800001/H1/C4/N71/S386/s02/T2 +ZY20210800001/H1/C4/N71/S386/s01/T1 +ZY20210800001/H1/C4/N70/S386/s05/T2 +ZY20210800001/H1/C4/N70/S386/s04/T4 +ZY20210800001/H1/C4/N70/S386/s03/T3 +ZY20210800001/H1/C4/N70/S386/s02/T2 +ZY20210800001/H1/C4/N70/S386/s01/T1 +ZY20210800001/H1/C4/N69/S392/s05/T4 +ZY20210800001/H1/C4/N69/S392/s04/T4 +ZY20210800001/H1/C4/N69/S392/s02/T2 +ZY20210800001/H1/C4/N69/S392/s01/T1 +ZY20210800001/H1/C4/N68/S391/s05/T4 +ZY20210800001/H1/C4/N68/S391/s04/T4 +ZY20210800001/H1/C4/N68/S391/s03/T3 +ZY20210800001/H1/C4/N68/S391/s02/T2 +ZY20210800001/H1/C4/N68/S391/s01/T1 +ZY20210800001/H1/C4/N67/S391/s05/T4 +ZY20210800001/H1/C4/N67/S391/s04/T4 +ZY20210800001/H1/C4/N67/S391/s03/T3 +ZY20210800001/H1/C4/N67/S391/s02/T2 +ZY20210800001/H1/C4/N66/S391/s05/T4 +ZY20210800001/H1/C4/N66/S391/s04/T4 +ZY20210800001/H1/C4/N66/S391/s03/T3 +ZY20210800001/H1/C4/N66/S391/s02/T2 +ZY20210800001/H1/C4/N66/S391/s01/T1 +ZY20210800001/H1/C4/N65/S391/s05/T4 +ZY20210800001/H1/C4/N65/S391/s04/T4 +ZY20210800001/H1/C4/N65/S391/s02/T2 +ZY20210800001/H1/C4/N65/S391/s01/T1 +ZY20210800001/H1/C4/N64/S385/s05/T1 +ZY20210800001/H1/C4/N64/S385/s04/T4 +ZY20210800001/H1/C4/N64/S385/s03/T3 +ZY20210800001/H1/C4/N64/S385/s02/T2 +ZY20210800001/H1/C4/N64/S385/s01/T1 +ZY20210800001/H1/C4/N63/S385/s05/T1 +ZY20210800001/H1/C4/N63/S385/s04/T4 +ZY20210800001/H1/C4/N63/S385/s03/T3 +ZY20210800001/H1/C4/N63/S385/s02/T2 +ZY20210800001/H1/C4/N63/S385/s01/T1 +ZY20210800001/H1/C4/N62/S385/s05/T1 +ZY20210800001/H1/C4/N62/S385/s04/T4 +ZY20210800001/H1/C4/N62/S385/s03/T3 +ZY20210800001/H1/C4/N62/S385/s02/T2 +ZY20210800001/H1/C4/N62/S385/s01/T1 +ZY20210800001/H1/C4/N61/S388/s05/T4 +ZY20210800001/H1/C4/N61/S388/s04/T4 +ZY20210800001/H1/C4/N61/S388/s03/T3 +ZY20210800001/H1/C4/N61/S388/s02/T2 +ZY20210800001/H1/C4/N61/S388/s01/T1 +ZY20210800001/H1/C4/N40/S22/s01/T1 +ZY20210800001/H1/C4/N39/S22/s01/T2 +ZY20210800001/H1/C4/N39/S22/s01/T1 +ZY20210800001/H1/C4/N38/S21/s05/T2 +ZY20210800001/H1/C4/N38/S21/s05/T1 +ZY20210800001/H1/C4/N37/S21/s05/T2 +ZY20210800001/H1/C4/N37/S21/s05/T1 +ZY20210800001/H1/C4/N36/S21/s04/T1 +ZY20210800001/H1/C4/N35/S21/s04/T2 +ZY20210800001/H1/C4/N35/S21/s04/T1 +ZY20210800001/H1/C4/N34/S21/s03/T1 +ZY20210800001/H1/C4/N33/S22/s02/T2 +ZY20210800001/H1/C4/N33/S22/s02/T1 +ZY20210800001/H1/C4/N27/S21/s01/T2 +ZY20210800001/H1/C4/N27/S21/s01/T1 +ZY20210800001/H1/C4/N10/S20/s04/T2 +ZY20210800001/H1/C4/N10/S20/s04/T1 +ZY20210800001/H1/C4/N08/S20/s01/T1 +ZY20210800001/H1/C4/N05/S20/s03/T2 +ZY20210800001/H1/C4/N05/S20/s03/T1 +ZY20210800001/H1/C4/N04/S20/s02/T2 +ZY20210800001/H1/C4/N04/S20/s02/T1 +ZY20210800001/H1/C4/N03/S20/s01/T2 +ZY20210800001/H1/C4/N02/S20/s04/T2 +ZY20210800001/H1/C4/N02/S20/s04/T1 +ZY20210800001/H1/C4/N01/S19/s05/T2 +ZY20210800001/H1/C4/N01/S19/s05/T1 +ZY20210800001/H1/C3/N46/S114/s03/T2 +ZY20210800001/H1/C3/N46/S114/s03/T1 +ZY20210800001/H1/C3/N44/S115/s03/T2 +ZY20210800001/H1/C3/N44/S115/s03/T1 +ZY20210800001/H1/C3/N40/S114/s02/T2 +ZY20210800001/H1/C3/N40/S114/s02/T1 +ZY20210800001/H1/C3/N33/S114/s05/T2 +ZY20210800001/H1/C3/N33/S114/s05/T1 +ZY20210800001/H1/C3/N28/S19/s03/T2 +ZY20210800001/H1/C3/N28/S19/s03/T1 +ZY20210800001/H1/C3/N25/S19/s02/T2 +ZY20210800001/H1/C3/N25/S19/s02/T1 +ZY20210800001/H1/C3/N23/S19/s01/T2 +ZY20210800001/H1/C3/N23/S19/s01/T1 +ZY20210800001/H1/C3/N20/S27/s04/T2 +ZY20210800001/H1/C3/N14/S27/s01/T2 +ZY20210800001/H1/C3/N13/S27/s01/T2 +ZY20210800001/H1/C3/N08/S28/s05/T2 +ZY20210800001/H1/C3/N08/S28/s05/T1 +ZY20210800001/H1/C3/N01/S54/s05/T2 +ZY20210800001/H1/C20/N48/S381/s04/T4 +ZY20210800001/H1/C20/N48/S381/s03/T3 +ZY20210800001/H1/C20/N48/S381/s02/T2 +ZY20210800001/H1/C20/N48/S381/s01/T1 +ZY20210800001/H1/C20/N47/S381/s04/T4 +ZY20210800001/H1/C20/N47/S381/s03/T3 +ZY20210800001/H1/C20/N47/S381/s02/T2 +ZY20210800001/H1/C20/N47/S381/s01/T1 +ZY20210800001/H1/C20/N34/S295/s05/T4 +ZY20210800001/H1/C20/N34/S292/s05/T3 +ZY20210800001/H1/C20/N34/S289/s05/T2 +ZY20210800001/H1/C20/N34/S286/s05/T1 +ZY20210800001/H1/C20/N33/S295/s04/T4 +ZY20210800001/H1/C20/N33/S292/s04/T3 +ZY20210800001/H1/C20/N33/S289/s04/T2 +ZY20210800001/H1/C20/N33/S286/s04/T1 +ZY20210800001/H1/C20/N32/S295/s04/T4 +ZY20210800001/H1/C20/N32/S292/s04/T3 +ZY20210800001/H1/C20/N32/S289/s04/T2 +ZY20210800001/H1/C20/N32/S286/s04/T1 +ZY20210800001/H1/C20/N31/S295/s04/T4 +ZY20210800001/H1/C20/N31/S292/s04/T3 +ZY20210800001/H1/C20/N31/S289/s04/T2 +ZY20210800001/H1/C20/N31/S286/s04/T1 +ZY20210800001/H1/C20/N30/S295/s04/T4 +ZY20210800001/H1/C20/N30/S292/s04/T3 +ZY20210800001/H1/C20/N30/S289/s04/T2 +ZY20210800001/H1/C20/N30/S286/s04/T1 +ZY20210800001/H1/C20/N29/S295/s03/T4 +ZY20210800001/H1/C20/N29/S292/s03/T3 +ZY20210800001/H1/C20/N29/S289/s03/T2 +ZY20210800001/H1/C20/N29/S286/s03/T1 +ZY20210800001/H1/C20/N28/S295/s03/T4 +ZY20210800001/H1/C20/N28/S292/s03/T3 +ZY20210800001/H1/C20/N28/S289/s03/T2 +ZY20210800001/H1/C20/N28/S286/s03/T1 +ZY20210800001/H1/C20/N27/S295/s03/T4 +ZY20210800001/H1/C20/N27/S292/s03/T3 +ZY20210800001/H1/C20/N27/S289/s03/T2 +ZY20210800001/H1/C20/N27/S286/s03/T1 +ZY20210800001/H1/C20/N25/S295/s02/T4 +ZY20210800001/H1/C20/N25/S292/s02/T3 +ZY20210800001/H1/C20/N25/S289/s02/T2 +ZY20210800001/H1/C20/N25/S286/s02/T1 +ZY20210800001/H1/C20/N24/S295/s02/T4 +ZY20210800001/H1/C20/N24/S292/s02/T3 +ZY20210800001/H1/C20/N24/S289/s02/T2 +ZY20210800001/H1/C20/N24/S286/s02/T1 +ZY20210800001/H1/C20/N23/S295/s02/T4 +ZY20210800001/H1/C20/N23/S292/s02/T3 +ZY20210800001/H1/C20/N23/S289/s02/T2 +ZY20210800001/H1/C20/N23/S286/s02/T1 +ZY20210800001/H1/C20/N22/S382/s03/T3 +ZY20210800001/H1/C20/N22/S382/s02/T2 +ZY20210800001/H1/C20/N22/S382/s01/T1 +ZY20210800001/H1/C20/N21/S382/s04/T4 +ZY20210800001/H1/C20/N21/S382/s03/T3 +ZY20210800001/H1/C20/N21/S382/s02/T2 +ZY20210800001/H1/C20/N21/S382/s01/T1 +ZY20210800001/H1/C20/N20/S381/s04/T4 +ZY20210800001/H1/C20/N20/S381/s03/T3 +ZY20210800001/H1/C20/N20/S381/s02/T2 +ZY20210800001/H1/C20/N20/S381/s01/T1 +ZY20210800001/H1/C20/N19/S381/s04/T4 +ZY20210800001/H1/C20/N19/S381/s03/T3 +ZY20210800001/H1/C20/N19/S381/s02/T2 +ZY20210800001/H1/C20/N19/S381/s01/T1 +ZY20210800001/H1/C20/N18/S295/s01/T4 +ZY20210800001/H1/C20/N18/S292/s01/T3 +ZY20210800001/H1/C20/N18/S289/s01/T2 +ZY20210800001/H1/C20/N18/S286/s01/T1 +ZY20210800001/H1/C2/N49/S54/s04/T2 +ZY20210800001/H1/C2/N49/S54/s04/T1 +ZY20210800001/H1/C2/N48/S54/s03/T2 +ZY20210800001/H1/C2/N48/S54/s03/T1 +ZY20210800001/H1/C2/N48/S214/s02/T6 +ZY20210800001/H1/C2/N47/S54/s03/T2 +ZY20210800001/H1/C2/N47/S54/s03/T1 +ZY20210800001/H1/C2/N47/S214/s02/T6 +ZY20210800001/H1/C2/N46/S54/s02/T2 +ZY20210800001/H1/C2/N46/S54/s02/T1 +ZY20210800001/H1/C2/N46/S214/s02/T6 +ZY20210800001/H1/C2/N45/S54/s02/T2 +ZY20210800001/H1/C2/N45/S54/s02/T1 +ZY20210800001/H1/C2/N45/S214/s02/T6 +ZY20210800001/H1/C2/N44/S214/s01/T6 +ZY20210800001/H1/C2/N43/S214/s01/T6 +ZY20210800001/H1/C2/N42/S63/s05/T2 +ZY20210800001/H1/C2/N42/S63/s05/T1 +ZY20210800001/H1/C2/N42/S214/s01/T6 +ZY20210800001/H1/C2/N41/S63/s05/T2 +ZY20210800001/H1/C2/N41/S63/s05/T1 +ZY20210800001/H1/C2/N41/S214/s01/T6 +ZY20210800001/H1/C2/N40/S213/s05/T5 +ZY20210800001/H1/C2/N39/S63/s04/T2 +ZY20210800001/H1/C2/N39/S63/s04/T1 +ZY20210800001/H1/C2/N39/S213/s05/T5 +ZY20210800001/H1/C2/N38/S63/s03/T2 +ZY20210800001/H1/C2/N38/S63/s03/T1 +ZY20210800001/H1/C2/N38/S213/s05/T5 +ZY20210800001/H1/C2/N37/S63/s03/T2 +ZY20210800001/H1/C2/N37/S63/s03/T1 +ZY20210800001/H1/C2/N37/S213/s05/T5 +ZY20210800001/H1/C2/N36/S63/s02/T2 +ZY20210800001/H1/C2/N36/S213/s04/T5 +ZY20210800001/H1/C2/N35/S213/s04/T5 +ZY20210800001/H1/C2/N34/S63/s01/T1 +ZY20210800001/H1/C2/N34/S213/s04/T1 +ZY20210800001/H1/C2/N33/S63/s01/T1 +ZY20210800001/H1/C2/N33/S213/s04/T5 +ZY20210800001/H1/C2/N32/S92/s05/T2 +ZY20210800001/H1/C2/N32/S92/s05/T1 +ZY20210800001/H1/C2/N32/S213/s03/T4 +ZY20210800001/H1/C2/N31/S92/s05/T2 +ZY20210800001/H1/C2/N31/S92/s05/T1 +ZY20210800001/H1/C2/N31/S213/s03/T4 +ZY20210800001/H1/C2/N30/S92/s04/T1 +ZY20210800001/H1/C2/N30/S214/s03/T1 +ZY20210800001/H1/C2/N30/S213/s03/T4 +ZY20210800001/H1/C2/N29/S92/s04/T2 +ZY20210800001/H1/C2/N29/S213/s03/T4 +ZY20210800001/H1/C2/N28/S92/s03/T2 +ZY20210800001/H1/C2/N28/S92/s03/T1 +ZY20210800001/H1/C2/N28/S213/s02/T4 +ZY20210800001/H1/C2/N27/S92/s03/T1 +ZY20210800001/H1/C2/N27/S213/s02/T4 +ZY20210800001/H1/C2/N26/S27/s02/T1 +ZY20210800001/H1/C2/N26/S213/s02/T4 +ZY20210800001/H1/C2/N25/S27/s02/T2 +ZY20210800001/H1/C2/N25/S27/s02/T1 +ZY20210800001/H1/C2/N25/S213/s02/T4 +ZY20210800001/H1/C2/N24/S214/s04/T1 +ZY20210800001/H1/C2/N24/S213/s01/T3 +ZY20210800001/H1/C2/N23/S27/s01/T2 +ZY20210800001/H1/C2/N23/S27/s01/T1 +ZY20210800001/H1/C2/N23/S213/s01/T3 +ZY20210800001/H1/C2/N22/S93/s05/T1 +ZY20210800001/H1/C2/N22/S213/s01/T3 +ZY20210800001/H1/C2/N21/S93/s05/T1 +ZY20210800001/H1/C2/N21/S213/s01/T3 +ZY20210800001/H1/C2/N20/S93/s04/T1 +ZY20210800001/H1/C2/N20/S212/s05/T3 +ZY20210800001/H1/C2/N19/S212/s05/T3 +ZY20210800001/H1/C2/N18/S93/s03/T2 +ZY20210800001/H1/C2/N18/S93/s03/T1 +ZY20210800001/H1/C2/N18/S212/s05/T3 +ZY20210800001/H1/C2/N17/S212/s05/T3 +ZY20210800001/H1/C2/N16/S93/s02/T1 +ZY20210800001/H1/C2/N16/S212/s04/T2 +ZY20210800001/H1/C2/N15/S93/s02/T2 +ZY20210800001/H1/C2/N15/S214/s03/T1 +ZY20210800001/H1/C2/N15/S212/s04/T2 +ZY20210800001/H1/C2/N14/S93/s01/T2 +ZY20210800001/H1/C2/N14/S93/s01/T1 +ZY20210800001/H1/C2/N14/S212/s04/T2 +ZY20210800001/H1/C2/N13/S93/s01/T1 +ZY20210800001/H1/C2/N13/S214/s03/T1 +ZY20210800001/H1/C2/N13/S212/s04/T2 +ZY20210800001/H1/C2/N12/S212/s03/T2 +ZY20210800001/H1/C2/N11/S212/s03/T2 +ZY20210800001/H1/C18/N50/S202/s03/T2 +ZY20210800001/H1/C18/N50/S150/s02/T1 +ZY20210800001/H1/C18/N48/S202/s03/T2 +ZY20210800001/H1/C18/N48/S150/s01/T1 +ZY20210800001/H1/C18/N47/S150/s01/T1 +ZY20210800001/H1/C18/N46/S202/s03/T2 +ZY20210800001/H1/C18/N46/S150/s01/T1 +ZY20210800001/H1/C18/N44/S394/s01/T1 +ZY20210800001/H1/C18/N43/S147/s05/T1 +ZY20210800001/H1/C18/N42/S202/s02/T2 +ZY20210800001/H1/C18/N42/S147/s05/T1 +ZY20210800001/H1/C18/N41/S147/s04/T1 +ZY20210800001/H1/C18/N40/S202/s02/T2 +ZY20210800001/H1/C18/N40/S147/s04/T1 +ZY20210800001/H1/C18/N39/S147/s04/T1 +ZY20210800001/H1/C18/N38/S394/s01/T1 +ZY20210800001/H1/C18/N37/S147/s03/T1 +ZY20210800001/H1/C18/N36/S147/s03/T1 +ZY20210800001/H1/C18/N35/S147/s03/T1 +ZY20210800001/H1/C18/N34/S147/s03/T1 +ZY20210800001/H1/C18/N32/S147/s02/T1 +ZY20210800001/H1/C18/N31/S147/s02/T1 +ZY20210800001/H1/C18/N30/S147/s02/T1 +ZY20210800001/H1/C18/N25/S202/s02/T2 +ZY20210800001/H1/C18/N24/S202/s01/T2 +ZY20210800001/H1/C18/N23/S202/s01/T2 +ZY20210800001/H1/C18/N23/S150/s03/T1 +ZY20210800001/H1/C18/N22/S202/s01/T2 +ZY20210800001/H1/C18/N21/S202/s01/T2 +ZY20210800001/H1/C18/N21/S150/s03/T1 +ZY20210800001/H1/C18/N20/S199/s05/T2 +ZY20210800001/H1/C18/N19/S199/s05/T2 +ZY20210800001/H1/C18/N19/S150/s02/T1 +ZY20210800001/H1/C18/N18/S199/s05/T2 +ZY20210800001/H1/C18/N17/S199/s05/T2 +ZY20210800001/H1/C18/N17/S150/s02/T1 +ZY20210800001/H1/C18/N16/S199/s04/T2 +ZY20210800001/H1/C18/N15/S199/s04/T2 +ZY20210800001/H1/C18/N14/S199/s04/T2 +ZY20210800001/H1/C18/N13/S199/s04/T2 +ZY20210800001/H1/C18/N12/S199/s03/T2 +ZY20210800001/H1/C18/N11/S199/s03/T2 +ZY20210800001/H1/C17/N76/S380/s05/T2 +ZY20210800001/H1/C17/N76/S380/s04/T1 +ZY20210800001/H1/C17/N76/S380/s03/T3 +ZY20210800001/H1/C17/N76/S380/s02/T2 +ZY20210800001/H1/C17/N76/S380/s01/T1 +ZY20210800001/H1/C17/N75/S266/s02/T3 +ZY20210800001/H1/C17/N74/S266/s01/T3 +ZY20210800001/H1/C17/N73/S266/s01/T3 +ZY20210800001/H1/C17/N72/S266/s01/T3 +ZY20210800001/H1/C17/N71/S266/s01/T2 +ZY20210800001/H1/C17/N70/S264/s05/T2 +ZY20210800001/H1/C17/N69/S264/s05/T2 +ZY20210800001/H1/C17/N68/S363/s03/T3 +ZY20210800001/H1/C17/N68/S363/s02/T2 +ZY20210800001/H1/C17/N67/S264/s05/T2 +ZY20210800001/H1/C17/N66/S264/s04/T2 +ZY20210800001/H1/C17/N65/S264/s04/T2 +ZY20210800001/H1/C17/N64/S264/s04/T2 +ZY20210800001/H1/C17/N63/S264/s04/T2 +ZY20210800001/H1/C17/N62/S266/s03/T3 +ZY20210800001/H1/C17/N62/S264/s03/T2 +ZY20210800001/H1/C17/N61/S266/s03/T3 +ZY20210800001/H1/C17/N61/S264/s03/T1 +ZY20210800001/H1/C17/N60/S266/s03/T3 +ZY20210800001/H1/C17/N60/S264/s03/T1 +ZY20210800001/H1/C17/N59/S266/s02/T3 +ZY20210800001/H1/C17/N59/S264/s03/T1 +ZY20210800001/H1/C17/N58/S266/s02/T3 +ZY20210800001/H1/C17/N58/S264/s02/T1 +ZY20210800001/H1/C17/N57/S266/s02/T3 +ZY20210800001/H1/C17/N57/S264/s02/T1 +ZY20210800001/H1/C17/N56/S264/s02/T1 +ZY20210800001/H1/C17/N23/S159/s03/T3 +ZY20210800001/H1/C17/N23/S146/s03/T1 +ZY20210800001/H1/C17/N21/S159/s03/T3 +ZY20210800001/H1/C17/N19/S159/s03/T3 +ZY20210800001/H1/C17/N17/S159/s02/T3 +ZY20210800001/H1/C17/N15/S159/s02/T3 +ZY20210800001/H1/C17/N13/S159/s02/T3 +ZY20210800001/H1/C14/N50/S209/s02/T2 +ZY20210800001/H1/C14/N50/S158/s02/T1 +ZY20210800001/H1/C14/N49/S209/s01/T2 +ZY20210800001/H1/C14/N49/S158/s01/T1 +ZY20210800001/H1/C14/N48/S209/s01/T2 +ZY20210800001/H1/C14/N48/S158/s01/T1 +ZY20210800001/H1/C14/N47/S209/s01/T2 +ZY20210800001/H1/C14/N47/S158/s01/T1 +ZY20210800001/H1/C14/N46/S209/s01/T2 +ZY20210800001/H1/C14/N46/S158/s01/T1 +ZY20210800001/H1/C14/N45/S207/s05/T2 +ZY20210800001/H1/C14/N45/S155/s05/T1 +ZY20210800001/H1/C14/N44/S207/s05/T2 +ZY20210800001/H1/C14/N44/S155/s05/T1 +ZY20210800001/H1/C14/N43/S207/s05/T2 +ZY20210800001/H1/C14/N43/S155/s05/T1 +ZY20210800001/H1/C14/N42/S207/s05/T2 +ZY20210800001/H1/C14/N42/S155/s05/T1 +ZY20210800001/H1/C14/N41/S207/s04/T2 +ZY20210800001/H1/C14/N41/S155/s04/T1 +ZY20210800001/H1/C14/N40/S207/s04/T2 +ZY20210800001/H1/C14/N40/S155/s04/T1 +ZY20210800001/H1/C14/N39/S207/s04/T2 +ZY20210800001/H1/C14/N39/S155/s04/T1 +ZY20210800001/H1/C14/N38/S207/s04/T2 +ZY20210800001/H1/C14/N38/S155/s04/T1 +ZY20210800001/H1/C14/N37/S333/s03/T2 +ZY20210800001/H1/C14/N37/S333/s02/T1 +ZY20210800001/H1/C14/N36/S333/s03/T2 +ZY20210800001/H1/C14/N36/S333/s02/T1 +ZY20210800001/H1/C14/N35/S207/s03/T2 +ZY20210800001/H1/C14/N34/S207/s03/T2 +ZY20210800001/H1/C14/N34/S155/s03/T1 +ZY20210800001/H1/C14/N33/S333/s03/T2 +ZY20210800001/H1/C14/N33/S333/s01/T1 +ZY20210800001/H1/C14/N32/S207/s02/T2 +ZY20210800001/H1/C14/N32/S155/s02/T1 +ZY20210800001/H1/C14/N31/S207/s02/T2 +ZY20210800001/H1/C14/N31/S155/s02/T1 +ZY20210800001/H1/C14/N30/S333/s03/T2 +ZY20210800001/H1/C14/N30/S333/s01/T1 +ZY20210800001/H1/C14/N29/S207/s01/T2 +ZY20210800001/H1/C14/N29/S155/s01/T1 +ZY20210800001/H1/C14/N28/S207/s01/T2 +ZY20210800001/H1/C14/N28/S155/s01/T1 +ZY20210800001/H1/C14/N27/S333/s02/T2 +ZY20210800001/H1/C14/N27/S333/s01/T1 +ZY20210800001/H1/C14/N26/S333/s02/T2 +ZY20210800001/H1/C14/N26/S333/s01/T1 +ZY20210800001/H1/C14/N25/S367/s01/T2 +ZY20210800001/H1/C14/N25/S209/s03/T2 +ZY20210800001/H1/C14/N25/S158/s03/T1 +ZY20210800001/H1/C14/N24/S367/s01/T1 +ZY20210800001/H1/C14/N23/S209/s03/T2 +ZY20210800001/H1/C14/N23/S158/s03/T1 +ZY20210800001/H1/C14/N22/S367/s01/T1 +ZY20210800001/H1/C14/N21/S209/s03/T2 +ZY20210800001/H1/C14/N21/S158/s03/T1 +ZY20210800001/H1/C14/N19/S209/s02/T2 +ZY20210800001/H1/C14/N19/S158/s02/T1 +ZY20210800001/H1/C14/N17/S209/s02/T2 +ZY20210800001/H1/C14/N17/S158/s02/T1 +ZY20210800001/H1/C14/N15/S209/s02/T2 +ZY20210800001/H1/C14/N15/S158/s02/T1 +ZY20210800001/H1/C13/N50/S238/s03/T4 +ZY20210800001/H1/C13/N50/S136/s03/T1 +ZY20210800001/H1/C13/N48/S238/s03/T4 +ZY20210800001/H1/C13/N48/S136/s03/T1 +ZY20210800001/H1/C13/N46/S238/s03/T4 +ZY20210800001/H1/C13/N46/S136/s03/T1 +ZY20210800001/H1/C13/N44/S238/s02/T4 +ZY20210800001/H1/C13/N44/S136/s02/T1 +ZY20210800001/H1/C13/N42/S238/s02/T4 +ZY20210800001/H1/C13/N42/S136/s02/T1 +ZY20210800001/H1/C13/N40/S366/s01/T4 +ZY20210800001/H1/C13/N40/S238/s02/T4 +ZY20210800001/H1/C13/N40/S136/s02/T1 +ZY20210800001/H1/C13/N25/S238/s02/T3 +ZY20210800001/H1/C13/N25/S136/s02/T1 +ZY20210800001/H1/C13/N24/S238/s01/T3 +ZY20210800001/H1/C13/N24/S136/s01/T1 +ZY20210800001/H1/C13/N23/S238/s01/T3 +ZY20210800001/H1/C13/N23/S136/s01/T1 +ZY20210800001/H1/C13/N22/S238/s01/T3 +ZY20210800001/H1/C13/N22/S136/s01/T1 +ZY20210800001/H1/C13/N21/S238/s01/T3 +ZY20210800001/H1/C13/N21/S136/s01/T1 +ZY20210800001/H1/C13/N20/S179/s05/T3 +ZY20210800001/H1/C13/N20/S132/s05/T1 +ZY20210800001/H1/C13/N19/S179/s05/T4 +ZY20210800001/H1/C13/N19/S132/s05/T1 +ZY20210800001/H1/C13/N18/S179/s05/T4 +ZY20210800001/H1/C13/N18/S132/s05/T1 +ZY20210800001/H1/C13/N17/S179/s05/T4 +ZY20210800001/H1/C13/N17/S132/s05/T1 +ZY20210800001/H1/C13/N16/S179/s04/T4 +ZY20210800001/H1/C13/N16/S132/s04/T1 +ZY20210800001/H1/C13/N15/S179/s04/T4 +ZY20210800001/H1/C13/N15/S132/s04/T1 +ZY20210800001/H1/C13/N14/S179/s04/T4 +ZY20210800001/H1/C13/N14/S132/s04/T1 +ZY20210800001/H1/C13/N13/S179/s04/T4 +ZY20210800001/H1/C13/N13/S132/s04/T1 +ZY20210800001/H1/C13/N12/S179/s03/T4 +ZY20210800001/H1/C13/N12/S132/s03/T1 +ZY20210800001/H1/C13/N11/S179/s03/T4 +ZY20210800001/H1/C13/N11/S132/s03/T1 +ZY20210800001/H1/C12/N50/S203/s02/T2 +ZY20210800001/H1/C12/N50/S169/s02/T1 +ZY20210800001/H1/C12/N49/S203/s01/T2 +ZY20210800001/H1/C12/N49/S169/s01/T1 +ZY20210800001/H1/C12/N48/S203/s01/T2 +ZY20210800001/H1/C12/N48/S169/s01/T1 +ZY20210800001/H1/C12/N47/S203/s01/T2 +ZY20210800001/H1/C12/N47/S169/s01/T1 +ZY20210800001/H1/C12/N46/S203/s01/T2 +ZY20210800001/H1/C12/N46/S169/s01/T1 +ZY20210800001/H1/C12/N45/S200/s05/T2 +ZY20210800001/H1/C12/N45/S165/s05/T1 +ZY20210800001/H1/C12/N44/S200/s05/T2 +ZY20210800001/H1/C12/N44/S165/s05/T1 +ZY20210800001/H1/C12/N43/S200/s05/T2 +ZY20210800001/H1/C12/N43/S165/s05/T1 +ZY20210800001/H1/C12/N42/S200/s05/T2 +ZY20210800001/H1/C12/N42/S165/s05/T1 +ZY20210800001/H1/C12/N41/S200/s04/T2 +ZY20210800001/H1/C12/N41/S165/s04/T1 +ZY20210800001/H1/C12/N40/S200/s04/T2 +ZY20210800001/H1/C12/N40/S165/s04/T1 +ZY20210800001/H1/C12/N39/S200/s04/T2 +ZY20210800001/H1/C12/N39/S165/s04/T1 +ZY20210800001/H1/C12/N38/S200/s04/T2 +ZY20210800001/H1/C12/N38/S165/s04/T1 +ZY20210800001/H1/C12/N37/S200/s03/T2 +ZY20210800001/H1/C12/N37/S165/s03/T1 +ZY20210800001/H1/C12/N36/S200/s03/T2 +ZY20210800001/H1/C12/N36/S165/s03/T1 +ZY20210800001/H1/C12/N35/S200/s03/T2 +ZY20210800001/H1/C12/N35/S165/s03/T1 +ZY20210800001/H1/C12/N34/S165/s03/T1 +ZY20210800001/H1/C12/N33/S200/s02/T2 +ZY20210800001/H1/C12/N33/S165/s02/T1 +ZY20210800001/H1/C12/N32/S200/s02/T2 +ZY20210800001/H1/C12/N32/S165/s02/T1 +ZY20210800001/H1/C12/N31/S200/s02/T2 +ZY20210800001/H1/C12/N31/S165/s02/T1 +ZY20210800001/H1/C12/N30/S200/s02/T2 +ZY20210800001/H1/C12/N30/S165/s02/T1 +ZY20210800001/H1/C12/N29/S200/s01/T2 +ZY20210800001/H1/C12/N29/S165/s01/T1 +ZY20210800001/H1/C12/N28/S200/s01/T2 +ZY20210800001/H1/C12/N28/S165/s01/T1 +ZY20210800001/H1/C12/N27/S200/s01/T2 +ZY20210800001/H1/C12/N27/S165/s01/T1 +ZY20210800001/H1/C12/N26/S200/s01/T2 +ZY20210800001/H1/C12/N26/S165/s01/T1 +ZY20210800001/H1/C12/N11/S203/s03/T2 +ZY20210800001/H1/C12/N11/S169/s03/T1 +ZY20210800001/H1/C11/N61/S376/s05/T3 +ZY20210800001/H1/C11/N61/S376/s04/T4 +ZY20210800001/H1/C11/N61/S376/s03/T3 +ZY20210800001/H1/C11/N61/S376/s02/T2 +ZY20210800001/H1/C11/N61/S376/s01/T1 +ZY20210800001/H1/C11/N60/S376/s05/T3 +ZY20210800001/H1/C11/N60/S376/s04/T4 +ZY20210800001/H1/C11/N60/S376/s03/T3 +ZY20210800001/H1/C11/N60/S376/s02/T2 +ZY20210800001/H1/C11/N60/S376/s01/T1 +ZY20210800001/H1/C11/N59/S376/s05/T3 +ZY20210800001/H1/C11/N59/S376/s04/T4 +ZY20210800001/H1/C11/N59/S376/s03/T3 +ZY20210800001/H1/C11/N59/S376/s02/T2 +ZY20210800001/H1/C11/N59/S376/s01/T1 +ZY20210800001/H1/C11/N58/S376/s05/T2 +ZY20210800001/H1/C11/N58/S376/s04/T4 +ZY20210800001/H1/C11/N58/S376/s03/T3 +ZY20210800001/H1/C11/N58/S376/s02/T2 +ZY20210800001/H1/C11/N58/S376/s01/T1 +ZY20210800001/H1/C11/N53/S367/s05/T1 +ZY20210800001/H1/C11/N53/S367/s04/T4 +ZY20210800001/H1/C11/N53/S367/s03/T3 +ZY20210800001/H1/C11/N53/S367/s02/T2 +ZY20210800001/H1/C11/N53/S367/s01/T1 +ZY20210800001/H1/C11/N52/S367/s05/T1 +ZY20210800001/H1/C11/N52/S367/s04/T4 +ZY20210800001/H1/C11/N52/S367/s03/T3 +ZY20210800001/H1/C11/N52/S367/s02/T2 +ZY20210800001/H1/C11/N52/S367/s01/T1 +ZY20210800001/H1/C11/N51/S367/s05/T1 +ZY20210800001/H1/C11/N51/S367/s04/T4 +ZY20210800001/H1/C11/N51/S367/s03/T3 +ZY20210800001/H1/C11/N51/S367/s02/T2 +ZY20210800001/H1/C11/N51/S367/s01/T1 +ZY20210800001/H1/C11/N24/S187/s01/T3 +ZY20210800001/H1/C11/N24/S129/s01/T1 +ZY20210800001/H1/C11/N23/S187/s01/T3 +ZY20210800001/H1/C11/N22/S187/s01/T3 +ZY20210800001/H1/C11/N22/S129/s01/T1 +ZY20210800001/H1/C11/N21/S187/s01/T3 +ZY20210800001/H1/C11/N21/S129/s01/T1 +ZY20210800001/H1/C11/N20/S185/s05/T3 +ZY20210800001/H1/C11/N20/S125/s05/T1 +ZY20210800001/H1/C11/N19/S185/s05/T2 +ZY20210800001/H1/C11/N19/S125/s05/T1 +ZY20210800001/H1/C11/N18/S185/s05/T2 +ZY20210800001/H1/C11/N18/S125/s05/T1 +ZY20210800001/H1/C11/N17/S185/s05/T2 +ZY20210800001/H1/C11/N17/S125/s05/T1 +ZY20210800001/H1/C11/N16/S185/s04/T2 +ZY20210800001/H1/C11/N16/S125/s04/T1 +ZY20210800001/H1/C11/N15/S185/s04/T2 +ZY20210800001/H1/C11/N15/S125/s04/T1 +ZY20210800001/H1/C11/N14/S185/s04/T2 +ZY20210800001/H1/C11/N14/S125/s04/T1 +ZY20210800001/H1/C11/N13/S185/s04/T2 +ZY20210800001/H1/C11/N13/S125/s04/T1 +ZY20210800001/H1/C11/N12/S185/s03/T2 +ZY20210800001/H1/C11/N12/S125/s03/T1 +ZY20210800001/H1/C11/N11/S185/s03/T2 +ZY20210800001/H1/C11/N11/S125/s03/T1 +ZY20210800001/H1/C11/N10/S367/s04/T1 +ZY20210800001/H1/C11/N10/S185/s03/T2 +ZY20210800001/H1/C11/N09/S367/s02/T2 +ZY20210800001/H1/C11/N09/S185/s03/T2 +ZY20210800001/H1/C11/N08/S185/s02/T2 +ZY20210800001/H1/C11/N07/S367/s02/T4 +ZY20210800001/H1/C11/N07/S185/s02/T2 +ZY20210800001/H1/C1/N50/S106/s03/T2 +ZY20210800001/H1/C1/N50/S106/s03/T1 +ZY20210800001/H1/C1/N49/S106/s05/T2 +ZY20210800001/H1/C1/N49/S106/s05/T1 +ZY20210800001/H1/C1/N48/S100/s03/T2 +ZY20210800001/H1/C1/N48/S100/s03/T1 +ZY20210800001/H1/C1/N47/S104/s04/T2 +ZY20210800001/H1/C1/N45/S106/s03/T1 +ZY20210800001/H1/C1/N44/S99/s02/T2 +ZY20210800001/H1/C1/N44/S99/s02/T1 +ZY20210800001/H1/C1/N41/S104/s03/T1 +ZY20210800001/H1/C1/N39/S99/s01/T2 +ZY20210800001/H1/C1/N39/S99/s01/T1 +ZY20210800001/H1/C1/N38/S100/s05/T2 +ZY20210800001/H1/C1/N38/S100/s05/T1 +ZY20210800001/H1/C1/N37/S104/s02/T2 +ZY20210800001/H1/C1/N37/S104/s02/T1 +ZY20210800001/H1/C1/N36/S100/s02/T2 +ZY20210800001/H1/C1/N36/S100/s02/T1 +ZY20210800001/H1/C1/N35/S104/s01/T2 +ZY20210800001/H1/C1/N34/S108/s05/T1 +ZY20210800001/H1/C1/N33/S100/s05/T2 +ZY20210800001/H1/C1/N33/S100/s05/T1 +ZY20210800001/H1/C1/N32/S108/s01/T2 +ZY20210800001/H1/C1/N32/S108/s01/T1 +ZY20210800001/H1/C1/N30/S104/s04/T2 +ZY20210800001/H1/C1/N29/S99/s03/T2 +ZY20210800001/H1/C1/N29/S99/s03/T1 +ZY20210800001/H1/C1/N28/S100/s03/T2 +ZY20210800001/H1/C1/N28/S100/s03/T1 +ZY20210800001/H1/C1/N27/S99/s05/T2 +ZY20210800001/H1/C1/N27/S99/s05/T1 +ZY20210800001/H1/C1/N26/S104/s05/T2 +ZY20210800001/H1/C1/N26/S104/s05/T1 +ZY20210800001/H1/C1/N24/S100/s01/T2 +ZY20210800001/H1/C1/N24/S100/s01/T1 +ZY20210800001/H1/C1/N23/S104/s05/T1 +ZY20210800001/H1/C1/N21/S99/s04/T2 +ZY20210800001/H1/C1/N21/S99/s04/T1 +ZY20210800001/H1/C1/N20/S108/s03/T1 +ZY20210800001/H1/C1/N19/S100/s02/T2 +ZY20210800001/H1/C1/N19/S100/s02/T1 diff --git a/third-party/HOI4D-Instructions/prepare_4Dseg/palette.py b/third-party/HOI4D-Instructions/prepare_4Dseg/palette.py new file mode 100644 index 0000000000000000000000000000000000000000..ac78687941aa0fb7aa58c6532e4efed18a87c6ed --- /dev/null +++ b/third-party/HOI4D-Instructions/prepare_4Dseg/palette.py @@ -0,0 +1,25 @@ +import numpy as np + + +def get_color_map(N=256): + def bitget(byteval, idx): + return ((byteval & (1 << idx)) != 0) + + cmap = np.zeros((N, 3), dtype=np.uint8) + for i in range(N): + r = g = b = 0 + c = i + for j in range(8): + r = r | (bitget(c, 0) << 7-j) + g = g | (bitget(c, 1) << 7-j) + b = b | (bitget(c, 2) << 7-j) + c = c >> 3 + + cmap[i] = np.array([r, g, b]) + + return cmap + + +color_map = get_color_map() +def pal_color_map(): + return color_map diff --git a/third-party/HOI4D-Instructions/prepare_4Dseg/pixel2category.py b/third-party/HOI4D-Instructions/prepare_4Dseg/pixel2category.py new file mode 100644 index 0000000000000000000000000000000000000000..8324f2d238e883f96499ae84be7e70b32c252e71 --- /dev/null +++ b/third-party/HOI4D-Instructions/prepare_4Dseg/pixel2category.py @@ -0,0 +1,44 @@ +from utils import category2label_map, category2label_map_instanceseg +from palette import pal_color_map +import cv2 +import numpy as np +import os + + +def get_mask_and_label(path): + '''/mnt/sas-raid5-7.2T/HOI4D_data/datatang/ZY20210800001/H1/C1/N15/S99/s4/T1/2Dseg/mask''' + l = path.split('/') + for i in l: + if 'C' in i: + category = i + #for img in os.listdir(path): + #f(img, category) + return f(path, category) + + +def f(img_path, category): + image = cv2.imread(img_path)[:, :, ::-1] + assert image.shape == (1080, 1920, 3) + # image = shift_mask(image, img_path) + color_map = pal_color_map() + + arrs = [] + labels = [] # semantic segmentation + labels_instanceseg = [] # instance segmentation + for i in range(10): + color = color_map[i + 1] + valid = (image[..., 0] == color[0]) & (image[..., 1] == color[1]) & (image[..., 2] == color[2]) + if np.sum(valid) == 0: + continue + if i >= len(category2label_map[category]): + continue + arrs.append(valid) + labels.append(category2label_map[category][i]) + labels_instanceseg.append(category2label_map_instanceseg[category][i]) + + return arrs, np.array(labels), np.array(labels_instanceseg) + + + +if __name__ == "__main__": + pass diff --git a/third-party/HOI4D-Instructions/prepare_4Dseg/prepare_4Dseg_dataset.py b/third-party/HOI4D-Instructions/prepare_4Dseg/prepare_4Dseg_dataset.py new file mode 100644 index 0000000000000000000000000000000000000000..ef823fa7882d97ee86807e7eb7806fa303d1983b --- /dev/null +++ b/third-party/HOI4D-Instructions/prepare_4Dseg/prepare_4Dseg_dataset.py @@ -0,0 +1,122 @@ +import os +import numpy as np +import argparse +import multiprocessing as mlp +from scene2frame import scene2frame_solve + + +def solve1(data_dir, data_2Dseg_dir, output_dir): + ex_path = os.path.join(data_dir, "3Dseg", "output.log") + image_path = os.path.join(data_dir, "align_rgb") + depth_path = os.path.join(data_dir, "align_depth") + mask_path = os.path.join(data_2Dseg_dir, "mask") + output_label_path = os.path.join(output_dir, "semantic_segmentation_label") + output_background_path = os.path.join(output_dir, "background") + label3d_path = os.path.join(data_dir, "3Dseg", "label.txt") + scene2frame_solve(ex_path, image_path, depth_path, mask_path, output_label_path, output_background_path, label3d_path) + + +def prepare(startIdx, endIdx, output_dir, npz_path): + for i in range(startIdx, endIdx): + pc = [] + rgb = [] + semantic = [] + with open(os.path.join(output_dir, "semantic_segmentation_label", str(i) + ".txt"), 'r') as f: + for line in f: + line = line.split(' ') + pc.append([float(line[0]), float(line[1]), float(line[2])]) + rgb.append([float(line[0]), float(line[1]), float(line[2])]) + semantic.append(int(float(line[3]) + 0.01)) + pc = np.array(pc) + rgb = np.array(rgb) + semantic = np.array(semantic) + center = np.mean(pc, axis=0) + np.savez(os.path.join(npz_path, str(i) + ".npz"), pc=pc, rgb=rgb, semantic=semantic, center=center) + + +def solve2(output_dir): + npz_path = os.path.join(output_dir, "npz") + os.makedirs(npz_path, exist_ok=True) + numThreads = 24 + numFrames = 300 + numFramesPerThread = np.ceil(numFrames/numThreads).astype(np.uint32) + procs = [] + for proc_index in range(numThreads): + startIdx = proc_index*numFramesPerThread + endIdx = min(startIdx+numFramesPerThread,numFrames) + args = (startIdx, endIdx, output_dir, npz_path) + proc = mlp.Process(target=prepare, args=args) + + proc.start() + procs.append(proc) + + for i in range(len(procs)): + procs[i].join() + + +def prepare_4Dseg_data(data_dir, output_dir, datalist_path): + + datalist = [] + with open(datalist_path, "r") as f: + for line in f: + content = line.strip() + if len(content) == 0: + continue + datalist.append(content) + + cnt = 0 + for video_name in datalist: + has_file = 0 + for i in range(300): + if os.path.isfile(os.path.join(output_dir, video_name, "npz", str(i) + ".npz")): + has_file += 1 + if has_file == 300: + cnt += 1 + # else: + # print(video_name) + print(cnt) + + + # Step1: + print("------start step 1: get semantic_segmentation_label------") + for video_name in datalist: + print(video_name) + + cnt = 0 + data_2Dseg_dir = None + for seg2D_dir in data_dir: + if os.path.isdir(os.path.join(seg2D_dir, video_name, "refine_2Dseg")): + data_2Dseg_dir = seg2D_dir + cnt += 1 + assert(cnt == 1) + solve1(os.path.join(data_dir, video_name), os.path.join(data_2Dseg_dir, video_name), os.path.join(output_dir, video_name)) + print("------finish step 1!------") + + ''' + # Step2: + print("------start step 2: get npz------") + for video_name in datalist: + print(video_name) + solve2(os.path.join(output_dir, video_name)) + print("------finish step 2!------") + ''' + + +def main(): + parser = argparse.ArgumentParser() + + parser.add_argument('--data_dir', type=str, default="/PATH/TO/HOI4D") + parser.add_argument('--output_dir', type=str, default="/PATH/TO/HOI4D_4Dseg") + parser.add_argument('--train_datalist_path', type=str, default="./datalists/train_all.txt") + parser.add_argument('--test_datalist_path', type=str, default="./datalists/test_all.txt") + + args = parser.parse_args() + + print("start preparing training set") + prepare_4Dseg_data(args.data_dir, args.output_dir, args.train_datalist_path) + print("start preparing test set") + prepare_4Dseg_data(args.data_dir, args.output_dir, args.test_datalist_path) + + +if __name__ == "__main__": + main() diff --git a/third-party/HOI4D-Instructions/prepare_4Dseg/prepare_datalists.py b/third-party/HOI4D-Instructions/prepare_4Dseg/prepare_datalists.py new file mode 100644 index 0000000000000000000000000000000000000000..be50d94a8e1a6a14c7be1ea52f088e4edd28d758 --- /dev/null +++ b/third-party/HOI4D-Instructions/prepare_4Dseg/prepare_datalists.py @@ -0,0 +1,44 @@ +import os + + +def prepare_datalists(root_dir): + datalist = [] + for ZY in os.listdir(root_dir): + p1 = os.path.join(root_dir, ZY) + if not os.path.isdir(p1): + continue + for H in os.listdir(p1): + p2 = os.path.join(p1, H) + if not os.path.isdir(p2): + continue + for C in os.listdir(p2): + p3 = os.path.join(p2, C) + if not os.path.isdir(p3): + continue + for N in os.listdir(p3): + p4 = os.path.join(p3, N) + if not os.path.isdir(p4): + continue + for S in os.listdir(p4): + p5 = os.path.join(p4, S) + if not os.path.isdir(p5): + continue + for s in os.listdir(p5): + p6 = os.path.join(p5, s) + if not os.path.isdir(p6): + continue + for T in os.listdir(p6): + p7 = os.path.join(p6, T) + if not os.path.isfile(os.path.join(p7, "3Dseg", "label.txt")): + continue + datalist.append(os.path.join(ZY, H, C, N, S, s, T)) + return datalist + + +if __name__ == "__main__": + root_dir = "/share/datasets/HOI4D_overall" + datalist = prepare_datalists(root_dir) + f = open("./datalists/train_all.txt", "w") + for d in datalist: + f.write(d + "\n") + f.close() diff --git a/third-party/HOI4D-Instructions/prepare_4Dseg/scene2frame.py b/third-party/HOI4D-Instructions/prepare_4Dseg/scene2frame.py new file mode 100644 index 0000000000000000000000000000000000000000..09ab9a6c6c5bf00cb51d67070218160a85e73a31 --- /dev/null +++ b/third-party/HOI4D-Instructions/prepare_4Dseg/scene2frame.py @@ -0,0 +1,173 @@ +import os +import cv2 +import argparse +import open3d as o3d +from plyfile import PlyData +import pandas as pd +import scipy.spatial as spt +import numpy as np +import multiprocessing as mlp +from pixel2category import get_mask_and_label + + +def get_foreground_depths_and_labels(depth_path, mask_path, ds, ls, ls_instanceseg): + depth = cv2.imread(depth_path, cv2.IMREAD_UNCHANGED) + mask = cv2.imread(mask_path, cv2.IMREAD_UNCHANGED) + assert mask.shape == (1080, 1920, 3) + + ans = [] + for d in ds: + x = depth.copy() + x[~d] = 0 + ans.append(x) + return ans, ls, ls_instanceseg + + +def convert(id, depth_path, mask_path, output_background_path): + # background + depth = cv2.imread(depth_path, cv2.IMREAD_UNCHANGED) + mask = cv2.imread(mask_path, cv2.IMREAD_UNCHANGED) + assert mask.shape == (1080, 1920, 3) + + s = np.sum(mask, axis=2) + depth_b = depth.copy() + depth_b[s > 0] = 0 + output_background_p = os.path.join(output_background_path, id + ".png") + cv2.imwrite(output_background_p, depth_b) + depth_b = o3d.io.read_image(output_background_p) + + # foreground + depth_fs = [] + ds, ls, ls_instanceseg = get_mask_and_label(mask_path) + depths, labels, labels_instanceseg = get_foreground_depths_and_labels(depth_path, mask_path, ds, ls, ls_instanceseg) + for i in range(len(depths)): + output_foreground_p = os.path.join(output_background_path.replace("background", "foreground_" + str(i + 1)), id + ".png") + os.makedirs(os.path.dirname(output_foreground_p), exist_ok=True) + d = depths[i] + cv2.imwrite(output_foreground_p, d) + d_f = o3d.io.read_image(output_foreground_p) + depth_fs.append([d_f, labels[i], labels_instanceseg[i]]) + + return depth_fs, depth_b + + +def scene2frame(filelist, image_path, depth_path, mask_path, output_label_path, output_background_path, extrinsics, label, ckt, max_instance_label): + + os.makedirs(output_label_path, exist_ok=True) + os.makedirs(output_background_path, exist_ok=True) + + for filename in filelist: + id = filename.split('.')[-2] + #print(id) + color_raw = o3d.io.read_image(os.path.join(image_path,id+'.jpg')) + depth_foregrounds, depth_background = convert(id, os.path.join(depth_path,id+'.png'), os.path.join(mask_path, id.zfill(5)+'.png'), output_background_path) + + # background + rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth( + color_raw, depth_background,convert_rgb_to_intensity=False) + pcd = o3d.geometry.PointCloud.create_from_rgbd_image( + rgbd_image, + o3d.camera.PinholeCameraIntrinsic( + o3d.camera.PinholeCameraIntrinsicParameters.Kinect2ColorCameraDefault),extrinsic=extrinsics[int(id)]) + # pcd.transform(extrinsics[int(id)]) + voxel_down_pcd = pcd.voxel_down_sample(voxel_size=0.02) + o3d.io.write_point_cloud(os.path.join(output_label_path, id+'.ply'), voxel_down_pcd) + + plydata_0 = PlyData.read(os.path.join(output_label_path, id+'.ply')) + data_0 = plydata_0.elements[0].data + data_pd_0 = pd.DataFrame(data_0) + data_np_0 = np.zeros((data_pd_0.shape[0],data_pd_0.shape[1]+2), dtype=np.float64) # 初始化储存数据的array + property_names_0 = data_0[0].dtype.names # 读取property的名字 + for i, name in enumerate(property_names_0): # 按property读取数据,这样可以保证读出的数据是同样的数据类型。 + data_np_0[:, i] = data_pd_0[name] + + + anchor = data_np_0[:,:3] + geo = data_np_0[:,:3] + # color = data_np_0[:,3:6] + feat = data_np_0[:, 3:5] + for i in range(data_np_0.shape[0]): + find_point = anchor[i] + d, x = ckt.query(find_point) # 返回最近邻点的距离d和在数组中的顺序x + feat[i] = label[x] + + ans = np.concatenate((geo,feat),axis=1) + + # foreground + for i in range(len(depth_foregrounds)): + depth_f = depth_foregrounds[i][0] + label_f = depth_foregrounds[i][1] + label_f_instanceseg = depth_foregrounds[i][2] + rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth( + color_raw, depth_f,convert_rgb_to_intensity=False) + pcd = o3d.geometry.PointCloud.create_from_rgbd_image( + rgbd_image, + o3d.camera.PinholeCameraIntrinsic( + o3d.camera.PinholeCameraIntrinsicParameters.Kinect2ColorCameraDefault),extrinsic=extrinsics[int(id)]) + # pcd.transform(extrinsics[int(id)]) + voxel_down_pcd = pcd.voxel_down_sample(voxel_size=0.02) + points = np.array(voxel_down_pcd.points) + if points.shape[0] == 0: + continue + o3d.io.write_point_cloud(os.path.join(output_label_path, id+'_f_'+str(i)+'.ply'), voxel_down_pcd) + + plydata_0 = PlyData.read(os.path.join(output_label_path, id+'_f_'+str(i)+'.ply')) + data_0 = plydata_0.elements[0].data + data_pd_0 = pd.DataFrame(data_0) + data_np_0 = np.zeros((data_pd_0.shape[0],data_pd_0.shape[1]+2), dtype=np.float64) # 初始化储存数据的array + property_names_0 = data_0[0].dtype.names # 读取property的名字 + for ii, name in enumerate(property_names_0): # 按property读取数据,这样可以保证读出的数据是同样的数据类型。 + data_np_0[:, ii] = data_pd_0[name] + + geo = data_np_0[:,:3] + feat = data_np_0[:, 3:5] + feat[:, 0] = label_f # semantic label + feat[:, 1] = max_instance_label + label_f_instanceseg # instance label + out = np.concatenate((geo,feat), axis=1) + ans = np.concatenate((ans, out), axis=0) + + np.savetxt(os.path.join(output_label_path, id+'.txt'), ans) + +def main(ex_path, image_path, depth_path, mask_depth, output_label_path, output_background_path, label3d_path): + + extr = o3d.io.read_pinhole_camera_trajectory(ex_path) + extrinsics = [] + for param in extr.parameters: + extrinsics.append(param.extrinsic) + data_np = np.loadtxt(label3d_path) + label = data_np[:,-2:] + max_instance_label = np.max(label[:, -1]) + coor = data_np[:,:3] + ckt = spt.cKDTree(coor) + + numThreads = 24 + numFrames = 300 + numFramesPerThread = np.ceil(numFrames/numThreads).astype(np.uint32) + procs = [] + filelist = [] + for i in range(300): + filelist.append(str(i) + ".jpg") + for proc_index in range(numThreads): + startIdx = proc_index*numFramesPerThread + endIdx = min(startIdx+numFramesPerThread,numFrames) + args = (filelist[startIdx:endIdx], image_path, depth_path, mask_depth, output_label_path, output_background_path, extrinsics, label, ckt, max_instance_label) + proc = mlp.Process(target=scene2frame, args=args) + + proc.start() + procs.append(proc) + + for i in range(len(procs)): + procs[i].join() + + +def scene2frame_solve(ex_path, image_path, depth_path, mask_depth, output_label_path, output_background_path, label3d_path): + try: + main(ex_path, image_path, depth_path, mask_depth, output_label_path, output_background_path, label3d_path) + except: + print("[error] ", image_path) + + +''' +if __name__ == '__main__': + app.run(main) +''' diff --git a/third-party/HOI4D-Instructions/prepare_4Dseg/utils.py b/third-party/HOI4D-Instructions/prepare_4Dseg/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ab1ecb5bfbdc049bca617a463c25100f35070e12 --- /dev/null +++ b/third-party/HOI4D-Instructions/prepare_4Dseg/utils.py @@ -0,0 +1,55 @@ +import csv + +# The i-th number of each category represents the semantic label number corresponding to the i-th color +category2label_map = { + "C1" : [24, 47], + "C2" : [17, 47, 17], + "C3" : [25, 47, 25], + "C4" : [19, 47, 19, 19, 16], + "C5" : [16, 47, 17], + "C6" : [27, 47, 27, 16], + "C7" : [15, 47, 46], + "C8" : [9, 47, 9, 9, 9, 47], + "C9" : [48, 47, 48], + "C10" : [22, 47], + "C11": [23, 47, 23], + "C12": [21, 47, 17], + "C13": [31, 47, 46], + "C14": [10, 47, 10, 16], + "C15": [20, 47, 20, 20, 20, 20], + "C16": [30, 47, 30, 30], + "C17": [29, 47, 29, 29, 29, 47], + "C18": [28, 47, 28, 28, 46], + "C19": [26, 47, 26, 26, 26, 26], + "C20": [2, 47, 47] +} + +# The i-th number of each category represents the instance label number corresponding to the ith color (extended backward based on the original instance number) +category2label_map_instanceseg = { + "C1" : [1, 2], + "C2" : [1, 2, 3], + "C3" : [1, 2, 1], + "C4" : [1, 2, 1, 1, 3], + "C5" : [1, 2, 3], + "C6" : [1, 2, 1, 3], + "C7" : [1, 2, 3], + "C8" : [1, 2, 1, 3, 3, 4], + "C9" : [1, 2, 1], + "C10" : [1, 2], + "C11": [1, 2, 1], + "C12": [1, 2, 3], + "C13": [1, 2, 3], + "C14": [1, 2, 1, 3], + "C15": [1, 2, 1, 1, 1, 1], + "C16": [1, 2, 1, 1], + "C17": [1, 2, 1, 1, 1, 3], + "C18": [1, 2, 1, 1, 3], + "C19": [1, 2, 1, 1, 1, 1], + "C20": [1, 2, 3] +} + + +def get_csv(path): + with open(path) as f: + f_csv = csv.reader(f) + return f_csv diff --git a/third-party/HOI4D-Instructions/release.txt b/third-party/HOI4D-Instructions/release.txt new file mode 100644 index 0000000000000000000000000000000000000000..a528d66bfb2e757b9b8bf502113569a281f98114 --- /dev/null +++ b/third-party/HOI4D-Instructions/release.txt @@ -0,0 +1,2971 @@ +ZY20210800004/H4/C8/N14/S71/s03/T2 +ZY20210800004/H4/C8/N14/S71/s03/T1 +ZY20210800004/H4/C8/N13/S71/s02/T2 +ZY20210800004/H4/C8/N13/S71/s02/T1 +ZY20210800004/H4/C8/N12/S71/s02/T2 +ZY20210800004/H4/C8/N12/S71/s02/T1 +ZY20210800004/H4/C7/N15/S56/s02/T1 +ZY20210800004/H4/C7/N13/S57/s01/T1 +ZY20210800004/H4/C6/N54/S378/s05/T2 +ZY20210800004/H4/C6/N54/S378/s04/T1 +ZY20210800004/H4/C6/N54/S378/s03/T3 +ZY20210800004/H4/C6/N54/S378/s02/T2 +ZY20210800004/H4/C6/N54/S378/s01/T1 +ZY20210800004/H4/C6/N52/S378/s05/T2 +ZY20210800004/H4/C6/N52/S378/s04/T1 +ZY20210800004/H4/C6/N52/S378/s03/T3 +ZY20210800004/H4/C6/N52/S378/s02/T2 +ZY20210800004/H4/C6/N52/S378/s01/T1 +ZY20210800004/H4/C6/N51/S378/s05/T2 +ZY20210800004/H4/C6/N51/S378/s04/T1 +ZY20210800004/H4/C6/N51/S378/s03/T3 +ZY20210800004/H4/C6/N51/S378/s02/T2 +ZY20210800004/H4/C6/N51/S378/s01/T1 +ZY20210800004/H4/C6/N50/S250/s05/T1 +ZY20210800004/H4/C6/N47/S250/s04/T1 +ZY20210800004/H4/C6/N43/S250/s03/T1 +ZY20210800004/H4/C6/N39/S250/s02/T1 +ZY20210800004/H4/C6/N24/S250/s01/T3 +ZY20210800004/H4/C6/N21/S250/s01/T3 +ZY20210800004/H4/C6/N20/S249/s05/T3 +ZY20210800004/H4/C6/N19/S249/s05/T3 +ZY20210800004/H4/C6/N16/S249/s04/T3 +ZY20210800004/H4/C6/N15/S82/s03/T2 +ZY20210800004/H4/C6/N15/S82/s03/T1 +ZY20210800004/H4/C6/N15/S249/s04/T3 +ZY20210800004/H4/C6/N14/S82/s02/T2 +ZY20210800004/H4/C6/N14/S82/s02/T1 +ZY20210800004/H4/C6/N14/S249/s04/T3 +ZY20210800004/H4/C6/N11/S82/s01/T2 +ZY20210800004/H4/C6/N11/S82/s01/T1 +ZY20210800004/H4/C6/N11/S249/s03/T2 +ZY20210800004/H4/C6/N10/S82/s05/T2 +ZY20210800004/H4/C6/N10/S82/s05/T1 +ZY20210800004/H4/C6/N10/S249/s03/T2 +ZY20210800004/H4/C6/N09/S82/s05/T1 +ZY20210800004/H4/C6/N09/S249/s03/T2 +ZY20210800004/H4/C6/N07/S82/s04/T2 +ZY20210800004/H4/C6/N07/S82/s04/T1 +ZY20210800004/H4/C6/N07/S249/s02/T2 +ZY20210800004/H4/C6/N06/S82/s03/T2 +ZY20210800004/H4/C6/N06/S82/s03/T1 +ZY20210800004/H4/C6/N06/S249/s02/T2 +ZY20210800004/H4/C6/N05/S82/s03/T2 +ZY20210800004/H4/C6/N05/S82/s03/T1 +ZY20210800004/H4/C6/N05/S249/s02/T2 +ZY20210800004/H4/C6/N04/S82/s02/T1 +ZY20210800004/H4/C6/N04/S249/s01/T2 +ZY20210800004/H4/C6/N03/S82/s02/T2 +ZY20210800004/H4/C6/N03/S82/s02/T1 +ZY20210800004/H4/C6/N03/S249/s01/T2 +ZY20210800004/H4/C6/N02/S82/s01/T2 +ZY20210800004/H4/C6/N02/S82/s01/T1 +ZY20210800004/H4/C6/N02/S249/s01/T2 +ZY20210800004/H4/C6/N01/S82/s01/T2 +ZY20210800004/H4/C6/N01/S82/s01/T1 +ZY20210800004/H4/C6/N01/S249/s01/T2 +ZY20210800004/H4/C5/N32/S56/s03/T1 +ZY20210800004/H4/C5/N31/S56/s03/T1 +ZY20210800004/H4/C5/N29/S113/s02/T5 +ZY20210800004/H4/C5/N29/S113/s02/T1 +ZY20210800004/H4/C5/N28/S113/s02/T5 +ZY20210800004/H4/C5/N27/S113/s01/T5 +ZY20210800004/H4/C5/N26/S113/s01/T1 +ZY20210800004/H4/C5/N23/S109/s04/T5 +ZY20210800004/H4/C5/N20/S109/s03/T5 +ZY20210800004/H4/C5/N18/S109/s02/T1 +ZY20210800004/H4/C5/N17/S109/s01/T1 +ZY20210800004/H4/C5/N16/S109/s01/T5 +ZY20210800004/H4/C5/N16/S109/s01/T1 +ZY20210800004/H4/C5/N15/S56/s02/T1 +ZY20210800004/H4/C5/N14/S56/s02/T1 +ZY20210800004/H4/C5/N13/S56/s01/T1 +ZY20210800004/H4/C5/N12/S56/s01/T1 +ZY20210800004/H4/C5/N11/S56/s05/T1 +ZY20210800004/H4/C4/N50/S260/s03/T2 +ZY20210800004/H4/C4/N50/S217/s05/T3 +ZY20210800004/H4/C4/N49/S260/s03/T2 +ZY20210800004/H4/C4/N49/S223/s03/T4 +ZY20210800004/H4/C4/N49/S217/s05/T3 +ZY20210800004/H4/C4/N48/S260/s02/T2 +ZY20210800004/H4/C4/N48/S223/s02/T4 +ZY20210800004/H4/C4/N48/S217/s05/T3 +ZY20210800004/H4/C4/N45/S260/s02/T2 +ZY20210800004/H4/C4/N45/S223/s02/T4 +ZY20210800004/H4/C4/N45/S217/s04/T3 +ZY20210800004/H4/C4/N44/S260/s01/T2 +ZY20210800004/H4/C4/N44/S223/s01/T4 +ZY20210800004/H4/C4/N44/S217/s04/T3 +ZY20210800004/H4/C4/N43/S260/s01/T2 +ZY20210800004/H4/C4/N43/S223/s01/T4 +ZY20210800004/H4/C4/N43/S217/s04/T3 +ZY20210800004/H4/C4/N42/S260/s01/T2 +ZY20210800004/H4/C4/N42/S223/s01/T4 +ZY20210800004/H4/C4/N42/S217/s03/T3 +ZY20210800004/H4/C4/N41/S260/s01/T2 +ZY20210800004/H4/C4/N41/S223/s01/T4 +ZY20210800004/H4/C4/N41/S217/s03/T3 +ZY20210800004/H4/C4/N40/S257/s05/T2 +ZY20210800004/H4/C4/N40/S217/s03/T3 +ZY20210800004/H4/C4/N39/S257/s05/T2 +ZY20210800004/H4/C4/N37/S217/s02/T3 +ZY20210800004/H4/C4/N36/S217/s02/T3 +ZY20210800004/H4/C4/N35/S221/s04/T4 +ZY20210800004/H4/C4/N35/S217/s02/T3 +ZY20210800004/H4/C4/N34/S221/s04/T4 +ZY20210800004/H4/C4/N34/S217/s01/T3 +ZY20210800004/H4/C4/N33/S257/s04/T1 +ZY20210800004/H4/C4/N33/S221/s04/T4 +ZY20210800004/H4/C4/N33/S217/s01/T3 +ZY20210800004/H4/C4/N27/S65/s01/T4 +ZY20210800004/H4/C4/N27/S221/s02/T4 +ZY20210800004/H4/C4/N27/S215/s05/T3 +ZY20210800004/H4/C4/N14/S254/s04/T1 +ZY20210800004/H4/C4/N14/S219/s04/T4 +ZY20210800004/H4/C4/N14/S215/s01/T2 +ZY20210800004/H4/C4/N10/S260/s05/T2 +ZY20210800004/H4/C4/N10/S254/s03/T1 +ZY20210800004/H4/C4/N08/S260/s05/T2 +ZY20210800004/H4/C4/N08/S254/s02/T1 +ZY20210800004/H4/C4/N08/S219/s02/T3 +ZY20210800004/H4/C4/N05/S260/s04/T2 +ZY20210800004/H4/C4/N05/S254/s02/T1 +ZY20210800004/H4/C4/N04/S260/s04/T2 +ZY20210800004/H4/C4/N04/S254/s01/T1 +ZY20210800004/H4/C4/N04/S219/s01/T3 +ZY20210800004/H4/C4/N03/S260/s04/T2 +ZY20210800004/H4/C4/N03/S254/s01/T1 +ZY20210800004/H4/C4/N03/S219/s01/T3 +ZY20210800004/H4/C4/N02/S260/s03/T2 +ZY20210800004/H4/C4/N02/S254/s01/T1 +ZY20210800004/H4/C4/N01/S260/s03/T2 +ZY20210800004/H4/C4/N01/S254/s01/T1 +ZY20210800004/H4/C4/N01/S219/s01/T3 +ZY20210800004/H4/C3/N68/S380/s05/T2 +ZY20210800004/H4/C3/N68/S380/s03/T2 +ZY20210800004/H4/C3/N68/S380/s02/T1 +ZY20210800004/H4/C3/N68/S380/s01/T1 +ZY20210800004/H4/C3/N67/S380/s05/T2 +ZY20210800004/H4/C3/N67/S380/s04/T2 +ZY20210800004/H4/C3/N67/S380/s03/T2 +ZY20210800004/H4/C3/N67/S380/s02/T1 +ZY20210800004/H4/C3/N67/S380/s01/T1 +ZY20210800004/H4/C3/N66/S380/s05/T1 +ZY20210800004/H4/C3/N66/S380/s04/T2 +ZY20210800004/H4/C3/N66/S380/s03/T2 +ZY20210800004/H4/C3/N66/S380/s02/T1 +ZY20210800004/H4/C3/N66/S380/s01/T1 +ZY20210800004/H4/C3/N65/S380/s05/T1 +ZY20210800004/H4/C3/N65/S380/s04/T2 +ZY20210800004/H4/C3/N65/S380/s03/T2 +ZY20210800004/H4/C3/N65/S380/s02/T1 +ZY20210800004/H4/C3/N65/S380/s01/T1 +ZY20210800004/H4/C3/N64/S379/s05/T2 +ZY20210800004/H4/C3/N64/S379/s04/T2 +ZY20210800004/H4/C3/N64/S379/s03/T2 +ZY20210800004/H4/C3/N64/S379/s02/T1 +ZY20210800004/H4/C3/N64/S379/s01/T1 +ZY20210800004/H4/C3/N63/S379/s05/T2 +ZY20210800004/H4/C3/N63/S379/s03/T2 +ZY20210800004/H4/C3/N63/S379/s02/T1 +ZY20210800004/H4/C3/N63/S379/s01/T1 +ZY20210800004/H4/C3/N62/S379/s05/T1 +ZY20210800004/H4/C3/N62/S379/s04/T2 +ZY20210800004/H4/C3/N62/S379/s03/T2 +ZY20210800004/H4/C3/N62/S379/s01/T1 +ZY20210800004/H4/C3/N61/S379/s05/T2 +ZY20210800004/H4/C3/N61/S379/s04/T2 +ZY20210800004/H4/C3/N61/S379/s03/T2 +ZY20210800004/H4/C3/N61/S379/s02/T1 +ZY20210800004/H4/C3/N61/S379/s01/T1 +ZY20210800004/H4/C3/N60/S377/s05/T2 +ZY20210800004/H4/C3/N60/S377/s04/T2 +ZY20210800004/H4/C3/N59/S375/s03/T2 +ZY20210800004/H4/C3/N59/S375/s02/T2 +ZY20210800004/H4/C3/N59/S374/s02/T1 +ZY20210800004/H4/C3/N59/S373/s05/T2 +ZY20210800004/H4/C3/N59/S373/s03/T1 +ZY20210800004/H4/C3/N58/S375/s03/T2 +ZY20210800004/H4/C3/N58/S375/s01/T2 +ZY20210800004/H4/C3/N58/S374/s02/T1 +ZY20210800004/H4/C3/N58/S373/s05/T2 +ZY20210800004/H4/C3/N58/S373/s02/T1 +ZY20210800004/H4/C3/N57/S375/s01/T2 +ZY20210800004/H4/C3/N57/S374/s02/T1 +ZY20210800004/H4/C3/N57/S373/s05/T2 +ZY20210800004/H4/C3/N57/S373/s04/T2 +ZY20210800004/H4/C3/N57/S373/s02/T1 +ZY20210800004/H4/C3/N56/S375/s01/T2 +ZY20210800004/H4/C3/N56/S374/s02/T1 +ZY20210800004/H4/C3/N56/S373/s05/T2 +ZY20210800004/H4/C3/N56/S373/s04/T2 +ZY20210800004/H4/C3/N56/S373/s02/T1 +ZY20210800004/H4/C3/N55/S375/s03/T1 +ZY20210800004/H4/C3/N55/S375/s01/T2 +ZY20210800004/H4/C3/N55/S374/s01/T1 +ZY20210800004/H4/C3/N55/S373/s04/T2 +ZY20210800004/H4/C3/N55/S373/s02/T1 +ZY20210800004/H4/C3/N54/S375/s03/T1 +ZY20210800004/H4/C3/N54/S374/s03/T2 +ZY20210800004/H4/C3/N54/S374/s01/T1 +ZY20210800004/H4/C3/N54/S373/s04/T2 +ZY20210800004/H4/C3/N54/S373/s01/T1 +ZY20210800004/H4/C3/N53/S375/s02/T1 +ZY20210800004/H4/C3/N53/S374/s03/T2 +ZY20210800004/H4/C3/N53/S374/s01/T1 +ZY20210800004/H4/C3/N53/S373/s03/T2 +ZY20210800004/H4/C3/N52/S375/s02/T1 +ZY20210800004/H4/C3/N52/S374/s03/T2 +ZY20210800004/H4/C3/N52/S374/s01/T1 +ZY20210800004/H4/C3/N52/S373/s03/T2 +ZY20210800004/H4/C3/N52/S373/s01/T1 +ZY20210800004/H4/C3/N46/S111/s05/T1 +ZY20210800004/H4/C3/N08/S97/s04/T2 +ZY20210800004/H4/C20/N50/S301/s03/T2 +ZY20210800004/H4/C20/N50/S298/s04/T1 +ZY20210800004/H4/C20/N49/S301/s03/T2 +ZY20210800004/H4/C20/N46/S304/s05/T4 +ZY20210800004/H4/C20/N46/S304/s01/T3 +ZY20210800004/H4/C20/N46/S301/s02/T2 +ZY20210800004/H4/C20/N46/S298/s03/T1 +ZY20210800004/H4/C20/N45/S304/s05/T4 +ZY20210800004/H4/C20/N45/S304/s01/T3 +ZY20210800004/H4/C20/N45/S301/s02/T2 +ZY20210800004/H4/C20/N45/S298/s03/T1 +ZY20210800004/H4/C20/N44/S304/s04/T4 +ZY20210800004/H4/C20/N44/S304/s01/T3 +ZY20210800004/H4/C20/N44/S301/s02/T2 +ZY20210800004/H4/C20/N44/S298/s03/T1 +ZY20210800004/H4/C20/N43/S304/s04/T4 +ZY20210800004/H4/C20/N43/S301/s05/T3 +ZY20210800004/H4/C20/N43/S301/s01/T2 +ZY20210800004/H4/C20/N43/S298/s02/T1 +ZY20210800004/H4/C20/N42/S304/s04/T4 +ZY20210800004/H4/C20/N42/S301/s05/T3 +ZY20210800004/H4/C20/N42/S301/s01/T2 +ZY20210800004/H4/C20/N42/S298/s02/T1 +ZY20210800004/H4/C20/N41/S304/s04/T4 +ZY20210800004/H4/C20/N41/S301/s05/T3 +ZY20210800004/H4/C20/N41/S301/s01/T2 +ZY20210800004/H4/C20/N41/S298/s02/T1 +ZY20210800004/H4/C20/N40/S304/s03/T4 +ZY20210800004/H4/C20/N40/S301/s05/T3 +ZY20210800004/H4/C20/N40/S301/s01/T2 +ZY20210800004/H4/C20/N40/S298/s02/T1 +ZY20210800004/H4/C20/N39/S304/s03/T4 +ZY20210800004/H4/C20/N39/S301/s04/T3 +ZY20210800004/H4/C20/N39/S298/s05/T2 +ZY20210800004/H4/C20/N39/S298/s01/T1 +ZY20210800004/H4/C20/N38/S304/s03/T4 +ZY20210800004/H4/C20/N38/S301/s04/T3 +ZY20210800004/H4/C20/N38/S298/s05/T2 +ZY20210800004/H4/C20/N38/S298/s01/T1 +ZY20210800004/H4/C20/N37/S304/s03/T4 +ZY20210800004/H4/C20/N37/S301/s04/T3 +ZY20210800004/H4/C20/N37/S298/s05/T2 +ZY20210800004/H4/C20/N37/S298/s01/T1 +ZY20210800004/H4/C20/N36/S304/s02/T4 +ZY20210800004/H4/C20/N36/S301/s04/T3 +ZY20210800004/H4/C20/N36/S298/s05/T2 +ZY20210800004/H4/C20/N36/S298/s01/T1 +ZY20210800004/H4/C2/N49/S16/s03/T5 +ZY20210800004/H4/C2/N49/S16/s03/T1 +ZY20210800004/H4/C2/N48/S16/s02/T5 +ZY20210800004/H4/C2/N48/S16/s02/T1 +ZY20210800004/H4/C2/N47/S16/s02/T1 +ZY20210800004/H4/C2/N45/S5/s01/T5 +ZY20210800004/H4/C2/N45/S5/s01/T1 +ZY20210800004/H4/C2/N44/S364/s05/T6 +ZY20210800004/H4/C2/N43/S15/s01/T5 +ZY20210800004/H4/C2/N40/S10/s05/T1 +ZY20210800004/H4/C2/N39/S364/s05/T4 +ZY20210800004/H4/C2/N39/S10/s05/T5 +ZY20210800004/H4/C2/N39/S10/s05/T1 +ZY20210800004/H4/C2/N36/S364/s05/T3 +ZY20210800004/H4/C2/N36/S10/s04/T5 +ZY20210800004/H4/C2/N33/S10/s03/T5 +ZY20210800004/H4/C2/N33/S10/s03/T1 +ZY20210800004/H4/C2/N32/S364/s04/T2 +ZY20210800004/H4/C2/N32/S14/s02/T1 +ZY20210800004/H4/C2/N30/S14/s01/T1 +ZY20210800004/H4/C2/N29/S14/s01/T1 +ZY20210800004/H4/C2/N27/S13/s05/T5 +ZY20210800004/H4/C2/N27/S13/s05/T1 +ZY20210800004/H4/C2/N23/S13/s03/T5 +ZY20210800004/H4/C2/N21/S13/s02/T1 +ZY20210800004/H4/C2/N19/S13/s01/T5 +ZY20210800004/H4/C2/N17/S364/s04/T2 +ZY20210800004/H4/C2/N16/S11/s04/T1 +ZY20210800004/H4/C2/N15/S11/s04/T5 +ZY20210800004/H4/C18/N50/S364/s03/T2 +ZY20210800004/H4/C18/N50/S162/s03/T1 +ZY20210800004/H4/C18/N48/S364/s03/T2 +ZY20210800004/H4/C18/N48/S162/s03/T1 +ZY20210800004/H4/C18/N47/S364/s03/T2 +ZY20210800004/H4/C18/N46/S162/s03/T1 +ZY20210800004/H4/C18/N42/S162/s02/T1 +ZY20210800004/H4/C18/N40/S162/s02/T1 +ZY20210800004/H4/C18/N36/S181/s03/T2 +ZY20210800004/H4/C18/N36/S162/s03/T1 +ZY20210800004/H4/C18/N34/S181/s03/T2 +ZY20210800004/H4/C18/N34/S162/s03/T1 +ZY20210800004/H4/C18/N32/S364/s02/T1 +ZY20210800004/H4/C18/N32/S181/s03/T2 +ZY20210800004/H4/C18/N32/S162/s03/T1 +ZY20210800004/H4/C18/N30/S181/s02/T2 +ZY20210800004/H4/C18/N30/S162/s02/T1 +ZY20210800004/H4/C18/N28/S181/s02/T2 +ZY20210800004/H4/C18/N28/S162/s02/T1 +ZY20210800004/H4/C18/N26/S181/s02/T2 +ZY20210800004/H4/C18/N26/S162/s02/T1 +ZY20210800004/H4/C18/N25/S181/s02/T2 +ZY20210800004/H4/C18/N25/S162/s02/T1 +ZY20210800004/H4/C18/N24/S181/s01/T2 +ZY20210800004/H4/C18/N24/S162/s01/T1 +ZY20210800004/H4/C18/N23/S181/s01/T2 +ZY20210800004/H4/C18/N23/S162/s01/T1 +ZY20210800004/H4/C18/N22/S181/s01/T2 +ZY20210800004/H4/C18/N22/S162/s01/T1 +ZY20210800004/H4/C18/N21/S181/s01/T2 +ZY20210800004/H4/C18/N21/S162/s01/T1 +ZY20210800004/H4/C18/N20/S178/s05/T2 +ZY20210800004/H4/C18/N20/S160/s05/T1 +ZY20210800004/H4/C18/N19/S178/s05/T2 +ZY20210800004/H4/C18/N19/S160/s05/T1 +ZY20210800004/H4/C18/N18/S178/s05/T2 +ZY20210800004/H4/C18/N18/S160/s05/T1 +ZY20210800004/H4/C18/N17/S178/s05/T2 +ZY20210800004/H4/C18/N17/S160/s05/T1 +ZY20210800004/H4/C18/N16/S178/s04/T2 +ZY20210800004/H4/C18/N16/S160/s04/T1 +ZY20210800004/H4/C18/N15/S178/s04/T2 +ZY20210800004/H4/C18/N15/S160/s04/T1 +ZY20210800004/H4/C18/N14/S178/s04/T2 +ZY20210800004/H4/C18/N14/S160/s04/T1 +ZY20210800004/H4/C18/N13/S178/s04/T2 +ZY20210800004/H4/C18/N13/S160/s04/T1 +ZY20210800004/H4/C18/N12/S178/s03/T2 +ZY20210800004/H4/C18/N12/S160/s03/T1 +ZY20210800004/H4/C18/N11/S178/s03/T2 +ZY20210800004/H4/C18/N11/S160/s03/T1 +ZY20210800004/H4/C17/N75/S262/s03/T2 +ZY20210800004/H4/C17/N75/S262/s02/T3 +ZY20210800004/H4/C17/N74/S262/s03/T2 +ZY20210800004/H4/C17/N74/S262/s01/T3 +ZY20210800004/H4/C17/N73/S262/s02/T3 +ZY20210800004/H4/C17/N73/S262/s01/T2 +ZY20210800004/H4/C17/N72/S262/s02/T3 +ZY20210800004/H4/C17/N72/S262/s01/T2 +ZY20210800004/H4/C17/N71/S262/s02/T3 +ZY20210800004/H4/C17/N71/S262/s01/T2 +ZY20210800004/H4/C17/N70/S259/s05/T2 +ZY20210800004/H4/C17/N69/S259/s05/T3 +ZY20210800004/H4/C17/N67/S259/s05/T3 +ZY20210800004/H4/C17/N66/S259/s04/T3 +ZY20210800004/H4/C17/N65/S259/s04/T2 +ZY20210800004/H4/C17/N64/S259/s04/T2 +ZY20210800004/H4/C17/N63/S259/s04/T2 +ZY20210800004/H4/C17/N62/S259/s03/T2 +ZY20210800004/H4/C17/N61/S259/s03/T1 +ZY20210800004/H4/C17/N60/S259/s03/T1 +ZY20210800004/H4/C17/N59/S259/s03/T1 +ZY20210800004/H4/C17/N58/S259/s02/T1 +ZY20210800004/H4/C17/N57/S259/s02/T1 +ZY20210800004/H4/C17/N56/S259/s02/T1 +ZY20210800004/H4/C17/N25/S194/s02/T2 +ZY20210800004/H4/C17/N25/S134/s02/T1 +ZY20210800004/H4/C17/N24/S194/s01/T2 +ZY20210800004/H4/C17/N24/S134/s02/T1 +ZY20210800004/H4/C17/N23/S194/s01/T2 +ZY20210800004/H4/C17/N23/S134/s04/T1 +ZY20210800004/H4/C17/N22/S194/s01/T2 +ZY20210800004/H4/C17/N22/S134/s02/T1 +ZY20210800004/H4/C17/N21/S194/s01/T2 +ZY20210800004/H4/C17/N21/S134/s02/T1 +ZY20210800004/H4/C17/N20/S190/s05/T2 +ZY20210800004/H4/C17/N20/S134/s01/T1 +ZY20210800004/H4/C17/N19/S190/s05/T2 +ZY20210800004/H4/C17/N19/S134/s01/T1 +ZY20210800004/H4/C17/N18/S190/s05/T2 +ZY20210800004/H4/C17/N18/S134/s01/T1 +ZY20210800004/H4/C17/N17/S190/s05/T2 +ZY20210800004/H4/C17/N17/S134/s01/T1 +ZY20210800004/H4/C17/N16/S190/s04/T2 +ZY20210800004/H4/C17/N16/S134/s04/T1 +ZY20210800004/H4/C17/N15/S190/s04/T3 +ZY20210800004/H4/C17/N14/S190/s04/T3 +ZY20210800004/H4/C17/N14/S134/s04/T1 +ZY20210800004/H4/C17/N13/S190/s04/T3 +ZY20210800004/H4/C17/N13/S138/s02/T1 +ZY20210800004/H4/C17/N12/S190/s03/T3 +ZY20210800004/H4/C17/N12/S138/s01/T1 +ZY20210800004/H4/C17/N11/S190/s03/T3 +ZY20210800004/H4/C17/N11/S138/s01/T1 +ZY20210800004/H4/C17/N10/S190/s03/T3 +ZY20210800004/H4/C17/N10/S138/s01/T1 +ZY20210800004/H4/C17/N09/S190/s03/T3 +ZY20210800004/H4/C17/N09/S138/s01/T1 +ZY20210800004/H4/C17/N08/S190/s02/T3 +ZY20210800004/H4/C17/N07/S190/s02/T3 +ZY20210800004/H4/C17/N07/S134/s05/T1 +ZY20210800004/H4/C17/N06/S190/s02/T3 +ZY20210800004/H4/C17/N06/S134/s05/T1 +ZY20210800004/H4/C14/N36/S335/s02/T2 +ZY20210800004/H4/C14/N36/S335/s01/T1 +ZY20210800004/H4/C14/N34/S211/s03/T2 +ZY20210800004/H4/C14/N34/S177/s03/T1 +ZY20210800004/H4/C14/N32/S211/s03/T2 +ZY20210800004/H4/C14/N32/S177/s03/T1 +ZY20210800004/H4/C14/N30/S335/s02/T2 +ZY20210800004/H4/C14/N30/S335/s01/T1 +ZY20210800004/H4/C14/N28/S211/s02/T2 +ZY20210800004/H4/C14/N28/S177/s02/T1 +ZY20210800004/H4/C14/N26/S335/s02/T2 +ZY20210800004/H4/C14/N26/S335/s01/T1 +ZY20210800004/H4/C14/N25/S211/s02/T2 +ZY20210800004/H4/C14/N25/S174/s01/T1 +ZY20210800004/H4/C14/N24/S211/s01/T2 +ZY20210800004/H4/C14/N23/S211/s01/T2 +ZY20210800004/H4/C14/N23/S174/s01/T1 +ZY20210800004/H4/C14/N22/S211/s01/T2 +ZY20210800004/H4/C14/N22/S174/s01/T1 +ZY20210800004/H4/C14/N21/S211/s01/T2 +ZY20210800004/H4/C14/N21/S174/s02/T1 +ZY20210800004/H4/C14/N20/S210/s05/T2 +ZY20210800004/H4/C14/N20/S174/s02/T1 +ZY20210800004/H4/C14/N19/S210/s05/T2 +ZY20210800004/H4/C14/N18/S210/s05/T2 +ZY20210800004/H4/C14/N18/S174/s02/T1 +ZY20210800004/H4/C14/N17/S210/s05/T2 +ZY20210800004/H4/C14/N17/S174/s03/T1 +ZY20210800004/H4/C14/N16/S210/s04/T2 +ZY20210800004/H4/C14/N16/S174/s03/T1 +ZY20210800004/H4/C14/N15/S210/s04/T2 +ZY20210800004/H4/C14/N15/S174/s03/T1 +ZY20210800004/H4/C14/N14/S210/s04/T2 +ZY20210800004/H4/C14/N14/S174/s03/T1 +ZY20210800004/H4/C14/N13/S210/s04/T2 +ZY20210800004/H4/C14/N13/S174/s04/T1 +ZY20210800004/H4/C14/N12/S210/s03/T2 +ZY20210800004/H4/C14/N12/S174/s04/T1 +ZY20210800004/H4/C14/N11/S174/s04/T1 +ZY20210800004/H4/C13/N50/S234/s02/T1 +ZY20210800004/H4/C13/N50/S186/s02/T3 +ZY20210800004/H4/C13/N49/S234/s01/T1 +ZY20210800004/H4/C13/N49/S186/s01/T3 +ZY20210800004/H4/C13/N48/S234/s01/T1 +ZY20210800004/H4/C13/N48/S186/s01/T3 +ZY20210800004/H4/C13/N47/S234/s01/T1 +ZY20210800004/H4/C13/N47/S186/s01/T3 +ZY20210800004/H4/C13/N46/S186/s01/T3 +ZY20210800004/H4/C13/N45/S233/s05/T1 +ZY20210800004/H4/C13/N44/S233/s05/T1 +ZY20210800004/H4/C13/N44/S184/s05/T4 +ZY20210800004/H4/C13/N43/S233/s05/T1 +ZY20210800004/H4/C13/N43/S184/s05/T4 +ZY20210800004/H4/C13/N42/S233/s05/T1 +ZY20210800004/H4/C13/N42/S184/s05/T4 +ZY20210800004/H4/C13/N41/S233/s04/T1 +ZY20210800004/H4/C13/N41/S184/s04/T4 +ZY20210800004/H4/C13/N40/S233/s04/T1 +ZY20210800004/H4/C13/N40/S184/s04/T4 +ZY20210800004/H4/C13/N39/S233/s04/T1 +ZY20210800004/H4/C13/N39/S184/s04/T4 +ZY20210800004/H4/C13/N38/S233/s04/T1 +ZY20210800004/H4/C13/N38/S184/s04/T4 +ZY20210800004/H4/C13/N37/S233/s03/T1 +ZY20210800004/H4/C13/N37/S184/s03/T4 +ZY20210800004/H4/C13/N36/S233/s03/T1 +ZY20210800004/H4/C13/N36/S184/s03/T4 +ZY20210800004/H4/C13/N35/S233/s03/T1 +ZY20210800004/H4/C13/N35/S184/s03/T4 +ZY20210800004/H4/C13/N34/S233/s03/T1 +ZY20210800004/H4/C13/N34/S184/s03/T4 +ZY20210800004/H4/C13/N33/S233/s02/T1 +ZY20210800004/H4/C13/N33/S184/s02/T4 +ZY20210800004/H4/C13/N32/S233/s02/T1 +ZY20210800004/H4/C13/N32/S184/s02/T4 +ZY20210800004/H4/C13/N31/S233/s02/T1 +ZY20210800004/H4/C13/N31/S184/s02/T4 +ZY20210800004/H4/C13/N30/S365/s01/T3 +ZY20210800004/H4/C13/N30/S233/s02/T1 +ZY20210800004/H4/C13/N30/S184/s02/T4 +ZY20210800004/H4/C13/N29/S184/s01/T4 +ZY20210800004/H4/C13/N28/S233/s01/T1 +ZY20210800004/H4/C13/N28/S184/s01/T4 +ZY20210800004/H4/C13/N27/S365/s01/T2 +ZY20210800004/H4/C13/N27/S233/s01/T1 +ZY20210800004/H4/C13/N27/S184/s01/T4 +ZY20210800004/H4/C13/N26/S233/s01/T1 +ZY20210800004/H4/C13/N26/S184/s01/T4 +ZY20210800004/H4/C13/N25/S234/s03/T1 +ZY20210800004/H4/C13/N25/S186/s03/T2 +ZY20210800004/H4/C13/N23/S234/s03/T1 +ZY20210800004/H4/C13/N23/S186/s03/T2 +ZY20210800004/H4/C13/N21/S234/s03/T1 +ZY20210800004/H4/C13/N21/S186/s02/T2 +ZY20210800004/H4/C13/N19/S234/s02/T1 +ZY20210800004/H4/C13/N19/S186/s02/T2 +ZY20210800004/H4/C13/N17/S234/s02/T1 +ZY20210800004/H4/C13/N17/S186/s02/T2 +ZY20210800004/H4/C13/N15/S234/s02/T1 +ZY20210800004/H4/C13/N15/S186/s02/T2 +ZY20210800004/H4/C13/N11/S365/s01/T1 +ZY20210800004/H4/C12/N50/S236/s02/T1 +ZY20210800004/H4/C12/N50/S186/s02/T2 +ZY20210800004/H4/C12/N49/S236/s02/T1 +ZY20210800004/H4/C12/N49/S186/s01/T2 +ZY20210800004/H4/C12/N48/S236/s01/T1 +ZY20210800004/H4/C12/N48/S186/s01/T2 +ZY20210800004/H4/C12/N47/S236/s01/T1 +ZY20210800004/H4/C12/N47/S186/s01/T2 +ZY20210800004/H4/C12/N46/S236/s01/T1 +ZY20210800004/H4/C12/N46/S186/s01/T2 +ZY20210800004/H4/C12/N45/S236/s01/T1 +ZY20210800004/H4/C12/N45/S184/s05/T2 +ZY20210800004/H4/C12/N44/S235/s05/T1 +ZY20210800004/H4/C12/N44/S184/s05/T2 +ZY20210800004/H4/C12/N43/S235/s05/T1 +ZY20210800004/H4/C12/N43/S184/s05/T2 +ZY20210800004/H4/C12/N42/S235/s05/T1 +ZY20210800004/H4/C12/N42/S184/s05/T2 +ZY20210800004/H4/C12/N41/S235/s05/T1 +ZY20210800004/H4/C12/N41/S184/s04/T2 +ZY20210800004/H4/C12/N40/S235/s04/T1 +ZY20210800004/H4/C12/N40/S184/s04/T2 +ZY20210800004/H4/C12/N39/S235/s04/T1 +ZY20210800004/H4/C12/N39/S184/s04/T2 +ZY20210800004/H4/C12/N38/S235/s04/T1 +ZY20210800004/H4/C12/N38/S184/s04/T2 +ZY20210800004/H4/C12/N37/S235/s04/T1 +ZY20210800004/H4/C12/N37/S184/s03/T2 +ZY20210800004/H4/C12/N36/S235/s03/T1 +ZY20210800004/H4/C12/N36/S184/s03/T2 +ZY20210800004/H4/C12/N35/S235/s03/T1 +ZY20210800004/H4/C12/N35/S184/s03/T2 +ZY20210800004/H4/C12/N34/S235/s03/T1 +ZY20210800004/H4/C12/N34/S184/s03/T2 +ZY20210800004/H4/C12/N33/S235/s03/T1 +ZY20210800004/H4/C12/N33/S184/s02/T2 +ZY20210800004/H4/C12/N32/S235/s02/T1 +ZY20210800004/H4/C12/N32/S184/s02/T2 +ZY20210800004/H4/C12/N31/S235/s02/T1 +ZY20210800004/H4/C12/N31/S184/s02/T2 +ZY20210800004/H4/C12/N30/S235/s02/T1 +ZY20210800004/H4/C12/N30/S184/s02/T2 +ZY20210800004/H4/C12/N29/S235/s02/T1 +ZY20210800004/H4/C12/N29/S184/s01/T2 +ZY20210800004/H4/C12/N28/S235/s01/T1 +ZY20210800004/H4/C12/N28/S184/s01/T2 +ZY20210800004/H4/C12/N27/S235/s01/T1 +ZY20210800004/H4/C12/N27/S184/s01/T2 +ZY20210800004/H4/C12/N26/S235/s01/T1 +ZY20210800004/H4/C12/N26/S184/s01/T2 +ZY20210800004/H4/C12/N25/S235/s01/T1 +ZY20210800004/H4/C12/N25/S186/s03/T2 +ZY20210800004/H4/C12/N23/S236/s03/T1 +ZY20210800004/H4/C12/N23/S186/s02/T2 +ZY20210800004/H4/C12/N21/S236/s03/T1 +ZY20210800004/H4/C12/N21/S186/s02/T2 +ZY20210800004/H4/C12/N19/S236/s03/T1 +ZY20210800004/H4/C12/N19/S186/s02/T2 +ZY20210800004/H4/C12/N17/S236/s02/T1 +ZY20210800004/H4/C12/N17/S186/s02/T2 +ZY20210800004/H4/C12/N15/S236/s05/T2 +ZY20210800004/H4/C12/N15/S236/s02/T1 +ZY20210800004/H4/C12/N15/S186/s02/T2 +ZY20210800004/H4/C12/N13/S236/s03/T1 +ZY20210800004/H4/C12/N13/S186/s02/T2 +ZY20210800004/H4/C11/N62/S383/s05/T3 +ZY20210800004/H4/C11/N62/S383/s04/T4 +ZY20210800004/H4/C11/N62/S383/s03/T3 +ZY20210800004/H4/C11/N62/S383/s02/T2 +ZY20210800004/H4/C11/N62/S383/s01/T1 +ZY20210800004/H4/C11/N57/S368/s05/T2 +ZY20210800004/H4/C11/N57/S368/s04/T4 +ZY20210800004/H4/C11/N57/S368/s03/T3 +ZY20210800004/H4/C11/N57/S368/s02/T2 +ZY20210800004/H4/C11/N57/S368/s01/T1 +ZY20210800004/H4/C11/N56/S368/s05/T2 +ZY20210800004/H4/C11/N56/S368/s04/T4 +ZY20210800004/H4/C11/N56/S368/s03/T3 +ZY20210800004/H4/C11/N56/S368/s02/T2 +ZY20210800004/H4/C11/N56/S368/s01/T1 +ZY20210800004/H4/C11/N55/S368/s05/T2 +ZY20210800004/H4/C11/N55/S368/s04/T4 +ZY20210800004/H4/C11/N55/S368/s03/T3 +ZY20210800004/H4/C11/N55/S368/s02/T2 +ZY20210800004/H4/C11/N55/S368/s01/T1 +ZY20210800004/H4/C11/N54/S368/s05/T1 +ZY20210800004/H4/C11/N54/S368/s03/T3 +ZY20210800004/H4/C11/N54/S368/s02/T2 +ZY20210800004/H4/C11/N54/S368/s01/T1 +ZY20210800004/H4/C11/N50/S193/s02/T3 +ZY20210800004/H4/C11/N50/S193/s02/T2 +ZY20210800004/H4/C11/N49/S193/s01/T3 +ZY20210800004/H4/C11/N47/S193/s01/T3 +ZY20210800004/H4/C11/N47/S193/s01/T2 +ZY20210800004/H4/C11/N43/S243/s05/T3 +ZY20210800004/H4/C11/N42/S243/s05/T4 +ZY20210800004/H4/C11/N41/S243/s04/T4 +ZY20210800004/H4/C11/N40/S243/s04/T4 +ZY20210800004/H4/C11/N39/S243/s04/T4 +ZY20210800004/H4/C11/N33/S243/s02/T4 +ZY20210800004/H4/C11/N25/S193/s03/T2 +ZY20210800004/H4/C11/N21/S193/s03/T3 +ZY20210800004/H4/C11/N21/S193/s03/T2 +ZY20210800004/H4/C11/N19/S193/s02/T3 +ZY20210800004/H4/C11/N19/S193/s02/T2 +ZY20210800004/H4/C11/N17/S193/s02/T3 +ZY20210800004/H4/C11/N17/S193/s02/T2 +ZY20210800004/H4/C11/N15/S193/s02/T3 +ZY20210800004/H4/C11/N15/S193/s02/T2 +ZY20210800004/H4/C1/N50/S6/s02/T1 +ZY20210800004/H4/C1/N50/S240/s03/T2 +ZY20210800004/H4/C1/N49/S240/s03/T2 +ZY20210800004/H4/C1/N48/S240/s02/T2 +ZY20210800004/H4/C1/N47/S240/s02/T2 +ZY20210800004/H4/C1/N46/S240/s02/T2 +ZY20210800004/H4/C1/N46/S17/s03/T1 +ZY20210800004/H4/C1/N45/S240/s02/T2 +ZY20210800004/H4/C1/N45/S17/s02/T3 +ZY20210800004/H4/C1/N45/S17/s02/T1 +ZY20210800004/H4/C1/N44/S240/s01/T2 +ZY20210800004/H4/C1/N43/S240/s01/T2 +ZY20210800004/H4/C1/N42/S240/s01/T2 +ZY20210800004/H4/C1/N42/S17/s01/T3 +ZY20210800004/H4/C1/N41/S240/s01/T2 +ZY20210800004/H4/C1/N41/S190/s03/T3 +ZY20210800004/H4/C1/N41/S17/s01/T3 +ZY20210800004/H4/C1/N41/S17/s01/T1 +ZY20210800004/H4/C1/N40/S239/s05/T2 +ZY20210800004/H4/C1/N40/S190/s03/T3 +ZY20210800004/H4/C1/N39/S244/s05/T4 +ZY20210800004/H4/C1/N39/S239/s05/T2 +ZY20210800004/H4/C1/N39/S190/s03/T3 +ZY20210800004/H4/C1/N38/S244/s05/T4 +ZY20210800004/H4/C1/N38/S239/s05/T2 +ZY20210800004/H4/C1/N38/S190/s02/T3 +ZY20210800004/H4/C1/N38/S18/s04/T1 +ZY20210800004/H4/C1/N37/S244/s05/T4 +ZY20210800004/H4/C1/N37/S239/s05/T2 +ZY20210800004/H4/C1/N37/S190/s02/T3 +ZY20210800004/H4/C1/N37/S18/s04/T3 +ZY20210800004/H4/C1/N36/S244/s04/T4 +ZY20210800004/H4/C1/N36/S239/s04/T2 +ZY20210800004/H4/C1/N36/S190/s02/T3 +ZY20210800004/H4/C1/N35/S244/s04/T4 +ZY20210800004/H4/C1/N35/S239/s04/T1 +ZY20210800004/H4/C1/N35/S190/s02/T3 +ZY20210800004/H4/C1/N35/S18/s03/T3 +ZY20210800004/H4/C1/N34/S244/s04/T4 +ZY20210800004/H4/C1/N34/S239/s04/T1 +ZY20210800004/H4/C1/N34/S190/s01/T3 +ZY20210800004/H4/C1/N33/S6/s05/T1 +ZY20210800004/H4/C1/N33/S244/s04/T4 +ZY20210800004/H4/C1/N33/S239/s04/T1 +ZY20210800004/H4/C1/N33/S190/s01/T3 +ZY20210800004/H4/C1/N32/S244/s03/T4 +ZY20210800004/H4/C1/N32/S239/s03/T1 +ZY20210800004/H4/C1/N32/S190/s01/T3 +ZY20210800004/H4/C1/N31/S244/s03/T4 +ZY20210800004/H4/C1/N31/S239/s03/T1 +ZY20210800004/H4/C1/N31/S190/s01/T3 +ZY20210800004/H4/C1/N30/S244/s03/T4 +ZY20210800004/H4/C1/N30/S242/s05/T3 +ZY20210800004/H4/C1/N30/S239/s03/T1 +ZY20210800004/H4/C1/N29/S244/s03/T4 +ZY20210800004/H4/C1/N29/S242/s05/T3 +ZY20210800004/H4/C1/N29/S239/s03/T1 +ZY20210800004/H4/C1/N29/S18/s01/T3 +ZY20210800004/H4/C1/N28/S244/s02/T4 +ZY20210800004/H4/C1/N28/S242/s05/T3 +ZY20210800004/H4/C1/N28/S239/s02/T1 +ZY20210800004/H4/C1/N27/S244/s02/T4 +ZY20210800004/H4/C1/N27/S242/s05/T3 +ZY20210800004/H4/C1/N27/S239/s02/T1 +ZY20210800004/H4/C1/N26/S242/s04/T3 +ZY20210800004/H4/C1/N26/S239/s02/T1 +ZY20210800004/H4/C1/N25/S244/s02/T4 +ZY20210800004/H4/C1/N25/S242/s04/T3 +ZY20210800004/H4/C1/N25/S239/s02/T1 +ZY20210800004/H4/C1/N24/S244/s01/T4 +ZY20210800004/H4/C1/N24/S242/s04/T3 +ZY20210800004/H4/C1/N24/S239/s01/T1 +ZY20210800004/H4/C1/N23/S244/s01/T4 +ZY20210800004/H4/C1/N23/S242/s04/T3 +ZY20210800004/H4/C1/N23/S239/s01/T1 +ZY20210800004/H4/C1/N22/S242/s03/T3 +ZY20210800004/H4/C1/N22/S239/s01/T1 +ZY20210800004/H4/C1/N21/S244/s01/T4 +ZY20210800004/H4/C1/N21/S242/s03/T3 +ZY20210800004/H4/C1/N21/S239/s01/T1 +ZY20210800004/H4/C1/N20/S242/s03/T2 +ZY20210800004/H4/C1/N20/S237/s05/T1 +ZY20210800004/H4/C1/N20/S194/s05/T4 +ZY20210800004/H4/C1/N19/S9/s04/T1 +ZY20210800004/H4/C1/N19/S242/s03/T2 +ZY20210800004/H4/C1/N19/S237/s05/T1 +ZY20210800004/H4/C1/N19/S194/s05/T4 +ZY20210800004/H4/C1/N14/S242/s01/T2 +ZY20210800004/H4/C1/N14/S237/s04/T1 +ZY20210800004/H4/C1/N14/S194/s04/T4 +ZY20210800004/H4/C1/N13/S242/s01/T2 +ZY20210800004/H4/C1/N13/S237/s04/T1 +ZY20210800004/H4/C1/N13/S194/s04/T4 +ZY20210800004/H4/C1/N06/S237/s02/T1 +ZY20210800004/H4/C1/N06/S194/s02/T4 +ZY20210800004/H4/C1/N05/S237/s02/T1 +ZY20210800004/H4/C1/N04/S237/s01/T1 +ZY20210800004/H4/C1/N03/S237/s01/T1 +ZY20210800004/H4/C1/N02/S240/s03/T2 +ZY20210800004/H4/C1/N02/S237/s01/T1 +ZY20210800004/H4/C1/N01/S240/s03/T2 +ZY20210800004/H4/C1/N01/S237/s01/T1 +ZY20210800003/H3/C9/N50/S306/s01/T2 +ZY20210800003/H3/C9/N49/S306/s01/T2 +ZY20210800003/H3/C9/N48/S303/s05/T2 +ZY20210800003/H3/C9/N47/S303/s05/T2 +ZY20210800003/H3/C9/N46/S303/s05/T2 +ZY20210800003/H3/C9/N45/S309/s02/T2 +ZY20210800003/H3/C9/N45/S303/s05/T2 +ZY20210800003/H3/C9/N44/S303/s04/T2 +ZY20210800003/H3/C9/N43/S45/s04/T2 +ZY20210800003/H3/C9/N43/S45/s04/T1 +ZY20210800003/H3/C9/N43/S309/s02/T2 +ZY20210800003/H3/C9/N43/S303/s04/T2 +ZY20210800003/H3/C9/N42/S303/s04/T2 +ZY20210800003/H3/C9/N41/S45/s05/T1 +ZY20210800003/H3/C9/N41/S309/s02/T2 +ZY20210800003/H3/C9/N41/S303/s04/T2 +ZY20210800003/H3/C9/N40/S45/s05/T2 +ZY20210800003/H3/C9/N40/S303/s03/T2 +ZY20210800003/H3/C9/N39/S309/s01/T2 +ZY20210800003/H3/C9/N39/S303/s03/T2 +ZY20210800003/H3/C9/N38/S303/s03/T2 +ZY20210800003/H3/C9/N37/S309/s01/T2 +ZY20210800003/H3/C9/N37/S303/s03/T2 +ZY20210800003/H3/C9/N35/S306/s05/T2 +ZY20210800003/H3/C9/N35/S303/s02/T2 +ZY20210800003/H3/C9/N33/S306/s05/T2 +ZY20210800003/H3/C9/N33/S303/s02/T2 +ZY20210800003/H3/C9/N32/S303/s01/T2 +ZY20210800003/H3/C9/N31/S306/s05/T2 +ZY20210800003/H3/C9/N31/S303/s01/T2 +ZY20210800003/H3/C9/N30/S303/s01/T2 +ZY20210800003/H3/C9/N29/S306/s05/T2 +ZY20210800003/H3/C9/N29/S303/s01/T2 +ZY20210800003/H3/C9/N28/S47/s01/T2 +ZY20210800003/H3/C9/N28/S300/s05/T2 +ZY20210800003/H3/C9/N27/S47/s02/T2 +ZY20210800003/H3/C9/N27/S306/s04/T2 +ZY20210800003/H3/C9/N27/S300/s05/T2 +ZY20210800003/H3/C9/N26/S300/s05/T2 +ZY20210800003/H3/C9/N25/S306/s04/T2 +ZY20210800003/H3/C9/N25/S300/s05/T2 +ZY20210800003/H3/C9/N24/S300/s04/T2 +ZY20210800003/H3/C9/N23/S306/s04/T2 +ZY20210800003/H3/C9/N23/S300/s04/T2 +ZY20210800003/H3/C9/N22/S300/s04/T2 +ZY20210800003/H3/C9/N21/S306/s04/T2 +ZY20210800003/H3/C9/N21/S300/s04/T2 +ZY20210800003/H3/C9/N20/S300/s03/T2 +ZY20210800003/H3/C9/N19/S45/s04/T2 +ZY20210800003/H3/C9/N19/S45/s04/T1 +ZY20210800003/H3/C9/N19/S306/s03/T2 +ZY20210800003/H3/C9/N19/S300/s03/T2 +ZY20210800003/H3/C9/N18/S300/s03/T2 +ZY20210800003/H3/C9/N17/S306/s03/T2 +ZY20210800003/H3/C9/N17/S300/s03/T2 +ZY20210800003/H3/C9/N16/S300/s02/T2 +ZY20210800003/H3/C9/N15/S306/s03/T2 +ZY20210800003/H3/C9/N15/S300/s02/T2 +ZY20210800003/H3/C9/N14/S300/s02/T2 +ZY20210800003/H3/C9/N13/S306/s03/T2 +ZY20210800003/H3/C9/N13/S300/s02/T2 +ZY20210800003/H3/C9/N12/S300/s01/T2 +ZY20210800003/H3/C9/N11/S306/s02/T2 +ZY20210800003/H3/C9/N11/S300/s01/T2 +ZY20210800003/H3/C8/N42/S74/s04/T2 +ZY20210800003/H3/C8/N42/S74/s04/T1 +ZY20210800003/H3/C8/N41/S74/s03/T2 +ZY20210800003/H3/C8/N40/S74/s03/T2 +ZY20210800003/H3/C8/N39/S74/s02/T2 +ZY20210800003/H3/C8/N39/S74/s02/T1 +ZY20210800003/H3/C8/N38/S74/s02/T2 +ZY20210800003/H3/C8/N38/S74/s02/T1 +ZY20210800003/H3/C6/N50/S252/s05/T1 +ZY20210800003/H3/C6/N47/S252/s04/T1 +ZY20210800003/H3/C6/N45/S252/s03/T1 +ZY20210800003/H3/C6/N43/S252/s03/T1 +ZY20210800003/H3/C6/N39/S252/s02/T1 +ZY20210800003/H3/C6/N28/S82/s05/T2 +ZY20210800003/H3/C6/N25/S82/s04/T2 +ZY20210800003/H3/C6/N25/S82/s04/T1 +ZY20210800003/H3/C6/N24/S82/s03/T1 +ZY20210800003/H3/C6/N24/S252/s01/T3 +ZY20210800003/H3/C6/N21/S252/s01/T3 +ZY20210800003/H3/C6/N20/S251/s05/T3 +ZY20210800003/H3/C6/N19/S251/s05/T3 +ZY20210800003/H3/C6/N16/S251/s04/T3 +ZY20210800003/H3/C6/N15/S251/s04/T3 +ZY20210800003/H3/C6/N14/S251/s04/T3 +ZY20210800003/H3/C6/N11/S251/s03/T2 +ZY20210800003/H3/C6/N10/S251/s03/T2 +ZY20210800003/H3/C6/N09/S251/s03/T2 +ZY20210800003/H3/C6/N07/S251/s02/T2 +ZY20210800003/H3/C6/N06/S251/s02/T2 +ZY20210800003/H3/C6/N05/S85/s05/T2 +ZY20210800003/H3/C6/N05/S85/s05/T1 +ZY20210800003/H3/C6/N05/S251/s02/T2 +ZY20210800003/H3/C6/N04/S85/s05/T2 +ZY20210800003/H3/C6/N04/S251/s01/T2 +ZY20210800003/H3/C6/N03/S85/s04/T1 +ZY20210800003/H3/C6/N03/S251/s01/T2 +ZY20210800003/H3/C6/N02/S85/s04/T1 +ZY20210800003/H3/C6/N02/S251/s01/T2 +ZY20210800003/H3/C6/N01/S85/s03/T2 +ZY20210800003/H3/C6/N01/S85/s03/T1 +ZY20210800003/H3/C6/N01/S251/s01/T2 +ZY20210800003/H3/C5/N49/S61/s05/T4 +ZY20210800003/H3/C5/N48/S61/s04/T1 +ZY20210800003/H3/C5/N47/S61/s04/T1 +ZY20210800003/H3/C5/N46/S61/s03/T1 +ZY20210800003/H3/C5/N45/S61/s03/T4 +ZY20210800003/H3/C5/N40/S60/s05/T4 +ZY20210800003/H3/C5/N40/S60/s05/T1 +ZY20210800003/H3/C5/N31/S58/s03/T1 +ZY20210800003/H3/C5/N18/S58/s04/T4 +ZY20210800003/H3/C5/N18/S58/s04/T1 +ZY20210800003/H3/C5/N13/S58/s02/T4 +ZY20210800003/H3/C5/N11/S58/s01/T1 +ZY20210800003/H3/C4/N45/S48/s03/T2 +ZY20210800003/H3/C4/N45/S48/s03/T1 +ZY20210800003/H3/C4/N44/S48/s02/T2 +ZY20210800003/H3/C4/N43/S48/s02/T2 +ZY20210800003/H3/C4/N43/S48/s02/T1 +ZY20210800003/H3/C4/N42/S48/s01/T2 +ZY20210800003/H3/C4/N42/S48/s01/T1 +ZY20210800003/H3/C4/N41/S48/s01/T2 +ZY20210800003/H3/C4/N41/S48/s01/T1 +ZY20210800003/H3/C4/N40/S53/s05/T2 +ZY20210800003/H3/C4/N40/S53/s05/T1 +ZY20210800003/H3/C4/N39/S53/s05/T2 +ZY20210800003/H3/C4/N39/S53/s05/T1 +ZY20210800003/H3/C4/N08/S119/s05/T2 +ZY20210800003/H3/C4/N08/S119/s05/T1 +ZY20210800003/H3/C4/N05/S50/s01/T4 +ZY20210800003/H3/C4/N05/S50/s01/T3 +ZY20210800003/H3/C4/N04/S50/s01/T4 +ZY20210800003/H3/C4/N04/S50/s01/T3 +ZY20210800003/H3/C4/N03/S50/s05/T4 +ZY20210800003/H3/C4/N03/S50/s05/T3 +ZY20210800003/H3/C4/N02/S50/s05/T4 +ZY20210800003/H3/C4/N02/S50/s05/T3 +ZY20210800003/H3/C3/N50/S284/s03/T2 +ZY20210800003/H3/C3/N50/S282/s02/T2 +ZY20210800003/H3/C3/N49/S284/s03/T2 +ZY20210800003/H3/C3/N49/S282/s01/T2 +ZY20210800003/H3/C3/N48/S284/s02/T2 +ZY20210800003/H3/C3/N48/S282/s01/T2 +ZY20210800003/H3/C3/N46/S284/s02/T2 +ZY20210800003/H3/C3/N46/S282/s01/T2 +ZY20210800003/H3/C3/N45/S284/s02/T2 +ZY20210800003/H3/C3/N45/S279/s05/T2 +ZY20210800003/H3/C3/N44/S279/s05/T2 +ZY20210800003/H3/C3/N40/S282/s05/T2 +ZY20210800003/H3/C3/N40/S279/s04/T2 +ZY20210800003/H3/C3/N36/S282/s04/T2 +ZY20210800003/H3/C3/N36/S279/s03/T2 +ZY20210800003/H3/C3/N34/S282/s04/T2 +ZY20210800003/H3/C3/N34/S279/s03/T2 +ZY20210800003/H3/C3/N33/S282/s04/T2 +ZY20210800003/H3/C3/N33/S279/s02/T2 +ZY20210800003/H3/C3/N32/S282/s03/T2 +ZY20210800003/H3/C3/N32/S279/s02/T2 +ZY20210800003/H3/C3/N31/S282/s03/T2 +ZY20210800003/H3/C3/N31/S279/s02/T2 +ZY20210800003/H3/C3/N28/S282/s02/T2 +ZY20210800003/H3/C3/N28/S279/s01/T2 +ZY20210800003/H3/C3/N26/S282/s02/T2 +ZY20210800003/H3/C3/N26/S279/s01/T2 +ZY20210800003/H3/C3/N25/S277/s05/T2 +ZY20210800003/H3/C3/N24/S277/s05/T2 +ZY20210800003/H3/C3/N23/S277/s05/T2 +ZY20210800003/H3/C3/N22/S277/s05/T2 +ZY20210800003/H3/C3/N20/S277/s04/T2 +ZY20210800003/H3/C3/N15/S277/s03/T2 +ZY20210800003/H3/C3/N13/S107/s04/T2 +ZY20210800003/H3/C3/N13/S107/s04/T1 +ZY20210800003/H3/C3/N10/S277/s02/T2 +ZY20210800003/H3/C3/N08/S277/s01/T2 +ZY20210800003/H3/C3/N07/S277/s01/T2 +ZY20210800003/H3/C3/N06/S277/s01/T2 +ZY20210800003/H3/C3/N03/S275/s05/T2 +ZY20210800003/H3/C3/N02/S275/s05/T2 +ZY20210800003/H3/C3/N01/S275/s04/T2 +ZY20210800003/H3/C20/N35/S307/s02/T1 +ZY20210800003/H3/C20/N17/S282/s03/T2 +ZY20210800003/H3/C20/N17/S279/s04/T1 +ZY20210800003/H3/C20/N16/S284/s02/T3 +ZY20210800003/H3/C20/N16/S284/s01/T4 +ZY20210800003/H3/C20/N16/S282/s03/T2 +ZY20210800003/H3/C20/N16/S279/s04/T1 +ZY20210800003/H3/C20/N15/S284/s02/T3 +ZY20210800003/H3/C20/N15/S284/s01/T4 +ZY20210800003/H3/C20/N15/S282/s03/T2 +ZY20210800003/H3/C20/N15/S279/s04/T1 +ZY20210800003/H3/C20/N14/S284/s05/T4 +ZY20210800003/H3/C20/N14/S284/s02/T3 +ZY20210800003/H3/C20/N14/S282/s03/T2 +ZY20210800003/H3/C20/N14/S279/s04/T1 +ZY20210800003/H3/C20/N13/S284/s05/T4 +ZY20210800003/H3/C20/N13/S284/s01/T3 +ZY20210800003/H3/C20/N13/S282/s02/T2 +ZY20210800003/H3/C20/N13/S279/s03/T1 +ZY20210800003/H3/C20/N12/S284/s05/T4 +ZY20210800003/H3/C20/N12/S284/s01/T3 +ZY20210800003/H3/C20/N12/S282/s02/T2 +ZY20210800003/H3/C20/N12/S279/s03/T2 +ZY20210800003/H3/C20/N11/S284/s05/T4 +ZY20210800003/H3/C20/N11/S284/s01/T3 +ZY20210800003/H3/C20/N11/S282/s02/T2 +ZY20210800003/H3/C20/N11/S279/s03/T1 +ZY20210800003/H3/C2/N49/S219/s02/T3 +ZY20210800003/H3/C2/N48/S219/s02/T3 +ZY20210800003/H3/C2/N47/S219/s02/T3 +ZY20210800003/H3/C2/N46/S219/s01/T3 +ZY20210800003/H3/C2/N45/S219/s01/T3 +ZY20210800003/H3/C2/N44/S51/s03/T1 +ZY20210800003/H3/C2/N44/S219/s01/T3 +ZY20210800003/H3/C2/N43/S219/s01/T3 +ZY20210800003/H3/C2/N42/S217/s05/T2 +ZY20210800003/H3/C2/N41/S217/s05/T2 +ZY20210800003/H3/C2/N40/S217/s05/T2 +ZY20210800003/H3/C2/N39/S217/s05/T2 +ZY20210800003/H3/C2/N38/S217/s04/T2 +ZY20210800003/H3/C2/N37/S217/s04/T2 +ZY20210800003/H3/C2/N36/S217/s04/T2 +ZY20210800003/H3/C2/N35/S217/s04/T2 +ZY20210800003/H3/C2/N34/S217/s03/T1 +ZY20210800003/H3/C2/N33/S217/s03/T1 +ZY20210800003/H3/C2/N32/S50/s02/T1 +ZY20210800003/H3/C2/N32/S217/s03/T1 +ZY20210800003/H3/C2/N31/S217/s03/T1 +ZY20210800003/H3/C2/N30/S217/s02/T1 +ZY20210800003/H3/C2/N29/S217/s02/T1 +ZY20210800003/H3/C2/N28/S217/s02/T1 +ZY20210800003/H3/C2/N27/S217/s02/T1 +ZY20210800003/H3/C2/N23/S217/s01/T6 +ZY20210800003/H3/C2/N22/S217/s01/T6 +ZY20210800003/H3/C2/N21/S215/s05/T6 +ZY20210800003/H3/C2/N20/S215/s05/T6 +ZY20210800003/H3/C2/N19/S215/s05/T6 +ZY20210800003/H3/C2/N18/S215/s05/T6 +ZY20210800003/H3/C2/N17/S215/s05/T6 +ZY20210800003/H3/C2/N16/S215/s04/T6 +ZY20210800003/H3/C2/N15/S215/s04/T5 +ZY20210800003/H3/C2/N14/S215/s04/T5 +ZY20210800003/H3/C2/N13/S215/s04/T5 +ZY20210800003/H3/C2/N12/S215/s03/T5 +ZY20210800003/H3/C2/N11/S215/s03/T5 +ZY20210800003/H3/C18/N50/S197/s02/T2 +ZY20210800003/H3/C18/N49/S197/s01/T2 +ZY20210800003/H3/C18/N48/S197/s01/T2 +ZY20210800003/H3/C18/N47/S197/s01/T2 +ZY20210800003/H3/C18/N46/S197/s01/T1 +ZY20210800003/H3/C18/N45/S195/s05/T2 +ZY20210800003/H3/C18/N43/S195/s05/T2 +ZY20210800003/H3/C18/N42/S195/s05/T2 +ZY20210800003/H3/C18/N41/S195/s04/T2 +ZY20210800003/H3/C18/N40/S195/s04/T2 +ZY20210800003/H3/C18/N39/S195/s04/T2 +ZY20210800003/H3/C18/N37/S195/s03/T2 +ZY20210800003/H3/C18/N36/S195/s03/T2 +ZY20210800003/H3/C18/N35/S195/s03/T2 +ZY20210800003/H3/C18/N34/S195/s03/T2 +ZY20210800003/H3/C18/N33/S195/s02/T2 +ZY20210800003/H3/C18/N32/S195/s02/T2 +ZY20210800003/H3/C18/N31/S195/s02/T2 +ZY20210800003/H3/C18/N30/S195/s02/T2 +ZY20210800003/H3/C18/N29/S195/s01/T2 +ZY20210800003/H3/C18/N28/S195/s01/T2 +ZY20210800003/H3/C18/N28/S143/s02/T1 +ZY20210800003/H3/C18/N27/S195/s01/T2 +ZY20210800003/H3/C18/N26/S195/s01/T2 +ZY20210800003/H3/C18/N25/S197/s03/T2 +ZY20210800003/H3/C18/N23/S197/s03/T2 +ZY20210800003/H3/C18/N21/S197/s03/T2 +ZY20210800003/H3/C18/N19/S197/s02/T2 +ZY20210800003/H3/C18/N17/S197/s02/T2 +ZY20210800003/H3/C18/N16/S139/s04/T1 +ZY20210800003/H3/C18/N15/S197/s02/T1 +ZY20210800003/H3/C18/N14/S139/s04/T1 +ZY20210800003/H3/C18/N13/S139/s04/T1 +ZY20210800003/H3/C18/N12/S139/s03/T1 +ZY20210800003/H3/C18/N11/S139/s03/T1 +ZY20210800003/H3/C17/N75/S266/s02/T3 +ZY20210800003/H3/C17/N74/S266/s01/T3 +ZY20210800003/H3/C17/N73/S266/s01/T3 +ZY20210800003/H3/C17/N72/S266/s01/T2 +ZY20210800003/H3/C17/N71/S266/s01/T2 +ZY20210800003/H3/C17/N70/S264/s05/T2 +ZY20210800003/H3/C17/N69/S266/s03/T3 +ZY20210800003/H3/C17/N69/S264/s05/T2 +ZY20210800003/H3/C17/N67/S266/s03/T3 +ZY20210800003/H3/C17/N67/S264/s05/T2 +ZY20210800003/H3/C17/N66/S266/s03/T3 +ZY20210800003/H3/C17/N66/S264/s04/T2 +ZY20210800003/H3/C17/N65/S266/s02/T3 +ZY20210800003/H3/C17/N65/S264/s04/T2 +ZY20210800003/H3/C17/N64/S266/s02/T3 +ZY20210800003/H3/C17/N64/S264/s04/T2 +ZY20210800003/H3/C17/N63/S266/s02/T3 +ZY20210800003/H3/C17/N63/S264/s04/T2 +ZY20210800003/H3/C17/N62/S264/s03/T2 +ZY20210800003/H3/C17/N61/S264/s03/T1 +ZY20210800003/H3/C17/N60/S264/s03/T1 +ZY20210800003/H3/C17/N59/S264/s03/T1 +ZY20210800003/H3/C17/N58/S264/s02/T1 +ZY20210800003/H3/C17/N57/S264/s02/T1 +ZY20210800003/H3/C17/N25/S171/s02/T3 +ZY20210800003/H3/C17/N25/S130/s02/T1 +ZY20210800003/H3/C17/N24/S171/s01/T3 +ZY20210800003/H3/C17/N24/S130/s01/T1 +ZY20210800003/H3/C17/N23/S171/s01/T3 +ZY20210800003/H3/C17/N23/S130/s01/T1 +ZY20210800003/H3/C17/N22/S130/s01/T1 +ZY20210800003/H3/C17/N21/S171/s01/T3 +ZY20210800003/H3/C17/N21/S130/s01/T1 +ZY20210800003/H3/C17/N20/S167/s05/T3 +ZY20210800003/H3/C17/N20/S126/s05/T1 +ZY20210800003/H3/C17/N19/S167/s05/T2 +ZY20210800003/H3/C17/N19/S126/s05/T1 +ZY20210800003/H3/C17/N18/S167/s05/T2 +ZY20210800003/H3/C17/N18/S126/s05/T1 +ZY20210800003/H3/C17/N17/S167/s05/T2 +ZY20210800003/H3/C17/N17/S126/s05/T1 +ZY20210800003/H3/C17/N16/S167/s04/T2 +ZY20210800003/H3/C17/N16/S126/s04/T1 +ZY20210800003/H3/C17/N15/S167/s04/T2 +ZY20210800003/H3/C17/N15/S126/s04/T1 +ZY20210800003/H3/C17/N14/S167/s04/T2 +ZY20210800003/H3/C17/N14/S126/s04/T1 +ZY20210800003/H3/C17/N13/S167/s04/T2 +ZY20210800003/H3/C17/N13/S126/s04/T1 +ZY20210800003/H3/C17/N12/S167/s03/T2 +ZY20210800003/H3/C17/N12/S126/s03/T1 +ZY20210800003/H3/C17/N11/S167/s03/T2 +ZY20210800003/H3/C17/N11/S126/s03/T1 +ZY20210800003/H3/C17/N10/S167/s03/T2 +ZY20210800003/H3/C17/N10/S126/s03/T1 +ZY20210800003/H3/C17/N09/S167/s03/T2 +ZY20210800003/H3/C17/N09/S126/s03/T1 +ZY20210800003/H3/C17/N08/S167/s02/T2 +ZY20210800003/H3/C17/N08/S126/s02/T1 +ZY20210800003/H3/C17/N07/S167/s02/T2 +ZY20210800003/H3/C17/N07/S126/s02/T1 +ZY20210800003/H3/C17/N06/S167/s02/T2 +ZY20210800003/H3/C17/N06/S126/s02/T1 +ZY20210800003/H3/C14/N50/S170/s02/T1 +ZY20210800003/H3/C14/N49/S209/s01/T2 +ZY20210800003/H3/C14/N49/S170/s01/T1 +ZY20210800003/H3/C14/N48/S209/s01/T2 +ZY20210800003/H3/C14/N48/S170/s01/T1 +ZY20210800003/H3/C14/N47/S209/s01/T2 +ZY20210800003/H3/C14/N47/S170/s01/T1 +ZY20210800003/H3/C14/N46/S209/s01/T2 +ZY20210800003/H3/C14/N46/S170/s01/T1 +ZY20210800003/H3/C14/N45/S166/s05/T1 +ZY20210800003/H3/C14/N44/S207/s05/T2 +ZY20210800003/H3/C14/N44/S166/s05/T1 +ZY20210800003/H3/C14/N43/S207/s05/T2 +ZY20210800003/H3/C14/N43/S166/s05/T1 +ZY20210800003/H3/C14/N42/S207/s05/T2 +ZY20210800003/H3/C14/N42/S166/s05/T1 +ZY20210800003/H3/C14/N41/S207/s04/T2 +ZY20210800003/H3/C14/N41/S166/s04/T1 +ZY20210800003/H3/C14/N40/S207/s04/T2 +ZY20210800003/H3/C14/N40/S166/s04/T1 +ZY20210800003/H3/C14/N39/S207/s04/T2 +ZY20210800003/H3/C14/N38/S207/s04/T2 +ZY20210800003/H3/C14/N38/S166/s04/T1 +ZY20210800003/H3/C14/N37/S334/s03/T2 +ZY20210800003/H3/C14/N37/S334/s02/T1 +ZY20210800003/H3/C14/N36/S334/s03/T2 +ZY20210800003/H3/C14/N36/S334/s02/T1 +ZY20210800003/H3/C14/N35/S207/s03/T2 +ZY20210800003/H3/C14/N35/S166/s03/T1 +ZY20210800003/H3/C14/N34/S207/s03/T2 +ZY20210800003/H3/C14/N34/S166/s03/T1 +ZY20210800003/H3/C14/N33/S334/s03/T2 +ZY20210800003/H3/C14/N33/S334/s01/T1 +ZY20210800003/H3/C14/N32/S207/s02/T2 +ZY20210800003/H3/C14/N32/S166/s02/T1 +ZY20210800003/H3/C14/N31/S207/s02/T2 +ZY20210800003/H3/C14/N31/S166/s02/T1 +ZY20210800003/H3/C14/N30/S334/s03/T2 +ZY20210800003/H3/C14/N30/S334/s01/T1 +ZY20210800003/H3/C14/N29/S207/s01/T2 +ZY20210800003/H3/C14/N29/S166/s01/T1 +ZY20210800003/H3/C14/N28/S207/s01/T2 +ZY20210800003/H3/C14/N28/S166/s01/T1 +ZY20210800003/H3/C14/N27/S334/s02/T2 +ZY20210800003/H3/C14/N27/S334/s01/T1 +ZY20210800003/H3/C14/N26/S334/s02/T2 +ZY20210800003/H3/C14/N26/S334/s01/T1 +ZY20210800003/H3/C14/N13/S209/s03/T2 +ZY20210800003/H3/C14/N13/S170/s03/T1 +ZY20210800003/H3/C14/N11/S209/s03/T2 +ZY20210800003/H3/C14/N11/S170/s03/T1 +ZY20210800003/H3/C13/N50/S203/s02/T4 +ZY20210800003/H3/C13/N50/S144/s02/T1 +ZY20210800003/H3/C13/N49/S203/s01/T4 +ZY20210800003/H3/C13/N49/S144/s01/T1 +ZY20210800003/H3/C13/N48/S203/s01/T4 +ZY20210800003/H3/C13/N48/S144/s01/T1 +ZY20210800003/H3/C13/N47/S203/s01/T4 +ZY20210800003/H3/C13/N47/S144/s01/T1 +ZY20210800003/H3/C13/N46/S203/s01/T4 +ZY20210800003/H3/C13/N46/S144/s01/T1 +ZY20210800003/H3/C13/N45/S200/s05/T4 +ZY20210800003/H3/C13/N45/S140/s05/T1 +ZY20210800003/H3/C13/N44/S200/s05/T4 +ZY20210800003/H3/C13/N43/S140/s05/T1 +ZY20210800003/H3/C13/N42/S200/s05/T4 +ZY20210800003/H3/C13/N42/S140/s05/T1 +ZY20210800003/H3/C13/N41/S200/s04/T4 +ZY20210800003/H3/C13/N41/S140/s04/T1 +ZY20210800003/H3/C13/N40/S200/s04/T4 +ZY20210800003/H3/C13/N39/S200/s04/T4 +ZY20210800003/H3/C13/N39/S140/s04/T1 +ZY20210800003/H3/C13/N38/S200/s04/T3 +ZY20210800003/H3/C13/N38/S140/s04/T1 +ZY20210800003/H3/C13/N37/S200/s03/T3 +ZY20210800003/H3/C13/N36/S200/s03/T3 +ZY20210800003/H3/C13/N36/S140/s03/T1 +ZY20210800003/H3/C13/N35/S200/s03/T3 +ZY20210800003/H3/C13/N35/S140/s03/T1 +ZY20210800003/H3/C13/N34/S200/s03/T3 +ZY20210800003/H3/C13/N34/S140/s03/T1 +ZY20210800003/H3/C13/N33/S200/s02/T3 +ZY20210800003/H3/C13/N33/S140/s02/T1 +ZY20210800003/H3/C13/N32/S200/s02/T3 +ZY20210800003/H3/C13/N32/S140/s02/T1 +ZY20210800003/H3/C13/N31/S200/s02/T2 +ZY20210800003/H3/C13/N31/S140/s02/T1 +ZY20210800003/H3/C13/N30/S200/s02/T2 +ZY20210800003/H3/C13/N30/S140/s02/T1 +ZY20210800003/H3/C13/N29/S200/s01/T2 +ZY20210800003/H3/C13/N29/S140/s01/T1 +ZY20210800003/H3/C13/N28/S200/s01/T2 +ZY20210800003/H3/C13/N28/S140/s01/T1 +ZY20210800003/H3/C13/N27/S200/s01/T2 +ZY20210800003/H3/C13/N27/S140/s01/T1 +ZY20210800003/H3/C13/N26/S200/s01/T2 +ZY20210800003/H3/C13/N26/S140/s01/T1 +ZY20210800003/H3/C13/N13/S144/s03/T1 +ZY20210800003/H3/C13/N11/S203/s03/T4 +ZY20210800003/H3/C13/N11/S144/s03/T1 +ZY20210800003/H3/C12/N48/S342/s03/T2 +ZY20210800003/H3/C12/N42/S342/s02/T2 +ZY20210800003/H3/C12/N36/S176/s03/T1 +ZY20210800003/H3/C12/N34/S176/s03/T1 +ZY20210800003/H3/C12/N32/S176/s03/T1 +ZY20210800003/H3/C12/N30/S176/s02/T1 +ZY20210800003/H3/C12/N28/S176/s02/T1 +ZY20210800003/H3/C12/N26/S176/s02/T1 +ZY20210800003/H3/C12/N25/S176/s02/T1 +ZY20210800003/H3/C12/N24/S342/s01/T2 +ZY20210800003/H3/C12/N24/S176/s03/T1 +ZY20210800003/H3/C12/N23/S176/s01/T1 +ZY20210800003/H3/C12/N22/S176/s01/T1 +ZY20210800003/H3/C12/N21/S176/s01/T1 +ZY20210800003/H3/C12/N20/S206/s05/T2 +ZY20210800003/H3/C12/N20/S173/s05/T1 +ZY20210800003/H3/C12/N19/S206/s05/T2 +ZY20210800003/H3/C12/N19/S173/s05/T1 +ZY20210800003/H3/C12/N18/S206/s05/T2 +ZY20210800003/H3/C12/N18/S173/s05/T1 +ZY20210800003/H3/C12/N17/S173/s05/T1 +ZY20210800003/H3/C12/N16/S206/s04/T2 +ZY20210800003/H3/C12/N16/S173/s04/T1 +ZY20210800003/H3/C12/N15/S206/s04/T2 +ZY20210800003/H3/C12/N15/S173/s04/T1 +ZY20210800003/H3/C12/N14/S206/s04/T2 +ZY20210800003/H3/C12/N14/S173/s04/T1 +ZY20210800003/H3/C12/N13/S206/s04/T2 +ZY20210800003/H3/C12/N13/S173/s04/T1 +ZY20210800003/H3/C12/N12/S206/s03/T2 +ZY20210800003/H3/C12/N12/S173/s03/T1 +ZY20210800003/H3/C12/N11/S206/s03/T2 +ZY20210800003/H3/C12/N11/S173/s03/T1 +ZY20210800003/H3/C11/N50/S182/s02/T4 +ZY20210800003/H3/C11/N50/S151/s02/T1 +ZY20210800003/H3/C11/N49/S182/s01/T4 +ZY20210800003/H3/C11/N49/S151/s01/T1 +ZY20210800003/H3/C11/N48/S182/s01/T4 +ZY20210800003/H3/C11/N47/S182/s01/T4 +ZY20210800003/H3/C11/N47/S151/s01/T1 +ZY20210800003/H3/C11/N43/S148/s05/T1 +ZY20210800003/H3/C11/N42/S180/s05/T4 +ZY20210800003/H3/C11/N42/S148/s05/T1 +ZY20210800003/H3/C11/N41/S180/s04/T4 +ZY20210800003/H3/C11/N41/S148/s04/T1 +ZY20210800003/H3/C11/N40/S180/s04/T4 +ZY20210800003/H3/C11/N40/S148/s04/T1 +ZY20210800003/H3/C11/N39/S180/s04/T4 +ZY20210800003/H3/C11/N39/S148/s04/T1 +ZY20210800003/H3/C11/N33/S180/s02/T3 +ZY20210800003/H3/C11/N33/S148/s02/T1 +ZY20210800003/H3/C11/N11/S182/s03/T4 +ZY20210800003/H3/C11/N11/S151/s03/T1 +ZY20210800003/H3/C11/N09/S182/s03/T4 +ZY20210800003/H3/C11/N09/S151/s03/T1 +ZY20210800003/H3/C11/N07/S182/s03/T4 +ZY20210800003/H3/C11/N07/S151/s03/T1 +ZY20210800003/H3/C1/N50/S83/s04/T2 +ZY20210800003/H3/C1/N50/S83/s04/T1 +ZY20210800003/H3/C1/N49/S83/s04/T2 +ZY20210800003/H3/C1/N49/S83/s04/T1 +ZY20210800003/H3/C1/N48/S83/s05/T2 +ZY20210800003/H3/C1/N48/S83/s05/T1 +ZY20210800003/H3/C1/N46/S84/s01/T1 +ZY20210800003/H3/C1/N45/S84/s02/T1 +ZY20210800003/H3/C1/N44/S84/s01/T2 +ZY20210800003/H3/C1/N42/S84/s03/T1 +ZY20210800003/H3/C1/N35/S83/s03/T1 +ZY20210800003/H3/C1/N33/S83/s02/T1 +ZY20210800003/H3/C1/N32/S83/s02/T2 +ZY20210800003/H3/C1/N32/S83/s02/T1 +ZY20210800003/H3/C1/N31/S83/s03/T1 +ZY20210800003/H3/C1/N30/S83/s01/T2 +ZY20210800003/H3/C1/N30/S83/s01/T1 +ZY20210800003/H3/C1/N29/S90/s05/T1 +ZY20210800003/H3/C1/N28/S90/s03/T2 +ZY20210800003/H3/C1/N27/S90/s02/T1 +ZY20210800003/H3/C1/N24/S87/s04/T1 +ZY20210800003/H3/C1/N21/S87/s02/T1 +ZY20210800003/H3/C1/N19/S87/s01/T2 +ZY20210800003/H3/C1/N08/S90/s01/T2 +ZY20210800003/H3/C1/N08/S90/s01/T1 +ZY20210800003/H3/C1/N03/S86/s02/T2 +ZY20210800003/H3/C1/N03/S86/s02/T1 +ZY20210800003/H3/C1/N02/S86/s01/T2 +ZY20210800003/H3/C1/N02/S86/s01/T1 +ZY20210800002/H2/C9/N50/S72/s02/T2 +ZY20210800002/H2/C9/N50/S72/s02/T1 +ZY20210800002/H2/C9/N50/S344/s03/T2 +ZY20210800002/H2/C9/N49/S344/s03/T2 +ZY20210800002/H2/C9/N48/S344/s03/T2 +ZY20210800002/H2/C9/N47/S344/s03/T2 +ZY20210800002/H2/C9/N46/S344/s02/T2 +ZY20210800002/H2/C9/N45/S344/s02/T2 +ZY20210800002/H2/C9/N44/S344/s02/T2 +ZY20210800002/H2/C9/N43/S344/s02/T2 +ZY20210800002/H2/C9/N42/S344/s01/T2 +ZY20210800002/H2/C9/N41/S344/s01/T2 +ZY20210800002/H2/C9/N40/S344/s01/T2 +ZY20210800002/H2/C9/N39/S344/s01/T2 +ZY20210800002/H2/C9/N37/S349/s04/T1 +ZY20210800002/H2/C9/N36/S349/s04/T1 +ZY20210800002/H2/C9/N35/S349/s04/T1 +ZY20210800002/H2/C9/N34/S349/s04/T1 +ZY20210800002/H2/C9/N32/S349/s03/T1 +ZY20210800002/H2/C9/N31/S349/s03/T1 +ZY20210800002/H2/C9/N28/S349/s02/T1 +ZY20210800002/H2/C9/N27/S349/s02/T1 +ZY20210800002/H2/C9/N26/S349/s02/T1 +ZY20210800002/H2/C9/N25/S350/s05/T2 +ZY20210800002/H2/C9/N25/S349/s02/T1 +ZY20210800002/H2/C9/N24/S350/s04/T2 +ZY20210800002/H2/C9/N24/S349/s01/T1 +ZY20210800002/H2/C9/N23/S350/s04/T2 +ZY20210800002/H2/C9/N23/S349/s01/T1 +ZY20210800002/H2/C9/N22/S350/s04/T2 +ZY20210800002/H2/C9/N22/S349/s01/T1 +ZY20210800002/H2/C9/N21/S350/s04/T2 +ZY20210800002/H2/C9/N21/S349/s01/T1 +ZY20210800002/H2/C9/N20/S350/s03/T2 +ZY20210800002/H2/C9/N20/S347/s05/T1 +ZY20210800002/H2/C9/N19/S350/s03/T2 +ZY20210800002/H2/C9/N19/S347/s05/T1 +ZY20210800002/H2/C9/N18/S350/s03/T2 +ZY20210800002/H2/C9/N18/S347/s05/T1 +ZY20210800002/H2/C9/N17/S350/s03/T2 +ZY20210800002/H2/C9/N17/S347/s05/T1 +ZY20210800002/H2/C9/N16/S350/s02/T2 +ZY20210800002/H2/C9/N15/S350/s02/T2 +ZY20210800002/H2/C9/N14/S350/s02/T2 +ZY20210800002/H2/C9/N13/S350/s02/T2 +ZY20210800002/H2/C9/N12/S350/s01/T2 +ZY20210800002/H2/C9/N11/S350/s01/T2 +ZY20210800002/H2/C8/N15/S80/s03/T2 +ZY20210800002/H2/C8/N15/S80/s03/T1 +ZY20210800002/H2/C8/N14/S80/s02/T2 +ZY20210800002/H2/C8/N14/S80/s02/T1 +ZY20210800002/H2/C8/N13/S80/s02/T2 +ZY20210800002/H2/C8/N13/S80/s02/T1 +ZY20210800002/H2/C8/N12/S80/s01/T2 +ZY20210800002/H2/C8/N12/S80/s01/T1 +ZY20210800002/H2/C8/N11/S80/s01/T2 +ZY20210800002/H2/C8/N11/S80/s01/T1 +ZY20210800002/H2/C7/N50/S58/s04/T1 +ZY20210800002/H2/C7/N49/S58/s03/T1 +ZY20210800002/H2/C7/N48/S58/s03/T1 +ZY20210800002/H2/C7/N47/S58/s02/T1 +ZY20210800002/H2/C7/N46/S58/s02/T1 +ZY20210800002/H2/C7/N45/S58/s01/T1 +ZY20210800002/H2/C7/N42/S57/s05/T1 +ZY20210800002/H2/C7/N41/S57/s04/T1 +ZY20210800002/H2/C7/N40/S57/s04/T1 +ZY20210800002/H2/C7/N39/S57/s03/T1 +ZY20210800002/H2/C7/N38/S57/s03/T1 +ZY20210800002/H2/C7/N37/S57/s02/T1 +ZY20210800002/H2/C7/N35/S57/s01/T1 +ZY20210800002/H2/C7/N34/S57/s01/T1 +ZY20210800002/H2/C7/N31/S81/s03/T3 +ZY20210800002/H2/C7/N31/S81/s03/T1 +ZY20210800002/H2/C7/N30/S81/s02/T3 +ZY20210800002/H2/C7/N30/S81/s02/T1 +ZY20210800002/H2/C7/N29/S81/s02/T3 +ZY20210800002/H2/C7/N29/S81/s02/T1 +ZY20210800002/H2/C7/N28/S81/s01/T3 +ZY20210800002/H2/C7/N28/S81/s01/T1 +ZY20210800002/H2/C7/N27/S79/s05/T1 +ZY20210800002/H2/C7/N26/S79/s05/T1 +ZY20210800002/H2/C7/N25/S81/s01/T1 +ZY20210800002/H2/C7/N24/S79/s04/T1 +ZY20210800002/H2/C7/N23/S79/s04/T1 +ZY20210800002/H2/C7/N22/S79/s03/T1 +ZY20210800002/H2/C7/N21/S79/s03/T1 +ZY20210800002/H2/C7/N20/S79/s02/T1 +ZY20210800002/H2/C7/N19/S79/s02/T1 +ZY20210800002/H2/C7/N18/S79/s01/T1 +ZY20210800002/H2/C7/N17/S55/s04/T3 +ZY20210800002/H2/C7/N16/S64/s03/T1 +ZY20210800002/H2/C7/N15/S64/s03/T3 +ZY20210800002/H2/C7/N15/S64/s03/T1 +ZY20210800002/H2/C7/N14/S64/s02/T3 +ZY20210800002/H2/C7/N14/S64/s02/T1 +ZY20210800002/H2/C7/N13/S64/s02/T3 +ZY20210800002/H2/C7/N13/S64/s02/T1 +ZY20210800002/H2/C7/N12/S64/s01/T3 +ZY20210800002/H2/C7/N12/S64/s01/T1 +ZY20210800002/H2/C7/N11/S64/s01/T3 +ZY20210800002/H2/C7/N11/S64/s01/T1 +ZY20210800002/H2/C6/N37/S246/s05/T3 +ZY20210800002/H2/C6/N33/S246/s04/T3 +ZY20210800002/H2/C6/N32/S246/s03/T3 +ZY20210800002/H2/C6/N30/S246/s03/T3 +ZY20210800002/H2/C6/N29/S246/s03/T3 +ZY20210800002/H2/C6/N28/S246/s02/T3 +ZY20210800002/H2/C6/N25/S43/s04/T1 +ZY20210800002/H2/C6/N25/S246/s02/T2 +ZY20210800002/H2/C6/N24/S43/s03/T1 +ZY20210800002/H2/C6/N24/S246/s01/T2 +ZY20210800002/H2/C6/N21/S43/s02/T1 +ZY20210800002/H2/C6/N21/S246/s01/T2 +ZY20210800002/H2/C6/N20/S245/s05/T2 +ZY20210800002/H2/C6/N19/S43/s01/T1 +ZY20210800002/H2/C6/N19/S245/s05/T2 +ZY20210800002/H2/C6/N16/S40/s03/T2 +ZY20210800002/H2/C6/N16/S40/s03/T1 +ZY20210800002/H2/C6/N16/S245/s04/T2 +ZY20210800002/H2/C6/N15/S40/s03/T1 +ZY20210800002/H2/C6/N15/S245/s04/T2 +ZY20210800002/H2/C6/N14/S40/s02/T1 +ZY20210800002/H2/C6/N14/S245/s04/T2 +ZY20210800002/H2/C6/N11/S245/s03/T1 +ZY20210800002/H2/C6/N10/S42/s05/T1 +ZY20210800002/H2/C6/N10/S245/s03/T1 +ZY20210800002/H2/C6/N09/S42/s05/T2 +ZY20210800002/H2/C6/N09/S42/s05/T1 +ZY20210800002/H2/C6/N09/S245/s03/T1 +ZY20210800002/H2/C6/N07/S42/s04/T2 +ZY20210800002/H2/C6/N07/S245/s02/T1 +ZY20210800002/H2/C6/N06/S245/s02/T1 +ZY20210800002/H2/C6/N05/S42/s03/T1 +ZY20210800002/H2/C6/N05/S245/s02/T1 +ZY20210800002/H2/C6/N04/S245/s01/T1 +ZY20210800002/H2/C6/N03/S245/s01/T1 +ZY20210800002/H2/C6/N02/S245/s01/T1 +ZY20210800002/H2/C6/N01/S245/s01/T1 +ZY20210800002/H2/C5/N50/S37/s02/T2 +ZY20210800002/H2/C5/N50/S265/s05/T5 +ZY20210800002/H2/C5/N50/S261/s03/T3 +ZY20210800002/H2/C5/N49/S37/s02/T2 +ZY20210800002/H2/C5/N49/S37/s02/T1 +ZY20210800002/H2/C5/N49/S265/s05/T5 +ZY20210800002/H2/C5/N49/S261/s03/T3 +ZY20210800002/H2/C5/N48/S37/s01/T2 +ZY20210800002/H2/C5/N48/S37/s01/T1 +ZY20210800002/H2/C5/N48/S265/s05/T5 +ZY20210800002/H2/C5/N48/S261/s02/T2 +ZY20210800002/H2/C5/N47/S37/s01/T2 +ZY20210800002/H2/C5/N47/S265/s05/T5 +ZY20210800002/H2/C5/N47/S261/s02/T2 +ZY20210800002/H2/C5/N46/S39/s05/T2 +ZY20210800002/H2/C5/N46/S265/s04/T4 +ZY20210800002/H2/C5/N46/S261/s02/T2 +ZY20210800002/H2/C5/N45/S39/s05/T2 +ZY20210800002/H2/C5/N45/S265/s04/T4 +ZY20210800002/H2/C5/N45/S261/s02/T2 +ZY20210800002/H2/C5/N44/S39/s04/T1 +ZY20210800002/H2/C5/N44/S269/s01/T6 +ZY20210800002/H2/C5/N44/S265/s04/T4 +ZY20210800002/H2/C5/N44/S261/s01/T2 +ZY20210800002/H2/C5/N43/S269/s01/T6 +ZY20210800002/H2/C5/N43/S265/s04/T4 +ZY20210800002/H2/C5/N43/S261/s01/T2 +ZY20210800002/H2/C5/N42/S269/s01/T6 +ZY20210800002/H2/C5/N42/S265/s03/T4 +ZY20210800002/H2/C5/N42/S261/s01/T2 +ZY20210800002/H2/C5/N41/S269/s01/T6 +ZY20210800002/H2/C5/N41/S265/s03/T4 +ZY20210800002/H2/C5/N41/S261/s01/T2 +ZY20210800002/H2/C5/N40/S268/s05/T6 +ZY20210800002/H2/C5/N40/S265/s03/T4 +ZY20210800002/H2/C5/N40/S258/s05/T2 +ZY20210800002/H2/C5/N39/S268/s05/T6 +ZY20210800002/H2/C5/N39/S265/s03/T4 +ZY20210800002/H2/C5/N39/S258/s05/T2 +ZY20210800002/H2/C5/N38/S268/s05/T6 +ZY20210800002/H2/C5/N38/S265/s02/T4 +ZY20210800002/H2/C5/N38/S258/s05/T2 +ZY20210800002/H2/C5/N37/S268/s05/T6 +ZY20210800002/H2/C5/N37/S265/s02/T4 +ZY20210800002/H2/C5/N37/S258/s05/T2 +ZY20210800002/H2/C5/N36/S41/s05/T2 +ZY20210800002/H2/C5/N36/S268/s04/T6 +ZY20210800002/H2/C5/N36/S265/s02/T4 +ZY20210800002/H2/C5/N36/S258/s04/T2 +ZY20210800002/H2/C5/N35/S41/s05/T2 +ZY20210800002/H2/C5/N35/S41/s05/T1 +ZY20210800002/H2/C5/N35/S268/s04/T6 +ZY20210800002/H2/C5/N35/S265/s02/T4 +ZY20210800002/H2/C5/N35/S258/s04/T2 +ZY20210800002/H2/C5/N34/S41/s04/T2 +ZY20210800002/H2/C5/N34/S41/s04/T1 +ZY20210800002/H2/C5/N34/S268/s04/T6 +ZY20210800002/H2/C5/N34/S265/s01/T4 +ZY20210800002/H2/C5/N34/S258/s04/T2 +ZY20210800002/H2/C5/N33/S41/s04/T2 +ZY20210800002/H2/C5/N33/S268/s04/T6 +ZY20210800002/H2/C5/N33/S265/s01/T4 +ZY20210800002/H2/C5/N33/S258/s04/T2 +ZY20210800002/H2/C5/N32/S41/s03/T2 +ZY20210800002/H2/C5/N32/S268/s03/T6 +ZY20210800002/H2/C5/N32/S265/s01/T4 +ZY20210800002/H2/C5/N32/S258/s03/T2 +ZY20210800002/H2/C5/N31/S268/s03/T6 +ZY20210800002/H2/C5/N31/S265/s01/T4 +ZY20210800002/H2/C5/N31/S258/s03/T2 +ZY20210800002/H2/C5/N31/S121/s03/T1 +ZY20210800002/H2/C5/N30/S41/s03/T2 +ZY20210800002/H2/C5/N30/S268/s03/T6 +ZY20210800002/H2/C5/N30/S263/s05/T4 +ZY20210800002/H2/C5/N30/S258/s03/T2 +ZY20210800002/H2/C5/N29/S41/s02/T1 +ZY20210800002/H2/C5/N29/S268/s03/T6 +ZY20210800002/H2/C5/N29/S263/s05/T4 +ZY20210800002/H2/C5/N29/S258/s03/T2 +ZY20210800002/H2/C5/N28/S41/s02/T2 +ZY20210800002/H2/C5/N28/S41/s02/T1 +ZY20210800002/H2/C5/N28/S268/s02/T6 +ZY20210800002/H2/C5/N28/S263/s05/T4 +ZY20210800002/H2/C5/N28/S258/s02/T2 +ZY20210800002/H2/C5/N27/S41/s01/T2 +ZY20210800002/H2/C5/N27/S41/s01/T1 +ZY20210800002/H2/C5/N27/S268/s02/T6 +ZY20210800002/H2/C5/N27/S263/s05/T4 +ZY20210800002/H2/C5/N27/S258/s02/T2 +ZY20210800002/H2/C5/N26/S41/s01/T2 +ZY20210800002/H2/C5/N26/S268/s02/T6 +ZY20210800002/H2/C5/N26/S263/s04/T4 +ZY20210800002/H2/C5/N26/S258/s02/T2 +ZY20210800002/H2/C5/N25/S268/s02/T6 +ZY20210800002/H2/C5/N25/S263/s04/T4 +ZY20210800002/H2/C5/N25/S258/s02/T2 +ZY20210800002/H2/C5/N24/S268/s01/T6 +ZY20210800002/H2/C5/N24/S263/s04/T4 +ZY20210800002/H2/C5/N24/S258/s01/T1 +ZY20210800002/H2/C5/N23/S56/s04/T2 +ZY20210800002/H2/C5/N23/S56/s04/T1 +ZY20210800002/H2/C5/N23/S268/s01/T6 +ZY20210800002/H2/C5/N23/S263/s04/T4 +ZY20210800002/H2/C5/N23/S258/s01/T1 +ZY20210800002/H2/C5/N22/S56/s04/T2 +ZY20210800002/H2/C5/N22/S56/s04/T1 +ZY20210800002/H2/C5/N22/S268/s01/T6 +ZY20210800002/H2/C5/N22/S263/s03/T3 +ZY20210800002/H2/C5/N22/S258/s01/T1 +ZY20210800002/H2/C5/N21/S56/s03/T2 +ZY20210800002/H2/C5/N21/S56/s03/T1 +ZY20210800002/H2/C5/N21/S268/s01/T6 +ZY20210800002/H2/C5/N21/S263/s03/T3 +ZY20210800002/H2/C5/N21/S258/s01/T1 +ZY20210800002/H2/C5/N20/S56/s03/T2 +ZY20210800002/H2/C5/N20/S267/s05/T5 +ZY20210800002/H2/C5/N20/S263/s03/T3 +ZY20210800002/H2/C5/N20/S255/s05/T1 +ZY20210800002/H2/C5/N19/S267/s05/T5 +ZY20210800002/H2/C5/N19/S263/s03/T3 +ZY20210800002/H2/C5/N19/S255/s05/T1 +ZY20210800002/H2/C5/N18/S56/s02/T2 +ZY20210800002/H2/C5/N18/S56/s02/T1 +ZY20210800002/H2/C5/N18/S267/s05/T5 +ZY20210800002/H2/C5/N18/S263/s02/T3 +ZY20210800002/H2/C5/N18/S255/s05/T1 +ZY20210800002/H2/C5/N17/S267/s05/T5 +ZY20210800002/H2/C5/N17/S263/s02/T3 +ZY20210800002/H2/C5/N17/S255/s05/T1 +ZY20210800002/H2/C5/N16/S56/s01/T2 +ZY20210800002/H2/C5/N16/S267/s04/T5 +ZY20210800002/H2/C5/N16/S263/s02/T3 +ZY20210800002/H2/C5/N16/S255/s04/T1 +ZY20210800002/H2/C5/N15/S267/s04/T5 +ZY20210800002/H2/C5/N15/S263/s02/T3 +ZY20210800002/H2/C5/N15/S255/s04/T1 +ZY20210800002/H2/C5/N15/S121/s03/T3 +ZY20210800002/H2/C5/N15/S121/s03/T1 +ZY20210800002/H2/C5/N14/S267/s04/T5 +ZY20210800002/H2/C5/N14/S263/s01/T3 +ZY20210800002/H2/C5/N14/S255/s04/T1 +ZY20210800002/H2/C5/N14/S121/s02/T3 +ZY20210800002/H2/C5/N13/S267/s04/T5 +ZY20210800002/H2/C5/N13/S263/s01/T3 +ZY20210800002/H2/C5/N13/S255/s04/T1 +ZY20210800002/H2/C5/N13/S121/s02/T1 +ZY20210800002/H2/C5/N12/S267/s03/T5 +ZY20210800002/H2/C5/N12/S263/s01/T3 +ZY20210800002/H2/C5/N12/S255/s03/T1 +ZY20210800002/H2/C5/N12/S121/s01/T3 +ZY20210800002/H2/C5/N11/S267/s03/T5 +ZY20210800002/H2/C5/N11/S263/s01/T3 +ZY20210800002/H2/C5/N11/S255/s03/T1 +ZY20210800002/H2/C5/N11/S121/s01/T3 +ZY20210800002/H2/C4/N27/S24/s01/T2 +ZY20210800002/H2/C4/N27/S24/s01/T1 +ZY20210800002/H2/C4/N10/S105/s02/T1 +ZY20210800002/H2/C4/N08/S105/s03/T2 +ZY20210800002/H2/C4/N08/S105/s03/T1 +ZY20210800002/H2/C4/N01/S105/s01/T2 +ZY20210800002/H2/C3/N50/S355/s01/T1 +ZY20210800002/H2/C3/N50/S354/s05/T2 +ZY20210800002/H2/C3/N50/S353/s05/T1 +ZY20210800002/H2/C3/N28/S354/s05/T2 +ZY20210800002/H2/C3/N28/S353/s05/T1 +ZY20210800002/H2/C3/N26/S353/s04/T1 +ZY20210800002/H2/C3/N25/S353/s04/T1 +ZY20210800002/H2/C3/N24/S353/s03/T1 +ZY20210800002/H2/C3/N23/S353/s03/T1 +ZY20210800002/H2/C3/N23/S103/s03/T2 +ZY20210800002/H2/C3/N23/S103/s03/T1 +ZY20210800002/H2/C3/N22/S353/s03/T1 +ZY20210800002/H2/C3/N20/S353/s03/T1 +ZY20210800002/H2/C3/N17/S353/s02/T1 +ZY20210800002/H2/C3/N15/S353/s02/T1 +ZY20210800002/H2/C3/N14/S353/s02/T1 +ZY20210800002/H2/C3/N06/S354/s01/T2 +ZY20210800002/H2/C3/N06/S353/s04/T1 +ZY20210800002/H2/C3/N03/S96/s01/T1 +ZY20210800002/H2/C3/N02/S354/s01/T2 +ZY20210800002/H2/C20/N16/S277/s01/T4 +ZY20210800002/H2/C20/N16/S275/s02/T2 +ZY20210800002/H2/C20/N15/S277/s01/T4 +ZY20210800002/H2/C20/N15/S275/s02/T2 +ZY20210800002/H2/C20/N15/S273/s03/T3 +ZY20210800002/H2/C20/N15/S271/s04/T1 +ZY20210800002/H2/C20/N14/S277/s01/T4 +ZY20210800002/H2/C20/N14/S275/s02/T2 +ZY20210800002/H2/C20/N14/S273/s03/T3 +ZY20210800002/H2/C20/N14/S271/s04/T1 +ZY20210800002/H2/C20/N13/S275/s05/T4 +ZY20210800002/H2/C20/N13/S275/s01/T2 +ZY20210800002/H2/C20/N13/S273/s03/T3 +ZY20210800002/H2/C20/N13/S271/s04/T1 +ZY20210800002/H2/C20/N12/S275/s05/T4 +ZY20210800002/H2/C20/N12/S275/s01/T2 +ZY20210800002/H2/C20/N12/S273/s02/T3 +ZY20210800002/H2/C20/N12/S271/s03/T1 +ZY20210800002/H2/C20/N11/S275/s05/T4 +ZY20210800002/H2/C20/N11/S275/s01/T2 +ZY20210800002/H2/C20/N11/S273/s02/T3 +ZY20210800002/H2/C20/N11/S271/s03/T1 +ZY20210800002/H2/C2/N50/S29/s05/T3 +ZY20210800002/H2/C2/N49/S29/s05/T3 +ZY20210800002/H2/C2/N49/S29/s05/T1 +ZY20210800002/H2/C2/N48/S29/s04/T3 +ZY20210800002/H2/C2/N48/S29/s04/T1 +ZY20210800002/H2/C2/N47/S29/s04/T3 +ZY20210800002/H2/C2/N47/S29/s04/T1 +ZY20210800002/H2/C2/N46/S29/s03/T1 +ZY20210800002/H2/C2/N45/S29/s03/T3 +ZY20210800002/H2/C2/N45/S29/s03/T1 +ZY20210800002/H2/C2/N44/S29/s02/T1 +ZY20210800002/H2/C2/N43/S29/s02/T3 +ZY20210800002/H2/C2/N39/S30/s05/T3 +ZY20210800002/H2/C2/N39/S30/s05/T1 +ZY20210800002/H2/C2/N37/S30/s04/T3 +ZY20210800002/H2/C2/N36/S30/s03/T3 +ZY20210800002/H2/C2/N36/S30/s03/T1 +ZY20210800002/H2/C2/N32/S30/s01/T1 +ZY20210800002/H2/C2/N30/S2/s05/T1 +ZY20210800002/H2/C2/N29/S2/s05/T3 +ZY20210800002/H2/C2/N27/S2/s04/T1 +ZY20210800002/H2/C2/N24/S2/s02/T3 +ZY20210800002/H2/C2/N24/S2/s02/T1 +ZY20210800002/H2/C2/N22/S2/s01/T3 +ZY20210800002/H2/C2/N21/S2/s01/T3 +ZY20210800002/H2/C2/N20/S25/s05/T1 +ZY20210800002/H2/C2/N19/S25/s05/T3 +ZY20210800002/H2/C2/N19/S25/s05/T1 +ZY20210800002/H2/C2/N18/S25/s04/T3 +ZY20210800002/H2/C2/N18/S25/s04/T1 +ZY20210800002/H2/C2/N17/S25/s04/T3 +ZY20210800002/H2/C2/N17/S25/s04/T1 +ZY20210800002/H2/C2/N16/S25/s03/T3 +ZY20210800002/H2/C2/N16/S25/s03/T1 +ZY20210800002/H2/C2/N15/S25/s03/T3 +ZY20210800002/H2/C2/N15/S25/s03/T1 +ZY20210800002/H2/C2/N14/S25/s02/T3 +ZY20210800002/H2/C2/N13/S25/s02/T3 +ZY20210800002/H2/C2/N11/S25/s01/T3 +ZY20210800002/H2/C2/N11/S25/s01/T1 +ZY20210800002/H2/C18/N50/S241/s02/T2 +ZY20210800002/H2/C18/N50/S135/s02/T1 +ZY20210800002/H2/C18/N49/S241/s01/T2 +ZY20210800002/H2/C18/N49/S135/s01/T1 +ZY20210800002/H2/C18/N48/S241/s01/T2 +ZY20210800002/H2/C18/N48/S135/s01/T1 +ZY20210800002/H2/C18/N47/S241/s01/T2 +ZY20210800002/H2/C18/N47/S135/s01/T1 +ZY20210800002/H2/C18/N46/S241/s01/T2 +ZY20210800002/H2/C18/N46/S135/s01/T1 +ZY20210800002/H2/C18/N45/S131/s05/T1 +ZY20210800002/H2/C18/N43/S183/s05/T2 +ZY20210800002/H2/C18/N43/S131/s05/T1 +ZY20210800002/H2/C18/N42/S183/s05/T2 +ZY20210800002/H2/C18/N42/S131/s05/T1 +ZY20210800002/H2/C18/N41/S183/s04/T2 +ZY20210800002/H2/C18/N41/S131/s04/T1 +ZY20210800002/H2/C18/N40/S183/s04/T2 +ZY20210800002/H2/C18/N40/S131/s04/T1 +ZY20210800002/H2/C18/N39/S183/s04/T2 +ZY20210800002/H2/C18/N39/S131/s04/T1 +ZY20210800002/H2/C18/N37/S131/s03/T1 +ZY20210800002/H2/C18/N36/S183/s03/T2 +ZY20210800002/H2/C18/N36/S131/s03/T1 +ZY20210800002/H2/C18/N35/S183/s03/T2 +ZY20210800002/H2/C18/N35/S131/s03/T1 +ZY20210800002/H2/C18/N34/S183/s03/T2 +ZY20210800002/H2/C18/N34/S131/s03/T1 +ZY20210800002/H2/C18/N33/S183/s02/T2 +ZY20210800002/H2/C18/N33/S131/s02/T1 +ZY20210800002/H2/C18/N32/S183/s02/T2 +ZY20210800002/H2/C18/N32/S131/s02/T1 +ZY20210800002/H2/C18/N31/S183/s02/T2 +ZY20210800002/H2/C18/N31/S131/s02/T1 +ZY20210800002/H2/C18/N30/S183/s02/T2 +ZY20210800002/H2/C18/N30/S131/s02/T1 +ZY20210800002/H2/C18/N29/S183/s01/T2 +ZY20210800002/H2/C18/N29/S131/s01/T1 +ZY20210800002/H2/C18/N28/S183/s01/T2 +ZY20210800002/H2/C18/N28/S131/s01/T1 +ZY20210800002/H2/C18/N27/S183/s01/T2 +ZY20210800002/H2/C18/N27/S131/s01/T1 +ZY20210800002/H2/C18/N26/S183/s01/T2 +ZY20210800002/H2/C18/N26/S131/s01/T1 +ZY20210800002/H2/C18/N13/S241/s03/T2 +ZY20210800002/H2/C18/N13/S135/s03/T1 +ZY20210800002/H2/C18/N11/S241/s03/T2 +ZY20210800002/H2/C18/N11/S135/s03/T1 +ZY20210800002/H2/C17/N75/S256/s02/T3 +ZY20210800002/H2/C17/N74/S256/s01/T3 +ZY20210800002/H2/C17/N73/S256/s01/T3 +ZY20210800002/H2/C17/N72/S256/s01/T3 +ZY20210800002/H2/C17/N71/S256/s01/T2 +ZY20210800002/H2/C17/N70/S253/s05/T2 +ZY20210800002/H2/C17/N69/S253/s05/T2 +ZY20210800002/H2/C17/N67/S253/s05/T2 +ZY20210800002/H2/C17/N66/S253/s04/T2 +ZY20210800002/H2/C17/N65/S253/s04/T2 +ZY20210800002/H2/C17/N64/S253/s04/T2 +ZY20210800002/H2/C17/N63/S253/s04/T2 +ZY20210800002/H2/C17/N62/S253/s03/T2 +ZY20210800002/H2/C17/N61/S253/s03/T1 +ZY20210800002/H2/C17/N60/S253/s03/T1 +ZY20210800002/H2/C17/N59/S253/s03/T1 +ZY20210800002/H2/C17/N58/S253/s02/T1 +ZY20210800002/H2/C17/N57/S253/s02/T1 +ZY20210800002/H2/C17/N56/S256/s03/T3 +ZY20210800002/H2/C17/N56/S253/s02/T1 +ZY20210800002/H2/C17/N16/S341/s01/T1 +ZY20210800002/H2/C17/N12/S356/s02/T3 +ZY20210800002/H2/C17/N12/S356/s01/T1 +ZY20210800002/H2/C17/N11/S159/s03/T3 +ZY20210800002/H2/C17/N11/S152/s03/T1 +ZY20210800002/H2/C17/N10/S341/s01/T1 +ZY20210800002/H2/C17/N09/S356/s02/T3 +ZY20210800002/H2/C17/N09/S356/s01/T1 +ZY20210800002/H2/C17/N09/S159/s03/T3 +ZY20210800002/H2/C17/N09/S152/s03/T1 +ZY20210800002/H2/C17/N08/S356/s01/T1 +ZY20210800002/H2/C17/N07/S159/s03/T3 +ZY20210800002/H2/C17/N07/S152/s03/T1 +ZY20210800002/H2/C14/N50/S187/s03/T2 +ZY20210800002/H2/C14/N50/S163/s03/T1 +ZY20210800002/H2/C14/N48/S187/s03/T2 +ZY20210800002/H2/C14/N48/S163/s03/T1 +ZY20210800002/H2/C14/N46/S187/s03/T2 +ZY20210800002/H2/C14/N46/S163/s03/T1 +ZY20210800002/H2/C14/N44/S187/s02/T2 +ZY20210800002/H2/C14/N44/S163/s02/T1 +ZY20210800002/H2/C14/N42/S187/s02/T2 +ZY20210800002/H2/C14/N42/S163/s02/T1 +ZY20210800002/H2/C14/N40/S187/s02/T2 +ZY20210800002/H2/C14/N40/S163/s02/T1 +ZY20210800002/H2/C14/N25/S187/s02/T2 +ZY20210800002/H2/C14/N25/S163/s02/T1 +ZY20210800002/H2/C14/N24/S359/s03/T2 +ZY20210800002/H2/C14/N24/S359/s02/T1 +ZY20210800002/H2/C14/N24/S163/s01/T1 +ZY20210800002/H2/C14/N23/S187/s01/T2 +ZY20210800002/H2/C14/N23/S163/s01/T1 +ZY20210800002/H2/C14/N22/S163/s01/T1 +ZY20210800002/H2/C14/N21/S187/s01/T2 +ZY20210800002/H2/C14/N21/S163/s01/T1 +ZY20210800002/H2/C14/N20/S185/s05/T2 +ZY20210800002/H2/C14/N20/S161/s05/T1 +ZY20210800002/H2/C14/N19/S185/s05/T2 +ZY20210800002/H2/C14/N19/S161/s05/T1 +ZY20210800002/H2/C14/N18/S185/s05/T2 +ZY20210800002/H2/C14/N18/S161/s05/T1 +ZY20210800002/H2/C14/N17/S185/s05/T2 +ZY20210800002/H2/C14/N17/S161/s05/T1 +ZY20210800002/H2/C14/N16/S185/s04/T2 +ZY20210800002/H2/C14/N16/S161/s04/T1 +ZY20210800002/H2/C14/N15/S185/s04/T2 +ZY20210800002/H2/C14/N15/S161/s04/T1 +ZY20210800002/H2/C14/N14/S185/s04/T2 +ZY20210800002/H2/C14/N14/S161/s04/T1 +ZY20210800002/H2/C14/N13/S185/s04/T2 +ZY20210800002/H2/C14/N13/S161/s04/T1 +ZY20210800002/H2/C14/N12/S185/s03/T2 +ZY20210800002/H2/C14/N12/S161/s03/T1 +ZY20210800002/H2/C14/N11/S185/s03/T2 +ZY20210800002/H2/C14/N11/S161/s03/T1 +ZY20210800002/H2/C13/N38/S192/s03/T2 +ZY20210800002/H2/C13/N38/S128/s03/T1 +ZY20210800002/H2/C13/N36/S192/s03/T2 +ZY20210800002/H2/C13/N36/S128/s03/T1 +ZY20210800002/H2/C13/N34/S192/s03/T2 +ZY20210800002/H2/C13/N34/S128/s03/T1 +ZY20210800002/H2/C13/N32/S192/s03/T2 +ZY20210800002/H2/C13/N32/S128/s03/T1 +ZY20210800002/H2/C13/N30/S192/s02/T2 +ZY20210800002/H2/C13/N30/S128/s02/T1 +ZY20210800002/H2/C13/N28/S192/s02/T2 +ZY20210800002/H2/C13/N28/S128/s02/T1 +ZY20210800002/H2/C13/N26/S192/s02/T2 +ZY20210800002/H2/C13/N26/S128/s02/T1 +ZY20210800002/H2/C13/N25/S189/s05/T4 +ZY20210800002/H2/C13/N25/S128/s02/T1 +ZY20210800002/H2/C13/N24/S192/s02/T3 +ZY20210800002/H2/C13/N24/S128/s01/T1 +ZY20210800002/H2/C13/N23/S192/s01/T3 +ZY20210800002/H2/C13/N23/S128/s01/T1 +ZY20210800002/H2/C13/N22/S189/s05/T4 +ZY20210800002/H2/C13/N22/S128/s01/T1 +ZY20210800002/H2/C13/N21/S192/s01/T3 +ZY20210800002/H2/C13/N21/S128/s01/T1 +ZY20210800002/H2/C13/N20/S192/s01/T3 +ZY20210800002/H2/C13/N20/S124/s05/T1 +ZY20210800002/H2/C13/N19/S189/s05/T4 +ZY20210800002/H2/C13/N19/S124/s05/T1 +ZY20210800002/H2/C13/N18/S192/s01/T3 +ZY20210800002/H2/C13/N18/S124/s05/T1 +ZY20210800002/H2/C13/N17/S189/s05/T3 +ZY20210800002/H2/C13/N17/S124/s05/T1 +ZY20210800002/H2/C13/N16/S189/s04/T4 +ZY20210800002/H2/C13/N16/S124/s04/T1 +ZY20210800002/H2/C13/N15/S346/s01/T1 +ZY20210800002/H2/C13/N15/S189/s04/T4 +ZY20210800002/H2/C13/N15/S124/s04/T1 +ZY20210800002/H2/C13/N14/S189/s04/T4 +ZY20210800002/H2/C13/N14/S124/s04/T1 +ZY20210800002/H2/C13/N13/S189/s04/T4 +ZY20210800002/H2/C13/N13/S124/s04/T1 +ZY20210800002/H2/C13/N12/S189/s03/T4 +ZY20210800002/H2/C13/N12/S124/s03/T1 +ZY20210800002/H2/C13/N11/S189/s03/T4 +ZY20210800002/H2/C13/N11/S124/s03/T1 +ZY20210800002/H2/C12/N46/S346/s03/T2 +ZY20210800002/H2/C12/N39/S346/s03/T2 +ZY20210800002/H2/C12/N36/S346/s03/T2 +ZY20210800002/H2/C12/N36/S198/s03/T2 +ZY20210800002/H2/C12/N36/S157/s03/T1 +ZY20210800002/H2/C12/N35/S346/s03/T1 +ZY20210800002/H2/C12/N34/S198/s03/T2 +ZY20210800002/H2/C12/N34/S157/s03/T1 +ZY20210800002/H2/C12/N33/S346/s01/T1 +ZY20210800002/H2/C12/N32/S198/s03/T2 +ZY20210800002/H2/C12/N32/S157/s03/T1 +ZY20210800002/H2/C12/N31/S346/s01/T1 +ZY20210800002/H2/C12/N30/S198/s02/T2 +ZY20210800002/H2/C12/N30/S157/s02/T1 +ZY20210800002/H2/C12/N28/S198/s02/T2 +ZY20210800002/H2/C12/N28/S157/s02/T1 +ZY20210800002/H2/C12/N26/S198/s02/T2 +ZY20210800002/H2/C12/N26/S157/s02/T1 +ZY20210800002/H2/C12/N25/S198/s02/T2 +ZY20210800002/H2/C12/N25/S157/s02/T1 +ZY20210800002/H2/C12/N24/S198/s01/T2 +ZY20210800002/H2/C12/N24/S157/s01/T1 +ZY20210800002/H2/C12/N23/S198/s01/T2 +ZY20210800002/H2/C12/N23/S157/s01/T1 +ZY20210800002/H2/C12/N22/S198/s01/T2 +ZY20210800002/H2/C12/N22/S157/s01/T1 +ZY20210800002/H2/C12/N21/S198/s01/T2 +ZY20210800002/H2/C12/N21/S157/s01/T1 +ZY20210800002/H2/C12/N20/S196/s05/T2 +ZY20210800002/H2/C12/N20/S154/s05/T1 +ZY20210800002/H2/C12/N19/S346/s02/T2 +ZY20210800002/H2/C12/N19/S196/s05/T2 +ZY20210800002/H2/C12/N19/S154/s05/T1 +ZY20210800002/H2/C12/N18/S196/s05/T2 +ZY20210800002/H2/C12/N18/S154/s05/T1 +ZY20210800002/H2/C12/N17/S196/s05/T2 +ZY20210800002/H2/C12/N17/S154/s05/T1 +ZY20210800002/H2/C12/N16/S346/s02/T1 +ZY20210800002/H2/C12/N16/S196/s04/T2 +ZY20210800002/H2/C12/N16/S154/s05/T1 +ZY20210800002/H2/C12/N15/S196/s04/T2 +ZY20210800002/H2/C12/N15/S154/s04/T1 +ZY20210800002/H2/C12/N14/S196/s04/T2 +ZY20210800002/H2/C12/N14/S154/s04/T1 +ZY20210800002/H2/C12/N13/S196/s04/T2 +ZY20210800002/H2/C12/N13/S154/s04/T1 +ZY20210800002/H2/C12/N12/S196/s03/T2 +ZY20210800002/H2/C12/N12/S154/s04/T1 +ZY20210800002/H2/C12/N11/S196/s03/T2 +ZY20210800002/H2/C12/N11/S154/s03/T1 +ZY20210800002/H2/C11/N50/S204/s03/T2 +ZY20210800002/H2/C11/N50/S137/s03/T1 +ZY20210800002/H2/C11/N48/S204/s03/T2 +ZY20210800002/H2/C11/N48/S137/s03/T1 +ZY20210800002/H2/C11/N42/S204/s02/T2 +ZY20210800002/H2/C11/N42/S137/s02/T1 +ZY20210800002/H2/C11/N40/S204/s02/T2 +ZY20210800002/H2/C11/N40/S137/s02/T1 +ZY20210800002/H2/C11/N24/S204/s01/T3 +ZY20210800002/H2/C11/N24/S137/s01/T1 +ZY20210800002/H2/C11/N23/S204/s01/T3 +ZY20210800002/H2/C11/N23/S137/s01/T1 +ZY20210800002/H2/C11/N22/S204/s01/T3 +ZY20210800002/H2/C11/N22/S137/s01/T1 +ZY20210800002/H2/C11/N21/S204/s01/T3 +ZY20210800002/H2/C11/N21/S137/s01/T1 +ZY20210800002/H2/C11/N20/S201/s05/T3 +ZY20210800002/H2/C11/N20/S133/s05/T1 +ZY20210800002/H2/C11/N19/S201/s05/T3 +ZY20210800002/H2/C11/N19/S133/s05/T1 +ZY20210800002/H2/C11/N18/S201/s05/T4 +ZY20210800002/H2/C11/N18/S133/s05/T1 +ZY20210800002/H2/C11/N17/S201/s05/T4 +ZY20210800002/H2/C11/N17/S133/s05/T1 +ZY20210800002/H2/C11/N16/S201/s04/T4 +ZY20210800002/H2/C11/N16/S133/s04/T1 +ZY20210800002/H2/C11/N15/S201/s04/T4 +ZY20210800002/H2/C11/N15/S133/s04/T1 +ZY20210800002/H2/C11/N14/S201/s04/T4 +ZY20210800002/H2/C11/N14/S133/s04/T1 +ZY20210800002/H2/C11/N13/S201/s04/T4 +ZY20210800002/H2/C11/N13/S133/s04/T1 +ZY20210800002/H2/C11/N12/S359/s02/T1 +ZY20210800002/H2/C11/N12/S201/s03/T4 +ZY20210800002/H2/C11/N12/S133/s03/T1 +ZY20210800002/H2/C11/N11/S359/s02/T1 +ZY20210800002/H2/C11/N11/S201/s03/T4 +ZY20210800002/H2/C11/N11/S133/s03/T1 +ZY20210800002/H2/C11/N10/S201/s03/T4 +ZY20210800002/H2/C11/N10/S133/s03/T1 +ZY20210800002/H2/C11/N09/S201/s03/T4 +ZY20210800002/H2/C11/N09/S133/s03/T1 +ZY20210800002/H2/C11/N08/S201/s02/T4 +ZY20210800002/H2/C11/N08/S133/s02/T1 +ZY20210800002/H2/C11/N07/S359/s01/T3 +ZY20210800002/H2/C11/N07/S201/s02/T4 +ZY20210800002/H2/C11/N07/S133/s02/T1 +ZY20210800002/H2/C1/N50/S89/s05/T3 +ZY20210800002/H2/C1/N49/S89/s05/T1 +ZY20210800002/H2/C1/N48/S89/s04/T3 +ZY20210800002/H2/C1/N48/S89/s04/T1 +ZY20210800002/H2/C1/N47/S89/s04/T3 +ZY20210800002/H2/C1/N47/S89/s04/T1 +ZY20210800002/H2/C1/N46/S89/s03/T3 +ZY20210800002/H2/C1/N46/S89/s03/T1 +ZY20210800002/H2/C1/N45/S94/s02/T3 +ZY20210800002/H2/C1/N42/S94/s01/T3 +ZY20210800002/H2/C1/N41/S94/s01/T3 +ZY20210800002/H2/C1/N39/S88/s05/T3 +ZY20210800002/H2/C1/N39/S88/s05/T1 +ZY20210800002/H2/C1/N38/S88/s04/T3 +ZY20210800002/H2/C1/N37/S88/s04/T3 +ZY20210800002/H2/C1/N37/S88/s04/T1 +ZY20210800002/H2/C1/N36/S94/s03/T3 +ZY20210800002/H2/C1/N35/S94/s03/T3 +ZY20210800002/H2/C1/N34/S94/s02/T1 +ZY20210800002/H2/C1/N34/S336/s01/T1 +ZY20210800002/H2/C1/N32/S88/s01/T3 +ZY20210800002/H2/C1/N32/S88/s01/T1 +ZY20210800002/H2/C1/N30/S94/s05/T3 +ZY20210800002/H2/C1/N29/S87/s05/T3 +ZY20210800002/H2/C1/N28/S87/s04/T3 +ZY20210800002/H2/C1/N28/S87/s04/T1 +ZY20210800002/H2/C1/N26/S94/s03/T3 +ZY20210800002/H2/C1/N24/S87/s02/T3 +ZY20210800002/H2/C1/N24/S87/s02/T1 +ZY20210800002/H2/C1/N23/S87/s02/T3 +ZY20210800002/H2/C1/N23/S87/s02/T1 +ZY20210800002/H2/C1/N21/S87/s01/T3 +ZY20210800002/H2/C1/N20/S339/s05/T2 +ZY20210800002/H2/C1/N20/S339/s05/T1 +ZY20210800002/H2/C1/N19/S339/s05/T2 +ZY20210800002/H2/C1/N19/S339/s05/T1 +ZY20210800002/H2/C1/N18/S339/s04/T2 +ZY20210800002/H2/C1/N16/S339/s03/T2 +ZY20210800002/H2/C1/N14/S339/s03/T1 +ZY20210800002/H2/C1/N13/S339/s02/T1 +ZY20210800002/H2/C1/N12/S339/s01/T2 +ZY20210800002/H2/C1/N12/S339/s01/T1 +ZY20210800002/H2/C1/N11/S339/s02/T2 +ZY20210800002/H2/C1/N10/S336/s01/T2 +ZY20210800002/H2/C1/N07/S336/s04/T2 +ZY20210800002/H2/C1/N06/S336/s04/T1 +ZY20210800002/H2/C1/N04/S336/s03/T2 +ZY20210800002/H2/C1/N03/S336/s02/T1 +ZY20210800002/H2/C1/N02/S336/s03/T2 +ZY20210800002/H2/C1/N01/S336/s02/T1 +ZY20210800001/H1/C9/N49/S36/s05/T2 +ZY20210800001/H1/C9/N49/S36/s05/T1 +ZY20210800001/H1/C9/N48/S36/s04/T2 +ZY20210800001/H1/C9/N48/S36/s04/T1 +ZY20210800001/H1/C9/N47/S36/s04/T2 +ZY20210800001/H1/C9/N47/S36/s04/T1 +ZY20210800001/H1/C9/N46/S36/s03/T2 +ZY20210800001/H1/C9/N45/S385/s04/T1 +ZY20210800001/H1/C9/N44/S36/s02/T2 +ZY20210800001/H1/C9/N43/S36/s02/T1 +ZY20210800001/H1/C9/N42/S33/s05/T2 +ZY20210800001/H1/C9/N42/S33/s05/T1 +ZY20210800001/H1/C9/N41/S36/s01/T2 +ZY20210800001/H1/C9/N41/S36/s01/T1 +ZY20210800001/H1/C9/N40/S35/s05/T2 +ZY20210800001/H1/C9/N40/S35/s05/T1 +ZY20210800001/H1/C9/N39/S35/s05/T2 +ZY20210800001/H1/C9/N39/S35/s05/T1 +ZY20210800001/H1/C9/N38/S35/s04/T2 +ZY20210800001/H1/C9/N38/S35/s04/T1 +ZY20210800001/H1/C9/N37/S35/s04/T1 +ZY20210800001/H1/C9/N36/S35/s03/T2 +ZY20210800001/H1/C9/N36/S35/s03/T1 +ZY20210800001/H1/C9/N35/S35/s03/T2 +ZY20210800001/H1/C9/N35/S35/s03/T1 +ZY20210800001/H1/C9/N34/S35/s02/T2 +ZY20210800001/H1/C9/N34/S35/s02/T1 +ZY20210800001/H1/C9/N33/S35/s02/T2 +ZY20210800001/H1/C9/N33/S35/s02/T1 +ZY20210800001/H1/C9/N32/S35/s01/T2 +ZY20210800001/H1/C9/N32/S35/s01/T1 +ZY20210800001/H1/C9/N31/S35/s01/T2 +ZY20210800001/H1/C9/N31/S35/s01/T1 +ZY20210800001/H1/C9/N30/S34/s05/T2 +ZY20210800001/H1/C9/N29/S34/s05/T2 +ZY20210800001/H1/C9/N28/S34/s04/T2 +ZY20210800001/H1/C9/N27/S34/s04/T2 +ZY20210800001/H1/C9/N26/S34/s03/T2 +ZY20210800001/H1/C9/N25/S34/s03/T2 +ZY20210800001/H1/C9/N24/S34/s02/T2 +ZY20210800001/H1/C9/N23/S34/s02/T2 +ZY20210800001/H1/C9/N23/S34/s02/T1 +ZY20210800001/H1/C9/N21/S34/s01/T2 +ZY20210800001/H1/C9/N20/S33/s05/T1 +ZY20210800001/H1/C9/N19/S36/s01/T2 +ZY20210800001/H1/C9/N19/S36/s01/T1 +ZY20210800001/H1/C9/N18/S33/s04/T2 +ZY20210800001/H1/C9/N18/S33/s04/T1 +ZY20210800001/H1/C9/N17/S33/s04/T1 +ZY20210800001/H1/C9/N16/S33/s03/T2 +ZY20210800001/H1/C9/N16/S33/s03/T1 +ZY20210800001/H1/C9/N15/S33/s03/T2 +ZY20210800001/H1/C9/N15/S33/s03/T1 +ZY20210800001/H1/C9/N14/S33/s02/T2 +ZY20210800001/H1/C9/N14/S33/s02/T1 +ZY20210800001/H1/C9/N13/S33/s02/T2 +ZY20210800001/H1/C9/N13/S33/s02/T1 +ZY20210800001/H1/C9/N12/S33/s01/T2 +ZY20210800001/H1/C9/N12/S33/s01/T1 +ZY20210800001/H1/C9/N11/S33/s01/T2 +ZY20210800001/H1/C9/N11/S33/s01/T1 +ZY20210800001/H1/C8/N49/S319/s05/T2 +ZY20210800001/H1/C8/N48/S324/s02/T2 +ZY20210800001/H1/C8/N48/S319/s05/T2 +ZY20210800001/H1/C8/N47/S324/s02/T2 +ZY20210800001/H1/C8/N47/S319/s05/T2 +ZY20210800001/H1/C8/N46/S324/s02/T2 +ZY20210800001/H1/C8/N46/S319/s04/T2 +ZY20210800001/H1/C8/N45/S324/s02/T2 +ZY20210800001/H1/C8/N45/S319/s04/T2 +ZY20210800001/H1/C8/N44/S324/s01/T2 +ZY20210800001/H1/C8/N44/S319/s04/T2 +ZY20210800001/H1/C8/N43/S324/s01/T2 +ZY20210800001/H1/C8/N43/S319/s04/T2 +ZY20210800001/H1/C8/N42/S77/s02/T2 +ZY20210800001/H1/C8/N42/S77/s02/T1 +ZY20210800001/H1/C8/N42/S324/s01/T2 +ZY20210800001/H1/C8/N42/S319/s03/T2 +ZY20210800001/H1/C8/N42/S315/s01/T1 +ZY20210800001/H1/C8/N41/S77/s02/T2 +ZY20210800001/H1/C8/N41/S77/s02/T1 +ZY20210800001/H1/C8/N41/S324/s01/T2 +ZY20210800001/H1/C8/N41/S319/s03/T2 +ZY20210800001/H1/C8/N41/S315/s01/T1 +ZY20210800001/H1/C8/N40/S77/s01/T2 +ZY20210800001/H1/C8/N40/S77/s01/T1 +ZY20210800001/H1/C8/N40/S323/s05/T2 +ZY20210800001/H1/C8/N40/S319/s03/T2 +ZY20210800001/H1/C8/N40/S313/s05/T1 +ZY20210800001/H1/C8/N39/S77/s01/T2 +ZY20210800001/H1/C8/N39/S77/s01/T1 +ZY20210800001/H1/C8/N39/S323/s05/T2 +ZY20210800001/H1/C8/N39/S319/s03/T2 +ZY20210800001/H1/C8/N39/S313/s05/T1 +ZY20210800001/H1/C8/N38/S76/s05/T2 +ZY20210800001/H1/C8/N38/S323/s05/T2 +ZY20210800001/H1/C8/N38/S319/s02/T2 +ZY20210800001/H1/C8/N38/S313/s05/T1 +ZY20210800001/H1/C8/N37/S323/s05/T2 +ZY20210800001/H1/C8/N37/S319/s02/T2 +ZY20210800001/H1/C8/N37/S313/s05/T1 +ZY20210800001/H1/C8/N36/S323/s04/T2 +ZY20210800001/H1/C8/N36/S319/s02/T2 +ZY20210800001/H1/C8/N36/S313/s04/T1 +ZY20210800001/H1/C8/N35/S76/s04/T1 +ZY20210800001/H1/C8/N35/S323/s04/T2 +ZY20210800001/H1/C8/N35/S319/s02/T2 +ZY20210800001/H1/C8/N35/S313/s04/T1 +ZY20210800001/H1/C8/N34/S77/s04/T2 +ZY20210800001/H1/C8/N34/S77/s04/T1 +ZY20210800001/H1/C8/N34/S323/s04/T2 +ZY20210800001/H1/C8/N34/S319/s01/T2 +ZY20210800001/H1/C8/N34/S313/s04/T1 +ZY20210800001/H1/C8/N33/S77/s03/T2 +ZY20210800001/H1/C8/N33/S77/s03/T1 +ZY20210800001/H1/C8/N33/S323/s04/T2 +ZY20210800001/H1/C8/N33/S319/s01/T2 +ZY20210800001/H1/C8/N33/S313/s04/T1 +ZY20210800001/H1/C8/N32/S77/s03/T2 +ZY20210800001/H1/C8/N32/S77/s03/T1 +ZY20210800001/H1/C8/N32/S313/s03/T1 +ZY20210800001/H1/C8/N31/S77/s04/T2 +ZY20210800001/H1/C8/N31/S77/s04/T1 +ZY20210800001/H1/C8/N31/S323/s03/T2 +ZY20210800001/H1/C8/N31/S319/s01/T2 +ZY20210800001/H1/C8/N31/S313/s03/T1 +ZY20210800001/H1/C8/N30/S77/s05/T2 +ZY20210800001/H1/C8/N30/S77/s05/T1 +ZY20210800001/H1/C8/N30/S317/s05/T2 +ZY20210800001/H1/C8/N30/S313/s03/T1 +ZY20210800001/H1/C8/N29/S77/s05/T2 +ZY20210800001/H1/C8/N29/S77/s05/T1 +ZY20210800001/H1/C8/N29/S323/s03/T2 +ZY20210800001/H1/C8/N29/S317/s05/T2 +ZY20210800001/H1/C8/N29/S313/s03/T1 +ZY20210800001/H1/C8/N28/S78/s01/T2 +ZY20210800001/H1/C8/N28/S78/s01/T1 +ZY20210800001/H1/C8/N28/S323/s02/T2 +ZY20210800001/H1/C8/N28/S317/s05/T2 +ZY20210800001/H1/C8/N28/S313/s02/T1 +ZY20210800001/H1/C8/N27/S76/s03/T2 +ZY20210800001/H1/C8/N27/S76/s03/T1 +ZY20210800001/H1/C8/N27/S323/s02/T2 +ZY20210800001/H1/C8/N27/S317/s05/T2 +ZY20210800001/H1/C8/N27/S313/s02/T1 +ZY20210800001/H1/C8/N26/S76/s03/T2 +ZY20210800001/H1/C8/N26/S76/s03/T1 +ZY20210800001/H1/C8/N26/S323/s02/T2 +ZY20210800001/H1/C8/N26/S317/s04/T2 +ZY20210800001/H1/C8/N26/S313/s02/T1 +ZY20210800001/H1/C8/N25/S76/s02/T2 +ZY20210800001/H1/C8/N25/S76/s02/T1 +ZY20210800001/H1/C8/N25/S323/s02/T2 +ZY20210800001/H1/C8/N25/S321/s01/T2 +ZY20210800001/H1/C8/N25/S313/s02/T1 +ZY20210800001/H1/C8/N24/S76/s02/T2 +ZY20210800001/H1/C8/N24/S76/s02/T1 +ZY20210800001/H1/C8/N24/S323/s01/T2 +ZY20210800001/H1/C8/N24/S313/s01/T1 +ZY20210800001/H1/C8/N23/S76/s01/T2 +ZY20210800001/H1/C8/N23/S76/s01/T1 +ZY20210800001/H1/C8/N23/S323/s01/T2 +ZY20210800001/H1/C8/N23/S313/s01/T1 +ZY20210800001/H1/C8/N22/S76/s01/T1 +ZY20210800001/H1/C8/N22/S313/s01/T1 +ZY20210800001/H1/C8/N21/S74/s03/T2 +ZY20210800001/H1/C8/N21/S74/s03/T1 +ZY20210800001/H1/C8/N21/S323/s01/T2 +ZY20210800001/H1/C8/N21/S313/s01/T1 +ZY20210800001/H1/C8/N20/S321/s05/T2 +ZY20210800001/H1/C8/N20/S311/s05/T1 +ZY20210800001/H1/C8/N19/S74/s02/T2 +ZY20210800001/H1/C8/N19/S74/s02/T1 +ZY20210800001/H1/C8/N19/S321/s05/T2 +ZY20210800001/H1/C8/N19/S311/s05/T1 +ZY20210800001/H1/C8/N18/S74/s02/T2 +ZY20210800001/H1/C8/N18/S74/s02/T1 +ZY20210800001/H1/C8/N18/S321/s05/T2 +ZY20210800001/H1/C8/N18/S311/s05/T1 +ZY20210800001/H1/C8/N17/S368/s01/T1 +ZY20210800001/H1/C8/N17/S367/s03/T2 +ZY20210800001/H1/C8/N17/S367/s03/T1 +ZY20210800001/H1/C8/N17/S321/s05/T2 +ZY20210800001/H1/C8/N17/S311/s05/T1 +ZY20210800001/H1/C8/N16/S74/s01/T2 +ZY20210800001/H1/C8/N16/S321/s04/T2 +ZY20210800001/H1/C8/N16/S311/s04/T1 +ZY20210800001/H1/C8/N15/S73/s03/T2 +ZY20210800001/H1/C8/N15/S73/s03/T1 +ZY20210800001/H1/C8/N15/S321/s04/T2 +ZY20210800001/H1/C8/N15/S311/s04/T1 +ZY20210800001/H1/C8/N14/S73/s02/T2 +ZY20210800001/H1/C8/N14/S73/s02/T1 +ZY20210800001/H1/C8/N14/S321/s04/T2 +ZY20210800001/H1/C8/N14/S311/s04/T1 +ZY20210800001/H1/C8/N13/S73/s02/T2 +ZY20210800001/H1/C8/N13/S73/s02/T1 +ZY20210800001/H1/C8/N13/S321/s04/T2 +ZY20210800001/H1/C8/N13/S311/s04/T1 +ZY20210800001/H1/C8/N12/S73/s01/T2 +ZY20210800001/H1/C8/N12/S73/s01/T1 +ZY20210800001/H1/C8/N12/S321/s03/T2 +ZY20210800001/H1/C8/N12/S311/s03/T1 +ZY20210800001/H1/C8/N11/S73/s01/T2 +ZY20210800001/H1/C8/N11/S73/s01/T1 +ZY20210800001/H1/C8/N11/S321/s03/T2 +ZY20210800001/H1/C8/N11/S311/s03/T1 +ZY20210800001/H1/C7/N50/S278/s05/T4 +ZY20210800001/H1/C7/N50/S274/s03/T2 +ZY20210800001/H1/C7/N49/S278/s05/T4 +ZY20210800001/H1/C7/N49/S274/s03/T2 +ZY20210800001/H1/C7/N48/S285/s02/T6 +ZY20210800001/H1/C7/N48/S278/s05/T4 +ZY20210800001/H1/C7/N48/S274/s02/T2 +ZY20210800001/H1/C7/N47/S285/s02/T6 +ZY20210800001/H1/C7/N47/S278/s05/T4 +ZY20210800001/H1/C7/N47/S274/s02/T2 +ZY20210800001/H1/C7/N46/S285/s02/T6 +ZY20210800001/H1/C7/N46/S278/s04/T4 +ZY20210800001/H1/C7/N46/S274/s02/T2 +ZY20210800001/H1/C7/N45/S285/s02/T6 +ZY20210800001/H1/C7/N45/S278/s04/T4 +ZY20210800001/H1/C7/N45/S274/s02/T2 +ZY20210800001/H1/C7/N44/S285/s01/T6 +ZY20210800001/H1/C7/N44/S278/s04/T4 +ZY20210800001/H1/C7/N44/S274/s01/T2 +ZY20210800001/H1/C7/N43/S285/s01/T6 +ZY20210800001/H1/C7/N43/S278/s04/T4 +ZY20210800001/H1/C7/N43/S274/s01/T2 +ZY20210800001/H1/C7/N42/S285/s01/T6 +ZY20210800001/H1/C7/N42/S278/s03/T4 +ZY20210800001/H1/C7/N42/S274/s01/T2 +ZY20210800001/H1/C7/N41/S285/s01/T6 +ZY20210800001/H1/C7/N41/S278/s03/T4 +ZY20210800001/H1/C7/N41/S274/s01/T2 +ZY20210800001/H1/C7/N40/S283/s05/T6 +ZY20210800001/H1/C7/N40/S278/s03/T4 +ZY20210800001/H1/C7/N40/S272/s05/T2 +ZY20210800001/H1/C7/N39/S61/s03/T2 +ZY20210800001/H1/C7/N39/S61/s03/T1 +ZY20210800001/H1/C7/N39/S283/s05/T6 +ZY20210800001/H1/C7/N39/S278/s03/T4 +ZY20210800001/H1/C7/N39/S272/s05/T2 +ZY20210800001/H1/C7/N38/S61/s03/T2 +ZY20210800001/H1/C7/N38/S61/s03/T1 +ZY20210800001/H1/C7/N38/S278/s02/T4 +ZY20210800001/H1/C7/N38/S272/s05/T2 +ZY20210800001/H1/C7/N37/S61/s02/T2 +ZY20210800001/H1/C7/N37/S61/s02/T1 +ZY20210800001/H1/C7/N37/S278/s02/T4 +ZY20210800001/H1/C7/N37/S272/s05/T2 +ZY20210800001/H1/C7/N36/S61/s02/T2 +ZY20210800001/H1/C7/N36/S61/s02/T1 +ZY20210800001/H1/C7/N36/S278/s02/T4 +ZY20210800001/H1/C7/N36/S272/s04/T2 +ZY20210800001/H1/C7/N35/S61/s01/T2 +ZY20210800001/H1/C7/N35/S61/s01/T1 +ZY20210800001/H1/C7/N35/S278/s02/T4 +ZY20210800001/H1/C7/N35/S272/s04/T2 +ZY20210800001/H1/C7/N34/S61/s01/T2 +ZY20210800001/H1/C7/N34/S61/s01/T1 +ZY20210800001/H1/C7/N34/S278/s01/T4 +ZY20210800001/H1/C7/N34/S272/s04/T2 +ZY20210800001/H1/C7/N33/S60/s05/T2 +ZY20210800001/H1/C7/N33/S60/s05/T1 +ZY20210800001/H1/C7/N33/S278/s01/T4 +ZY20210800001/H1/C7/N33/S272/s04/T2 +ZY20210800001/H1/C7/N32/S60/s05/T2 +ZY20210800001/H1/C7/N32/S60/s05/T1 +ZY20210800001/H1/C7/N32/S278/s01/T4 +ZY20210800001/H1/C7/N32/S272/s03/T2 +ZY20210800001/H1/C7/N31/S60/s04/T2 +ZY20210800001/H1/C7/N31/S60/s04/T1 +ZY20210800001/H1/C7/N31/S278/s01/T4 +ZY20210800001/H1/C7/N31/S272/s03/T2 +ZY20210800001/H1/C7/N30/S60/s04/T2 +ZY20210800001/H1/C7/N30/S60/s04/T1 +ZY20210800001/H1/C7/N30/S276/s05/T4 +ZY20210800001/H1/C7/N30/S272/s03/T2 +ZY20210800001/H1/C7/N29/S60/s02/T2 +ZY20210800001/H1/C7/N29/S60/s02/T1 +ZY20210800001/H1/C7/N29/S276/s05/T4 +ZY20210800001/H1/C7/N29/S272/s03/T2 +ZY20210800001/H1/C7/N28/S60/s02/T2 +ZY20210800001/H1/C7/N28/S60/s02/T1 +ZY20210800001/H1/C7/N28/S276/s05/T4 +ZY20210800001/H1/C7/N28/S272/s02/T2 +ZY20210800001/H1/C7/N27/S60/s03/T2 +ZY20210800001/H1/C7/N27/S60/s03/T1 +ZY20210800001/H1/C7/N27/S276/s05/T4 +ZY20210800001/H1/C7/N27/S272/s02/T2 +ZY20210800001/H1/C7/N26/S60/s03/T2 +ZY20210800001/H1/C7/N26/S60/s03/T1 +ZY20210800001/H1/C7/N26/S276/s04/T4 +ZY20210800001/H1/C7/N26/S272/s02/T2 +ZY20210800001/H1/C7/N25/S60/s01/T2 +ZY20210800001/H1/C7/N25/S60/s01/T1 +ZY20210800001/H1/C7/N25/S276/s04/T3 +ZY20210800001/H1/C7/N25/S272/s02/T1 +ZY20210800001/H1/C7/N24/S59/s03/T2 +ZY20210800001/H1/C7/N24/S59/s03/T1 +ZY20210800001/H1/C7/N24/S276/s04/T3 +ZY20210800001/H1/C7/N24/S272/s01/T1 +ZY20210800001/H1/C7/N23/S59/s03/T2 +ZY20210800001/H1/C7/N23/S59/s03/T1 +ZY20210800001/H1/C7/N23/S276/s04/T3 +ZY20210800001/H1/C7/N23/S272/s01/T1 +ZY20210800001/H1/C7/N22/S60/s01/T2 +ZY20210800001/H1/C7/N22/S60/s01/T1 +ZY20210800001/H1/C7/N22/S276/s03/T3 +ZY20210800001/H1/C7/N22/S272/s01/T1 +ZY20210800001/H1/C7/N21/S59/s04/T1 +ZY20210800001/H1/C7/N21/S276/s03/T3 +ZY20210800001/H1/C7/N21/S272/s01/T1 +ZY20210800001/H1/C7/N20/S59/s02/T2 +ZY20210800001/H1/C7/N20/S59/s02/T1 +ZY20210800001/H1/C7/N20/S276/s03/T3 +ZY20210800001/H1/C7/N20/S270/s05/T1 +ZY20210800001/H1/C7/N19/S59/s05/T2 +ZY20210800001/H1/C7/N19/S59/s05/T1 +ZY20210800001/H1/C7/N19/S276/s03/T3 +ZY20210800001/H1/C7/N19/S270/s05/T1 +ZY20210800001/H1/C7/N18/S59/s05/T2 +ZY20210800001/H1/C7/N18/S59/s05/T1 +ZY20210800001/H1/C7/N18/S276/s02/T3 +ZY20210800001/H1/C7/N18/S270/s05/T1 +ZY20210800001/H1/C7/N17/S59/s04/T2 +ZY20210800001/H1/C7/N17/S59/s04/T1 +ZY20210800001/H1/C7/N17/S276/s02/T3 +ZY20210800001/H1/C7/N17/S270/s05/T1 +ZY20210800001/H1/C7/N16/S59/s02/T2 +ZY20210800001/H1/C7/N16/S59/s02/T1 +ZY20210800001/H1/C7/N16/S276/s02/T3 +ZY20210800001/H1/C7/N16/S270/s04/T1 +ZY20210800001/H1/C7/N15/S276/s02/T3 +ZY20210800001/H1/C7/N15/S270/s04/T1 +ZY20210800001/H1/C7/N14/S280/s04/T5 +ZY20210800001/H1/C7/N14/S276/s01/T3 +ZY20210800001/H1/C7/N14/S270/s04/T1 +ZY20210800001/H1/C7/N13/S280/s04/T5 +ZY20210800001/H1/C7/N13/S276/s01/T3 +ZY20210800001/H1/C7/N13/S270/s04/T1 +ZY20210800001/H1/C7/N12/S280/s03/T5 +ZY20210800001/H1/C7/N12/S276/s01/T3 +ZY20210800001/H1/C7/N12/S270/s03/T1 +ZY20210800001/H1/C7/N11/S280/s03/T5 +ZY20210800001/H1/C7/N11/S276/s01/T3 +ZY20210800001/H1/C7/N11/S270/s03/T1 +ZY20210800001/H1/C6/N37/S248/s05/T3 +ZY20210800001/H1/C6/N33/S87/s03/T2 +ZY20210800001/H1/C6/N33/S248/s04/T3 +ZY20210800001/H1/C6/N32/S87/s02/T1 +ZY20210800001/H1/C6/N32/S248/s03/T3 +ZY20210800001/H1/C6/N30/S248/s03/T3 +ZY20210800001/H1/C6/N29/S248/s03/T3 +ZY20210800001/H1/C6/N28/S87/s01/T2 +ZY20210800001/H1/C6/N25/S86/s01/T1 +ZY20210800001/H1/C6/N25/S248/s02/T2 +ZY20210800001/H1/C6/N24/S248/s01/T2 +ZY20210800001/H1/C6/N21/S86/s03/T1 +ZY20210800001/H1/C6/N21/S248/s01/T2 +ZY20210800001/H1/C6/N20/S247/s05/T2 +ZY20210800001/H1/C6/N19/S86/s01/T2 +ZY20210800001/H1/C6/N19/S247/s05/T2 +ZY20210800001/H1/C6/N16/S85/s03/T1 +ZY20210800001/H1/C6/N16/S247/s04/T2 +ZY20210800001/H1/C6/N15/S85/s03/T2 +ZY20210800001/H1/C6/N15/S247/s04/T2 +ZY20210800001/H1/C6/N14/S85/s02/T2 +ZY20210800001/H1/C6/N14/S247/s04/T2 +ZY20210800001/H1/C6/N11/S247/s03/T1 +ZY20210800001/H1/C6/N10/S247/s03/T1 +ZY20210800001/H1/C6/N09/S247/s03/T1 +ZY20210800001/H1/C6/N07/S82/s04/T2 +ZY20210800001/H1/C6/N07/S82/s04/T1 +ZY20210800001/H1/C6/N07/S247/s02/T1 +ZY20210800001/H1/C6/N06/S82/s03/T2 +ZY20210800001/H1/C6/N06/S247/s02/T1 +ZY20210800001/H1/C6/N05/S247/s02/T1 +ZY20210800001/H1/C6/N04/S247/s01/T1 +ZY20210800001/H1/C6/N03/S82/s02/T2 +ZY20210800001/H1/C6/N03/S82/s02/T1 +ZY20210800001/H1/C6/N03/S247/s01/T1 +ZY20210800001/H1/C6/N02/S82/s01/T2 +ZY20210800001/H1/C6/N02/S247/s01/T1 +ZY20210800001/H1/C6/N01/S82/s01/T2 +ZY20210800001/H1/C6/N01/S247/s01/T1 +ZY20210800001/H1/C5/N47/S57/s05/T2 +ZY20210800001/H1/C5/N47/S57/s05/T1 +ZY20210800001/H1/C5/N46/S57/s05/T2 +ZY20210800001/H1/C5/N46/S57/s05/T1 +ZY20210800001/H1/C5/N15/S57/s03/T2 +ZY20210800001/H1/C5/N15/S57/s03/T1 +ZY20210800001/H1/C4/N75/S387/s05/T2 +ZY20210800001/H1/C4/N75/S387/s04/T4 +ZY20210800001/H1/C4/N75/S387/s03/T3 +ZY20210800001/H1/C4/N75/S387/s02/T2 +ZY20210800001/H1/C4/N75/S387/s01/T1 +ZY20210800001/H1/C4/N74/S387/s05/T2 +ZY20210800001/H1/C4/N74/S387/s04/T4 +ZY20210800001/H1/C4/N74/S387/s03/T3 +ZY20210800001/H1/C4/N74/S387/s02/T2 +ZY20210800001/H1/C4/N74/S387/s01/T1 +ZY20210800001/H1/C4/N73/S386/s05/T2 +ZY20210800001/H1/C4/N73/S386/s04/T4 +ZY20210800001/H1/C4/N73/S386/s03/T3 +ZY20210800001/H1/C4/N73/S386/s02/T2 +ZY20210800001/H1/C4/N73/S386/s01/T1 +ZY20210800001/H1/C4/N72/S386/s05/T2 +ZY20210800001/H1/C4/N72/S386/s04/T4 +ZY20210800001/H1/C4/N72/S386/s03/T3 +ZY20210800001/H1/C4/N72/S386/s02/T2 +ZY20210800001/H1/C4/N72/S386/s01/T1 +ZY20210800001/H1/C4/N71/S386/s05/T2 +ZY20210800001/H1/C4/N71/S386/s04/T4 +ZY20210800001/H1/C4/N71/S386/s03/T3 +ZY20210800001/H1/C4/N71/S386/s02/T2 +ZY20210800001/H1/C4/N71/S386/s01/T1 +ZY20210800001/H1/C4/N70/S386/s05/T2 +ZY20210800001/H1/C4/N70/S386/s04/T4 +ZY20210800001/H1/C4/N70/S386/s03/T3 +ZY20210800001/H1/C4/N70/S386/s02/T2 +ZY20210800001/H1/C4/N70/S386/s01/T1 +ZY20210800001/H1/C4/N69/S392/s05/T4 +ZY20210800001/H1/C4/N69/S392/s04/T4 +ZY20210800001/H1/C4/N69/S392/s02/T2 +ZY20210800001/H1/C4/N69/S392/s01/T1 +ZY20210800001/H1/C4/N68/S391/s05/T4 +ZY20210800001/H1/C4/N68/S391/s04/T4 +ZY20210800001/H1/C4/N68/S391/s03/T3 +ZY20210800001/H1/C4/N68/S391/s02/T2 +ZY20210800001/H1/C4/N68/S391/s01/T1 +ZY20210800001/H1/C4/N67/S391/s05/T4 +ZY20210800001/H1/C4/N67/S391/s04/T4 +ZY20210800001/H1/C4/N67/S391/s03/T3 +ZY20210800001/H1/C4/N67/S391/s02/T2 +ZY20210800001/H1/C4/N66/S391/s05/T4 +ZY20210800001/H1/C4/N66/S391/s04/T4 +ZY20210800001/H1/C4/N66/S391/s03/T3 +ZY20210800001/H1/C4/N66/S391/s02/T2 +ZY20210800001/H1/C4/N66/S391/s01/T1 +ZY20210800001/H1/C4/N65/S391/s05/T4 +ZY20210800001/H1/C4/N65/S391/s04/T4 +ZY20210800001/H1/C4/N65/S391/s02/T2 +ZY20210800001/H1/C4/N65/S391/s01/T1 +ZY20210800001/H1/C4/N64/S385/s05/T1 +ZY20210800001/H1/C4/N64/S385/s04/T4 +ZY20210800001/H1/C4/N64/S385/s03/T3 +ZY20210800001/H1/C4/N64/S385/s02/T2 +ZY20210800001/H1/C4/N64/S385/s01/T1 +ZY20210800001/H1/C4/N63/S385/s05/T1 +ZY20210800001/H1/C4/N63/S385/s04/T4 +ZY20210800001/H1/C4/N63/S385/s03/T3 +ZY20210800001/H1/C4/N63/S385/s02/T2 +ZY20210800001/H1/C4/N63/S385/s01/T1 +ZY20210800001/H1/C4/N62/S385/s05/T1 +ZY20210800001/H1/C4/N62/S385/s04/T4 +ZY20210800001/H1/C4/N62/S385/s03/T3 +ZY20210800001/H1/C4/N62/S385/s02/T2 +ZY20210800001/H1/C4/N62/S385/s01/T1 +ZY20210800001/H1/C4/N61/S388/s05/T4 +ZY20210800001/H1/C4/N61/S388/s04/T4 +ZY20210800001/H1/C4/N61/S388/s03/T3 +ZY20210800001/H1/C4/N61/S388/s02/T2 +ZY20210800001/H1/C4/N61/S388/s01/T1 +ZY20210800001/H1/C4/N40/S22/s01/T1 +ZY20210800001/H1/C4/N39/S22/s01/T2 +ZY20210800001/H1/C4/N39/S22/s01/T1 +ZY20210800001/H1/C4/N38/S21/s05/T2 +ZY20210800001/H1/C4/N38/S21/s05/T1 +ZY20210800001/H1/C4/N37/S21/s05/T2 +ZY20210800001/H1/C4/N37/S21/s05/T1 +ZY20210800001/H1/C4/N36/S21/s04/T1 +ZY20210800001/H1/C4/N35/S21/s04/T2 +ZY20210800001/H1/C4/N35/S21/s04/T1 +ZY20210800001/H1/C4/N34/S21/s03/T1 +ZY20210800001/H1/C4/N33/S22/s02/T2 +ZY20210800001/H1/C4/N33/S22/s02/T1 +ZY20210800001/H1/C4/N27/S21/s01/T2 +ZY20210800001/H1/C4/N27/S21/s01/T1 +ZY20210800001/H1/C4/N10/S20/s04/T2 +ZY20210800001/H1/C4/N10/S20/s04/T1 +ZY20210800001/H1/C4/N08/S20/s01/T1 +ZY20210800001/H1/C4/N05/S20/s03/T2 +ZY20210800001/H1/C4/N05/S20/s03/T1 +ZY20210800001/H1/C4/N04/S20/s02/T2 +ZY20210800001/H1/C4/N04/S20/s02/T1 +ZY20210800001/H1/C4/N03/S20/s01/T2 +ZY20210800001/H1/C4/N02/S20/s04/T2 +ZY20210800001/H1/C4/N02/S20/s04/T1 +ZY20210800001/H1/C4/N01/S19/s05/T2 +ZY20210800001/H1/C4/N01/S19/s05/T1 +ZY20210800001/H1/C3/N46/S114/s03/T2 +ZY20210800001/H1/C3/N46/S114/s03/T1 +ZY20210800001/H1/C3/N44/S115/s03/T2 +ZY20210800001/H1/C3/N44/S115/s03/T1 +ZY20210800001/H1/C3/N40/S114/s02/T2 +ZY20210800001/H1/C3/N40/S114/s02/T1 +ZY20210800001/H1/C3/N33/S114/s05/T2 +ZY20210800001/H1/C3/N33/S114/s05/T1 +ZY20210800001/H1/C3/N28/S19/s03/T2 +ZY20210800001/H1/C3/N28/S19/s03/T1 +ZY20210800001/H1/C3/N25/S19/s02/T2 +ZY20210800001/H1/C3/N25/S19/s02/T1 +ZY20210800001/H1/C3/N23/S19/s01/T2 +ZY20210800001/H1/C3/N23/S19/s01/T1 +ZY20210800001/H1/C3/N20/S27/s04/T2 +ZY20210800001/H1/C3/N14/S27/s01/T2 +ZY20210800001/H1/C3/N13/S27/s01/T2 +ZY20210800001/H1/C3/N08/S28/s05/T2 +ZY20210800001/H1/C3/N08/S28/s05/T1 +ZY20210800001/H1/C3/N01/S54/s05/T2 +ZY20210800001/H1/C20/N48/S381/s04/T4 +ZY20210800001/H1/C20/N48/S381/s03/T3 +ZY20210800001/H1/C20/N48/S381/s02/T2 +ZY20210800001/H1/C20/N48/S381/s01/T1 +ZY20210800001/H1/C20/N47/S381/s04/T4 +ZY20210800001/H1/C20/N47/S381/s03/T3 +ZY20210800001/H1/C20/N47/S381/s02/T2 +ZY20210800001/H1/C20/N47/S381/s01/T1 +ZY20210800001/H1/C20/N34/S295/s05/T4 +ZY20210800001/H1/C20/N34/S292/s05/T3 +ZY20210800001/H1/C20/N34/S289/s05/T2 +ZY20210800001/H1/C20/N34/S286/s05/T1 +ZY20210800001/H1/C20/N33/S295/s04/T4 +ZY20210800001/H1/C20/N33/S292/s04/T3 +ZY20210800001/H1/C20/N33/S289/s04/T2 +ZY20210800001/H1/C20/N33/S286/s04/T1 +ZY20210800001/H1/C20/N32/S295/s04/T4 +ZY20210800001/H1/C20/N32/S289/s04/T2 +ZY20210800001/H1/C20/N32/S286/s04/T1 +ZY20210800001/H1/C20/N31/S295/s04/T4 +ZY20210800001/H1/C20/N31/S292/s04/T3 +ZY20210800001/H1/C20/N31/S289/s04/T2 +ZY20210800001/H1/C20/N31/S286/s04/T1 +ZY20210800001/H1/C20/N30/S295/s04/T4 +ZY20210800001/H1/C20/N30/S292/s04/T3 +ZY20210800001/H1/C20/N30/S289/s04/T2 +ZY20210800001/H1/C20/N30/S286/s04/T1 +ZY20210800001/H1/C20/N29/S295/s03/T4 +ZY20210800001/H1/C20/N29/S292/s03/T3 +ZY20210800001/H1/C20/N29/S289/s03/T2 +ZY20210800001/H1/C20/N29/S286/s03/T1 +ZY20210800001/H1/C20/N28/S295/s03/T4 +ZY20210800001/H1/C20/N28/S292/s03/T3 +ZY20210800001/H1/C20/N28/S289/s03/T2 +ZY20210800001/H1/C20/N28/S286/s03/T1 +ZY20210800001/H1/C20/N27/S295/s03/T4 +ZY20210800001/H1/C20/N27/S292/s03/T3 +ZY20210800001/H1/C20/N27/S289/s03/T2 +ZY20210800001/H1/C20/N27/S286/s03/T1 +ZY20210800001/H1/C20/N25/S295/s02/T4 +ZY20210800001/H1/C20/N25/S292/s02/T3 +ZY20210800001/H1/C20/N25/S289/s02/T2 +ZY20210800001/H1/C20/N25/S286/s02/T1 +ZY20210800001/H1/C20/N24/S295/s02/T4 +ZY20210800001/H1/C20/N24/S292/s02/T3 +ZY20210800001/H1/C20/N24/S289/s02/T2 +ZY20210800001/H1/C20/N24/S286/s02/T1 +ZY20210800001/H1/C20/N23/S295/s02/T4 +ZY20210800001/H1/C20/N23/S292/s02/T3 +ZY20210800001/H1/C20/N23/S289/s02/T2 +ZY20210800001/H1/C20/N23/S286/s02/T1 +ZY20210800001/H1/C20/N22/S382/s03/T3 +ZY20210800001/H1/C20/N22/S382/s02/T2 +ZY20210800001/H1/C20/N22/S382/s01/T1 +ZY20210800001/H1/C20/N21/S382/s04/T4 +ZY20210800001/H1/C20/N21/S382/s03/T3 +ZY20210800001/H1/C20/N21/S382/s02/T2 +ZY20210800001/H1/C20/N21/S382/s01/T1 +ZY20210800001/H1/C20/N20/S381/s04/T4 +ZY20210800001/H1/C20/N20/S381/s03/T3 +ZY20210800001/H1/C20/N20/S381/s02/T2 +ZY20210800001/H1/C20/N20/S381/s01/T1 +ZY20210800001/H1/C20/N19/S381/s04/T4 +ZY20210800001/H1/C20/N19/S381/s03/T3 +ZY20210800001/H1/C20/N19/S381/s02/T2 +ZY20210800001/H1/C20/N19/S381/s01/T1 +ZY20210800001/H1/C20/N18/S295/s01/T4 +ZY20210800001/H1/C20/N18/S292/s01/T3 +ZY20210800001/H1/C20/N18/S289/s01/T2 +ZY20210800001/H1/C20/N18/S286/s01/T1 +ZY20210800001/H1/C2/N49/S54/s04/T2 +ZY20210800001/H1/C2/N49/S54/s04/T1 +ZY20210800001/H1/C2/N48/S54/s03/T2 +ZY20210800001/H1/C2/N48/S54/s03/T1 +ZY20210800001/H1/C2/N48/S214/s02/T6 +ZY20210800001/H1/C2/N47/S54/s03/T2 +ZY20210800001/H1/C2/N47/S54/s03/T1 +ZY20210800001/H1/C2/N47/S214/s02/T6 +ZY20210800001/H1/C2/N46/S54/s02/T2 +ZY20210800001/H1/C2/N46/S54/s02/T1 +ZY20210800001/H1/C2/N46/S214/s02/T6 +ZY20210800001/H1/C2/N45/S54/s02/T2 +ZY20210800001/H1/C2/N45/S54/s02/T1 +ZY20210800001/H1/C2/N45/S214/s02/T6 +ZY20210800001/H1/C2/N44/S214/s01/T6 +ZY20210800001/H1/C2/N43/S214/s01/T6 +ZY20210800001/H1/C2/N42/S63/s05/T2 +ZY20210800001/H1/C2/N42/S63/s05/T1 +ZY20210800001/H1/C2/N42/S214/s01/T6 +ZY20210800001/H1/C2/N41/S63/s05/T2 +ZY20210800001/H1/C2/N41/S63/s05/T1 +ZY20210800001/H1/C2/N41/S214/s01/T6 +ZY20210800001/H1/C2/N40/S213/s05/T5 +ZY20210800001/H1/C2/N39/S63/s04/T2 +ZY20210800001/H1/C2/N39/S63/s04/T1 +ZY20210800001/H1/C2/N39/S213/s05/T5 +ZY20210800001/H1/C2/N38/S63/s03/T2 +ZY20210800001/H1/C2/N38/S63/s03/T1 +ZY20210800001/H1/C2/N38/S213/s05/T5 +ZY20210800001/H1/C2/N37/S63/s03/T2 +ZY20210800001/H1/C2/N37/S63/s03/T1 +ZY20210800001/H1/C2/N37/S213/s05/T5 +ZY20210800001/H1/C2/N36/S63/s02/T2 +ZY20210800001/H1/C2/N36/S213/s04/T5 +ZY20210800001/H1/C2/N35/S213/s04/T5 +ZY20210800001/H1/C2/N34/S63/s01/T1 +ZY20210800001/H1/C2/N34/S213/s04/T1 +ZY20210800001/H1/C2/N33/S63/s01/T1 +ZY20210800001/H1/C2/N33/S213/s04/T5 +ZY20210800001/H1/C2/N32/S92/s05/T2 +ZY20210800001/H1/C2/N32/S92/s05/T1 +ZY20210800001/H1/C2/N32/S213/s03/T4 +ZY20210800001/H1/C2/N31/S92/s05/T2 +ZY20210800001/H1/C2/N31/S92/s05/T1 +ZY20210800001/H1/C2/N31/S213/s03/T4 +ZY20210800001/H1/C2/N30/S92/s04/T1 +ZY20210800001/H1/C2/N30/S214/s03/T1 +ZY20210800001/H1/C2/N30/S213/s03/T4 +ZY20210800001/H1/C2/N29/S92/s04/T2 +ZY20210800001/H1/C2/N29/S213/s03/T4 +ZY20210800001/H1/C2/N28/S92/s03/T2 +ZY20210800001/H1/C2/N28/S92/s03/T1 +ZY20210800001/H1/C2/N28/S213/s02/T4 +ZY20210800001/H1/C2/N27/S92/s03/T1 +ZY20210800001/H1/C2/N27/S213/s02/T4 +ZY20210800001/H1/C2/N26/S27/s02/T1 +ZY20210800001/H1/C2/N26/S213/s02/T4 +ZY20210800001/H1/C2/N25/S27/s02/T2 +ZY20210800001/H1/C2/N25/S27/s02/T1 +ZY20210800001/H1/C2/N25/S213/s02/T4 +ZY20210800001/H1/C2/N24/S214/s04/T1 +ZY20210800001/H1/C2/N24/S213/s01/T3 +ZY20210800001/H1/C2/N23/S27/s01/T2 +ZY20210800001/H1/C2/N23/S27/s01/T1 +ZY20210800001/H1/C2/N23/S213/s01/T3 +ZY20210800001/H1/C2/N22/S93/s05/T1 +ZY20210800001/H1/C2/N22/S213/s01/T3 +ZY20210800001/H1/C2/N21/S93/s05/T1 +ZY20210800001/H1/C2/N21/S213/s01/T3 +ZY20210800001/H1/C2/N20/S93/s04/T1 +ZY20210800001/H1/C2/N20/S212/s05/T3 +ZY20210800001/H1/C2/N19/S212/s05/T3 +ZY20210800001/H1/C2/N18/S93/s03/T2 +ZY20210800001/H1/C2/N18/S93/s03/T1 +ZY20210800001/H1/C2/N18/S212/s05/T3 +ZY20210800001/H1/C2/N17/S212/s05/T3 +ZY20210800001/H1/C2/N16/S93/s02/T1 +ZY20210800001/H1/C2/N16/S212/s04/T2 +ZY20210800001/H1/C2/N15/S93/s02/T2 +ZY20210800001/H1/C2/N15/S214/s03/T1 +ZY20210800001/H1/C2/N15/S212/s04/T2 +ZY20210800001/H1/C2/N14/S93/s01/T2 +ZY20210800001/H1/C2/N14/S93/s01/T1 +ZY20210800001/H1/C2/N14/S212/s04/T2 +ZY20210800001/H1/C2/N13/S93/s01/T1 +ZY20210800001/H1/C2/N13/S214/s03/T1 +ZY20210800001/H1/C2/N13/S212/s04/T2 +ZY20210800001/H1/C2/N12/S212/s03/T2 +ZY20210800001/H1/C2/N11/S212/s03/T2 +ZY20210800001/H1/C18/N50/S202/s03/T2 +ZY20210800001/H1/C18/N50/S150/s02/T1 +ZY20210800001/H1/C18/N48/S202/s03/T2 +ZY20210800001/H1/C18/N48/S150/s01/T1 +ZY20210800001/H1/C18/N47/S150/s01/T1 +ZY20210800001/H1/C18/N46/S202/s03/T2 +ZY20210800001/H1/C18/N46/S150/s01/T1 +ZY20210800001/H1/C18/N44/S394/s01/T1 +ZY20210800001/H1/C18/N43/S147/s05/T1 +ZY20210800001/H1/C18/N42/S202/s02/T2 +ZY20210800001/H1/C18/N42/S147/s05/T1 +ZY20210800001/H1/C18/N41/S147/s04/T1 +ZY20210800001/H1/C18/N40/S202/s02/T2 +ZY20210800001/H1/C18/N40/S147/s04/T1 +ZY20210800001/H1/C18/N39/S147/s04/T1 +ZY20210800001/H1/C18/N38/S394/s01/T1 +ZY20210800001/H1/C18/N37/S147/s03/T1 +ZY20210800001/H1/C18/N36/S147/s03/T1 +ZY20210800001/H1/C18/N35/S147/s03/T1 +ZY20210800001/H1/C18/N34/S147/s03/T1 +ZY20210800001/H1/C18/N32/S147/s02/T1 +ZY20210800001/H1/C18/N31/S147/s02/T1 +ZY20210800001/H1/C18/N30/S147/s02/T1 +ZY20210800001/H1/C18/N25/S202/s02/T2 +ZY20210800001/H1/C18/N24/S202/s01/T2 +ZY20210800001/H1/C18/N23/S202/s01/T2 +ZY20210800001/H1/C18/N23/S150/s03/T1 +ZY20210800001/H1/C18/N22/S202/s01/T2 +ZY20210800001/H1/C18/N21/S202/s01/T2 +ZY20210800001/H1/C18/N21/S150/s03/T1 +ZY20210800001/H1/C18/N20/S199/s05/T2 +ZY20210800001/H1/C18/N19/S199/s05/T2 +ZY20210800001/H1/C18/N19/S150/s02/T1 +ZY20210800001/H1/C18/N18/S199/s05/T2 +ZY20210800001/H1/C18/N17/S199/s05/T2 +ZY20210800001/H1/C18/N17/S150/s02/T1 +ZY20210800001/H1/C18/N16/S199/s04/T2 +ZY20210800001/H1/C18/N15/S199/s04/T2 +ZY20210800001/H1/C18/N14/S199/s04/T2 +ZY20210800001/H1/C18/N13/S199/s04/T2 +ZY20210800001/H1/C18/N12/S199/s03/T2 +ZY20210800001/H1/C18/N11/S199/s03/T2 +ZY20210800001/H1/C17/N76/S380/s05/T2 +ZY20210800001/H1/C17/N76/S380/s04/T1 +ZY20210800001/H1/C17/N76/S380/s03/T3 +ZY20210800001/H1/C17/N76/S380/s02/T2 +ZY20210800001/H1/C17/N76/S380/s01/T1 +ZY20210800001/H1/C17/N75/S266/s02/T3 +ZY20210800001/H1/C17/N74/S266/s01/T3 +ZY20210800001/H1/C17/N73/S266/s01/T3 +ZY20210800001/H1/C17/N72/S266/s01/T3 +ZY20210800001/H1/C17/N71/S266/s01/T2 +ZY20210800001/H1/C17/N70/S264/s05/T2 +ZY20210800001/H1/C17/N69/S264/s05/T2 +ZY20210800001/H1/C17/N68/S363/s03/T3 +ZY20210800001/H1/C17/N68/S363/s02/T2 +ZY20210800001/H1/C17/N67/S264/s05/T2 +ZY20210800001/H1/C17/N66/S264/s04/T2 +ZY20210800001/H1/C17/N65/S264/s04/T2 +ZY20210800001/H1/C17/N64/S264/s04/T2 +ZY20210800001/H1/C17/N63/S264/s04/T2 +ZY20210800001/H1/C17/N62/S266/s03/T3 +ZY20210800001/H1/C17/N62/S264/s03/T2 +ZY20210800001/H1/C17/N61/S266/s03/T3 +ZY20210800001/H1/C17/N61/S264/s03/T1 +ZY20210800001/H1/C17/N60/S266/s03/T3 +ZY20210800001/H1/C17/N60/S264/s03/T1 +ZY20210800001/H1/C17/N59/S266/s02/T3 +ZY20210800001/H1/C17/N59/S264/s03/T1 +ZY20210800001/H1/C17/N58/S266/s02/T3 +ZY20210800001/H1/C17/N58/S264/s02/T1 +ZY20210800001/H1/C17/N57/S266/s02/T3 +ZY20210800001/H1/C17/N57/S264/s02/T1 +ZY20210800001/H1/C17/N56/S264/s02/T1 +ZY20210800001/H1/C17/N23/S159/s03/T3 +ZY20210800001/H1/C17/N23/S146/s03/T1 +ZY20210800001/H1/C17/N21/S159/s03/T3 +ZY20210800001/H1/C17/N19/S159/s03/T3 +ZY20210800001/H1/C17/N17/S159/s02/T3 +ZY20210800001/H1/C17/N15/S159/s02/T3 +ZY20210800001/H1/C17/N13/S159/s02/T3 +ZY20210800001/H1/C14/N50/S209/s02/T2 +ZY20210800001/H1/C14/N50/S158/s02/T1 +ZY20210800001/H1/C14/N49/S209/s01/T2 +ZY20210800001/H1/C14/N49/S158/s01/T1 +ZY20210800001/H1/C14/N48/S209/s01/T2 +ZY20210800001/H1/C14/N48/S158/s01/T1 +ZY20210800001/H1/C14/N47/S209/s01/T2 +ZY20210800001/H1/C14/N47/S158/s01/T1 +ZY20210800001/H1/C14/N46/S209/s01/T2 +ZY20210800001/H1/C14/N46/S158/s01/T1 +ZY20210800001/H1/C14/N45/S207/s05/T2 +ZY20210800001/H1/C14/N45/S155/s05/T1 +ZY20210800001/H1/C14/N44/S207/s05/T2 +ZY20210800001/H1/C14/N44/S155/s05/T1 +ZY20210800001/H1/C14/N43/S207/s05/T2 +ZY20210800001/H1/C14/N43/S155/s05/T1 +ZY20210800001/H1/C14/N42/S207/s05/T2 +ZY20210800001/H1/C14/N42/S155/s05/T1 +ZY20210800001/H1/C14/N41/S207/s04/T2 +ZY20210800001/H1/C14/N41/S155/s04/T1 +ZY20210800001/H1/C14/N40/S207/s04/T2 +ZY20210800001/H1/C14/N40/S155/s04/T1 +ZY20210800001/H1/C14/N39/S207/s04/T2 +ZY20210800001/H1/C14/N39/S155/s04/T1 +ZY20210800001/H1/C14/N38/S207/s04/T2 +ZY20210800001/H1/C14/N38/S155/s04/T1 +ZY20210800001/H1/C14/N37/S333/s03/T2 +ZY20210800001/H1/C14/N37/S333/s02/T1 +ZY20210800001/H1/C14/N36/S333/s03/T2 +ZY20210800001/H1/C14/N36/S333/s02/T1 +ZY20210800001/H1/C14/N35/S207/s03/T2 +ZY20210800001/H1/C14/N34/S207/s03/T2 +ZY20210800001/H1/C14/N34/S155/s03/T1 +ZY20210800001/H1/C14/N33/S333/s03/T2 +ZY20210800001/H1/C14/N33/S333/s01/T1 +ZY20210800001/H1/C14/N32/S207/s02/T2 +ZY20210800001/H1/C14/N32/S155/s02/T1 +ZY20210800001/H1/C14/N31/S207/s02/T2 +ZY20210800001/H1/C14/N31/S155/s02/T1 +ZY20210800001/H1/C14/N30/S333/s03/T2 +ZY20210800001/H1/C14/N30/S333/s01/T1 +ZY20210800001/H1/C14/N29/S207/s01/T2 +ZY20210800001/H1/C14/N29/S155/s01/T1 +ZY20210800001/H1/C14/N28/S207/s01/T2 +ZY20210800001/H1/C14/N28/S155/s01/T1 +ZY20210800001/H1/C14/N27/S333/s02/T2 +ZY20210800001/H1/C14/N27/S333/s01/T1 +ZY20210800001/H1/C14/N26/S333/s02/T2 +ZY20210800001/H1/C14/N26/S333/s01/T1 +ZY20210800001/H1/C14/N25/S367/s01/T2 +ZY20210800001/H1/C14/N25/S209/s03/T2 +ZY20210800001/H1/C14/N25/S158/s03/T1 +ZY20210800001/H1/C14/N24/S367/s01/T1 +ZY20210800001/H1/C14/N23/S209/s03/T2 +ZY20210800001/H1/C14/N23/S158/s03/T1 +ZY20210800001/H1/C14/N22/S367/s01/T1 +ZY20210800001/H1/C14/N21/S209/s03/T2 +ZY20210800001/H1/C14/N21/S158/s03/T1 +ZY20210800001/H1/C14/N19/S209/s02/T2 +ZY20210800001/H1/C14/N19/S158/s02/T1 +ZY20210800001/H1/C14/N17/S209/s02/T2 +ZY20210800001/H1/C14/N17/S158/s02/T1 +ZY20210800001/H1/C14/N15/S209/s02/T2 +ZY20210800001/H1/C14/N15/S158/s02/T1 +ZY20210800001/H1/C13/N50/S238/s03/T4 +ZY20210800001/H1/C13/N50/S136/s03/T1 +ZY20210800001/H1/C13/N48/S238/s03/T4 +ZY20210800001/H1/C13/N48/S136/s03/T1 +ZY20210800001/H1/C13/N46/S238/s03/T4 +ZY20210800001/H1/C13/N46/S136/s03/T1 +ZY20210800001/H1/C13/N44/S238/s02/T4 +ZY20210800001/H1/C13/N44/S136/s02/T1 +ZY20210800001/H1/C13/N42/S238/s02/T4 +ZY20210800001/H1/C13/N42/S136/s02/T1 +ZY20210800001/H1/C13/N40/S366/s01/T4 +ZY20210800001/H1/C13/N40/S238/s02/T4 +ZY20210800001/H1/C13/N40/S136/s02/T1 +ZY20210800001/H1/C13/N25/S238/s02/T3 +ZY20210800001/H1/C13/N25/S136/s02/T1 +ZY20210800001/H1/C13/N24/S238/s01/T3 +ZY20210800001/H1/C13/N24/S136/s01/T1 +ZY20210800001/H1/C13/N23/S238/s01/T3 +ZY20210800001/H1/C13/N23/S136/s01/T1 +ZY20210800001/H1/C13/N22/S238/s01/T3 +ZY20210800001/H1/C13/N22/S136/s01/T1 +ZY20210800001/H1/C13/N21/S238/s01/T3 +ZY20210800001/H1/C13/N21/S136/s01/T1 +ZY20210800001/H1/C13/N20/S179/s05/T3 +ZY20210800001/H1/C13/N20/S132/s05/T1 +ZY20210800001/H1/C13/N19/S179/s05/T4 +ZY20210800001/H1/C13/N19/S132/s05/T1 +ZY20210800001/H1/C13/N18/S179/s05/T4 +ZY20210800001/H1/C13/N18/S132/s05/T1 +ZY20210800001/H1/C13/N17/S179/s05/T4 +ZY20210800001/H1/C13/N17/S132/s05/T1 +ZY20210800001/H1/C13/N16/S179/s04/T4 +ZY20210800001/H1/C13/N16/S132/s04/T1 +ZY20210800001/H1/C13/N15/S179/s04/T4 +ZY20210800001/H1/C13/N15/S132/s04/T1 +ZY20210800001/H1/C13/N14/S179/s04/T4 +ZY20210800001/H1/C13/N14/S132/s04/T1 +ZY20210800001/H1/C13/N13/S179/s04/T4 +ZY20210800001/H1/C13/N13/S132/s04/T1 +ZY20210800001/H1/C13/N12/S179/s03/T4 +ZY20210800001/H1/C13/N12/S132/s03/T1 +ZY20210800001/H1/C13/N11/S179/s03/T4 +ZY20210800001/H1/C13/N11/S132/s03/T1 +ZY20210800001/H1/C12/N50/S203/s02/T2 +ZY20210800001/H1/C12/N50/S169/s02/T1 +ZY20210800001/H1/C12/N49/S203/s01/T2 +ZY20210800001/H1/C12/N49/S169/s01/T1 +ZY20210800001/H1/C12/N48/S203/s01/T2 +ZY20210800001/H1/C12/N48/S169/s01/T1 +ZY20210800001/H1/C12/N47/S203/s01/T2 +ZY20210800001/H1/C12/N47/S169/s01/T1 +ZY20210800001/H1/C12/N46/S203/s01/T2 +ZY20210800001/H1/C12/N46/S169/s01/T1 +ZY20210800001/H1/C12/N45/S200/s05/T2 +ZY20210800001/H1/C12/N45/S165/s05/T1 +ZY20210800001/H1/C12/N44/S200/s05/T2 +ZY20210800001/H1/C12/N44/S165/s05/T1 +ZY20210800001/H1/C12/N43/S200/s05/T2 +ZY20210800001/H1/C12/N43/S165/s05/T1 +ZY20210800001/H1/C12/N42/S200/s05/T2 +ZY20210800001/H1/C12/N42/S165/s05/T1 +ZY20210800001/H1/C12/N41/S200/s04/T2 +ZY20210800001/H1/C12/N41/S165/s04/T1 +ZY20210800001/H1/C12/N40/S200/s04/T2 +ZY20210800001/H1/C12/N40/S165/s04/T1 +ZY20210800001/H1/C12/N39/S200/s04/T2 +ZY20210800001/H1/C12/N39/S165/s04/T1 +ZY20210800001/H1/C12/N38/S200/s04/T2 +ZY20210800001/H1/C12/N38/S165/s04/T1 +ZY20210800001/H1/C12/N37/S200/s03/T2 +ZY20210800001/H1/C12/N37/S165/s03/T1 +ZY20210800001/H1/C12/N36/S200/s03/T2 +ZY20210800001/H1/C12/N36/S165/s03/T1 +ZY20210800001/H1/C12/N35/S200/s03/T2 +ZY20210800001/H1/C12/N35/S165/s03/T1 +ZY20210800001/H1/C12/N34/S165/s03/T1 +ZY20210800001/H1/C12/N33/S200/s02/T2 +ZY20210800001/H1/C12/N33/S165/s02/T1 +ZY20210800001/H1/C12/N32/S200/s02/T2 +ZY20210800001/H1/C12/N32/S165/s02/T1 +ZY20210800001/H1/C12/N31/S200/s02/T2 +ZY20210800001/H1/C12/N31/S165/s02/T1 +ZY20210800001/H1/C12/N30/S200/s02/T2 +ZY20210800001/H1/C12/N30/S165/s02/T1 +ZY20210800001/H1/C12/N29/S200/s01/T2 +ZY20210800001/H1/C12/N29/S165/s01/T1 +ZY20210800001/H1/C12/N28/S200/s01/T2 +ZY20210800001/H1/C12/N28/S165/s01/T1 +ZY20210800001/H1/C12/N27/S200/s01/T2 +ZY20210800001/H1/C12/N27/S165/s01/T1 +ZY20210800001/H1/C12/N26/S200/s01/T2 +ZY20210800001/H1/C12/N26/S165/s01/T1 +ZY20210800001/H1/C12/N11/S203/s03/T2 +ZY20210800001/H1/C12/N11/S169/s03/T1 +ZY20210800001/H1/C11/N61/S376/s05/T3 +ZY20210800001/H1/C11/N61/S376/s04/T4 +ZY20210800001/H1/C11/N61/S376/s03/T3 +ZY20210800001/H1/C11/N61/S376/s02/T2 +ZY20210800001/H1/C11/N61/S376/s01/T1 +ZY20210800001/H1/C11/N60/S376/s05/T3 +ZY20210800001/H1/C11/N60/S376/s04/T4 +ZY20210800001/H1/C11/N60/S376/s03/T3 +ZY20210800001/H1/C11/N60/S376/s02/T2 +ZY20210800001/H1/C11/N60/S376/s01/T1 +ZY20210800001/H1/C11/N59/S376/s05/T3 +ZY20210800001/H1/C11/N59/S376/s04/T4 +ZY20210800001/H1/C11/N59/S376/s03/T3 +ZY20210800001/H1/C11/N59/S376/s02/T2 +ZY20210800001/H1/C11/N59/S376/s01/T1 +ZY20210800001/H1/C11/N58/S376/s05/T2 +ZY20210800001/H1/C11/N58/S376/s04/T4 +ZY20210800001/H1/C11/N58/S376/s03/T3 +ZY20210800001/H1/C11/N58/S376/s02/T2 +ZY20210800001/H1/C11/N58/S376/s01/T1 +ZY20210800001/H1/C11/N53/S367/s05/T1 +ZY20210800001/H1/C11/N53/S367/s04/T4 +ZY20210800001/H1/C11/N53/S367/s03/T3 +ZY20210800001/H1/C11/N53/S367/s02/T2 +ZY20210800001/H1/C11/N53/S367/s01/T1 +ZY20210800001/H1/C11/N52/S367/s05/T1 +ZY20210800001/H1/C11/N52/S367/s04/T4 +ZY20210800001/H1/C11/N52/S367/s03/T3 +ZY20210800001/H1/C11/N52/S367/s02/T2 +ZY20210800001/H1/C11/N52/S367/s01/T1 +ZY20210800001/H1/C11/N51/S367/s05/T1 +ZY20210800001/H1/C11/N51/S367/s04/T4 +ZY20210800001/H1/C11/N51/S367/s03/T3 +ZY20210800001/H1/C11/N51/S367/s02/T2 +ZY20210800001/H1/C11/N51/S367/s01/T1 +ZY20210800001/H1/C11/N24/S187/s01/T3 +ZY20210800001/H1/C11/N24/S129/s01/T1 +ZY20210800001/H1/C11/N23/S187/s01/T3 +ZY20210800001/H1/C11/N22/S187/s01/T3 +ZY20210800001/H1/C11/N22/S129/s01/T1 +ZY20210800001/H1/C11/N21/S187/s01/T3 +ZY20210800001/H1/C11/N21/S129/s01/T1 +ZY20210800001/H1/C11/N20/S185/s05/T3 +ZY20210800001/H1/C11/N20/S125/s05/T1 +ZY20210800001/H1/C11/N19/S185/s05/T2 +ZY20210800001/H1/C11/N19/S125/s05/T1 +ZY20210800001/H1/C11/N18/S185/s05/T2 +ZY20210800001/H1/C11/N18/S125/s05/T1 +ZY20210800001/H1/C11/N17/S185/s05/T2 +ZY20210800001/H1/C11/N17/S125/s05/T1 +ZY20210800001/H1/C11/N16/S185/s04/T2 +ZY20210800001/H1/C11/N16/S125/s04/T1 +ZY20210800001/H1/C11/N15/S185/s04/T2 +ZY20210800001/H1/C11/N15/S125/s04/T1 +ZY20210800001/H1/C11/N14/S185/s04/T2 +ZY20210800001/H1/C11/N14/S125/s04/T1 +ZY20210800001/H1/C11/N13/S185/s04/T2 +ZY20210800001/H1/C11/N13/S125/s04/T1 +ZY20210800001/H1/C11/N12/S185/s03/T2 +ZY20210800001/H1/C11/N12/S125/s03/T1 +ZY20210800001/H1/C11/N11/S185/s03/T2 +ZY20210800001/H1/C11/N11/S125/s03/T1 +ZY20210800001/H1/C11/N10/S367/s04/T1 +ZY20210800001/H1/C11/N10/S185/s03/T2 +ZY20210800001/H1/C11/N09/S367/s02/T2 +ZY20210800001/H1/C11/N09/S185/s03/T2 +ZY20210800001/H1/C11/N08/S185/s02/T2 +ZY20210800001/H1/C11/N07/S367/s02/T4 +ZY20210800001/H1/C11/N07/S185/s02/T2 +ZY20210800001/H1/C1/N50/S106/s03/T2 +ZY20210800001/H1/C1/N50/S106/s03/T1 +ZY20210800001/H1/C1/N49/S106/s05/T2 +ZY20210800001/H1/C1/N49/S106/s05/T1 +ZY20210800001/H1/C1/N48/S100/s03/T2 +ZY20210800001/H1/C1/N48/S100/s03/T1 +ZY20210800001/H1/C1/N47/S104/s04/T2 +ZY20210800001/H1/C1/N45/S106/s03/T1 +ZY20210800001/H1/C1/N44/S99/s02/T2 +ZY20210800001/H1/C1/N44/S99/s02/T1 +ZY20210800001/H1/C1/N41/S104/s03/T1 +ZY20210800001/H1/C1/N39/S99/s01/T2 +ZY20210800001/H1/C1/N39/S99/s01/T1 +ZY20210800001/H1/C1/N38/S100/s05/T2 +ZY20210800001/H1/C1/N38/S100/s05/T1 +ZY20210800001/H1/C1/N37/S104/s02/T2 +ZY20210800001/H1/C1/N37/S104/s02/T1 +ZY20210800001/H1/C1/N36/S100/s02/T2 +ZY20210800001/H1/C1/N36/S100/s02/T1 +ZY20210800001/H1/C1/N35/S104/s01/T2 +ZY20210800001/H1/C1/N34/S108/s05/T1 +ZY20210800001/H1/C1/N33/S100/s05/T2 +ZY20210800001/H1/C1/N33/S100/s05/T1 +ZY20210800001/H1/C1/N32/S108/s01/T2 +ZY20210800001/H1/C1/N32/S108/s01/T1 +ZY20210800001/H1/C1/N30/S104/s04/T2 +ZY20210800001/H1/C1/N29/S99/s03/T2 +ZY20210800001/H1/C1/N29/S99/s03/T1 +ZY20210800001/H1/C1/N28/S100/s03/T2 +ZY20210800001/H1/C1/N28/S100/s03/T1 +ZY20210800001/H1/C1/N27/S99/s05/T2 +ZY20210800001/H1/C1/N27/S99/s05/T1 +ZY20210800001/H1/C1/N26/S104/s05/T2 +ZY20210800001/H1/C1/N26/S104/s05/T1 +ZY20210800001/H1/C1/N24/S100/s01/T2 +ZY20210800001/H1/C1/N24/S100/s01/T1 +ZY20210800001/H1/C1/N23/S104/s05/T1 +ZY20210800001/H1/C1/N21/S99/s04/T2 +ZY20210800001/H1/C1/N21/S99/s04/T1 +ZY20210800001/H1/C1/N20/S108/s03/T1 +ZY20210800001/H1/C1/N19/S100/s02/T2 +ZY20210800001/H1/C1/N19/S100/s02/T1 diff --git a/third-party/HOI4D-Instructions/testset.txt b/third-party/HOI4D-Instructions/testset.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbf0fcdaf9b4d052961b3477611103ebceab0abf --- /dev/null +++ b/third-party/HOI4D-Instructions/testset.txt @@ -0,0 +1,933 @@ +ZY20210800004/H4/C8/N03/S71/s01/T2 +ZY20210800004/H4/C8/N03/S71/s01/T1 +ZY20210800004/H4/C8/N10/S71/s03/T2 +ZY20210800004/H4/C8/N10/S71/s03/T1 +ZY20210800004/H4/C8/N01/S71/s01/T2 +ZY20210800004/H4/C8/N01/S71/s01/T1 +ZY20210800004/H4/C8/N03/S71/s01/T2 +ZY20210800004/H4/C8/N03/S71/s01/T1 +ZY20210800004/H4/C8/N01/S71/s01/T2 +ZY20210800004/H4/C8/N01/S71/s01/T1 +ZY20210800004/H4/C7/N08/S56/s03/T1 +ZY20210800004/H4/C7/N07/S56/s03/T1 +ZY20210800004/H4/C7/N03/S56/s01/T1 +ZY20210800004/H4/C7/N01/S57/s03/T1 +ZY20210800004/H4/C7/N08/S56/s03/T1 +ZY20210800004/H4/C7/N07/S56/s03/T1 +ZY20210800004/H4/C7/N05/S56/s02/T1 +ZY20210800004/H4/C7/N04/S56/s01/T1 +ZY20210800004/H4/C7/N03/S56/s01/T1 +ZY20210800004/H4/C7/N01/S57/s03/T1 +ZY20210800004/H4/C6/N09/S82/s05/T1 +ZY20210800004/H4/C6/N07/S82/s04/T2 +ZY20210800004/H4/C6/N07/S82/s04/T1 +ZY20210800004/H4/C6/N06/S82/s03/T2 +ZY20210800004/H4/C6/N06/S82/s03/T1 +ZY20210800004/H4/C6/N05/S82/s03/T1 +ZY20210800004/H4/C6/N04/S82/s02/T1 +ZY20210800004/H4/C6/N03/S82/s02/T2 +ZY20210800004/H4/C6/N03/S82/s02/T1 +ZY20210800004/H4/C6/N02/S82/s01/T2 +ZY20210800004/H4/C6/N02/S82/s01/T1 +ZY20210800004/H4/C6/N01/S82/s01/T2 +ZY20210800004/H4/C6/N01/S82/s01/T1 +ZY20210800004/H4/C5/N08/S56/s04/T1 +ZY20210800004/H4/C5/N10/S56/s05/T1 +ZY20210800004/H4/C5/N09/S366/s03/T1 +ZY20210800004/H4/C5/N09/S366/s02/T3 +ZY20210800004/H4/C5/N09/S366/s02/T1 +ZY20210800004/H4/C5/N08/S56/s04/T1 +ZY20210800004/H4/C4/N53/S372/s05/T1 +ZY20210800004/H4/C4/N53/S372/s04/T4 +ZY20210800004/H4/C4/N53/S372/s03/T3 +ZY20210800004/H4/C4/N53/S372/s02/T2 +ZY20210800004/H4/C4/N53/S372/s01/T1 +ZY20210800004/H4/C4/N52/S372/s05/T1 +ZY20210800004/H4/C4/N52/S372/s04/T4 +ZY20210800004/H4/C4/N52/S372/s03/T3 +ZY20210800004/H4/C4/N52/S372/s02/T2 +ZY20210800004/H4/C4/N52/S372/s01/T1 +ZY20210800004/H4/C4/N51/S372/s05/T1 +ZY20210800004/H4/C4/N51/S372/s04/T4 +ZY20210800004/H4/C4/N51/S372/s03/T3 +ZY20210800004/H4/C4/N51/S372/s02/T2 +ZY20210800004/H4/C4/N51/S372/s01/T1 +ZY20210800004/H4/C3/N08/S97/s04/T2 +ZY20210800004/H4/C20/N01/S301/s03/T2 +ZY20210800004/H4/C20/N01/S298/s04/T1 +ZY20210800004/H4/C2/N07/S10/s02/T1 +ZY20210800004/H4/C2/N05/S10/s01/T5 +ZY20210800004/H4/C2/N05/S10/s01/T1 +ZY20210800004/H4/C2/N04/S16/s01/T1 +ZY20210800004/H4/C2/N03/S16/s01/T1 +ZY20210800004/H4/C2/N02/S16/s01/T5 +ZY20210800004/H4/C2/N10/S11/s01/T5 +ZY20210800004/H4/C2/N01/S16/s01/T5 +ZY20210800004/H4/C2/N08/S364/s04/T1 +ZY20210800004/H4/C2/N07/S10/s02/T1 +ZY20210800004/H4/C2/N05/S10/s01/T5 +ZY20210800004/H4/C2/N05/S10/s01/T1 +ZY20210800004/H4/C2/N04/S364/s04/T1 +ZY20210800004/H4/C2/N04/S16/s01/T1 +ZY20210800004/H4/C2/N03/S16/s01/T1 +ZY20210800004/H4/C2/N02/S16/s01/T5 +ZY20210800004/H4/C2/N01/S16/s01/T5 +ZY20210800004/H4/C18/N10/S178/s03/T2 +ZY20210800004/H4/C18/N10/S160/s03/T1 +ZY20210800004/H4/C18/N09/S178/s03/T2 +ZY20210800004/H4/C18/N09/S160/s03/T1 +ZY20210800004/H4/C18/N08/S364/s02/T1 +ZY20210800004/H4/C18/N08/S178/s02/T2 +ZY20210800004/H4/C18/N08/S160/s02/T1 +ZY20210800004/H4/C18/N07/S178/s02/T2 +ZY20210800004/H4/C18/N07/S160/s02/T1 +ZY20210800004/H4/C18/N06/S178/s02/T2 +ZY20210800004/H4/C18/N06/S160/s02/T1 +ZY20210800004/H4/C18/N05/S178/s02/T2 +ZY20210800004/H4/C18/N05/S160/s02/T1 +ZY20210800004/H4/C18/N04/S364/s02/T1 +ZY20210800004/H4/C18/N04/S178/s01/T2 +ZY20210800004/H4/C18/N04/S160/s01/T1 +ZY20210800004/H4/C18/N03/S364/s03/T2 +ZY20210800004/H4/C18/N03/S178/s01/T2 +ZY20210800004/H4/C18/N03/S160/s01/T1 +ZY20210800004/H4/C18/N02/S178/s01/T2 +ZY20210800004/H4/C18/N02/S160/s01/T1 +ZY20210800004/H4/C18/N01/S178/s01/T2 +ZY20210800004/H4/C18/N01/S160/s01/T1 +ZY20210800004/H4/C17/N55/S259/s02/T1 +ZY20210800004/H4/C17/N54/S259/s01/T1 +ZY20210800004/H4/C17/N52/S259/s01/T1 +ZY20210800004/H4/C17/N51/S259/s01/T1 +ZY20210800004/H4/C17/N05/S190/s02/T3 +ZY20210800004/H4/C17/N05/S134/s05/T1 +ZY20210800004/H4/C17/N04/S190/s01/T3 +ZY20210800004/H4/C17/N04/S134/s03/T1 +ZY20210800004/H4/C17/N03/S190/s01/T2 +ZY20210800004/H4/C17/N03/S134/s03/T1 +ZY20210800004/H4/C17/N02/S134/s03/T1 +ZY20210800004/H4/C17/N01/S190/s01/T3 +ZY20210800004/H4/C17/N01/S134/s03/T1 +ZY20210800004/H4/C16/N49/S230/s01/T5 +ZY20210800004/H4/C16/N45/S281/s03/T3 +ZY20210800004/H4/C16/N44/S281/s03/T3 +ZY20210800004/H4/C16/N42/S281/s03/T3 +ZY20210800004/H4/C16/N41/S368/s01/T3 +ZY20210800004/H4/C16/N40/S230/s04/T4 +ZY20210800004/H4/C16/N39/S281/s02/T3 +ZY20210800004/H4/C16/N38/S230/s04/T2 +ZY20210800004/H4/C16/N37/S230/s03/T4 +ZY20210800004/H4/C16/N36/S230/s03/T5 +ZY20210800004/H4/C16/N35/S230/s03/T4 +ZY20210800004/H4/C16/N34/S281/s02/T3 +ZY20210800004/H4/C16/N32/S230/s02/T5 +ZY20210800004/H4/C16/N31/S281/s02/T3 +ZY20210800004/H4/C16/N30/S281/s02/T3 +ZY20210800004/H4/C16/N29/S281/s01/T3 +ZY20210800004/H4/C16/N28/S230/s01/T2 +ZY20210800004/H4/C16/N27/S281/s01/T3 +ZY20210800004/H4/C16/N25/S230/s05/T5 +ZY20210800004/H4/C16/N21/S230/s03/T5 +ZY20210800004/H4/C16/N19/S230/s02/T5 +ZY20210800004/H4/C16/N17/S230/s02/T2 +ZY20210800004/H4/C15/N50/S175/s03/T1 +ZY20210800004/H4/C15/N46/S175/s03/T1 +ZY20210800004/H4/C15/N44/S175/s02/T1 +ZY20210800004/H4/C15/N42/S175/s02/T1 +ZY20210800004/H4/C15/N25/S175/s02/T1 +ZY20210800004/H4/C15/N24/S175/s01/T1 +ZY20210800004/H4/C15/N23/S175/s01/T1 +ZY20210800004/H4/C15/N19/S172/s05/T1 +ZY20210800004/H4/C15/N18/S172/s05/T1 +ZY20210800004/H4/C15/N17/S172/s05/T1 +ZY20210800004/H4/C15/N14/S172/s04/T1 +ZY20210800004/H4/C15/N12/S172/s03/T1 +ZY20210800004/H4/C15/N11/S172/s03/T1 +ZY20210800004/H4/C15/N10/S172/s03/T1 +ZY20210800004/H4/C15/N08/S172/s02/T1 +ZY20210800004/H4/C15/N06/S172/s02/T1 +ZY20210800004/H4/C15/N04/S172/s01/T1 +ZY20210800004/H4/C14/N10/S210/s03/T2 +ZY20210800004/H4/C14/N10/S174/s04/T1 +ZY20210800004/H4/C14/N09/S210/s03/T2 +ZY20210800004/H4/C14/N09/S174/s05/T1 +ZY20210800004/H4/C14/N08/S210/s02/T2 +ZY20210800004/H4/C14/N07/S210/s02/T2 +ZY20210800004/H4/C14/N07/S174/s05/T1 +ZY20210800004/H4/C14/N06/S210/s02/T2 +ZY20210800004/H4/C14/N06/S174/s05/T1 +ZY20210800004/H4/C14/N05/S210/s02/T2 +ZY20210800004/H4/C14/N05/S177/s01/T1 +ZY20210800004/H4/C14/N04/S210/s01/T2 +ZY20210800004/H4/C14/N04/S177/s01/T1 +ZY20210800004/H4/C14/N03/S210/s01/T2 +ZY20210800004/H4/C14/N03/S177/s01/T1 +ZY20210800004/H4/C14/N02/S210/s01/T2 +ZY20210800004/H4/C14/N01/S210/s01/T2 +ZY20210800004/H4/C14/N01/S177/s02/T1 +ZY20210800004/H4/C13/N07/S365/s01/T1 +ZY20210800004/H4/C11/N66/S384/s05/T4 +ZY20210800004/H4/C11/N66/S384/s04/T4 +ZY20210800004/H4/C11/N66/S384/s03/T3 +ZY20210800004/H4/C11/N66/S384/s02/T2 +ZY20210800004/H4/C11/N66/S384/s01/T1 +ZY20210800004/H4/C11/N65/S384/s05/T4 +ZY20210800004/H4/C11/N65/S384/s04/T4 +ZY20210800004/H4/C11/N65/S384/s03/T3 +ZY20210800004/H4/C11/N65/S384/s02/T2 +ZY20210800004/H4/C11/N65/S384/s01/T1 +ZY20210800004/H4/C11/N64/S384/s05/T4 +ZY20210800004/H4/C11/N64/S384/s04/T4 +ZY20210800004/H4/C11/N64/S384/s03/T3 +ZY20210800004/H4/C11/N64/S384/s02/T2 +ZY20210800004/H4/C11/N64/S384/s01/T1 +ZY20210800004/H4/C11/N63/S383/s05/T4 +ZY20210800004/H4/C11/N63/S383/s04/T4 +ZY20210800004/H4/C11/N63/S383/s03/T3 +ZY20210800004/H4/C11/N63/S383/s01/T1 +ZY20210800004/H4/C1/N18/S242/s02/T2 +ZY20210800004/H4/C1/N18/S237/s05/T1 +ZY20210800004/H4/C1/N18/S194/s05/T4 +ZY20210800004/H4/C1/N17/S242/s02/T2 +ZY20210800004/H4/C1/N17/S237/s05/T1 +ZY20210800004/H4/C1/N17/S194/s05/T4 +ZY20210800004/H4/C1/N16/S9/s04/T3 +ZY20210800004/H4/C1/N16/S242/s02/T2 +ZY20210800004/H4/C1/N16/S237/s04/T1 +ZY20210800004/H4/C1/N16/S194/s04/T4 +ZY20210800004/H4/C1/N15/S242/s02/T2 +ZY20210800004/H4/C1/N15/S237/s04/T1 +ZY20210800004/H4/C1/N15/S194/s04/T4 +ZY20210800004/H4/C1/N12/S242/s01/T2 +ZY20210800004/H4/C1/N12/S237/s03/T1 +ZY20210800004/H4/C1/N12/S194/s03/T4 +ZY20210800004/H4/C1/N11/S242/s01/T2 +ZY20210800004/H4/C1/N11/S237/s03/T1 +ZY20210800004/H4/C1/N11/S194/s03/T4 +ZY20210800004/H4/C1/N10/S237/s03/T1 +ZY20210800004/H4/C1/N10/S194/s03/T4 +ZY20210800004/H4/C1/N09/S237/s03/T1 +ZY20210800004/H4/C1/N09/S194/s03/T4 +ZY20210800004/H4/C1/N09/S18/s01/T3 +ZY20210800004/H4/C1/N09/S18/s01/T1 +ZY20210800004/H4/C1/N08/S237/s02/T1 +ZY20210800004/H4/C1/N08/S194/s02/T4 +ZY20210800004/H4/C1/N07/S237/s02/T1 +ZY20210800004/H4/C1/N07/S194/s02/T4 +ZY20210800003/H3/C9/N10/S300/s01/T2 +ZY20210800003/H3/C9/N09/S306/s02/T2 +ZY20210800003/H3/C9/N09/S300/s01/T2 +ZY20210800003/H3/C9/N07/S306/s02/T2 +ZY20210800003/H3/C9/N05/S306/s02/T2 +ZY20210800003/H3/C9/N03/S306/s01/T2 +ZY20210800003/H3/C9/N01/S306/s01/T2 +ZY20210800003/H3/C5/N10/S57/s05/T4 +ZY20210800003/H3/C5/N06/S57/s03/T4 +ZY20210800003/H3/C5/N05/S57/s03/T1 +ZY20210800003/H3/C5/N03/S57/s02/T4 +ZY20210800003/H3/C5/N02/S57/s01/T1 +ZY20210800003/H3/C3/N44/S284/s01/T2 +ZY20210800003/H3/C20/N10/S284/s04/T4 +ZY20210800003/H3/C20/N10/S284/s01/T3 +ZY20210800003/H3/C20/N10/S282/s02/T2 +ZY20210800003/H3/C20/N10/S279/s03/T1 +ZY20210800003/H3/C20/N09/S279/s02/T1 +ZY20210800003/H3/C20/N08/S284/s04/T4 +ZY20210800003/H3/C20/N08/S282/s05/T3 +ZY20210800003/H3/C20/N08/S282/s01/T2 +ZY20210800003/H3/C20/N08/S279/s02/T1 +ZY20210800003/H3/C20/N07/S284/s04/T4 +ZY20210800003/H3/C20/N07/S282/s05/T3 +ZY20210800003/H3/C20/N07/S282/s01/T2 +ZY20210800003/H3/C20/N07/S279/s02/T1 +ZY20210800003/H3/C20/N06/S284/s03/T4 +ZY20210800003/H3/C20/N06/S282/s05/T3 +ZY20210800003/H3/C20/N06/S282/s01/T2 +ZY20210800003/H3/C20/N06/S279/s02/T1 +ZY20210800003/H3/C20/N05/S284/s03/T4 +ZY20210800003/H3/C20/N05/S282/s04/T3 +ZY20210800003/H3/C20/N05/S279/s05/T2 +ZY20210800003/H3/C20/N05/S279/s01/T1 +ZY20210800003/H3/C20/N04/S284/s03/T4 +ZY20210800003/H3/C20/N04/S282/s04/T3 +ZY20210800003/H3/C20/N04/S279/s05/T2 +ZY20210800003/H3/C20/N04/S279/s01/T1 +ZY20210800003/H3/C20/N03/S284/s03/T4 +ZY20210800003/H3/C20/N03/S282/s04/T3 +ZY20210800003/H3/C20/N03/S279/s05/T2 +ZY20210800003/H3/C20/N03/S279/s01/T1 +ZY20210800003/H3/C20/N02/S284/s02/T4 +ZY20210800003/H3/C20/N02/S282/s04/T3 +ZY20210800003/H3/C20/N02/S279/s01/T1 +ZY20210800003/H3/C2/N10/S215/s03/T5 +ZY20210800003/H3/C2/N09/S215/s03/T5 +ZY20210800003/H3/C2/N08/S215/s02/T4 +ZY20210800003/H3/C2/N07/S215/s02/T4 +ZY20210800003/H3/C2/N06/S215/s02/T4 +ZY20210800003/H3/C2/N05/S52/s04/T1 +ZY20210800003/H3/C2/N05/S215/s02/T4 +ZY20210800003/H3/C2/N04/S52/s03/T1 +ZY20210800003/H3/C2/N04/S215/s01/T4 +ZY20210800003/H3/C2/N03/S52/s03/T1 +ZY20210800003/H3/C2/N03/S215/s01/T4 +ZY20210800003/H3/C2/N02/S52/s02/T1 +ZY20210800003/H3/C2/N02/S215/s01/T4 +ZY20210800003/H3/C2/N01/S52/s02/T1 +ZY20210800003/H3/C2/N01/S215/s01/T4 +ZY20210800003/H3/C18/N10/S139/s03/T1 +ZY20210800003/H3/C18/N09/S139/s03/T1 +ZY20210800003/H3/C18/N08/S139/s02/T1 +ZY20210800003/H3/C18/N04/S139/s01/T1 +ZY20210800003/H3/C17/N55/S264/s02/T1 +ZY20210800003/H3/C17/N54/S264/s01/T1 +ZY20210800003/H3/C17/N52/S264/s01/T1 +ZY20210800003/H3/C17/N51/S264/s01/T1 +ZY20210800003/H3/C17/N05/S167/s02/T2 +ZY20210800003/H3/C17/N05/S126/s02/T1 +ZY20210800003/H3/C17/N04/S167/s01/T2 +ZY20210800003/H3/C17/N04/S126/s01/T1 +ZY20210800003/H3/C17/N03/S167/s01/T2 +ZY20210800003/H3/C17/N03/S126/s01/T1 +ZY20210800003/H3/C17/N02/S126/s01/T1 +ZY20210800003/H3/C17/N01/S167/s01/T2 +ZY20210800003/H3/C17/N01/S126/s01/T1 +ZY20210800003/H3/C16/N46/S229/s03/T5 +ZY20210800003/H3/C16/N24/S229/s01/T4 +ZY20210800003/H3/C16/N22/S229/s01/T4 +ZY20210800003/H3/C16/N21/S229/s01/T4 +ZY20210800003/H3/C16/N19/S228/s05/T4 +ZY20210800003/H3/C16/N18/S228/s05/T3 +ZY20210800003/H3/C16/N17/S228/s05/T3 +ZY20210800003/H3/C16/N16/S228/s04/T3 +ZY20210800003/H3/C16/N15/S228/s04/T3 +ZY20210800003/H3/C16/N14/S228/s04/T3 +ZY20210800003/H3/C16/N13/S228/s04/T3 +ZY20210800003/H3/C16/N11/S228/s03/T3 +ZY20210800003/H3/C16/N10/S228/s03/T3 +ZY20210800003/H3/C16/N03/S228/s01/T2 +ZY20210800003/H3/C16/N01/S228/s01/T2 +ZY20210800003/H3/C15/N34/S168/s03/T1 +ZY20210800003/H3/C15/N22/S168/s01/T1 +ZY20210800003/H3/C14/N09/S209/s03/T2 +ZY20210800003/H3/C14/N09/S170/s03/T1 +ZY20210800003/H3/C14/N07/S209/s03/T2 +ZY20210800003/H3/C14/N07/S170/s03/T1 +ZY20210800003/H3/C14/N05/S209/s02/T2 +ZY20210800003/H3/C14/N05/S170/s02/T1 +ZY20210800003/H3/C14/N03/S209/s02/T2 +ZY20210800003/H3/C14/N03/S170/s02/T1 +ZY20210800003/H3/C14/N01/S209/s02/T2 +ZY20210800003/H3/C14/N01/S170/s02/T1 +ZY20210800003/H3/C13/N09/S203/s03/T4 +ZY20210800003/H3/C13/N09/S144/s03/T1 +ZY20210800003/H3/C13/N07/S203/s03/T4 +ZY20210800003/H3/C13/N07/S144/s03/T1 +ZY20210800003/H3/C13/N05/S203/s02/T4 +ZY20210800003/H3/C13/N05/S144/s02/T1 +ZY20210800003/H3/C13/N03/S203/s02/T4 +ZY20210800003/H3/C13/N03/S144/s02/T1 +ZY20210800003/H3/C13/N01/S346/s02/T4 +ZY20210800003/H3/C13/N01/S144/s02/T1 +ZY20210800003/H3/C12/N10/S206/s03/T2 +ZY20210800003/H3/C12/N10/S173/s03/T1 +ZY20210800003/H3/C12/N09/S206/s03/T2 +ZY20210800003/H3/C12/N09/S173/s03/T1 +ZY20210800003/H3/C12/N08/S206/s02/T2 +ZY20210800003/H3/C12/N08/S173/s02/T1 +ZY20210800003/H3/C12/N07/S206/s02/T2 +ZY20210800003/H3/C12/N07/S173/s02/T1 +ZY20210800003/H3/C12/N06/S206/s02/T2 +ZY20210800003/H3/C12/N06/S173/s02/T1 +ZY20210800003/H3/C12/N05/S206/s02/T2 +ZY20210800003/H3/C12/N05/S173/s02/T1 +ZY20210800003/H3/C12/N04/S206/s01/T2 +ZY20210800003/H3/C12/N04/S173/s01/T1 +ZY20210800003/H3/C12/N03/S206/s01/T2 +ZY20210800003/H3/C12/N03/S173/s01/T1 +ZY20210800003/H3/C12/N02/S206/s01/T2 +ZY20210800003/H3/C12/N02/S173/s01/T1 +ZY20210800003/H3/C12/N01/S206/s01/T2 +ZY20210800003/H3/C12/N01/S173/s01/T1 +ZY20210800003/H3/C11/N05/S182/s02/T4 +ZY20210800003/H3/C11/N05/S151/s02/T1 +ZY20210800003/H3/C11/N03/S182/s02/T4 +ZY20210800003/H3/C11/N03/S151/s02/T1 +ZY20210800003/H3/C11/N01/S182/s02/T4 +ZY20210800003/H3/C11/N01/S151/s02/T1 +ZY20210800003/H3/C1/N17/S86/s05/T2 +ZY20210800003/H3/C1/N17/S86/s05/T1 +ZY20210800003/H3/C1/N11/S90/s03/T2 +ZY20210800003/H3/C1/N11/S90/s03/T1 +ZY20210800003/H3/C1/N10/S90/s01/T2 +ZY20210800003/H3/C1/N10/S90/s01/T1 +ZY20210800003/H3/C1/N09/S83/s01/T1 +ZY20210800002/H2/C9/N10/S350/s01/T2 +ZY20210800002/H2/C9/N09/S350/s01/T2 +ZY20210800002/H2/C9/N08/S344/s05/T2 +ZY20210800002/H2/C9/N07/S344/s05/T2 +ZY20210800002/H2/C9/N06/S347/s02/T1 +ZY20210800002/H2/C9/N06/S344/s05/T2 +ZY20210800002/H2/C9/N05/S344/s05/T2 +ZY20210800002/H2/C9/N04/S347/s01/T1 +ZY20210800002/H2/C9/N04/S344/s04/T2 +ZY20210800002/H2/C9/N03/S347/s01/T1 +ZY20210800002/H2/C9/N03/S344/s04/T2 +ZY20210800002/H2/C9/N02/S347/s01/T1 +ZY20210800002/H2/C9/N02/S344/s04/T2 +ZY20210800002/H2/C9/N01/S347/s01/T1 +ZY20210800002/H2/C9/N01/S344/s04/T2 +ZY20210800002/H2/C8/N10/S71/s05/T2 +ZY20210800002/H2/C8/N10/S71/s05/T1 +ZY20210800002/H2/C8/N09/S71/s05/T2 +ZY20210800002/H2/C8/N09/S71/s05/T1 +ZY20210800002/H2/C8/N08/S71/s04/T2 +ZY20210800002/H2/C8/N08/S71/s04/T1 +ZY20210800002/H2/C8/N07/S71/s04/T2 +ZY20210800002/H2/C8/N07/S71/s04/T1 +ZY20210800002/H2/C8/N06/S71/s03/T2 +ZY20210800002/H2/C8/N06/S71/s03/T1 +ZY20210800002/H2/C8/N05/S71/s03/T2 +ZY20210800002/H2/C8/N05/S71/s03/T1 +ZY20210800002/H2/C8/N04/S71/s02/T2 +ZY20210800002/H2/C8/N04/S71/s02/T1 +ZY20210800002/H2/C8/N03/S71/s02/T2 +ZY20210800002/H2/C8/N03/S71/s02/T1 +ZY20210800002/H2/C8/N02/S71/s01/T2 +ZY20210800002/H2/C8/N02/S71/s01/T1 +ZY20210800002/H2/C8/N01/S71/s01/T1 +ZY20210800002/H2/C7/N10/S55/s05/T3 +ZY20210800002/H2/C7/N10/S55/s05/T1 +ZY20210800002/H2/C7/N09/S55/s05/T3 +ZY20210800002/H2/C7/N09/S55/s05/T1 +ZY20210800002/H2/C7/N08/S55/s04/T3 +ZY20210800002/H2/C7/N08/S55/s04/T1 +ZY20210800002/H2/C7/N06/S55/s03/T3 +ZY20210800002/H2/C7/N06/S55/s03/T1 +ZY20210800002/H2/C7/N05/S55/s03/T3 +ZY20210800002/H2/C7/N05/S55/s03/T1 +ZY20210800002/H2/C7/N04/S55/s02/T3 +ZY20210800002/H2/C7/N04/S55/s02/T1 +ZY20210800002/H2/C7/N03/S55/s02/T3 +ZY20210800002/H2/C7/N03/S55/s02/T1 +ZY20210800002/H2/C7/N02/S55/s01/T3 +ZY20210800002/H2/C7/N02/S55/s01/T1 +ZY20210800002/H2/C7/N01/S55/s01/T3 +ZY20210800002/H2/C7/N01/S55/s01/T1 +ZY20210800002/H2/C5/N10/S267/s03/T5 +ZY20210800002/H2/C5/N10/S261/s05/T3 +ZY20210800002/H2/C5/N10/S255/s03/T1 +ZY20210800002/H2/C5/N10/S122/s05/T1 +ZY20210800002/H2/C5/N09/S267/s03/T5 +ZY20210800002/H2/C5/N09/S261/s05/T3 +ZY20210800002/H2/C5/N09/S255/s03/T1 +ZY20210800002/H2/C5/N09/S122/s02/T1 +ZY20210800002/H2/C5/N08/S267/s02/T5 +ZY20210800002/H2/C5/N08/S261/s05/T3 +ZY20210800002/H2/C5/N08/S255/s02/T1 +ZY20210800002/H2/C5/N08/S122/s04/T3 +ZY20210800002/H2/C5/N08/S122/s04/T1 +ZY20210800002/H2/C5/N07/S267/s02/T5 +ZY20210800002/H2/C5/N07/S261/s05/T3 +ZY20210800002/H2/C5/N07/S255/s02/T1 +ZY20210800002/H2/C5/N07/S122/s04/T3 +ZY20210800002/H2/C5/N07/S122/s04/T1 +ZY20210800002/H2/C5/N06/S267/s02/T5 +ZY20210800002/H2/C5/N06/S261/s04/T3 +ZY20210800002/H2/C5/N06/S255/s02/T1 +ZY20210800002/H2/C5/N06/S122/s03/T1 +ZY20210800002/H2/C5/N05/S267/s02/T5 +ZY20210800002/H2/C5/N05/S261/s04/T3 +ZY20210800002/H2/C5/N05/S255/s02/T1 +ZY20210800002/H2/C5/N04/S267/s01/T5 +ZY20210800002/H2/C5/N04/S261/s04/T3 +ZY20210800002/H2/C5/N04/S255/s01/T1 +ZY20210800002/H2/C5/N04/S122/s02/T3 +ZY20210800002/H2/C5/N04/S122/s02/T1 +ZY20210800002/H2/C5/N03/S267/s01/T5 +ZY20210800002/H2/C5/N03/S261/s04/T3 +ZY20210800002/H2/C5/N03/S255/s01/T1 +ZY20210800002/H2/C5/N02/S267/s01/T5 +ZY20210800002/H2/C5/N02/S261/s03/T3 +ZY20210800002/H2/C5/N02/S255/s01/T1 +ZY20210800002/H2/C5/N02/S122/s01/T3 +ZY20210800002/H2/C5/N02/S122/s01/T1 +ZY20210800002/H2/C5/N01/S267/s01/T5 +ZY20210800002/H2/C5/N01/S261/s03/T3 +ZY20210800002/H2/C5/N01/S255/s01/T1 +ZY20210800002/H2/C5/N01/S122/s01/T1 +ZY20210800002/H2/C20/N10/S275/s05/T4 +ZY20210800002/H2/C20/N10/S275/s01/T2 +ZY20210800002/H2/C20/N10/S273/s02/T3 +ZY20210800002/H2/C20/N10/S271/s03/T1 +ZY20210800002/H2/C20/N09/S273/s02/T3 +ZY20210800002/H2/C20/N08/S275/s04/T4 +ZY20210800002/H2/C20/N08/S273/s05/T2 +ZY20210800002/H2/C20/N08/S273/s01/T3 +ZY20210800002/H2/C20/N08/S271/s02/T1 +ZY20210800002/H2/C20/N07/S275/s04/T4 +ZY20210800002/H2/C20/N07/S273/s05/T2 +ZY20210800002/H2/C20/N07/S273/s01/T3 +ZY20210800002/H2/C20/N06/S275/s04/T4 +ZY20210800002/H2/C20/N06/S273/s05/T2 +ZY20210800002/H2/C20/N06/S273/s01/T3 +ZY20210800002/H2/C20/N06/S271/s02/T1 +ZY20210800002/H2/C20/N05/S275/s03/T4 +ZY20210800002/H2/C20/N05/S273/s04/T2 +ZY20210800002/H2/C20/N05/S273/s01/T3 +ZY20210800002/H2/C20/N04/S275/s03/T4 +ZY20210800002/H2/C20/N04/S273/s04/T2 +ZY20210800002/H2/C20/N04/S271/s05/T3 +ZY20210800002/H2/C20/N04/S271/s01/T1 +ZY20210800002/H2/C20/N03/S275/s03/T4 +ZY20210800002/H2/C20/N03/S273/s04/T2 +ZY20210800002/H2/C20/N03/S271/s05/T3 +ZY20210800002/H2/C20/N03/S271/s01/T1 +ZY20210800002/H2/C20/N02/S275/s03/T4 +ZY20210800002/H2/C20/N02/S273/s04/T2 +ZY20210800002/H2/C20/N02/S271/s05/T3 +ZY20210800002/H2/C20/N02/S271/s01/T1 +ZY20210800002/H2/C20/N01/S275/s02/T4 +ZY20210800002/H2/C20/N01/S273/s03/T2 +ZY20210800002/H2/C20/N01/S271/s05/T3 +ZY20210800002/H2/C2/N10/S28/s05/T3 +ZY20210800002/H2/C2/N10/S28/s05/T1 +ZY20210800002/H2/C2/N09/S28/s05/T3 +ZY20210800002/H2/C2/N09/S28/s05/T1 +ZY20210800002/H2/C2/N06/S28/s03/T3 +ZY20210800002/H2/C2/N05/S28/s03/T3 +ZY20210800002/H2/C2/N04/S28/s02/T1 +ZY20210800002/H2/C2/N02/S28/s01/T1 +ZY20210800002/H2/C18/N09/S241/s03/T2 +ZY20210800002/H2/C18/N09/S135/s03/T1 +ZY20210800002/H2/C18/N07/S241/s03/T2 +ZY20210800002/H2/C18/N07/S135/s03/T1 +ZY20210800002/H2/C18/N05/S241/s02/T2 +ZY20210800002/H2/C18/N05/S135/s02/T1 +ZY20210800002/H2/C18/N03/S135/s02/T1 +ZY20210800002/H2/C18/N01/S135/s02/T1 +ZY20210800002/H2/C17/N55/S256/s03/T3 +ZY20210800002/H2/C17/N55/S253/s02/T1 +ZY20210800002/H2/C17/N54/S256/s03/T3 +ZY20210800002/H2/C17/N54/S253/s01/T1 +ZY20210800002/H2/C17/N52/S256/s02/T3 +ZY20210800002/H2/C17/N52/S253/s01/T1 +ZY20210800002/H2/C17/N51/S256/s02/T3 +ZY20210800002/H2/C17/N51/S253/s01/T1 +ZY20210800002/H2/C17/N05/S159/s02/T3 +ZY20210800002/H2/C17/N05/S152/s02/T1 +ZY20210800002/H2/C17/N04/S356/s01/T1 +ZY20210800002/H2/C17/N03/S159/s02/T3 +ZY20210800002/H2/C17/N03/S152/s02/T1 +ZY20210800002/H2/C17/N01/S159/s02/T3 +ZY20210800002/H2/C17/N01/S152/s02/T1 +ZY20210800002/H2/C16/N34/S227/s03/T3 +ZY20210800002/H2/C16/N32/S227/s03/T2 +ZY20210800002/H2/C16/N30/S227/s02/T3 +ZY20210800002/H2/C16/N28/S227/s02/T3 +ZY20210800002/H2/C16/N25/S227/s02/T3 +ZY20210800002/H2/C16/N22/S227/s01/T3 +ZY20210800002/H2/C16/N21/S227/s01/T2 +ZY20210800002/H2/C16/N19/S226/s05/T2 +ZY20210800002/H2/C16/N16/S226/s04/T2 +ZY20210800002/H2/C16/N15/S226/s04/T4 +ZY20210800002/H2/C16/N14/S226/s04/T5 +ZY20210800002/H2/C16/N10/S226/s03/T4 +ZY20210800002/H2/C16/N06/S226/s02/T2 +ZY20210800002/H2/C15/N25/S156/s03/T1 +ZY20210800002/H2/C14/N10/S185/s03/T2 +ZY20210800002/H2/C14/N10/S161/s03/T1 +ZY20210800002/H2/C14/N09/S185/s03/T2 +ZY20210800002/H2/C14/N09/S161/s03/T1 +ZY20210800002/H2/C14/N08/S185/s02/T2 +ZY20210800002/H2/C14/N08/S161/s02/T1 +ZY20210800002/H2/C14/N07/S185/s02/T2 +ZY20210800002/H2/C14/N07/S161/s02/T1 +ZY20210800002/H2/C14/N06/S185/s02/T2 +ZY20210800002/H2/C14/N06/S161/s02/T1 +ZY20210800002/H2/C14/N05/S185/s02/T2 +ZY20210800002/H2/C14/N05/S161/s02/T1 +ZY20210800002/H2/C14/N04/S185/s01/T2 +ZY20210800002/H2/C14/N04/S161/s01/T1 +ZY20210800002/H2/C14/N03/S185/s01/T2 +ZY20210800002/H2/C14/N03/S161/s01/T1 +ZY20210800002/H2/C14/N02/S185/s01/T2 +ZY20210800002/H2/C14/N02/S161/s01/T1 +ZY20210800002/H2/C14/N01/S185/s01/T2 +ZY20210800002/H2/C14/N01/S161/s01/T1 +ZY20210800002/H2/C13/N10/S189/s03/T4 +ZY20210800002/H2/C13/N10/S124/s03/T1 +ZY20210800002/H2/C13/N09/S189/s03/T4 +ZY20210800002/H2/C13/N09/S124/s03/T1 +ZY20210800002/H2/C13/N08/S189/s02/T4 +ZY20210800002/H2/C13/N08/S124/s02/T1 +ZY20210800002/H2/C13/N07/S189/s02/T4 +ZY20210800002/H2/C13/N07/S124/s02/T1 +ZY20210800002/H2/C13/N06/S189/s02/T4 +ZY20210800002/H2/C13/N06/S124/s02/T1 +ZY20210800002/H2/C13/N05/S189/s02/T4 +ZY20210800002/H2/C13/N05/S124/s02/T1 +ZY20210800002/H2/C13/N04/S189/s01/T4 +ZY20210800002/H2/C13/N04/S124/s01/T1 +ZY20210800002/H2/C13/N03/S189/s01/T4 +ZY20210800002/H2/C13/N03/S124/s01/T1 +ZY20210800002/H2/C13/N02/S189/s01/T4 +ZY20210800002/H2/C13/N02/S124/s01/T1 +ZY20210800002/H2/C13/N01/S189/s01/T4 +ZY20210800002/H2/C13/N01/S124/s01/T1 +ZY20210800002/H2/C12/N10/S346/s02/T2 +ZY20210800002/H2/C12/N10/S196/s03/T2 +ZY20210800002/H2/C12/N10/S154/s03/T1 +ZY20210800002/H2/C12/N09/S196/s03/T2 +ZY20210800002/H2/C12/N09/S154/s03/T1 +ZY20210800002/H2/C12/N08/S196/s02/T2 +ZY20210800002/H2/C12/N08/S154/s02/T1 +ZY20210800002/H2/C12/N07/S196/s02/T2 +ZY20210800002/H2/C12/N07/S154/s02/T1 +ZY20210800002/H2/C12/N06/S196/s02/T2 +ZY20210800002/H2/C12/N06/S154/s02/T1 +ZY20210800002/H2/C12/N05/S196/s02/T2 +ZY20210800002/H2/C12/N05/S154/s02/T1 +ZY20210800002/H2/C12/N04/S346/s01/T1 +ZY20210800002/H2/C12/N04/S196/s01/T2 +ZY20210800002/H2/C12/N04/S154/s01/T1 +ZY20210800002/H2/C12/N03/S196/s01/T2 +ZY20210800002/H2/C12/N03/S154/s01/T1 +ZY20210800002/H2/C12/N02/S196/s01/T2 +ZY20210800002/H2/C12/N02/S154/s01/T1 +ZY20210800002/H2/C12/N01/S346/s02/T1 +ZY20210800002/H2/C12/N01/S196/s01/T2 +ZY20210800002/H2/C12/N01/S154/s01/T1 +ZY20210800002/H2/C11/N06/S201/s02/T4 +ZY20210800002/H2/C11/N06/S133/s02/T1 +ZY20210800002/H2/C11/N05/S201/s02/T4 +ZY20210800002/H2/C11/N05/S133/s02/T1 +ZY20210800002/H2/C11/N04/S359/s01/T4 +ZY20210800002/H2/C11/N04/S201/s01/T4 +ZY20210800002/H2/C11/N04/S133/s01/T1 +ZY20210800002/H2/C11/N03/S201/s01/T4 +ZY20210800002/H2/C11/N03/S133/s01/T1 +ZY20210800002/H2/C11/N02/S201/s01/T4 +ZY20210800002/H2/C11/N02/S133/s01/T1 +ZY20210800002/H2/C11/N01/S359/s01/T4 +ZY20210800002/H2/C11/N01/S201/s01/T4 +ZY20210800002/H2/C11/N01/S133/s01/T1 +ZY20210800002/H2/C10/N48/S329/s05/T3 +ZY20210800002/H2/C10/N33/S329/s01/T3 +ZY20210800002/H2/C1/N09/S88/s01/T1 +ZY20210800001/H1/C9/N10/S32/s05/T2 +ZY20210800001/H1/C9/N10/S32/s05/T1 +ZY20210800001/H1/C9/N09/S32/s05/T2 +ZY20210800001/H1/C9/N09/S32/s05/T1 +ZY20210800001/H1/C9/N08/S32/s04/T2 +ZY20210800001/H1/C9/N08/S32/s04/T1 +ZY20210800001/H1/C9/N07/S32/s04/T2 +ZY20210800001/H1/C9/N07/S32/s04/T1 +ZY20210800001/H1/C9/N05/S32/s03/T2 +ZY20210800001/H1/C9/N05/S32/s03/T1 +ZY20210800001/H1/C9/N04/S32/s02/T2 +ZY20210800001/H1/C9/N04/S32/s02/T1 +ZY20210800001/H1/C9/N03/S32/s02/T2 +ZY20210800001/H1/C9/N03/S32/s02/T1 +ZY20210800001/H1/C9/N02/S32/s01/T2 +ZY20210800001/H1/C9/N01/S32/s03/T2 +ZY20210800001/H1/C8/N09/S72/s05/T2 +ZY20210800001/H1/C8/N09/S72/s05/T1 +ZY20210800001/H1/C8/N08/S72/s04/T2 +ZY20210800001/H1/C8/N08/S72/s04/T1 +ZY20210800001/H1/C8/N07/S72/s04/T2 +ZY20210800001/H1/C8/N07/S72/s04/T1 +ZY20210800001/H1/C8/N06/S72/s03/T2 +ZY20210800001/H1/C8/N06/S72/s03/T1 +ZY20210800001/H1/C8/N05/S72/s03/T2 +ZY20210800001/H1/C8/N05/S72/s03/T1 +ZY20210800001/H1/C8/N04/S72/s02/T2 +ZY20210800001/H1/C8/N04/S72/s02/T1 +ZY20210800001/H1/C8/N03/S72/s02/T2 +ZY20210800001/H1/C8/N03/S72/s02/T1 +ZY20210800001/H1/C8/N02/S72/s01/T2 +ZY20210800001/H1/C8/N02/S72/s01/T1 +ZY20210800001/H1/C8/N10/S72/s05/T2 +ZY20210800001/H1/C8/N10/S72/s05/T1 +ZY20210800001/H1/C8/N10/S321/s03/T2 +ZY20210800001/H1/C8/N10/S315/s05/T1 +ZY20210800001/H1/C8/N10/S311/s03/T1 +ZY20210800001/H1/C8/N01/S72/s01/T2 +ZY20210800001/H1/C8/N01/S72/s01/T1 +ZY20210800001/H1/C8/N09/S72/s05/T2 +ZY20210800001/H1/C8/N09/S72/s05/T1 +ZY20210800001/H1/C8/N09/S321/s03/T2 +ZY20210800001/H1/C8/N09/S315/s05/T1 +ZY20210800001/H1/C8/N09/S311/s03/T1 +ZY20210800001/H1/C8/N08/S72/s04/T2 +ZY20210800001/H1/C8/N08/S72/s04/T1 +ZY20210800001/H1/C8/N08/S321/s02/T2 +ZY20210800001/H1/C8/N08/S315/s05/T1 +ZY20210800001/H1/C8/N08/S311/s02/T1 +ZY20210800001/H1/C8/N07/S72/s04/T2 +ZY20210800001/H1/C8/N07/S72/s04/T1 +ZY20210800001/H1/C8/N07/S321/s02/T2 +ZY20210800001/H1/C8/N07/S315/s05/T1 +ZY20210800001/H1/C8/N07/S311/s02/T1 +ZY20210800001/H1/C8/N06/S72/s03/T2 +ZY20210800001/H1/C8/N06/S72/s03/T1 +ZY20210800001/H1/C8/N06/S321/s02/T2 +ZY20210800001/H1/C8/N06/S315/s04/T1 +ZY20210800001/H1/C8/N06/S311/s02/T1 +ZY20210800001/H1/C8/N05/S72/s03/T2 +ZY20210800001/H1/C8/N05/S72/s03/T1 +ZY20210800001/H1/C8/N05/S321/s02/T2 +ZY20210800001/H1/C8/N05/S315/s04/T1 +ZY20210800001/H1/C8/N05/S311/s02/T1 +ZY20210800001/H1/C8/N04/S72/s02/T2 +ZY20210800001/H1/C8/N04/S72/s02/T1 +ZY20210800001/H1/C8/N04/S321/s01/T2 +ZY20210800001/H1/C8/N04/S315/s04/T1 +ZY20210800001/H1/C8/N04/S311/s01/T1 +ZY20210800001/H1/C8/N03/S72/s02/T2 +ZY20210800001/H1/C8/N03/S72/s02/T1 +ZY20210800001/H1/C8/N03/S321/s01/T2 +ZY20210800001/H1/C8/N03/S315/s04/T1 +ZY20210800001/H1/C8/N03/S311/s01/T1 +ZY20210800001/H1/C8/N02/S72/s01/T2 +ZY20210800001/H1/C8/N02/S72/s01/T1 +ZY20210800001/H1/C8/N02/S315/s03/T1 +ZY20210800001/H1/C8/N02/S311/s01/T1 +ZY20210800001/H1/C8/N01/S72/s01/T2 +ZY20210800001/H1/C8/N01/S72/s01/T1 +ZY20210800001/H1/C8/N01/S321/s01/T2 +ZY20210800001/H1/C8/N01/S315/s03/T1 +ZY20210800001/H1/C8/N01/S311/s01/T1 +ZY20210800001/H1/C7/N10/S280/s03/T5 +ZY20210800001/H1/C7/N10/S274/s05/T3 +ZY20210800001/H1/C7/N10/S270/s03/T1 +ZY20210800001/H1/C7/N01/S59/s01/T2 +ZY20210800001/H1/C7/N01/S59/s01/T1 +ZY20210800001/H1/C7/N09/S280/s03/T5 +ZY20210800001/H1/C7/N09/S274/s05/T3 +ZY20210800001/H1/C7/N09/S270/s03/T1 +ZY20210800001/H1/C7/N08/S280/s02/T5 +ZY20210800001/H1/C7/N08/S274/s05/T3 +ZY20210800001/H1/C7/N08/S270/s02/T1 +ZY20210800001/H1/C7/N07/S280/s02/T5 +ZY20210800001/H1/C7/N07/S274/s05/T3 +ZY20210800001/H1/C7/N07/S270/s02/T1 +ZY20210800001/H1/C7/N06/S280/s02/T5 +ZY20210800001/H1/C7/N06/S274/s04/T3 +ZY20210800001/H1/C7/N06/S270/s02/T1 +ZY20210800001/H1/C7/N05/S280/s02/T5 +ZY20210800001/H1/C7/N05/S274/s04/T3 +ZY20210800001/H1/C7/N05/S270/s02/T1 +ZY20210800001/H1/C7/N04/S280/s01/T5 +ZY20210800001/H1/C7/N04/S274/s04/T3 +ZY20210800001/H1/C7/N04/S270/s01/T1 +ZY20210800001/H1/C7/N03/S280/s01/T5 +ZY20210800001/H1/C7/N03/S274/s04/T3 +ZY20210800001/H1/C7/N03/S270/s01/T1 +ZY20210800001/H1/C7/N02/S59/s01/T1 +ZY20210800001/H1/C7/N02/S280/s01/T5 +ZY20210800001/H1/C7/N02/S274/s03/T3 +ZY20210800001/H1/C7/N02/S270/s01/T1 +ZY20210800001/H1/C7/N01/S59/s01/T2 +ZY20210800001/H1/C7/N01/S59/s01/T1 +ZY20210800001/H1/C7/N01/S280/s01/T5 +ZY20210800001/H1/C7/N01/S274/s03/T3 +ZY20210800001/H1/C7/N01/S270/s01/T1 +ZY20210800001/H1/C6/N07/S82/s04/T2 +ZY20210800001/H1/C6/N07/S82/s04/T1 +ZY20210800001/H1/C6/N06/S82/s03/T2 +ZY20210800001/H1/C6/N56/S390/s05/T2 +ZY20210800001/H1/C6/N56/S390/s04/T3 +ZY20210800001/H1/C6/N56/S390/s03/T2 +ZY20210800001/H1/C6/N56/S390/s02/T1 +ZY20210800001/H1/C6/N56/S390/s01/T1 +ZY20210800001/H1/C6/N55/S390/s05/T2 +ZY20210800001/H1/C6/N55/S390/s04/T3 +ZY20210800001/H1/C6/N55/S390/s03/T2 +ZY20210800001/H1/C6/N55/S390/s02/T1 +ZY20210800001/H1/C6/N55/S390/s01/T1 +ZY20210800001/H1/C6/N53/S390/s04/T3 +ZY20210800001/H1/C6/N53/S390/s03/T2 +ZY20210800001/H1/C6/N53/S390/s02/T1 +ZY20210800001/H1/C6/N53/S390/s01/T1 +ZY20210800001/H1/C6/N03/S82/s02/T2 +ZY20210800001/H1/C6/N03/S82/s02/T1 +ZY20210800001/H1/C6/N02/S82/s01/T2 +ZY20210800001/H1/C6/N01/S82/s01/T2 +ZY20210800001/H1/C5/N10/S57/s03/T1 +ZY20210800001/H1/C5/N09/S369/s04/T4 +ZY20210800001/H1/C5/N09/S369/s03/T1 +ZY20210800001/H1/C5/N09/S369/s02/T2 +ZY20210800001/H1/C5/N09/S369/s01/T1 +ZY20210800001/H1/C5/N05/S57/s01/T1 +ZY20210800001/H1/C5/N04/S57/s02/T1 +ZY20210800001/H1/C5/N02/S57/s02/T2 +ZY20210800001/H1/C5/N01/S57/s01/T2 +ZY20210800001/H1/C4/N08/S20/s01/T1 +ZY20210800001/H1/C4/N60/S388/s05/T3 +ZY20210800001/H1/C4/N60/S388/s04/T4 +ZY20210800001/H1/C4/N60/S388/s03/T3 +ZY20210800001/H1/C4/N60/S388/s02/T2 +ZY20210800001/H1/C4/N60/S388/s01/T1 +ZY20210800001/H1/C4/N59/S388/s05/T3 +ZY20210800001/H1/C4/N59/S388/s04/T4 +ZY20210800001/H1/C4/N59/S388/s02/T2 +ZY20210800001/H1/C4/N59/S388/s01/T1 +ZY20210800001/H1/C4/N58/S388/s05/T3 +ZY20210800001/H1/C4/N58/S388/s04/T4 +ZY20210800001/H1/C4/N58/S388/s03/T3 +ZY20210800001/H1/C4/N58/S388/s02/T2 +ZY20210800001/H1/C4/N58/S388/s01/T1 +ZY20210800001/H1/C4/N57/S388/s05/T3 +ZY20210800001/H1/C4/N57/S388/s04/T4 +ZY20210800001/H1/C4/N57/S388/s03/T3 +ZY20210800001/H1/C4/N57/S388/s02/T2 +ZY20210800001/H1/C4/N57/S388/s01/T1 +ZY20210800001/H1/C4/N56/S388/s05/T3 +ZY20210800001/H1/C4/N56/S388/s04/T4 +ZY20210800001/H1/C4/N56/S388/s03/T3 +ZY20210800001/H1/C4/N56/S388/s02/T2 +ZY20210800001/H1/C4/N56/S388/s01/T1 +ZY20210800001/H1/C4/N55/S388/s05/T3 +ZY20210800001/H1/C4/N55/S388/s04/T4 +ZY20210800001/H1/C4/N55/S388/s03/T3 +ZY20210800001/H1/C4/N55/S388/s02/T2 +ZY20210800001/H1/C4/N55/S388/s01/T1 +ZY20210800001/H1/C4/N54/S388/s05/T3 +ZY20210800001/H1/C4/N54/S388/s04/T4 +ZY20210800001/H1/C4/N54/S388/s03/T3 +ZY20210800001/H1/C4/N54/S388/s02/T2 +ZY20210800001/H1/C4/N54/S388/s01/T1 +ZY20210800001/H1/C4/N05/S20/s03/T2 +ZY20210800001/H1/C4/N05/S20/s03/T1 +ZY20210800001/H1/C4/N04/S20/s02/T2 +ZY20210800001/H1/C4/N04/S20/s02/T1 +ZY20210800001/H1/C4/N03/S20/s01/T2 +ZY20210800001/H1/C4/N02/S20/s04/T2 +ZY20210800001/H1/C4/N02/S20/s04/T1 +ZY20210800001/H1/C4/N01/S19/s05/T2 +ZY20210800001/H1/C4/N01/S19/s05/T1 +ZY20210800001/H1/C3/N70/S389/s05/T1 +ZY20210800001/H1/C3/N70/S389/s03/T2 +ZY20210800001/H1/C3/N70/S389/s02/T1 +ZY20210800001/H1/C3/N70/S389/s01/T1 +ZY20210800001/H1/C3/N69/S389/s05/T2 +ZY20210800001/H1/C3/N69/S389/s02/T1 +ZY20210800001/H1/C3/N69/S389/s01/T1 +ZY20210800001/H1/C3/N60/S377/s03/T1 +ZY20210800001/H1/C3/N60/S377/s02/T1 +ZY20210800001/H1/C3/N60/S377/s01/T1 +ZY20210800001/H1/C3/N51/S380/s05/T2 +ZY20210800001/H1/C3/N51/S380/s04/T2 +ZY20210800001/H1/C3/N51/S380/s03/T1 +ZY20210800001/H1/C3/N51/S380/s02/T1 +ZY20210800001/H1/C3/N51/S380/s01/T1 +ZY20210800001/H1/C2/N10/S214/s03/T1 +ZY20210800001/H1/C2/N10/S212/s03/T2 +ZY20210800001/H1/C2/N09/S337/s04/T2 +ZY20210800001/H1/C2/N09/S337/s04/T1 +ZY20210800001/H1/C2/N09/S214/s04/T1 +ZY20210800001/H1/C2/N09/S212/s03/T2 +ZY20210800001/H1/C2/N08/S337/s03/T1 +ZY20210800001/H1/C2/N08/S212/s02/T5 +ZY20210800001/H1/C2/N07/S337/s03/T2 +ZY20210800001/H1/C2/N07/S212/s02/T1 +ZY20210800001/H1/C2/N06/S212/s02/T1 +ZY20210800001/H1/C2/N05/S212/s02/T1 +ZY20210800001/H1/C2/N04/S337/s01/T1 +ZY20210800001/H1/C2/N04/S212/s01/T1 +ZY20210800001/H1/C2/N03/S337/s01/T2 +ZY20210800001/H1/C2/N03/S337/s01/T1 +ZY20210800001/H1/C2/N03/S212/s01/T1 +ZY20210800001/H1/C2/N02/S338/s01/T1 +ZY20210800001/H1/C2/N02/S212/s01/T1 +ZY20210800001/H1/C2/N01/S338/s01/T2 +ZY20210800001/H1/C18/N10/S199/s03/T2 +ZY20210800001/H1/C18/N09/S199/s03/T2 +ZY20210800001/H1/C18/N08/S199/s02/T2 +ZY20210800001/H1/C18/N07/S199/s02/T2 +ZY20210800001/H1/C18/N06/S199/s02/T2 +ZY20210800001/H1/C18/N05/S199/s02/T2 +ZY20210800001/H1/C18/N04/S199/s01/T2 +ZY20210800001/H1/C18/N03/S199/s01/T2 +ZY20210800001/H1/C18/N02/S199/s01/T2 +ZY20210800001/H1/C18/N01/S199/s01/T2 +ZY20210800001/H1/C17/N55/S264/s02/T1 +ZY20210800001/H1/C17/N54/S264/s01/T1 +ZY20210800001/H1/C17/N53/S363/s03/T3 +ZY20210800001/H1/C17/N53/S363/s02/T2 +ZY20210800001/H1/C17/N53/S363/s01/T1 +ZY20210800001/H1/C17/N52/S264/s01/T1 +ZY20210800001/H1/C17/N51/S264/s01/T1 +ZY20210800001/H1/C16/N50/S232/s02/T2 +ZY20210800001/H1/C16/N49/S232/s01/T5 +ZY20210800001/H1/C16/N47/S232/s01/T4 +ZY20210800001/H1/C16/N45/S231/s05/T3 +ZY20210800001/H1/C16/N44/S231/s05/T3 +ZY20210800001/H1/C16/N42/S231/s05/T3 +ZY20210800001/H1/C16/N38/S231/s04/T2 +ZY20210800001/H1/C16/N37/S231/s03/T4 +ZY20210800001/H1/C16/N35/S231/s05/T3 +ZY20210800001/H1/C16/N34/S231/s03/T3 +ZY20210800001/H1/C16/N32/S231/s02/T5 +ZY20210800001/H1/C16/N31/S231/s02/T3 +ZY20210800001/H1/C16/N30/S231/s02/T3 +ZY20210800001/H1/C16/N29/S231/s01/T3 +ZY20210800001/H1/C16/N28/S231/s01/T2 +ZY20210800001/H1/C16/N11/S232/s03/T2 +ZY20210800001/H1/C16/N09/S232/s03/T2 +ZY20210800001/H1/C16/N07/S232/s03/T4 +ZY20210800001/H1/C16/N05/S232/s02/T4 +ZY20210800001/H1/C16/N03/S232/s02/T2 +ZY20210800001/H1/C14/N09/S367/s01/T2 +ZY20210800001/H1/C13/N10/S179/s03/T4 +ZY20210800001/H1/C13/N10/S132/s03/T1 +ZY20210800001/H1/C13/N09/S132/s03/T1 +ZY20210800001/H1/C13/N08/S179/s02/T4 +ZY20210800001/H1/C13/N08/S132/s02/T1 +ZY20210800001/H1/C13/N07/S179/s02/T4 +ZY20210800001/H1/C13/N07/S132/s02/T1 +ZY20210800001/H1/C13/N06/S179/s02/T2 +ZY20210800001/H1/C13/N06/S132/s02/T1 +ZY20210800001/H1/C13/N05/S179/s02/T2 +ZY20210800001/H1/C13/N05/S132/s02/T1 +ZY20210800001/H1/C13/N04/S179/s01/T2 +ZY20210800001/H1/C13/N04/S132/s01/T1 +ZY20210800001/H1/C13/N03/S179/s01/T2 +ZY20210800001/H1/C13/N03/S132/s01/T1 +ZY20210800001/H1/C13/N02/S179/s01/T2 +ZY20210800001/H1/C13/N02/S132/s01/T1 +ZY20210800001/H1/C13/N01/S179/s01/T2 +ZY20210800001/H1/C13/N01/S132/s01/T1 +ZY20210800001/H1/C12/N09/S203/s03/T2 +ZY20210800001/H1/C12/N09/S169/s03/T1 +ZY20210800001/H1/C12/N07/S203/s03/T2 +ZY20210800001/H1/C12/N07/S169/s03/T1 +ZY20210800001/H1/C12/N05/S203/s02/T2 +ZY20210800001/H1/C12/N05/S169/s02/T1 +ZY20210800001/H1/C12/N03/S203/s02/T2 +ZY20210800001/H1/C12/N03/S169/s02/T1 +ZY20210800001/H1/C12/N01/S203/s02/T2 +ZY20210800001/H1/C12/N01/S169/s02/T1 +ZY20210800001/H1/C11/N06/S185/s02/T2 +ZY20210800001/H1/C11/N05/S185/s02/T2 +ZY20210800001/H1/C11/N04/S367/s02/T3 +ZY20210800001/H1/C11/N04/S185/s01/T2 +ZY20210800001/H1/C11/N03/S185/s01/T2 +ZY20210800001/H1/C11/N02/S185/s01/T2 +ZY20210800001/H1/C11/N01/S185/s01/T2 +ZY20210800001/H1/C10/N52/S384/s05/T1 +ZY20210800001/H1/C10/N52/S384/s04/T4 +ZY20210800001/H1/C10/N52/S384/s03/T3 +ZY20210800001/H1/C10/N52/S384/s02/T2 +ZY20210800001/H1/C10/N52/S384/s01/T1 +ZY20210800001/H1/C10/N51/S384/s05/T4 +ZY20210800001/H1/C10/N51/S384/s04/T4 +ZY20210800001/H1/C10/N51/S384/s02/T2 +ZY20210800001/H1/C10/N51/S384/s01/T1 +ZY20210800001/H1/C1/N18/S108/s01/T2 +ZY20210800001/H1/C1/N18/S108/s01/T1 +ZY20210800001/H1/C1/N17/S100/s04/T2 +ZY20210800001/H1/C1/N17/S100/s04/T1 +ZY20210800001/H1/C1/N16/S100/s04/T2 +ZY20210800001/H1/C1/N16/S100/s04/T1 +ZY20210800001/H1/C1/N15/S99/s04/T1 \ No newline at end of file diff --git a/third-party/HOI4D-Instructions/utils/color_map.py b/third-party/HOI4D-Instructions/utils/color_map.py new file mode 100644 index 0000000000000000000000000000000000000000..ae89e3655994d91e03e8fd85430342d23c3e881d --- /dev/null +++ b/third-party/HOI4D-Instructions/utils/color_map.py @@ -0,0 +1,24 @@ +import numpy as np + + +def get_color_map(N=256): + """ + Return the color (R, G, B) of each label index. + """ + + def bitget(byteval, idx): + return ((byteval & (1 << idx)) != 0) + + cmap = np.zeros((N, 3), dtype=np.uint8) + for i in range(N): + r = g = b = 0 + c = i + for j in range(8): + r = r | (bitget(c, 0) << 7-j) + g = g | (bitget(c, 1) << 7-j) + b = b | (bitget(c, 2) << 7-j) + c = c >> 3 + + cmap[i] = np.array([r, g, b]) + + return cmap diff --git a/third-party/HOI4D-Instructions/utils/decode.py b/third-party/HOI4D-Instructions/utils/decode.py new file mode 100644 index 0000000000000000000000000000000000000000..d8437cebb8d1176d093df9250abdd4234a25c46f --- /dev/null +++ b/third-party/HOI4D-Instructions/utils/decode.py @@ -0,0 +1,34 @@ +import os +import subprocess +import sys + +def decode_video(root): + + with open('./release.txt', 'r') as f: + rgb_list = [os.path.join(root, i.strip(),'align_rgb') for i in f.readlines()] + + for rgb in rgb_list: + depth = rgb.replace('align_rgb','align_depth') + rgb_video = os.path.join(rgb, "image.mp4") + depth_video = os.path.join(depth, "depth_video.avi") + + cmd = """ ffmpeg -i {} -f image2 -start_number 0 -vf fps=fps=15 -qscale:v 2 {}/%05d.{} -loglevel quiet """.format(rgb_video, rgb, "jpg") + + print(cmd) + p = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + if err: + log.info(err.decode()) + + cmd = """ ffmpeg -i {} -f image2 -start_number 0 -vf fps=fps=15 -qscale:v 2 {}/%05d.{} -loglevel quiet """.format(depth_video, depth, "png") + print(cmd) + + p = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + if err: + log.info(err.decode()) + +if __name__ == '__main__': + decode_video('/path/to/HOI4D/') diff --git a/third-party/HOI4D-Instructions/utils/parse_2Dmask_img.py b/third-party/HOI4D-Instructions/utils/parse_2Dmask_img.py new file mode 100644 index 0000000000000000000000000000000000000000..0bd3345c989437fbd926aa88f377b4d97ca269a7 --- /dev/null +++ b/third-party/HOI4D-Instructions/utils/parse_2Dmask_img.py @@ -0,0 +1,23 @@ +import numpy as np +from color_map import get_color_map + + +def parse_2Dmask_img(mask_img, N=10): + """ + mask_img: RGB image, shape = (H, W, 3) + N: number of labels (including background) + + return: pixel labels, shape = (H, W) + """ + + color_map = get_color_map(N=N) + + H, W = mask_img.shape[:2] + labels = np.zeros((H, W)).astype(np.uint8) + + for i in range(N): + c = color_map[i] + valid = (mask_img[..., 0] == c[0]) & (mask_img[..., 1] == c[1]) & (mask_img[..., 2] == c[2]) + labels[valid] = i + + return labels diff --git a/third-party/InterFormer/LICENSE b/third-party/InterFormer/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/third-party/InterFormer/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/third-party/InterFormer/README.md b/third-party/InterFormer/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3294b8445e97878adb75eaa01c8e9ff2b05d24d1 --- /dev/null +++ b/third-party/InterFormer/README.md @@ -0,0 +1,158 @@ +# InterFormer + +Official implementation of the paper: **"Interaction-aware Representation Modeling with Co-occurrence Consistency for Egocentric Hand-Object Parsing"**, *ICLR 2026* + +--- + +## 📋 Table of Contents + +- [Overview](#overview) +- [Environment Setup](#environment-setup) +- [Dataset Preparation](#dataset-preparation) +- [Pretrained Model](#pretrained-model) +- [Training](#training) + - [Single-GPU Training](#single-gpu-training) + - [Multi-GPU Training](#multi-gpu-training) +- [Testing](#testing) +- [Checkpoints](#checkpoints) +- [Results](#results) + +--- + +## Overview + +This repository contains the official code for **InterFormer**, a novel framework for egocentric hand-object parsing that leverages interaction-aware representation modeling with co-occurrence consistency. + +--- + +## Environment Setup + +Create and activate the conda environment using the provided configuration file: + +```bash +# Create environment from yaml file +conda env create -f mmseg.yaml + +# Activate the environment +conda activate mmseg +``` + +> **Note**: If you don't have `mmseg.yaml`, please ensure you have installed mmsegmentation and its dependencies. Alternatively, you can install manually: +> ```bash +> pip install torch torchvision +> pip install mmcv-full +> pip install mmsegmentation +> ``` + +--- + +## Dataset Preparation + +1. Download the dataset from [Google Drive](https://drive.google.com/file/d/1Pc6Ofd3q-yEwByxIqgaJfEJv4QtWtKjP/view?usp=drive_link) + +2. Extract the dataset: + ```bash + unzip dataset.zip -d /path/to/your/dataset/folder + ``` + +3. Update the dataset path in the configuration file: + ```bash + # Edit ./mmseg/configs/config_interformer.py + # Change the dataset path to your extracted folder + data_root = '/path/to/your/dataset/folder' + ``` + +--- + +## Pretrained Model + +Download the pretrained backbone model: + +```bash +# Download pretrained model +wget https://drive.google.com/file/d/13Wd08wkbscxAR1TAgaNWQ2_luYC9pahs/view?usp=drive_link -O pretrained_model/backbone.pth +``` + +Alternatively, download manually from [this link](https://drive.google.com/file/d/13Wd08wkbscxAR1TAgaNWQ2_luYC9pahs/view?usp=drive_link) and place it in the `pretrained_model/` directory. + +Then update the pretrained path in `./mmseg/configs/config_interformer.py `: +```python +pretrained = '/path/to/pretrained_model/backbone.pth' +``` + +--- + +## Training + +### Single-GPU Training + +Run the following command for single-GPU training: + +```bash +python tools/train.py ./mmseg/configs/config_interformer.py +``` + +### Multi-GPU Training + +For multi-GPU training, use the distributed training script: + +```bash +bash tools/dist_train.sh ./mmseg/configs/config_interformer.py +``` + +Example (4 GPUs): +```bash +bash tools/dist_train.sh ./mmseg/configs/config_interformer.py py 4 +``` + +### Training Log + +We provide our training log file (`Training_Log.log`) in this repository. The best results are achieved at **iteration 93,900**. + +--- + +## Testing + +### Single-GPU Testing + +To test a trained model on a single GPU: + +```bash +python tools/test.py +``` + +Example: +```bash +python tools/test.py config/config_interformer.py work_dirs/checkpoint.pth +``` + +--- + +## Checkpoints + +We provide our trained checkpoint for reproduction: + +- **Download link**: [Google Drive](https://drive.google.com/file/d/172Hi0jTTijEnbroYSUZgOfpsyue_HHxg/view?usp=drive_link) + +Download and use it for testing or inference. + +--- + +## Citation + +If you find this work useful for your research, please cite: + +```bibtex +@inproceedings{su2026interformer, + title={Interaction-aware Representation Modeling with Co-occurrence Consistency for Egocentric Hand-Object Parsing}, + author={Su, Yuejiao and Wang, Yi and Yao, Lei and Cui, Yawen and Chau, Lap-Pui}, + booktitle={International Conference on Learning Representations (ICLR)}, + year={2026} +} +``` + +--- + +## Contact + +For questions or issues, please open an issue on GitHub or contact the authors directly. diff --git a/third-party/InterFormer/docker/Dockerfile b/third-party/InterFormer/docker/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..26420ddbbb30734cde37206fd44deb9851b0e620 --- /dev/null +++ b/third-party/InterFormer/docker/Dockerfile @@ -0,0 +1,35 @@ +ARG PYTORCH="1.11.0" +ARG CUDA="11.3" +ARG CUDNN="8" +ARG MMCV="2.0.1" + +FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel + +ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX" +ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all" +ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" + +# To fix GPG key error when running apt-get update +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub + +RUN apt-get update && apt-get install -y git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN conda clean --all + +# Install MMCV +ARG PYTORCH +ARG CUDA +ARG MMCV +RUN ["/bin/bash", "-c", "pip install openmim"] +RUN ["/bin/bash", "-c", "mim install mmengine"] +RUN ["/bin/bash", "-c", "mim install mmcv==${MMCV}"] + +# Install MMSegmentation +RUN git clone -b main https://github.com/open-mmlab/mmsegmentation.git /mmsegmentation +WORKDIR /mmsegmentation +ENV FORCE_CUDA="1" +RUN pip install -r requirements.txt +RUN pip install --no-cache-dir -e . diff --git a/third-party/InterFormer/docker/serve/Dockerfile b/third-party/InterFormer/docker/serve/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..38f91baa5b06760f35e4ae27dd598df1135366ec --- /dev/null +++ b/third-party/InterFormer/docker/serve/Dockerfile @@ -0,0 +1,51 @@ +ARG PYTORCH="1.11.0" +ARG CUDA="11.3" +ARG CUDNN="8" +FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel + +ARG MMCV="2.0.1" +ARG MMSEG="1.2.2" + +ENV PYTHONUNBUFFERED TRUE + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ + ca-certificates \ + g++ \ + openjdk-11-jre-headless \ + # MMDet Requirements + ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \ + && rm -rf /var/lib/apt/lists/* + +ENV PATH="/opt/conda/bin:$PATH" +RUN export FORCE_CUDA=1 + +# TORCHSEVER +RUN pip install torchserve torch-model-archiver + +# MMLAB +ARG PYTORCH +ARG CUDA +RUN ["/bin/bash", "-c", "pip install openmim"] +RUN ["/bin/bash", "-c", "mim install mmengine"] +RUN ["/bin/bash", "-c", "mim install mmcv==${MMCV}"] +RUN pip install mmsegmentation==${MMSEG} + +RUN useradd -m model-server \ + && mkdir -p /home/model-server/tmp + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh + +RUN chmod +x /usr/local/bin/entrypoint.sh \ + && chown -R model-server /home/model-server + +COPY config.properties /home/model-server/config.properties +RUN mkdir /home/model-server/model-store && chown -R model-server /home/model-server/model-store + +EXPOSE 8080 8081 8082 + +USER model-server +WORKDIR /home/model-server +ENV TEMP=/home/model-server/tmp +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD ["serve"] diff --git a/third-party/InterFormer/docker/serve/config.properties b/third-party/InterFormer/docker/serve/config.properties new file mode 100644 index 0000000000000000000000000000000000000000..efb9c47e40ab550bac765611e6c6c6f2a7152f11 --- /dev/null +++ b/third-party/InterFormer/docker/serve/config.properties @@ -0,0 +1,5 @@ +inference_address=http://0.0.0.0:8080 +management_address=http://0.0.0.0:8081 +metrics_address=http://0.0.0.0:8082 +model_store=/home/model-server/model-store +load_models=all diff --git a/third-party/InterFormer/docker/serve/entrypoint.sh b/third-party/InterFormer/docker/serve/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ba00b048aed84b45c5a8015a016ff148e97d86 --- /dev/null +++ b/third-party/InterFormer/docker/serve/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +if [[ "$1" = "serve" ]]; then + shift 1 + torchserve --start --ts-config /home/model-server/config.properties +else + eval "$@" +fi + +# prevent docker exit +tail -f /dev/null diff --git a/third-party/InterFormer/mmseg/__init__.py b/third-party/InterFormer/mmseg/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..524d356a0103ec84165dcf87e4dab8ea1ab9cad4 --- /dev/null +++ b/third-party/InterFormer/mmseg/__init__.py @@ -0,0 +1,76 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import warnings + +import mmcv +import mmengine +from packaging.version import parse + +from .version import __version__, version_info + +MMCV_MIN = '2.0.0rc4' +MMCV_MAX = '2.3.0' +MMENGINE_MIN = '0.5.0' +MMENGINE_MAX = '1.0.0' + + +def digit_version(version_str: str, length: int = 4): + """Convert a version string into a tuple of integers. + + This method is usually used for comparing two versions. For pre-release + versions: alpha < beta < rc. + + Args: + version_str (str): The version string. + length (int): The maximum number of version levels. Default: 4. + + Returns: + tuple[int]: The version info in digits (integers). + """ + version = parse(version_str) + assert version.release, f'failed to parse version {version_str}' + release = list(version.release) + release = release[:length] + if len(release) < length: + release = release + [0] * (length - len(release)) + if version.is_prerelease: + mapping = {'a': -3, 'b': -2, 'rc': -1} + val = -4 + # version.pre can be None + if version.pre: + if version.pre[0] not in mapping: + warnings.warn(f'unknown prerelease version {version.pre[0]}, ' + 'version checking may go wrong') + else: + val = mapping[version.pre[0]] + release.extend([val, version.pre[-1]]) + else: + release.extend([val, 0]) + + elif version.is_postrelease: + release.extend([1, version.post]) + else: + release.extend([0, 0]) + return tuple(release) + + +mmcv_min_version = digit_version(MMCV_MIN) +mmcv_max_version = digit_version(MMCV_MAX) +mmcv_version = digit_version(mmcv.__version__) + + +if not (mmcv_min_version <= mmcv_version < mmcv_max_version): + warnings.warn( + f'MMCV=={mmcv.__version__} is outside InterFormer\'s original ' + f'window [{MMCV_MIN}, {MMCV_MAX}); continuing anyway.' + ) + +mmengine_min_version = digit_version(MMENGINE_MIN) +mmengine_max_version = digit_version(MMENGINE_MAX) +mmengine_version = digit_version(mmengine.__version__) + +assert (mmengine_min_version <= mmengine_version < mmengine_max_version), \ + f'MMEngine=={mmengine.__version__} is used but incompatible. ' \ + f'Please install mmengine>={mmengine_min_version}, '\ + f'<{mmengine_max_version}.' + +__all__ = ['__version__', 'version_info', 'digit_version'] diff --git a/third-party/InterFormer/mmseg/__pycache__/__init__.cpython-38.pyc b/third-party/InterFormer/mmseg/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0941bd12aa06651cf9918d76fb20bcf7fd542aa Binary files /dev/null and b/third-party/InterFormer/mmseg/__pycache__/__init__.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/__pycache__/version.cpython-38.pyc b/third-party/InterFormer/mmseg/__pycache__/version.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af1dc88e4161ff3168128ed8ea4fd045a37c8cdb Binary files /dev/null and b/third-party/InterFormer/mmseg/__pycache__/version.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/apis/__init__.py b/third-party/InterFormer/mmseg/apis/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b50a266319c9cf74cb8b13afcff564248c058732 --- /dev/null +++ b/third-party/InterFormer/mmseg/apis/__init__.py @@ -0,0 +1,9 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from .inference import inference_model, init_model, show_result_pyplot +from .mmseg_inferencer import MMSegInferencer +from .remote_sense_inferencer import RSImage, RSInferencer + +__all__ = [ + 'init_model', 'inference_model', 'show_result_pyplot', 'MMSegInferencer', + 'RSInferencer', 'RSImage' +] diff --git a/third-party/InterFormer/mmseg/apis/inference.py b/third-party/InterFormer/mmseg/apis/inference.py new file mode 100644 index 0000000000000000000000000000000000000000..aab11d14f4becc43d4c2ecd3772417e4923bd20e --- /dev/null +++ b/third-party/InterFormer/mmseg/apis/inference.py @@ -0,0 +1,189 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import warnings +from pathlib import Path +from typing import Optional, Union + +import mmcv +import numpy as np +import torch +from mmengine import Config +from mmengine.registry import init_default_scope +from mmengine.runner import load_checkpoint +from mmengine.utils import mkdir_or_exist + +from mmseg.models import BaseSegmentor +from mmseg.registry import MODELS +from mmseg.structures import SegDataSample +from mmseg.utils import SampleList, dataset_aliases, get_classes, get_palette +from mmseg.visualization import SegLocalVisualizer +from .utils import ImageType, _preprare_data + + +def init_model(config: Union[str, Path, Config], + checkpoint: Optional[str] = None, + device: str = 'cuda:0', + cfg_options: Optional[dict] = None): + """Initialize a segmentor from config file. + + Args: + config (str, :obj:`Path`, or :obj:`mmengine.Config`): Config file path, + :obj:`Path`, or the config object. + checkpoint (str, optional): Checkpoint path. If left as None, the model + will not load any weights. + device (str, optional) CPU/CUDA device option. Default 'cuda:0'. + Use 'cpu' for loading model on CPU. + cfg_options (dict, optional): Options to override some settings in + the used config. + Returns: + nn.Module: The constructed segmentor. + """ + if isinstance(config, (str, Path)): + config = Config.fromfile(config) + elif not isinstance(config, Config): + raise TypeError('config must be a filename or Config object, ' + 'but got {}'.format(type(config))) + if cfg_options is not None: + config.merge_from_dict(cfg_options) + if config.model.type == 'EncoderDecoder': + if 'init_cfg' in config.model.backbone: + config.model.backbone.init_cfg = None + elif config.model.type == 'MultimodalEncoderDecoder': + for k, v in config.model.items(): + if isinstance(v, dict) and 'init_cfg' in v: + config.model[k].init_cfg = None + config.model.pretrained = None + config.model.train_cfg = None + init_default_scope(config.get('default_scope', 'mmseg')) + + model = MODELS.build(config.model) + if checkpoint is not None: + checkpoint = load_checkpoint(model, checkpoint, map_location='cpu') + dataset_meta = checkpoint['meta'].get('dataset_meta', None) + # save the dataset_meta in the model for convenience + if 'dataset_meta' in checkpoint.get('meta', {}): + # mmseg 1.x + model.dataset_meta = dataset_meta + elif 'CLASSES' in checkpoint.get('meta', {}): + # < mmseg 1.x + classes = checkpoint['meta']['CLASSES'] + palette = checkpoint['meta']['PALETTE'] + model.dataset_meta = {'classes': classes, 'palette': palette} + else: + warnings.simplefilter('once') + warnings.warn( + 'dataset_meta or class names are not saved in the ' + 'checkpoint\'s meta data, classes and palette will be' + 'set according to num_classes ') + num_classes = model.decode_head.num_classes + dataset_name = None + for name in dataset_aliases.keys(): + if len(get_classes(name)) == num_classes: + dataset_name = name + break + if dataset_name is None: + warnings.warn( + 'No suitable dataset found, use Cityscapes by default') + dataset_name = 'cityscapes' + model.dataset_meta = { + 'classes': get_classes(dataset_name), + 'palette': get_palette(dataset_name) + } + model.cfg = config # save the config in the model for convenience + model.to(device) + model.eval() + return model + + +def inference_model(model: BaseSegmentor, + img: ImageType) -> Union[SegDataSample, SampleList]: + """Inference image(s) with the segmentor. + + Args: + model (nn.Module): The loaded segmentor. + imgs (str/ndarray or list[str/ndarray]): Either image files or loaded + images. + + Returns: + :obj:`SegDataSample` or list[:obj:`SegDataSample`]: + If imgs is a list or tuple, the same length list type results + will be returned, otherwise return the segmentation results directly. + """ + # prepare data + data, is_batch = _preprare_data(img, model) + + # forward the model + with torch.no_grad(): + results = model.test_step(data) + + return results if is_batch else results[0] + + +def show_result_pyplot(model: BaseSegmentor, + img: Union[str, np.ndarray], + result: SegDataSample, + opacity: float = 0.5, + title: str = '', + draw_gt: bool = True, + draw_pred: bool = True, + wait_time: float = 0, + show: bool = True, + with_labels: Optional[bool] = True, + save_dir=None, + out_file=None): + """Visualize the segmentation results on the image. + + Args: + model (nn.Module): The loaded segmentor. + img (str or np.ndarray): Image filename or loaded image. + result (SegDataSample): The prediction SegDataSample result. + opacity(float): Opacity of painted segmentation map. + Default 0.5. Must be in (0, 1] range. + title (str): The title of pyplot figure. + Default is ''. + draw_gt (bool): Whether to draw GT SegDataSample. Default to True. + draw_pred (bool): Whether to draw Prediction SegDataSample. + Defaults to True. + wait_time (float): The interval of show (s). 0 is the special value + that means "forever". Defaults to 0. + show (bool): Whether to display the drawn image. + Default to True. + with_labels(bool, optional): Add semantic labels in visualization + result, Default to True. + save_dir (str, optional): Save file dir for all storage backends. + If it is None, the backend storage will not save any data. + out_file (str, optional): Path to output file. Default to None. + + + + Returns: + np.ndarray: the drawn image which channel is RGB. + """ + if hasattr(model, 'module'): + model = model.module + if isinstance(img, str): + image = mmcv.imread(img, channel_order='rgb') + else: + image = img + if save_dir is not None: + mkdir_or_exist(save_dir) + # init visualizer + visualizer = SegLocalVisualizer( + vis_backends=[dict(type='LocalVisBackend')], + save_dir=save_dir, + alpha=opacity) + visualizer.dataset_meta = dict( + classes=model.dataset_meta['classes'], + palette=model.dataset_meta['palette']) + visualizer.add_datasample( + name=title, + image=image, + data_sample=result, + draw_gt=draw_gt, + draw_pred=draw_pred, + wait_time=wait_time, + out_file=out_file, + show=show, + with_labels=with_labels) + vis_img = visualizer.get_image() + + return vis_img diff --git a/third-party/InterFormer/mmseg/apis/mmseg_inferencer.py b/third-party/InterFormer/mmseg/apis/mmseg_inferencer.py new file mode 100644 index 0000000000000000000000000000000000000000..02a198b516a71c1f5a0833955607ba4ecc05bf13 --- /dev/null +++ b/third-party/InterFormer/mmseg/apis/mmseg_inferencer.py @@ -0,0 +1,382 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import os.path as osp +import warnings +from typing import List, Optional, Sequence, Union + +import mmcv +import mmengine +import numpy as np +import torch +import torch.nn as nn +from mmcv.transforms import Compose +from mmengine.infer.infer import BaseInferencer, ModelType +from mmengine.model import revert_sync_batchnorm +from mmengine.registry import init_default_scope +from mmengine.runner.checkpoint import _load_checkpoint_to_model +from PIL import Image + +from mmseg.structures import SegDataSample +from mmseg.utils import ConfigType, SampleList, get_classes, get_palette +from mmseg.visualization import SegLocalVisualizer + +InputType = Union[str, np.ndarray] +InputsType = Union[InputType, Sequence[InputType]] +PredType = Union[SegDataSample, SampleList] + + +class MMSegInferencer(BaseInferencer): + """Semantic segmentation inferencer, provides inference and visualization + interfaces. Note: MMEngine >= 0.5.0 is required. + + Args: + model (str, optional): Path to the config file or the model name + defined in metafile. Take the `mmseg metafile `_ + as an example the `model` could be + "fcn_r50-d8_4xb2-40k_cityscapes-512x1024", and the weights of model + will be download automatically. If use config file, like + "configs/fcn/fcn_r50-d8_4xb2-40k_cityscapes-512x1024.py", the + `weights` should be defined. + weights (str, optional): Path to the checkpoint. If it is not specified + and model is a model name of metafile, the weights will be loaded + from metafile. Defaults to None. + classes (list, optional): Input classes for result rendering, as the + prediction of segmentation model is a segment map with label + indices, `classes` is a list which includes items responding to the + label indices. If classes is not defined, visualizer will take + `cityscapes` classes by default. Defaults to None. + palette (list, optional): Input palette for result rendering, which is + a list of color palette responding to the classes. If palette is + not defined, visualizer will take `cityscapes` palette by default. + Defaults to None. + dataset_name (str, optional): `Dataset name or alias `_ + visulizer will use the meta information of the dataset i.e. classes + and palette, but the `classes` and `palette` have higher priority. + Defaults to None. + device (str, optional): Device to run inference. If None, the available + device will be automatically used. Defaults to None. + scope (str, optional): The scope of the model. Defaults to 'mmseg'. + """ # noqa + + preprocess_kwargs: set = set() + forward_kwargs: set = {'mode', 'out_dir'} + visualize_kwargs: set = { + 'show', 'wait_time', 'img_out_dir', 'opacity', 'return_vis', + 'with_labels' + } + postprocess_kwargs: set = {'pred_out_dir', 'return_datasample'} + + def __init__(self, + model: Union[ModelType, str], + weights: Optional[str] = None, + classes: Optional[Union[str, List]] = None, + palette: Optional[Union[str, List]] = None, + dataset_name: Optional[str] = None, + device: Optional[str] = None, + scope: Optional[str] = 'mmseg') -> None: + # A global counter tracking the number of images processes, for + # naming of the output images + self.num_visualized_imgs = 0 + self.num_pred_imgs = 0 + init_default_scope(scope if scope else 'mmseg') + super().__init__( + model=model, weights=weights, device=device, scope=scope) + + if device == 'cpu' or not torch.cuda.is_available(): + self.model = revert_sync_batchnorm(self.model) + + assert isinstance(self.visualizer, SegLocalVisualizer) + self.visualizer.set_dataset_meta(classes, palette, dataset_name) + + def _load_weights_to_model(self, model: nn.Module, + checkpoint: Optional[dict], + cfg: Optional[ConfigType]) -> None: + """Loading model weights and meta information from cfg and checkpoint. + + Subclasses could override this method to load extra meta information + from ``checkpoint`` and ``cfg`` to model. + + Args: + model (nn.Module): Model to load weights and meta information. + checkpoint (dict, optional): The loaded checkpoint. + cfg (Config or ConfigDict, optional): The loaded config. + """ + + if checkpoint is not None: + _load_checkpoint_to_model(model, checkpoint) + checkpoint_meta = checkpoint.get('meta', {}) + # save the dataset_meta in the model for convenience + if 'dataset_meta' in checkpoint_meta: + # mmsegmentation 1.x + model.dataset_meta = { + 'classes': checkpoint_meta['dataset_meta'].get('classes'), + 'palette': checkpoint_meta['dataset_meta'].get('palette') + } + elif 'CLASSES' in checkpoint_meta: + # mmsegmentation 0.x + classes = checkpoint_meta['CLASSES'] + palette = checkpoint_meta.get('PALETTE', None) + model.dataset_meta = {'classes': classes, 'palette': palette} + else: + warnings.warn( + 'dataset_meta or class names are not saved in the ' + 'checkpoint\'s meta data, use classes of Cityscapes by ' + 'default.') + model.dataset_meta = { + 'classes': get_classes('cityscapes'), + 'palette': get_palette('cityscapes') + } + else: + warnings.warn('Checkpoint is not loaded, and the inference ' + 'result is calculated by the randomly initialized ' + 'model!') + warnings.warn( + 'weights is None, use cityscapes classes by default.') + model.dataset_meta = { + 'classes': get_classes('cityscapes'), + 'palette': get_palette('cityscapes') + } + + def __call__(self, + inputs: InputsType, + return_datasamples: bool = False, + batch_size: int = 1, + return_vis: bool = False, + show: bool = False, + wait_time: int = 0, + out_dir: str = '', + img_out_dir: str = 'vis', + pred_out_dir: str = 'pred', + **kwargs) -> dict: + """Call the inferencer. + + Args: + inputs (Union[list, str, np.ndarray]): Inputs for the inferencer. + return_datasamples (bool): Whether to return results as + :obj:`SegDataSample`. Defaults to False. + batch_size (int): Batch size. Defaults to 1. + show (bool): Whether to display the rendering color segmentation + mask in a popup window. Defaults to False. + wait_time (float): The interval of show (s). Defaults to 0. + out_dir (str): Output directory of inference results. Defaults + to ''. + img_out_dir (str): Subdirectory of `out_dir`, used to save + rendering color segmentation mask, so `out_dir` must be defined + if you would like to save predicted mask. Defaults to 'vis'. + pred_out_dir (str): Subdirectory of `out_dir`, used to save + predicted mask file, so `out_dir` must be defined if you would + like to save predicted mask. Defaults to 'pred'. + + **kwargs: Other keyword arguments passed to :meth:`preprocess`, + :meth:`forward`, :meth:`visualize` and :meth:`postprocess`. + Each key in kwargs should be in the corresponding set of + ``preprocess_kwargs``, ``forward_kwargs``, ``visualize_kwargs`` + and ``postprocess_kwargs``. + + + Returns: + dict: Inference and visualization results. + """ + + if out_dir != '': + pred_out_dir = osp.join(out_dir, pred_out_dir) + img_out_dir = osp.join(out_dir, img_out_dir) + else: + pred_out_dir = '' + img_out_dir = '' + + return super().__call__( + inputs=inputs, + return_datasamples=return_datasamples, + batch_size=batch_size, + show=show, + wait_time=wait_time, + img_out_dir=img_out_dir, + pred_out_dir=pred_out_dir, + return_vis=return_vis, + **kwargs) + + def visualize(self, + inputs: list, + preds: List[dict], + return_vis: bool = False, + show: bool = False, + wait_time: int = 0, + img_out_dir: str = '', + opacity: float = 0.8, + with_labels: Optional[bool] = True) -> List[np.ndarray]: + """Visualize predictions. + + Args: + inputs (list): Inputs preprocessed by :meth:`_inputs_to_list`. + preds (Any): Predictions of the model. + show (bool): Whether to display the image in a popup window. + Defaults to False. + wait_time (float): The interval of show (s). Defaults to 0. + img_out_dir (str): Output directory of rendering prediction i.e. + color segmentation mask. Defaults: '' + opacity (int, float): The transparency of segmentation mask. + Defaults to 0.8. + + Returns: + List[np.ndarray]: Visualization results. + """ + if not show and img_out_dir == '' and not return_vis: + return None + if self.visualizer is None: + raise ValueError('Visualization needs the "visualizer" term' + 'defined in the config, but got None.') + + self.visualizer.set_dataset_meta(**self.model.dataset_meta) + self.visualizer.alpha = opacity + + results = [] + + for single_input, pred in zip(inputs, preds): + if isinstance(single_input, str): + img_bytes = mmengine.fileio.get(single_input) + img = mmcv.imfrombytes(img_bytes) + img = img[:, :, ::-1] + img_name = osp.basename(single_input) + elif isinstance(single_input, np.ndarray): + img = single_input.copy() + img_num = str(self.num_visualized_imgs).zfill(8) + '_vis' + img_name = f'{img_num}.jpg' + else: + raise ValueError('Unsupported input type:' + f'{type(single_input)}') + + out_file = osp.join(img_out_dir, img_name) if img_out_dir != ''\ + else None + + self.visualizer.add_datasample( + img_name, + img, + pred, + show=show, + wait_time=wait_time, + draw_gt=False, + draw_pred=True, + out_file=out_file, + with_labels=with_labels) + if return_vis: + results.append(self.visualizer.get_image()) + self.num_visualized_imgs += 1 + + return results if return_vis else None + + def postprocess(self, + preds: PredType, + visualization: List[np.ndarray], + return_datasample: bool = False, + pred_out_dir: str = '') -> dict: + """Process the predictions and visualization results from ``forward`` + and ``visualize``. + + This method should be responsible for the following tasks: + + 1. Pack the predictions and visualization results and return them. + 2. Save the predictions, if it needed. + + Args: + preds (List[Dict]): Predictions of the model. + visualization (List[np.ndarray]): The list of rendering color + segmentation mask. + return_datasample (bool): Whether to return results as datasamples. + Defaults to False. + pred_out_dir: File to save the inference results w/o + visualization. If left as empty, no file will be saved. + Defaults to ''. + + Returns: + dict: Inference and visualization results with key ``predictions`` + and ``visualization`` + + - ``visualization (Any)``: Returned by :meth:`visualize` + - ``predictions`` (List[np.ndarray], np.ndarray): Returned by + :meth:`forward` and processed in :meth:`postprocess`. + If ``return_datasample=False``, it will be the segmentation mask + with label indice. + """ + if return_datasample: + if len(preds) == 1: + return preds[0] + else: + return preds + + results_dict = {} + + results_dict['predictions'] = [] + results_dict['visualization'] = [] + + for i, pred in enumerate(preds): + pred_data = dict() + if 'pred_sem_seg' in pred.keys(): + pred_data['sem_seg'] = pred.pred_sem_seg.numpy().data[0] + elif 'pred_depth_map' in pred.keys(): + pred_data['depth_map'] = pred.pred_depth_map.numpy().data[0] + + if visualization is not None: + vis = visualization[i] + results_dict['visualization'].append(vis) + if pred_out_dir != '': + mmengine.mkdir_or_exist(pred_out_dir) + for key, data in pred_data.items(): + post_fix = '_pred.png' if key == 'sem_seg' else '_pred.npy' + img_name = str(self.num_pred_imgs).zfill(8) + post_fix + img_path = osp.join(pred_out_dir, img_name) + if key == 'sem_seg': + output = Image.fromarray(data.astype(np.uint8)) + output.save(img_path) + else: + np.save(img_path, data) + pred_data = next(iter(pred_data.values())) + results_dict['predictions'].append(pred_data) + self.num_pred_imgs += 1 + + if len(results_dict['predictions']) == 1: + results_dict['predictions'] = results_dict['predictions'][0] + if visualization is not None: + results_dict['visualization'] = \ + results_dict['visualization'][0] + return results_dict + + def _init_pipeline(self, cfg: ConfigType) -> Compose: + """Initialize the test pipeline. + + Return a pipeline to handle various input data, such as ``str``, + ``np.ndarray``. It is an abstract method in BaseInferencer, and should + be implemented in subclasses. + + The returned pipeline will be used to process a single data. + It will be used in :meth:`preprocess` like this: + + .. code-block:: python + def preprocess(self, inputs, batch_size, **kwargs): + ... + dataset = map(self.pipeline, dataset) + ... + """ + pipeline_cfg = cfg.test_dataloader.dataset.pipeline + # Loading annotations is also not applicable + for transform in ('LoadAnnotations', 'LoadDepthAnnotation'): + idx = self._get_transform_idx(pipeline_cfg, transform) + if idx != -1: + del pipeline_cfg[idx] + + load_img_idx = self._get_transform_idx(pipeline_cfg, + 'LoadImageFromFile') + if load_img_idx == -1: + raise ValueError( + 'LoadImageFromFile is not found in the test pipeline') + pipeline_cfg[load_img_idx]['type'] = 'InferencerLoader' + return Compose(pipeline_cfg) + + def _get_transform_idx(self, pipeline_cfg: ConfigType, name: str) -> int: + """Returns the index of the transform in a pipeline. + + If the transform is not found, returns -1. + """ + for i, transform in enumerate(pipeline_cfg): + if transform['type'] == name: + return i + return -1 diff --git a/third-party/InterFormer/mmseg/apis/remote_sense_inferencer.py b/third-party/InterFormer/mmseg/apis/remote_sense_inferencer.py new file mode 100644 index 0000000000000000000000000000000000000000..6726c6ae3464b3911f7e69b14a0baf35cffc66d0 --- /dev/null +++ b/third-party/InterFormer/mmseg/apis/remote_sense_inferencer.py @@ -0,0 +1,279 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import threading +from queue import Queue +from typing import List, Optional, Tuple + +import numpy as np +import torch +from mmengine import Config +from mmengine.model import BaseModel +from mmengine.registry import init_default_scope +from mmengine.runner import load_checkpoint + +try: + from osgeo import gdal +except ImportError: + gdal = None + +from mmseg.registry import MODELS +from .utils import _preprare_data + + +class RSImage: + """Remote sensing image class. + + Args: + img (str or gdal.Dataset): Image file path or gdal.Dataset. + """ + + def __init__(self, image): + self.dataset = gdal.Open(image, gdal.GA_ReadOnly) if isinstance( + image, str) else image + assert isinstance(self.dataset, gdal.Dataset), \ + f'{image} is not a image' + self.width = self.dataset.RasterXSize + self.height = self.dataset.RasterYSize + self.channel = self.dataset.RasterCount + self.trans = self.dataset.GetGeoTransform() + self.proj = self.dataset.GetProjection() + self.band_list = [] + self.band_list.extend( + self.dataset.GetRasterBand(c + 1) for c in range(self.channel)) + self.grids = [] + + def read(self, grid: Optional[List] = None) -> np.ndarray: + """Read image data. If grid is None, read the whole image. + + Args: + grid (Optional[List], optional): Grid to read. Defaults to None. + Returns: + np.ndarray: Image data. + """ + if grid is None: + return np.einsum('ijk->jki', self.dataset.ReadAsArray()) + assert len( + grid) >= 4, 'grid must be a list containing at least 4 elements' + data = self.dataset.ReadAsArray(*grid[:4]) + if data.ndim == 2: + data = data[np.newaxis, ...] + return np.einsum('ijk->jki', data) + + def write(self, data: Optional[np.ndarray], grid: Optional[List] = None): + """Write image data. + + Args: + grid (Optional[List], optional): Grid to write. Defaults to None. + data (Optional[np.ndarray], optional): Data to write. + Defaults to None. + + Raises: + ValueError: Either grid or data must be provided. + """ + if grid is not None: + assert len(grid) == 8, 'grid must be a list of 8 elements' + for band in self.band_list: + band.WriteArray( + data[grid[5]:grid[5] + grid[7], grid[4]:grid[4] + grid[6]], + grid[0] + grid[4], grid[1] + grid[5]) + elif data is not None: + for i in range(self.channel): + self.band_list[i].WriteArray(data[..., i]) + else: + raise ValueError('Either grid or data must be provided.') + + def create_seg_map(self, output_path: Optional[str] = None): + if output_path is None: + output_path = 'output_label.tif' + driver = gdal.GetDriverByName('GTiff') + seg_map = driver.Create(output_path, self.width, self.height, 1, + gdal.GDT_Byte) + seg_map.SetGeoTransform(self.trans) + seg_map.SetProjection(self.proj) + seg_map_img = RSImage(seg_map) + seg_map_img.path = output_path + return seg_map_img + + def create_grids(self, + window_size: Tuple[int, int], + stride: Tuple[int, int] = (0, 0)): + """Create grids for image inference. + + Args: + window_size (Tuple[int, int]): the size of the sliding window. + stride (Tuple[int, int], optional): the stride of the sliding + window. Defaults to (0, 0). + + Raises: + AssertionError: window_size must be a tuple of 2 elements. + AssertionError: stride must be a tuple of 2 elements. + """ + assert len( + window_size) == 2, 'window_size must be a tuple of 2 elements' + assert len(stride) == 2, 'stride must be a tuple of 2 elements' + win_w, win_h = window_size + stride_x, stride_y = stride + + stride_x = win_w if stride_x == 0 else stride_x + stride_y = win_h if stride_y == 0 else stride_y + + x_half_overlap = (win_w - stride_x + 1) // 2 + y_half_overlap = (win_h - stride_y + 1) // 2 + + for y in range(0, self.height, stride_y): + y_end = y + win_h >= self.height + y_offset = self.height - win_h if y_end else y + y_size = win_h + y_crop_off = 0 if y_offset == 0 else y_half_overlap + y_crop_size = y_size if y_end else win_h - y_crop_off + + for x in range(0, self.width, stride_x): + x_end = x + win_w >= self.width + x_offset = self.width - win_w if x_end else x + x_size = win_w + x_crop_off = 0 if x_offset == 0 else x_half_overlap + x_crop_size = x_size if x_end else win_w - x_crop_off + + self.grids.append([ + x_offset, y_offset, x_size, y_size, x_crop_off, y_crop_off, + x_crop_size, y_crop_size + ]) + + +class RSInferencer: + """Remote sensing inference class. + + Args: + model (BaseModel): The loaded model. + batch_size (int, optional): Batch size. Defaults to 1. + thread (int, optional): Number of threads. Defaults to 1. + """ + + def __init__(self, model: BaseModel, batch_size: int = 1, thread: int = 1): + self.model = model + self.batch_size = batch_size + self.END_FLAG = object() + self.read_buffer = Queue(self.batch_size) + self.write_buffer = Queue(self.batch_size) + self.thread = thread + + @classmethod + def from_config_path(cls, + config_path: str, + checkpoint_path: str, + batch_size: int = 1, + thread: int = 1, + device: Optional[str] = 'cpu'): + """Initialize a segmentor from config file. + + Args: + config_path (str): Config file path. + checkpoint_path (str): Checkpoint path. + batch_size (int, optional): Batch size. Defaults to 1. + """ + init_default_scope('mmseg') + cfg = Config.fromfile(config_path) + model = MODELS.build(cfg.model) + model.cfg = cfg + load_checkpoint(model, checkpoint_path, map_location='cpu') + model.to(device) + model.eval() + return cls(model, batch_size, thread) + + @classmethod + def from_model(cls, + model: BaseModel, + checkpoint_path: Optional[str] = None, + batch_size: int = 1, + thread: int = 1, + device: Optional[str] = 'cpu'): + """Initialize a segmentor from model. + + Args: + model (BaseModel): The loaded model. + checkpoint_path (Optional[str]): Checkpoint path. + batch_size (int, optional): Batch size. Defaults to 1. + """ + if checkpoint_path is not None: + load_checkpoint(model, checkpoint_path, map_location='cpu') + model.to(device) + return cls(model, batch_size, thread) + + def read(self, + image: RSImage, + window_size: Tuple[int, int], + strides: Tuple[int, int] = (0, 0)): + """Load image data to read buffer. + + Args: + image (RSImage): The image to read. + window_size (Tuple[int, int]): The size of the sliding window. + strides (Tuple[int, int], optional): The stride of the sliding + window. Defaults to (0, 0). + """ + image.create_grids(window_size, strides) + for grid in image.grids: + self.read_buffer.put([grid, image.read(grid=grid)]) + self.read_buffer.put(self.END_FLAG) + + def inference(self): + """Inference image data from read buffer and put the result to write + buffer.""" + while True: + item = self.read_buffer.get() + if item == self.END_FLAG: + self.read_buffer.put(self.END_FLAG) + self.write_buffer.put(item) + break + data, _ = _preprare_data(item[1], self.model) + with torch.no_grad(): + result = self.model.test_step(data) + item[1] = result[0].pred_sem_seg.cpu().data.numpy()[0] + self.write_buffer.put(item) + self.read_buffer.task_done() + + def write(self, image: RSImage, output_path: Optional[str] = None): + """Write image data from write buffer. + + Args: + image (RSImage): The image to write. + output_path (Optional[str], optional): The path to save the + segmentation map. Defaults to None. + """ + seg_map = image.create_seg_map(output_path) + while True: + item = self.write_buffer.get() + if item == self.END_FLAG: + break + seg_map.write(data=item[1], grid=item[0]) + self.write_buffer.task_done() + + def run(self, + image: RSImage, + window_size: Tuple[int, int], + strides: Tuple[int, int] = (0, 0), + output_path: Optional[str] = None): + """Run inference with multi-threading. + + Args: + image (RSImage): The image to inference. + window_size (Tuple[int, int]): The size of the sliding window. + strides (Tuple[int, int], optional): The stride of the sliding + window. Defaults to (0, 0). + output_path (Optional[str], optional): The path to save the + segmentation map. Defaults to None. + """ + read_thread = threading.Thread( + target=self.read, args=(image, window_size, strides)) + read_thread.start() + inference_threads = [] + for _ in range(self.thread): + inference_thread = threading.Thread(target=self.inference) + inference_thread.start() + inference_threads.append(inference_thread) + write_thread = threading.Thread( + target=self.write, args=(image, output_path)) + write_thread.start() + read_thread.join() + for inference_thread in inference_threads: + inference_thread.join() + write_thread.join() diff --git a/third-party/InterFormer/mmseg/apis/utils.py b/third-party/InterFormer/mmseg/apis/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..4cf877566028dbb2b966c2888b1ebd1a5f57c330 --- /dev/null +++ b/third-party/InterFormer/mmseg/apis/utils.py @@ -0,0 +1,41 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from collections import defaultdict +from typing import Sequence, Union + +import numpy as np +from mmengine.dataset import Compose +from mmengine.model import BaseModel + +ImageType = Union[str, np.ndarray, Sequence[str], Sequence[np.ndarray]] + + +def _preprare_data(imgs: ImageType, model: BaseModel): + + cfg = model.cfg + for t in cfg.test_pipeline: + if t.get('type') == 'LoadAnnotations': + cfg.test_pipeline.remove(t) + + is_batch = True + if not isinstance(imgs, (list, tuple)): + imgs = [imgs] + is_batch = False + + if isinstance(imgs[0], np.ndarray): + cfg.test_pipeline[0]['type'] = 'LoadImageFromNDArray' + + # TODO: Consider using the singleton pattern to avoid building + # a pipeline for each inference + pipeline = Compose(cfg.test_pipeline) + + data = defaultdict(list) + for img in imgs: + if isinstance(img, np.ndarray): + data_ = dict(img=img) + else: + data_ = dict(img_path=img) + data_ = pipeline(data_) + data['inputs'].append(data_['inputs']) + data['data_samples'].append(data_['data_samples']) + + return data, is_batch diff --git a/third-party/InterFormer/mmseg/configs/_base_/datasets/loveda.py b/third-party/InterFormer/mmseg/configs/_base_/datasets/loveda.py new file mode 100644 index 0000000000000000000000000000000000000000..eb3d358fe437f46d1ce0e5a4c9b6a6c101b2e297 --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/datasets/loveda.py @@ -0,0 +1,79 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmcv.transforms.loading import LoadImageFromFile +from mmcv.transforms.processing import (RandomFlip, RandomResize, Resize, + TestTimeAug) +from mmengine.dataset.sampler import DefaultSampler, InfiniteSampler + +from mmseg.datasets.loveda import LoveDADataset +from mmseg.datasets.transforms.formatting import PackSegInputs +from mmseg.datasets.transforms.loading import LoadAnnotations +from mmseg.datasets.transforms.transforms import (PhotoMetricDistortion, + RandomCrop) +from mmseg.evaluation import IoUMetric + +# dataset settings +dataset_type = LoveDADataset +data_root = 'data/loveDA' +crop_size = (512, 512) +train_pipeline = [ + dict(type=LoadImageFromFile), + dict(type=LoadAnnotations, reduce_zero_label=True), + dict( + type=RandomResize, + scale=(2048, 512), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type=RandomCrop, crop_size=crop_size, cat_max_ratio=0.75), + dict(type=RandomFlip, prob=0.5), + dict(type=PhotoMetricDistortion), + dict(type=PackSegInputs) +] +test_pipeline = [ + dict(type=LoadImageFromFile), + dict(type=Resize, scale=(1024, 1024), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type=LoadAnnotations, reduce_zero_label=True), + dict(type=PackSegInputs) +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type=LoadImageFromFile, backend_args=None), + dict( + type=TestTimeAug, + transforms=[[ + dict(type=Resize, scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type=RandomFlip, prob=0., direction='horizontal'), + dict(type=RandomFlip, prob=1., direction='horizontal') + ], [dict(type=LoadAnnotations)], + [dict(type=PackSegInputs)]]) +] +train_dataloader = dict( + batch_size=2, + num_workers=12, + persistent_workers=True, + sampler=dict(type=InfiniteSampler, shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='img_dir/train', seg_map_path='ann_dir/train'), + pipeline=train_pipeline)) + +val_dataloader = dict( + batch_size=1, + num_workers=4, + persistent_workers=True, + sampler=dict(type=DefaultSampler, shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict(img_path='img_dir/val', seg_map_path='ann_dir/val'), + pipeline=test_pipeline)) + +test_dataloader = val_dataloader +val_evaluator = dict(type=IoUMetric, iou_metrics=['mIoU']) +test_evaluator = val_evaluator diff --git a/third-party/InterFormer/mmseg/configs/_base_/datasets/potsdam.py b/third-party/InterFormer/mmseg/configs/_base_/datasets/potsdam.py new file mode 100644 index 0000000000000000000000000000000000000000..33a4ebfd8f841ff502828c0adbc60c963e154897 --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/datasets/potsdam.py @@ -0,0 +1,81 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmcv.transforms.loading import LoadImageFromFile +from mmcv.transforms.processing import (RandomFlip, RandomResize, Resize, + TestTimeAug) +from mmengine.dataset.sampler import DefaultSampler, InfiniteSampler + +from mmseg.datasets.potsdam import PotsdamDataset +from mmseg.datasets.transforms.formatting import PackSegInputs +from mmseg.datasets.transforms.loading import LoadAnnotations +from mmseg.datasets.transforms.transforms import (PhotoMetricDistortion, + RandomCrop) +from mmseg.evaluation import IoUMetric + +# dataset settings +dataset_type = PotsdamDataset +data_root = 'data/potsdam' +crop_size = (512, 512) +train_pipeline = [ + dict(type=LoadImageFromFile), + dict(type=LoadAnnotations, reduce_zero_label=True), + dict( + type=RandomResize, + scale=(512, 512), + ratio_range=(0.5, 2.0), + keep_ratio=True), + dict(type=RandomCrop, crop_size=crop_size, cat_max_ratio=0.75), + dict(type=RandomFlip, prob=0.5), + dict(type=PhotoMetricDistortion), + dict(type=PackSegInputs) +] +test_pipeline = [ + dict(type=LoadImageFromFile), + dict(type=Resize, scale=(512, 512), keep_ratio=True), + # add loading annotation after ``Resize`` because ground truth + # does not need to do resize data transform + dict(type=LoadAnnotations, reduce_zero_label=True), + dict(type=PackSegInputs) +] +img_ratios = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75] +tta_pipeline = [ + dict(type=LoadImageFromFile, backend_args=None), + dict( + type=TestTimeAug, + transforms=[[ + dict(type=Resize, scale_factor=r, keep_ratio=True) + for r in img_ratios + ], + [ + dict(type=RandomFlip, prob=0., direction='horizontal'), + dict(type=RandomFlip, prob=1., direction='horizontal') + ], [dict(type=LoadAnnotations)], + [dict(type=PackSegInputs)]]) +] + +train_dataloader = dict( + batch_size=2, + num_workers=4, + persistent_workers=True, + sampler=dict(type=InfiniteSampler, shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='img_dir/train', seg_map_path='ann_dir/train'), + pipeline=train_pipeline)) + +val_dataloader = dict( + batch_size=1, + num_workers=4, + persistent_workers=True, + sampler=dict(type=DefaultSampler, shuffle=False), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict(img_path='img_dir/val', seg_map_path='ann_dir/val'), + pipeline=test_pipeline)) +test_dataloader = val_dataloader + +val_evaluator = dict( + type=IoUMetric, iou_metrics=['mIoU']) # 'mDice', 'mFscore' +test_evaluator = val_evaluator diff --git a/third-party/InterFormer/mmseg/configs/_base_/default_runtime.py b/third-party/InterFormer/mmseg/configs/_base_/default_runtime.py new file mode 100644 index 0000000000000000000000000000000000000000..c90502096b36abeda6be0840da67c255bd223d9f --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/default_runtime.py @@ -0,0 +1,22 @@ +# Copyright (c) OpenMMLab. All rights reserved. + +from mmengine.visualization import LocalVisBackend + +from mmseg.models import SegTTAModel +from mmseg.visualization import SegLocalVisualizer + +env_cfg = dict( + cudnn_benchmark=False, + mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0), + dist_cfg=dict(backend='nccl'), +) +vis_backends = [dict(type=LocalVisBackend)] +visualizer = dict( + type=SegLocalVisualizer, vis_backends=vis_backends, name='visualizer') +log_processor = dict(by_epoch=False) +log_level = 'INFO' +load_from = None +resume = False + +tta_model = dict(type=SegTTAModel) +default_scope = None diff --git a/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_160k.py b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_160k.py new file mode 100644 index 0000000000000000000000000000000000000000..294d6ee3f534f39676f2fa7cdb99bc4321320351 --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_160k.py @@ -0,0 +1,43 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmengine.hooks import (CheckpointHook, DistSamplerSeedHook, IterTimerHook, + LoggerHook, ParamSchedulerHook) +from mmengine.optim.optimizer.optimizer_wrapper import OptimWrapper +from mmengine.optim.scheduler.lr_scheduler import PolyLR +from mmengine.runner.loops import IterBasedTrainLoop, TestLoop, ValLoop +from torch.optim.sgd import SGD + +from mmseg.engine import SegVisualizationHook + +# optimizer +optimizer = dict( + type=SGD, + # lr=0.01, + # momentum=0.9, + # weight_decay=0.0005 +) + +optim_wrapper = dict(type=OptimWrapper, optimizer=optimizer, clip_grad=None) + +# learning policy +param_scheduler = [ + dict( + type=PolyLR, + eta_min=1e-4, + power=0.9, + begin=0, + end=160000, + by_epoch=False) +] +# training schedule for 160k + +train_cfg = dict(type=IterBasedTrainLoop, max_iters=160000, val_interval=8000) +val_cfg = dict(type=ValLoop) +test_cfg = dict(type=TestLoop) + +default_hooks = dict( + timer=dict(type=IterTimerHook), + logger=dict(type=LoggerHook, interval=50, log_metric_by_epoch=False), + param_scheduler=dict(type=ParamSchedulerHook), + checkpoint=dict(type=CheckpointHook, by_epoch=False, interval=8000), + sampler_seed=dict(type=DistSamplerSeedHook), + visualization=dict(type=SegVisualizationHook)) diff --git a/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_20k.py b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_20k.py new file mode 100644 index 0000000000000000000000000000000000000000..255300a1f4e4161deb80a34298b734a80f685f92 --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_20k.py @@ -0,0 +1,36 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmengine.hooks import (CheckpointHook, DistSamplerSeedHook, IterTimerHook, + LoggerHook, ParamSchedulerHook) +from mmengine.optim.optimizer.optimizer_wrapper import OptimWrapper +from mmengine.optim.scheduler.lr_scheduler import PolyLR +from mmengine.runner.loops import IterBasedTrainLoop, TestLoop, ValLoop +from torch.optim.sgd import SGD + +from mmseg.engine import SegVisualizationHook + +# optimizer +optimizer = dict(type=SGD, lr=0.01, momentum=0.9, weight_decay=0.0005) +optim_wrapper = dict(type=OptimWrapper, optimizer=optimizer, clip_grad=None) + +# learning policy +param_scheduler = [ + dict( + type=PolyLR, + eta_min=1e-4, + power=0.9, + begin=0, + end=20000, + by_epoch=False) +] +# training schedule for 20k +train_cfg = dict(type=IterBasedTrainLoop, max_iters=20000, val_interval=2000) +val_cfg = dict(type=ValLoop) +test_cfg = dict(type=TestLoop) + +default_hooks = dict( + timer=dict(type=IterTimerHook), + logger=dict(type=LoggerHook, interval=50, log_metric_by_epoch=False), + param_scheduler=dict(type=ParamSchedulerHook), + checkpoint=dict(type=CheckpointHook, by_epoch=False, interval=2000), + sampler_seed=dict(type=DistSamplerSeedHook), + visualization=dict(type=SegVisualizationHook)) diff --git a/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_240k.py b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_240k.py new file mode 100644 index 0000000000000000000000000000000000000000..cf9e5d3c94e2d70992a7f66b4a38ee3a0ba8c8f8 --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_240k.py @@ -0,0 +1,34 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmengine.hooks import (CheckpointHook, DistSamplerSeedHook, IterTimerHook, + LoggerHook, ParamSchedulerHook) +from mmengine.optim.optimizer.optimizer_wrapper import OptimWrapper +from mmengine.optim.scheduler.lr_scheduler import PolyLR +from mmengine.runner.loops import IterBasedTrainLoop, TestLoop, ValLoop +# from mmengine.runner.loops import EpochBasedTrainLoop +from torch.optim.sgd import SGD + +from mmseg.engine import SegVisualizationHook + +optimizer = dict(type=SGD, lr=0.01, momentum=0.9, weight_decay=0.0005) +optim_wrapper = dict(type=OptimWrapper, optimizer=optimizer, clip_grad=None) +# learning policy +param_scheduler = [ + dict( + type=PolyLR, + eta_min=1e-4, + power=0.9, + begin=0, + end=240000, + by_epoch=False) +] +# training schedule for 240k +train_cfg = dict(type=IterBasedTrainLoop, max_iters=240000, val_interval=24000) +val_cfg = dict(type=ValLoop) +test_cfg = dict(type=TestLoop) +default_hooks = dict( + timer=dict(type=IterTimerHook), + logger=dict(type=LoggerHook, interval=50, log_metric_by_epoch=False), + param_scheduler=dict(type=ParamSchedulerHook), + checkpoint=dict(type=CheckpointHook, by_epoch=False, interval=24000), + sampler_seed=dict(type=DistSamplerSeedHook), + visualization=dict(type=SegVisualizationHook)) diff --git a/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_25k.py b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_25k.py new file mode 100644 index 0000000000000000000000000000000000000000..8a3ebf405e431973d4dc9ef541f424dedf5f83ce --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_25k.py @@ -0,0 +1,43 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmengine.hooks import (CheckpointHook, DistSamplerSeedHook, IterTimerHook, + LoggerHook, ParamSchedulerHook) +from mmengine.optim.optimizer.optimizer_wrapper import OptimWrapper +from mmengine.optim.scheduler.lr_scheduler import ConstantLR, LinearLR +from mmengine.runner.loops import IterBasedTrainLoop, TestLoop, ValLoop +# from mmengine.runner.loops import EpochBasedTrainLoop +from torch.optim.adamw import AdamW + +from mmseg.engine import SegVisualizationHook +from mmseg.engine.schedulers import PolyLRRatio + +# optimizer +optimizer = dict(type=AdamW, lr=0.01, weight_decay=0.1) + +optim_wrapper = dict(type=OptimWrapper, optimizer=optimizer, clip_grad=None) +# learning policy + +# learning policy +param_scheduler = [ + dict(type=LinearLR, start_factor=3e-2, begin=0, end=12000, by_epoch=False), + dict( + type=PolyLRRatio, + eta_min_ratio=3e-2, + power=0.9, + begin=12000, + end=24000, + by_epoch=False), + dict(type=ConstantLR, by_epoch=False, factor=1, begin=24000, end=25000) +] + +# training schedule for 25k +train_cfg = dict(type=IterBasedTrainLoop, max_iters=25000, val_interval=1000) +val_cfg = dict(type=ValLoop) +test_cfg = dict(type=TestLoop) + +default_hooks = dict( + timer=dict(type=IterTimerHook), + logger=dict(type=LoggerHook, interval=50, log_metric_by_epoch=False), + param_scheduler=dict(type=ParamSchedulerHook), + checkpoint=dict(type=CheckpointHook, by_epoch=False, interval=1000), + sampler_seed=dict(type=DistSamplerSeedHook), + visualization=dict(type=SegVisualizationHook)) diff --git a/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_320k.py b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_320k.py new file mode 100644 index 0000000000000000000000000000000000000000..dae323ec48adf33f67d91d5843f787a63bcac90c --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_320k.py @@ -0,0 +1,36 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmengine.hooks import (CheckpointHook, DistSamplerSeedHook, IterTimerHook, + LoggerHook, ParamSchedulerHook) +from mmengine.optim.optimizer.optimizer_wrapper import OptimWrapper +from mmengine.optim.scheduler.lr_scheduler import PolyLR +from mmengine.runner.loops import IterBasedTrainLoop, TestLoop, ValLoop +# from mmengine.runner.loops import EpochBasedTrainLoop +from torch.optim.sgd import SGD + +from mmseg.engine import SegVisualizationHook + +# optimizer +optimizer = dict(type=SGD, lr=0.01, momentum=0.9, weight_decay=0.0005) +optim_wrapper = dict(type=OptimWrapper, optimizer=optimizer, clip_grad=None) + +# learning policy +param_scheduler = [ + dict( + type=PolyLR, + eta_min=1e-4, + power=0.9, + begin=0, + end=320000, + by_epoch=False) +] +# training schedule for 320k +train_cfg = dict(type=IterBasedTrainLoop, max_iters=320000, val_interval=32000) +val_cfg = dict(type=ValLoop) +test_cfg = dict(type=TestLoop) +default_hooks = dict( + timer=dict(type=IterTimerHook), + logger=dict(type=LoggerHook, interval=50, log_metric_by_epoch=False), + param_scheduler=dict(type=ParamSchedulerHook), + checkpoint=dict(type=CheckpointHook, by_epoch=False, interval=32000), + sampler_seed=dict(type=DistSamplerSeedHook), + visualization=dict(type=SegVisualizationHook)) diff --git a/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_40k.py b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_40k.py new file mode 100644 index 0000000000000000000000000000000000000000..b4b2ea42b5c13f588497b654023e7b539fadc565 --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_40k.py @@ -0,0 +1,34 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmengine.hooks import (CheckpointHook, DistSamplerSeedHook, IterTimerHook, + LoggerHook, ParamSchedulerHook) +from mmengine.optim.optimizer.optimizer_wrapper import OptimWrapper +from mmengine.optim.scheduler.lr_scheduler import PolyLR +from mmengine.runner.loops import IterBasedTrainLoop, TestLoop, ValLoop +from torch.optim.sgd import SGD + +from mmseg.engine import SegVisualizationHook + +# optimizer +optimizer = dict(type=SGD, lr=0.01, momentum=0.9, weight_decay=0.0005) +optim_wrapper = dict(type=OptimWrapper, optimizer=optimizer, clip_grad=None) + +param_scheduler = [ + dict( + type=PolyLR, + eta_min=1e-4, + power=0.9, + begin=0, + end=40000, + by_epoch=False) +] +# training schedule for 40k +train_cfg = dict(type=IterBasedTrainLoop, max_iters=40000, val_interval=4000) +val_cfg = dict(type=ValLoop) +test_cfg = dict(type=TestLoop) +default_hooks = dict( + timer=dict(type=IterTimerHook), + logger=dict(type=LoggerHook, interval=50, log_metric_by_epoch=False), + param_scheduler=dict(type=ParamSchedulerHook), + checkpoint=dict(type=CheckpointHook, by_epoch=False, interval=4000), + sampler_seed=dict(type=DistSamplerSeedHook), + visualization=dict(type=SegVisualizationHook)) diff --git a/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_80k.py b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_80k.py new file mode 100644 index 0000000000000000000000000000000000000000..3e711ca891564993f86eba0af6a45ff4ab1543dd --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/_base_/schedules/schedule_80k.py @@ -0,0 +1,42 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmengine.hooks import (CheckpointHook, DistSamplerSeedHook, IterTimerHook, + LoggerHook, ParamSchedulerHook) +from mmengine.optim.optimizer.optimizer_wrapper import OptimWrapper +from mmengine.optim.scheduler.lr_scheduler import PolyLR +from mmengine.runner.loops import IterBasedTrainLoop, TestLoop, ValLoop +from torch.optim.sgd import SGD + +from mmseg.engine import SegVisualizationHook + +# optimizer +optimizer = dict( + type=SGD, + # lr=0.01, + # momentum=0.9, + # weight_decay=0.0005 +) + +optim_wrapper = dict(type=OptimWrapper, optimizer=optimizer, clip_grad=None) + +# learning policy +param_scheduler = [ + dict( + type=PolyLR, + eta_min=1e-4, + power=0.9, + begin=0, + end=80000, + by_epoch=False) +] +# training schedule for 80k +train_cfg = dict(type=IterBasedTrainLoop, max_iters=80000, val_interval=8000) +val_cfg = dict(type=ValLoop) +test_cfg = dict(type=TestLoop) + +default_hooks = dict( + timer=dict(type=IterTimerHook), + logger=dict(type=LoggerHook, interval=50, log_metric_by_epoch=False), + param_scheduler=dict(type=ParamSchedulerHook), + checkpoint=dict(type=CheckpointHook, by_epoch=False, interval=8000), + sampler_seed=dict(type=DistSamplerSeedHook), + visualization=dict(type=SegVisualizationHook)) diff --git a/third-party/InterFormer/mmseg/configs/config_interformer.py b/third-party/InterFormer/mmseg/configs/config_interformer.py new file mode 100644 index 0000000000000000000000000000000000000000..bae6256c3f5da78de94e30fa7c13631ca6287cd0 --- /dev/null +++ b/third-party/InterFormer/mmseg/configs/config_interformer.py @@ -0,0 +1,248 @@ +backbone_norm_cfg = dict(type='LN', requires_grad=True) +norm_cfg = dict(type='SyncBN', requires_grad=True) +crop_size = (448,448) +data_preprocessor = dict( + type='SegDataPreProcessor', + size=crop_size, + mean=[106.01075, 95.40013, 87.42854], + std=[64.356636, 60.888744, 61.41911], + bgr_to_rgb=True, + pad_val=0, + seg_pad_val=255) + + +find_unused_parameters=True +dataset_type = 'EgoHOSDataset' +data_root='/mnt/nvme1/suyuejiao/egohos_split_data/' +crop_size = (448,448) +max_iters=180000 +# model_cfg +num_classes = 6 +model = dict( + type='EncoderDecoder', + pretrained= + '/home/suyuejiao/mmsegmentation/swin_base_patch4_window12_384_22k_20220317-e5c09f74.pth', + data_preprocessor=data_preprocessor, + backbone=dict( + type='SwinTransformer', + pretrain_img_size=384, + embed_dims=128, + patch_size=4, + window_size=12, + mlp_ratio=4, + depths=[2, 2, 18, 2], + num_heads=[4, 8, 16, 32], + strides=(4, 2, 2, 2), + out_indices=(0, 1, 2, 3), + qkv_bias=True, + qk_scale=None, + patch_norm=True, + drop_rate=0., + attn_drop_rate=0., + drop_path_rate=0.3, + use_abs_pos_embed=False, + act_cfg=dict(type='GELU'), + norm_cfg=backbone_norm_cfg), + decode_head=dict( + type='InterFormerDecoder', + in_channels=[128, 256, 512, 1024], + strides=[4, 8, 16, 32], + feat_channels=256, + out_channels=256, + num_classes=num_classes, + num_queries=5, + num_transformer_feat_level=3, + align_corners=False, + pixel_decoder=dict( + type='mmdet.MSDeformAttnPixelDecoder', + num_outs=3, + norm_cfg=dict(type='GN', num_groups=32), + act_cfg=dict(type='ReLU'), + encoder=dict( # DeformableDetrTransformerEncoder + num_layers=6, + layer_cfg=dict( # DeformableDetrTransformerEncoderLayer + self_attn_cfg=dict( # MultiScaleDeformableAttention + embed_dims=256, + num_heads=8, + num_levels=3, + num_points=4, + im2col_step=64, + dropout=0.0, + batch_first=True, + norm_cfg=None, + init_cfg=None), + ffn_cfg=dict( + embed_dims=256, + feedforward_channels=1024, + num_fcs=2, + ffn_drop=0.0, + act_cfg=dict(type='ReLU', inplace=True))), + init_cfg=None), + positional_encoding=dict( # SinePositionalEncoding + num_feats=128, normalize=True), + init_cfg=None), + enforce_decoder_input_project=False, + positional_encoding=dict( # SinePositionalEncoding + num_feats=128, normalize=True), + transformer_decoder=dict( # Mask2FormerTransformerDecoder + return_intermediate=True, + num_layers=9, + layer_cfg=dict( # Mask2FormerTransformerDecoderLayer + self_attn_cfg=dict( # MultiheadAttention + embed_dims=256, + num_heads=8, + attn_drop=0.0, + proj_drop=0.0, + dropout_layer=None, + batch_first=True), + cross_attn_cfg=dict( # MultiheadAttention + embed_dims=256, + num_heads=8, + attn_drop=0.0, + proj_drop=0.0, + dropout_layer=None, + batch_first=True), + ffn_cfg=dict( + embed_dims=256, + feedforward_channels=2048, + num_fcs=2, + act_cfg=dict(type='ReLU', inplace=True), + ffn_drop=0.0, + dropout_layer=None, + add_identity=True)), + init_cfg=None), + loss_cls=dict( + type='mmdet.CrossEntropyLoss', + use_sigmoid=False, + loss_weight=2.0, + reduction='mean', + class_weight=[1.0] * num_classes + [0.1]), + loss_mask=dict( + type='mmdet.CrossEntropyLoss', + use_sigmoid=True, + reduction='mean', + loss_weight=5.0), + loss_dice=dict( + type='mmdet.DiceLoss', + use_sigmoid=True, + activate=True, + reduction='mean', + naive_dice=True, + eps=1.0, + loss_weight=5.0), + train_cfg=dict( + num_points=12544, + oversample_ratio=3.0, + importance_sample_ratio=0.75, + assigner=dict( + type='mmdet.HungarianAssigner', + match_costs=[ + dict(type='mmdet.ClassificationCost', weight=2.0), + dict( + type='mmdet.CrossEntropyLossCost', + weight=5.0, + use_sigmoid=True), + dict( + type='mmdet.DiceCost', + weight=5.0, + pred_act=True, + eps=1.0) + ]), + sampler=dict(type='mmdet.MaskPseudoSampler'))), + train_cfg=dict(), + test_cfg=dict(mode='whole') +) +# optimizer +train_dataloader = dict( + batch_size=4, + num_workers=1, + persistent_workers=True, + sampler=dict(type='InfiniteSampler', shuffle=True), + dataset=dict( + type=dataset_type, + data_root=data_root, + data_prefix=dict( + img_path='train/image', seg_map_path='train/lbl_hand_1stobj'), + pipeline=[ + dict(type='LoadImageFromFile'), + dict(type='LoadAnnotations'), + dict(type='Resize', scale=crop_size, keep_ratio=False), + dict(type='PhotoMetricDistortion'), + dict(type='PackSegInputs') + ])) +train_cfg = dict(type='IterBasedTrainLoop', max_iters=max_iters, val_interval=1500) + + +val_cfg = dict(type='ValLoop') + + +test_pipeline = [ + dict(type='LoadImageFromFile'), + dict(type='Resize', scale=crop_size, keep_ratio=False), + dict(type='LoadAnnotations'), + dict(type='PackSegInputs') +] + +val_dataloader = dict( + batch_size=8, + num_workers=4, + dataset=dict(type=dataset_type, + data_root=data_root, + data_prefix=dict(img_path='test_indomain/image', seg_map_path='test_indomain/lbl_hand_obj1st'), + pipeline=test_pipeline), + sampler=dict(type='DefaultSampler', shuffle=False) # necessary +) +test_dataloader = val_dataloader + + +val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU']) +test_evaluator = val_evaluator +test_cfg = val_cfg +test_evaluator = val_evaluator + + + + +default_scope = 'mmseg' +env_cfg = dict( + cudnn_benchmark=True, + mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0), + dist_cfg=dict(backend='nccl')) + +visualizer = dict( + type='SegLocalVisualizer', vis_backends=[dict(type='TensorboardVisBackend')], name='visualizer') +log_processor = dict(by_epoch=False) +log_level = 'INFO' +load_from = None +resume = False + +optim_wrapper = dict( + type='OptimWrapper', + optimizer=dict( + type='AdamW', lr=0.00001, betas=(0.9, 0.999), weight_decay=0.01), + paramwise_cfg=dict( + custom_keys={ + 'pos_block': dict(decay_mult=0.), + 'norm': dict(decay_mult=0.), + 'head': dict(lr_mult=10.) + })) + +param_scheduler = [ + dict(type='LinearLR', by_epoch=False, start_factor=0.1, begin=0, end=10000), + dict( + type='PolyLR', + eta_min=0, + power=1.1, + begin=10000, + end=max_iters, + by_epoch=False, + ) +] + +default_hooks = dict( + timer=dict(type='IterTimerHook'), + logger=dict(type='LoggerHook', interval=50, log_metric_by_epoch=False), + param_scheduler=dict(type='ParamSchedulerHook'), + checkpoint=dict(type='CheckpointHook', by_epoch=False, interval=1600000, save_optimizer=True, save_param_scheduler=True, save_best='mIoU', rule='greater'), + sampler_seed=dict(type='DistSamplerSeedHook'), + visualization=dict(type='SegVisualizationHook')) \ No newline at end of file diff --git a/third-party/InterFormer/mmseg/datasets/__init__.py b/third-party/InterFormer/mmseg/datasets/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b8cff7ca9542dbe00dcb515a44034c1558bdc197 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/__init__.py @@ -0,0 +1,66 @@ +# Copyright (c) OpenMMLab. All rights reserved. +# yapf: disable +from .ade import ADE20KDataset +from .basesegdataset import BaseCDDataset, BaseSegDataset +from .bdd100k import BDD100KDataset +from .chase_db1 import ChaseDB1Dataset +from .cityscapes import CityscapesDataset +from .coco_stuff import COCOStuffDataset +from .dark_zurich import DarkZurichDataset +from .dataset_wrappers import MultiImageMixDataset +from .decathlon import DecathlonDataset +from .drive import DRIVEDataset +from .dsdl import DSDLSegDataset +from .hrf import HRFDataset +from .hsi_drive import HSIDrive20Dataset +from .isaid import iSAIDDataset +from .isprs import ISPRSDataset +from .levir import LEVIRCDDataset +from .lip import LIPDataset +from .loveda import LoveDADataset +from .mapillary import MapillaryDataset_v1, MapillaryDataset_v2 +from .night_driving import NightDrivingDataset +from .nyu import NYUDataset +from .pascal_context import PascalContextDataset, PascalContextDataset59 +from .potsdam import PotsdamDataset +from .refuge import REFUGEDataset +from .stare import STAREDataset +from .synapse import SynapseDataset +# yapf: disable +from .transforms import (CLAHE, AdjustGamma, Albu, BioMedical3DPad, + BioMedical3DRandomCrop, BioMedical3DRandomFlip, + BioMedicalGaussianBlur, BioMedicalGaussianNoise, + BioMedicalRandomGamma, ConcatCDInput, GenerateEdge, + LoadAnnotations, LoadBiomedicalAnnotation, + LoadBiomedicalData, LoadBiomedicalImageFromFile, + LoadImageFromNDArray, LoadMultipleRSImageFromFile, + LoadSingleRSImageFromFile, PackSegInputs, + PhotoMetricDistortion, RandomCrop, RandomCutOut, + RandomMosaic, RandomRotate, RandomRotFlip, Rerange, + ResizeShortestEdge, ResizeToMultiple, RGB2Gray, + SegRescale) +from .voc import PascalVOCDataset +from .interformer_dataset import EgoHOSDataset + +# yapf: enable +__all__ = [ + 'BaseSegDataset', 'BioMedical3DRandomCrop', 'BioMedical3DRandomFlip', + 'CityscapesDataset', 'PascalVOCDataset', 'ADE20KDataset', + 'PascalContextDataset', 'PascalContextDataset59', 'ChaseDB1Dataset', + 'DRIVEDataset', 'HRFDataset', 'STAREDataset', 'DarkZurichDataset', + 'NightDrivingDataset', 'COCOStuffDataset', 'LoveDADataset', + 'MultiImageMixDataset', 'iSAIDDataset', 'ISPRSDataset', 'PotsdamDataset', + 'LoadAnnotations', 'RandomCrop', 'SegRescale', 'PhotoMetricDistortion', + 'RandomRotate', 'AdjustGamma', 'CLAHE', 'Rerange', 'RGB2Gray', + 'RandomCutOut', 'RandomMosaic', 'PackSegInputs', 'ResizeToMultiple', + 'LoadImageFromNDArray', 'LoadBiomedicalImageFromFile', + 'LoadBiomedicalAnnotation', 'LoadBiomedicalData', 'GenerateEdge', + 'DecathlonDataset', 'LIPDataset', 'ResizeShortestEdge', + 'BioMedicalGaussianNoise', 'BioMedicalGaussianBlur', + 'BioMedicalRandomGamma', 'BioMedical3DPad', 'RandomRotFlip', + 'SynapseDataset', 'REFUGEDataset', 'MapillaryDataset_v1', + 'MapillaryDataset_v2', 'Albu', 'LEVIRCDDataset', + 'LoadMultipleRSImageFromFile', 'LoadSingleRSImageFromFile', + 'ConcatCDInput', 'BaseCDDataset', 'DSDLSegDataset', 'BDD100KDataset', + 'NYUDataset', 'HSIDrive20Dataset','EgoHOSDataset' +] diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/__init__.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d56762dd300e7c026be775ac2e3a9ece8dae6a4a Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/__init__.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/ade.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/ade.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7eb5eb3cd7584c79acf9682345a1c89ca0cd91d2 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/ade.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/basesegdataset.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/basesegdataset.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8726d347a5386bd1b3cf4ac392a319762876f01c Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/basesegdataset.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/bdd100k.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/bdd100k.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7738490e78313bfa949a6b6529c5a82f5be06eb9 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/bdd100k.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/chase_db1.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/chase_db1.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8928317ccfe18b9e7cc808fc357b3d8d6bfc2645 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/chase_db1.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/cityscapes.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/cityscapes.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ebc00ccc5eaba01e3c1ea5ad63fe4ab7a4350c4 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/cityscapes.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/coco_stuff.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/coco_stuff.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..edd93dc28d2cea1d8d5a9e2e370313a3cdab09fd Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/coco_stuff.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/dark_zurich.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/dark_zurich.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fac68495bdc91a3dffc91b7ff1e6ad5c3d39e1b8 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/dark_zurich.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/dataset_wrappers.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/dataset_wrappers.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0140d059cee181fdf20861c2ac0da07d02c75d9 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/dataset_wrappers.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/decathlon.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/decathlon.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..84ba5d8bc54a95bcc064948e694093f3e7f0a3ae Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/decathlon.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/drive.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/drive.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1bdbbc76a966b33b8111ddc4a213d217f91835d1 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/drive.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/dsdl.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/dsdl.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93b7d6adcc8c75891791853e8824696625b9a264 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/dsdl.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/hrf.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/hrf.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..53d5e5308673e7f76204bbc4b2bd85fcb70f01b8 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/hrf.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/hsi_drive.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/hsi_drive.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..34ba927ec7dcc9cfa9c89ab18747996fc539756c Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/hsi_drive.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/interformer_dataset.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/interformer_dataset.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eae0e0c53997868a17e0f5075f8fe57b0dfd8a4f Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/interformer_dataset.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/isaid.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/isaid.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..99bd68d44f87dc7cce3c0bb59c24e872d5861c99 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/isaid.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/isprs.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/isprs.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41c5f387df441712d044b0f7e05fb49cf436ccff Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/isprs.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/levir.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/levir.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0ae6102d1b8e77d812550725c3c671e601a6469 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/levir.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/lip.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/lip.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0476bbd9495d9d46f393e1939c7df8a9493243a6 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/lip.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/loveda.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/loveda.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f44bd6bd6a9fae7663a1a306ba221cc42f28fcd6 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/loveda.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/mapillary.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/mapillary.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd4e86bf5a17d19642ba646f01b63d338d1aa663 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/mapillary.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/night_driving.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/night_driving.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9385a7927a0ed233aff0cb9eb52bd9b774fc1ddc Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/night_driving.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/nyu.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/nyu.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66f30e5262b2a0888be687770a72e90a0ffc7769 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/nyu.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/pascal_context.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/pascal_context.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1b47637e6d69a9ef7e91eabe30b4b63d4ac4a3ed Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/pascal_context.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/potsdam.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/potsdam.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5296a657a79eb37e3b91c160804ad5b6d8f7f825 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/potsdam.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/refuge.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/refuge.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..74d9be16c38f617749984772d9d8c31c12919f5f Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/refuge.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/stare.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/stare.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b4c4e05dd18df9848be7dd16c2d07148e44a5a2 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/stare.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/synapse.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/synapse.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a333c190071abd32a72433b2a6e807c06c9224f4 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/synapse.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/__pycache__/voc.cpython-38.pyc b/third-party/InterFormer/mmseg/datasets/__pycache__/voc.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b79b7755c92bc73fb8e8e1d247f8f6a5d710554 Binary files /dev/null and b/third-party/InterFormer/mmseg/datasets/__pycache__/voc.cpython-38.pyc differ diff --git a/third-party/InterFormer/mmseg/datasets/ade.py b/third-party/InterFormer/mmseg/datasets/ade.py new file mode 100644 index 0000000000000000000000000000000000000000..e9bdae7421205f25d39441381d6492e9208a4714 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/ade.py @@ -0,0 +1,92 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class ADE20KDataset(BaseSegDataset): + """ADE20K dataset. + + In segmentation map annotation for ADE20K, 0 stands for background, which + is not included in 150 categories. ``reduce_zero_label`` is fixed to True. + The ``img_suffix`` is fixed to '.jpg' and ``seg_map_suffix`` is fixed to + '.png'. + """ + METAINFO = dict( + classes=('wall', 'building', 'sky', 'floor', 'tree', 'ceiling', 'road', + 'bed ', 'windowpane', 'grass', 'cabinet', 'sidewalk', + 'person', 'earth', 'door', 'table', 'mountain', 'plant', + 'curtain', 'chair', 'car', 'water', 'painting', 'sofa', + 'shelf', 'house', 'sea', 'mirror', 'rug', 'field', 'armchair', + 'seat', 'fence', 'desk', 'rock', 'wardrobe', 'lamp', + 'bathtub', 'railing', 'cushion', 'base', 'box', 'column', + 'signboard', 'chest of drawers', 'counter', 'sand', 'sink', + 'skyscraper', 'fireplace', 'refrigerator', 'grandstand', + 'path', 'stairs', 'runway', 'case', 'pool table', 'pillow', + 'screen door', 'stairway', 'river', 'bridge', 'bookcase', + 'blind', 'coffee table', 'toilet', 'flower', 'book', 'hill', + 'bench', 'countertop', 'stove', 'palm', 'kitchen island', + 'computer', 'swivel chair', 'boat', 'bar', 'arcade machine', + 'hovel', 'bus', 'towel', 'light', 'truck', 'tower', + 'chandelier', 'awning', 'streetlight', 'booth', + 'television receiver', 'airplane', 'dirt track', 'apparel', + 'pole', 'land', 'bannister', 'escalator', 'ottoman', 'bottle', + 'buffet', 'poster', 'stage', 'van', 'ship', 'fountain', + 'conveyer belt', 'canopy', 'washer', 'plaything', + 'swimming pool', 'stool', 'barrel', 'basket', 'waterfall', + 'tent', 'bag', 'minibike', 'cradle', 'oven', 'ball', 'food', + 'step', 'tank', 'trade name', 'microwave', 'pot', 'animal', + 'bicycle', 'lake', 'dishwasher', 'screen', 'blanket', + 'sculpture', 'hood', 'sconce', 'vase', 'traffic light', + 'tray', 'ashcan', 'fan', 'pier', 'crt screen', 'plate', + 'monitor', 'bulletin board', 'shower', 'radiator', 'glass', + 'clock', 'flag'), + palette=[[120, 120, 120], [180, 120, 120], [6, 230, 230], [80, 50, 50], + [4, 200, 3], [120, 120, 80], [140, 140, 140], [204, 5, 255], + [230, 230, 230], [4, 250, 7], [224, 5, 255], [235, 255, 7], + [150, 5, 61], [120, 120, 70], [8, 255, 51], [255, 6, 82], + [143, 255, 140], [204, 255, 4], [255, 51, 7], [204, 70, 3], + [0, 102, 200], [61, 230, 250], [255, 6, 51], [11, 102, 255], + [255, 7, 71], [255, 9, 224], [9, 7, 230], [220, 220, 220], + [255, 9, 92], [112, 9, 255], [8, 255, 214], [7, 255, 224], + [255, 184, 6], [10, 255, 71], [255, 41, 10], [7, 255, 255], + [224, 255, 8], [102, 8, 255], [255, 61, 6], [255, 194, 7], + [255, 122, 8], [0, 255, 20], [255, 8, 41], [255, 5, 153], + [6, 51, 255], [235, 12, 255], [160, 150, 20], [0, 163, 255], + [140, 140, 140], [250, 10, 15], [20, 255, 0], [31, 255, 0], + [255, 31, 0], [255, 224, 0], [153, 255, 0], [0, 0, 255], + [255, 71, 0], [0, 235, 255], [0, 173, 255], [31, 0, 255], + [11, 200, 200], [255, 82, 0], [0, 255, 245], [0, 61, 255], + [0, 255, 112], [0, 255, 133], [255, 0, 0], [255, 163, 0], + [255, 102, 0], [194, 255, 0], [0, 143, 255], [51, 255, 0], + [0, 82, 255], [0, 255, 41], [0, 255, 173], [10, 0, 255], + [173, 255, 0], [0, 255, 153], [255, 92, 0], [255, 0, 255], + [255, 0, 245], [255, 0, 102], [255, 173, 0], [255, 0, 20], + [255, 184, 184], [0, 31, 255], [0, 255, 61], [0, 71, 255], + [255, 0, 204], [0, 255, 194], [0, 255, 82], [0, 10, 255], + [0, 112, 255], [51, 0, 255], [0, 194, 255], [0, 122, 255], + [0, 255, 163], [255, 153, 0], [0, 255, 10], [255, 112, 0], + [143, 255, 0], [82, 0, 255], [163, 255, 0], [255, 235, 0], + [8, 184, 170], [133, 0, 255], [0, 255, 92], [184, 0, 255], + [255, 0, 31], [0, 184, 255], [0, 214, 255], [255, 0, 112], + [92, 255, 0], [0, 224, 255], [112, 224, 255], [70, 184, 160], + [163, 0, 255], [153, 0, 255], [71, 255, 0], [255, 0, 163], + [255, 204, 0], [255, 0, 143], [0, 255, 235], [133, 255, 0], + [255, 0, 235], [245, 0, 255], [255, 0, 122], [255, 245, 0], + [10, 190, 212], [214, 255, 0], [0, 204, 255], [20, 0, 255], + [255, 255, 0], [0, 153, 255], [0, 41, 255], [0, 255, 204], + [41, 0, 255], [41, 255, 0], [173, 0, 255], [0, 245, 255], + [71, 0, 255], [122, 0, 255], [0, 255, 184], [0, 92, 255], + [184, 255, 0], [0, 133, 255], [255, 214, 0], [25, 194, 194], + [102, 255, 0], [92, 0, 255]]) + + def __init__(self, + img_suffix='.jpg', + seg_map_suffix='.png', + reduce_zero_label=True, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/basesegdataset.py b/third-party/InterFormer/mmseg/datasets/basesegdataset.py new file mode 100644 index 0000000000000000000000000000000000000000..9c4668c1f561961fb27642fb7c1ac702f626cbb7 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/basesegdataset.py @@ -0,0 +1,552 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import copy +import os.path as osp +from typing import Callable, Dict, List, Optional, Sequence, Union + +import mmengine +import mmengine.fileio as fileio +import numpy as np +from mmengine.dataset import BaseDataset, Compose + +from mmseg.registry import DATASETS + + +@DATASETS.register_module() +class BaseSegDataset(BaseDataset): + """Custom dataset for semantic segmentation. An example of file structure + is as followed. + + .. code-block:: none + + ├── data + │ ├── my_dataset + │ │ ├── img_dir + │ │ │ ├── train + │ │ │ │ ├── xxx{img_suffix} + │ │ │ │ ├── yyy{img_suffix} + │ │ │ │ ├── zzz{img_suffix} + │ │ │ ├── val + │ │ ├── ann_dir + │ │ │ ├── train + │ │ │ │ ├── xxx{seg_map_suffix} + │ │ │ │ ├── yyy{seg_map_suffix} + │ │ │ │ ├── zzz{seg_map_suffix} + │ │ │ ├── val + + The img/gt_semantic_seg pair of BaseSegDataset should be of the same + except suffix. A valid img/gt_semantic_seg filename pair should be like + ``xxx{img_suffix}`` and ``xxx{seg_map_suffix}`` (extension is also included + in the suffix). If split is given, then ``xxx`` is specified in txt file. + Otherwise, all files in ``img_dir/``and ``ann_dir`` will be loaded. + Please refer to ``docs/en/tutorials/new_dataset.md`` for more details. + + + Args: + ann_file (str): Annotation file path. Defaults to ''. + metainfo (dict, optional): Meta information for dataset, such as + specify classes to load. Defaults to None. + data_root (str, optional): The root directory for ``data_prefix`` and + ``ann_file``. Defaults to None. + data_prefix (dict, optional): Prefix for training data. Defaults to + dict(img_path=None, seg_map_path=None). + img_suffix (str): Suffix of images. Default: '.jpg' + seg_map_suffix (str): Suffix of segmentation maps. Default: '.png' + filter_cfg (dict, optional): Config for filter data. Defaults to None. + indices (int or Sequence[int], optional): Support using first few + data in annotation file to facilitate training/testing on a smaller + dataset. Defaults to None which means using all ``data_infos``. + serialize_data (bool, optional): Whether to hold memory using + serialized objects, when enabled, data loader workers can use + shared RAM from master process instead of making a copy. Defaults + to True. + pipeline (list, optional): Processing pipeline. Defaults to []. + test_mode (bool, optional): ``test_mode=True`` means in test phase. + Defaults to False. + lazy_init (bool, optional): Whether to load annotation during + instantiation. In some cases, such as visualization, only the meta + information of the dataset is needed, which is not necessary to + load annotation file. ``Basedataset`` can skip load annotations to + save time by set ``lazy_init=True``. Defaults to False. + max_refetch (int, optional): If ``Basedataset.prepare_data`` get a + None img. The maximum extra number of cycles to get a valid + image. Defaults to 1000. + ignore_index (int): The label index to be ignored. Default: 255 + reduce_zero_label (bool): Whether to mark label zero as ignored. + Default to False. + backend_args (dict, Optional): Arguments to instantiate a file backend. + See https://mmengine.readthedocs.io/en/latest/api/fileio.htm + for details. Defaults to None. + Notes: mmcv>=2.0.0rc4, mmengine>=0.2.0 required. + """ + METAINFO: dict = dict() + + def __init__(self, + ann_file: str = '', + img_suffix='.jpg', + seg_map_suffix='.png', + metainfo: Optional[dict] = None, + data_root: Optional[str] = None, + data_prefix: dict = dict(img_path='', seg_map_path=''), + filter_cfg: Optional[dict] = None, + indices: Optional[Union[int, Sequence[int]]] = None, + serialize_data: bool = True, + pipeline: List[Union[dict, Callable]] = [], + test_mode: bool = False, + lazy_init: bool = False, + max_refetch: int = 1000, + ignore_index: int = 255, + reduce_zero_label: bool = False, + backend_args: Optional[dict] = None) -> None: + + self.img_suffix = img_suffix + self.seg_map_suffix = seg_map_suffix + self.ignore_index = ignore_index + self.reduce_zero_label = reduce_zero_label + self.backend_args = backend_args.copy() if backend_args else None + + self.data_root = data_root + self.data_prefix = copy.copy(data_prefix) + self.ann_file = ann_file + self.filter_cfg = copy.deepcopy(filter_cfg) + self._indices = indices + self.serialize_data = serialize_data + self.test_mode = test_mode + self.max_refetch = max_refetch + self.data_list: List[dict] = [] + self.data_bytes: np.ndarray + + # Set meta information. + self._metainfo = self._load_metainfo(copy.deepcopy(metainfo)) + + # Get label map for custom classes + new_classes = self._metainfo.get('classes', None) + self.label_map = self.get_label_map(new_classes) + self._metainfo.update( + dict( + label_map=self.label_map, + reduce_zero_label=self.reduce_zero_label)) + + # Update palette based on label map or generate palette + # if it is not defined + updated_palette = self._update_palette() + self._metainfo.update(dict(palette=updated_palette)) + + # Join paths. + if self.data_root is not None: + self._join_prefix() + + # Build pipeline. + self.pipeline = Compose(pipeline) + # Full initialize the dataset. + if not lazy_init: + self.full_init() + + if test_mode: + assert self._metainfo.get('classes') is not None, \ + 'dataset metainfo `classes` should be specified when testing' + + @classmethod + def get_label_map(cls, + new_classes: Optional[Sequence] = None + ) -> Union[Dict, None]: + """Require label mapping. + + The ``label_map`` is a dictionary, its keys are the old label ids and + its values are the new label ids, and is used for changing pixel + labels in load_annotations. If and only if old classes in cls.METAINFO + is not equal to new classes in self._metainfo and nether of them is not + None, `label_map` is not None. + + Args: + new_classes (list, tuple, optional): The new classes name from + metainfo. Default to None. + + + Returns: + dict, optional: The mapping from old classes in cls.METAINFO to + new classes in self._metainfo + """ + old_classes = cls.METAINFO.get('classes', None) + if (new_classes is not None and old_classes is not None + and list(new_classes) != list(old_classes)): + + label_map = {} + if not set(new_classes).issubset(cls.METAINFO['classes']): + raise ValueError( + f'new classes {new_classes} is not a ' + f'subset of classes {old_classes} in METAINFO.') + for i, c in enumerate(old_classes): + if c not in new_classes: + label_map[i] = 255 + else: + label_map[i] = new_classes.index(c) + return label_map + else: + return None + + def _update_palette(self) -> list: + """Update palette after loading metainfo. + + If length of palette is equal to classes, just return the palette. + If palette is not defined, it will randomly generate a palette. + If classes is updated by customer, it will return the subset of + palette. + + Returns: + Sequence: Palette for current dataset. + """ + palette = self._metainfo.get('palette', []) + classes = self._metainfo.get('classes', []) + # palette does match classes + if len(palette) == len(classes): + return palette + + if len(palette) == 0: + # Get random state before set seed, and restore + # random state later. + # It will prevent loss of randomness, as the palette + # may be different in each iteration if not specified. + # See: https://github.com/open-mmlab/mmdetection/issues/5844 + state = np.random.get_state() + np.random.seed(42) + # random palette + new_palette = np.random.randint( + 0, 255, size=(len(classes), 3)).tolist() + np.random.set_state(state) + elif len(palette) >= len(classes) and self.label_map is not None: + new_palette = [] + # return subset of palette + for old_id, new_id in sorted( + self.label_map.items(), key=lambda x: x[1]): + if new_id != 255: + new_palette.append(palette[old_id]) + new_palette = type(palette)(new_palette) + else: + raise ValueError('palette does not match classes ' + f'as metainfo is {self._metainfo}.') + return new_palette + + def load_data_list(self) -> List[dict]: + """Load annotation from directory or annotation file. + + Returns: + list[dict]: All data info of dataset. + """ + data_list = [] + img_dir = self.data_prefix.get('img_path', None) + ann_dir = self.data_prefix.get('seg_map_path', None) + if not osp.isdir(self.ann_file) and self.ann_file: + assert osp.isfile(self.ann_file), \ + f'Failed to load `ann_file` {self.ann_file}' + lines = mmengine.list_from_file( + self.ann_file, backend_args=self.backend_args) + for line in lines: + img_name = line.strip() + data_info = dict( + img_path=osp.join(img_dir, img_name + self.img_suffix)) + if ann_dir is not None: + seg_map = img_name + self.seg_map_suffix + data_info['seg_map_path'] = osp.join(ann_dir, seg_map) + data_info['label_map'] = self.label_map + data_info['reduce_zero_label'] = self.reduce_zero_label + data_info['seg_fields'] = [] + data_list.append(data_info) + else: + _suffix_len = len(self.img_suffix) + for img in fileio.list_dir_or_file( + dir_path=img_dir, + list_dir=False, + suffix=self.img_suffix, + recursive=True, + backend_args=self.backend_args): + data_info = dict(img_path=osp.join(img_dir, img)) + if ann_dir is not None: + seg_map = img[:-_suffix_len] + self.seg_map_suffix + data_info['seg_map_path'] = osp.join(ann_dir, seg_map) + data_info['label_map'] = self.label_map + data_info['reduce_zero_label'] = self.reduce_zero_label + data_info['seg_fields'] = [] + data_list.append(data_info) + data_list = sorted(data_list, key=lambda x: x['img_path']) + return data_list + + +@DATASETS.register_module() +class BaseCDDataset(BaseDataset): + """Custom dataset for change detection. An example of file structure is as + followed. + + .. code-block:: none + + ├── data + │ ├── my_dataset + │ │ ├── img_dir + │ │ │ ├── train + │ │ │ │ ├── xxx{img_suffix} + │ │ │ │ ├── yyy{img_suffix} + │ │ │ │ ├── zzz{img_suffix} + │ │ │ ├── val + │ │ ├── img_dir2 + │ │ │ ├── train + │ │ │ │ ├── xxx{img_suffix} + │ │ │ │ ├── yyy{img_suffix} + │ │ │ │ ├── zzz{img_suffix} + │ │ │ ├── val + │ │ ├── ann_dir + │ │ │ ├── train + │ │ │ │ ├── xxx{seg_map_suffix} + │ │ │ │ ├── yyy{seg_map_suffix} + │ │ │ │ ├── zzz{seg_map_suffix} + │ │ │ ├── val + + The image names in img_dir and img_dir2 should be consistent. + The img/gt_semantic_seg pair of BaseSegDataset should be of the same + except suffix. A valid img/gt_semantic_seg filename pair should be like + ``xxx{img_suffix}`` and ``xxx{seg_map_suffix}`` (extension is also included + in the suffix). If split is given, then ``xxx`` is specified in txt file. + Otherwise, all files in ``img_dir/``and ``ann_dir`` will be loaded. + Please refer to ``docs/en/tutorials/new_dataset.md`` for more details. + + + Args: + ann_file (str): Annotation file path. Defaults to ''. + metainfo (dict, optional): Meta information for dataset, such as + specify classes to load. Defaults to None. + data_root (str, optional): The root directory for ``data_prefix`` and + ``ann_file``. Defaults to None. + data_prefix (dict, optional): Prefix for training data. Defaults to + dict(img_path=None, img_path2=None, seg_map_path=None). + img_suffix (str): Suffix of images. Default: '.jpg' + img_suffix2 (str): Suffix of images. Default: '.jpg' + seg_map_suffix (str): Suffix of segmentation maps. Default: '.png' + filter_cfg (dict, optional): Config for filter data. Defaults to None. + indices (int or Sequence[int], optional): Support using first few + data in annotation file to facilitate training/testing on a smaller + dataset. Defaults to None which means using all ``data_infos``. + serialize_data (bool, optional): Whether to hold memory using + serialized objects, when enabled, data loader workers can use + shared RAM from master process instead of making a copy. Defaults + to True. + pipeline (list, optional): Processing pipeline. Defaults to []. + test_mode (bool, optional): ``test_mode=True`` means in test phase. + Defaults to False. + lazy_init (bool, optional): Whether to load annotation during + instantiation. In some cases, such as visualization, only the meta + information of the dataset is needed, which is not necessary to + load annotation file. ``Basedataset`` can skip load annotations to + save time by set ``lazy_init=True``. Defaults to False. + max_refetch (int, optional): If ``Basedataset.prepare_data`` get a + None img. The maximum extra number of cycles to get a valid + image. Defaults to 1000. + ignore_index (int): The label index to be ignored. Default: 255 + reduce_zero_label (bool): Whether to mark label zero as ignored. + Default to False. + backend_args (dict, Optional): Arguments to instantiate a file backend. + See https://mmengine.readthedocs.io/en/latest/api/fileio.htm + for details. Defaults to None. + Notes: mmcv>=2.0.0rc4, mmengine>=0.2.0 required. + """ + METAINFO: dict = dict() + + def __init__(self, + ann_file: str = '', + img_suffix='.jpg', + img_suffix2='.jpg', + seg_map_suffix='.png', + metainfo: Optional[dict] = None, + data_root: Optional[str] = None, + data_prefix: dict = dict( + img_path='', img_path2='', seg_map_path=''), + filter_cfg: Optional[dict] = None, + indices: Optional[Union[int, Sequence[int]]] = None, + serialize_data: bool = True, + pipeline: List[Union[dict, Callable]] = [], + test_mode: bool = False, + lazy_init: bool = False, + max_refetch: int = 1000, + ignore_index: int = 255, + reduce_zero_label: bool = False, + backend_args: Optional[dict] = None) -> None: + + self.img_suffix = img_suffix + self.img_suffix2 = img_suffix2 + self.seg_map_suffix = seg_map_suffix + self.ignore_index = ignore_index + self.reduce_zero_label = reduce_zero_label + self.backend_args = backend_args.copy() if backend_args else None + + self.data_root = data_root + self.data_prefix = copy.copy(data_prefix) + self.ann_file = ann_file + self.filter_cfg = copy.deepcopy(filter_cfg) + self._indices = indices + self.serialize_data = serialize_data + self.test_mode = test_mode + self.max_refetch = max_refetch + self.data_list: List[dict] = [] + self.data_bytes: np.ndarray + + # Set meta information. + self._metainfo = self._load_metainfo(copy.deepcopy(metainfo)) + + # Get label map for custom classes + new_classes = self._metainfo.get('classes', None) + self.label_map = self.get_label_map(new_classes) + self._metainfo.update( + dict( + label_map=self.label_map, + reduce_zero_label=self.reduce_zero_label)) + + # Update palette based on label map or generate palette + # if it is not defined + updated_palette = self._update_palette() + self._metainfo.update(dict(palette=updated_palette)) + + # Join paths. + if self.data_root is not None: + self._join_prefix() + + # Build pipeline. + self.pipeline = Compose(pipeline) + # Full initialize the dataset. + if not lazy_init: + self.full_init() + + if test_mode: + assert self._metainfo.get('classes') is not None, \ + 'dataset metainfo `classes` should be specified when testing' + + @classmethod + def get_label_map(cls, + new_classes: Optional[Sequence] = None + ) -> Union[Dict, None]: + """Require label mapping. + + The ``label_map`` is a dictionary, its keys are the old label ids and + its values are the new label ids, and is used for changing pixel + labels in load_annotations. If and only if old classes in cls.METAINFO + is not equal to new classes in self._metainfo and nether of them is not + None, `label_map` is not None. + + Args: + new_classes (list, tuple, optional): The new classes name from + metainfo. Default to None. + + + Returns: + dict, optional: The mapping from old classes in cls.METAINFO to + new classes in self._metainfo + """ + old_classes = cls.METAINFO.get('classes', None) + if (new_classes is not None and old_classes is not None + and list(new_classes) != list(old_classes)): + + label_map = {} + if not set(new_classes).issubset(cls.METAINFO['classes']): + raise ValueError( + f'new classes {new_classes} is not a ' + f'subset of classes {old_classes} in METAINFO.') + for i, c in enumerate(old_classes): + if c not in new_classes: + label_map[i] = 255 + else: + label_map[i] = new_classes.index(c) + return label_map + else: + return None + + def _update_palette(self) -> list: + """Update palette after loading metainfo. + + If length of palette is equal to classes, just return the palette. + If palette is not defined, it will randomly generate a palette. + If classes is updated by customer, it will return the subset of + palette. + + Returns: + Sequence: Palette for current dataset. + """ + palette = self._metainfo.get('palette', []) + classes = self._metainfo.get('classes', []) + # palette does match classes + if len(palette) == len(classes): + return palette + + if len(palette) == 0: + # Get random state before set seed, and restore + # random state later. + # It will prevent loss of randomness, as the palette + # may be different in each iteration if not specified. + # See: https://github.com/open-mmlab/mmdetection/issues/5844 + state = np.random.get_state() + np.random.seed(42) + # random palette + new_palette = np.random.randint( + 0, 255, size=(len(classes), 3)).tolist() + np.random.set_state(state) + elif len(palette) >= len(classes) and self.label_map is not None: + new_palette = [] + # return subset of palette + for old_id, new_id in sorted( + self.label_map.items(), key=lambda x: x[1]): + if new_id != 255: + new_palette.append(palette[old_id]) + new_palette = type(palette)(new_palette) + else: + raise ValueError('palette does not match classes ' + f'as metainfo is {self._metainfo}.') + return new_palette + + def load_data_list(self) -> List[dict]: + """Load annotation from directory or annotation file. + + Returns: + list[dict]: All data info of dataset. + """ + data_list = [] + img_dir = self.data_prefix.get('img_path', None) + img_dir2 = self.data_prefix.get('img_path2', None) + ann_dir = self.data_prefix.get('seg_map_path', None) + if osp.isfile(self.ann_file): + lines = mmengine.list_from_file( + self.ann_file, backend_args=self.backend_args) + for line in lines: + img_name = line.strip() + if '.' in osp.basename(img_name): + img_name, img_ext = osp.splitext(img_name) + self.img_suffix = img_ext + self.img_suffix2 = img_ext + data_info = dict( + img_path=osp.join(img_dir, img_name + self.img_suffix), + img_path2=osp.join(img_dir2, img_name + self.img_suffix2)) + + if ann_dir is not None: + seg_map = img_name + self.seg_map_suffix + data_info['seg_map_path'] = osp.join(ann_dir, seg_map) + data_info['label_map'] = self.label_map + data_info['reduce_zero_label'] = self.reduce_zero_label + data_info['seg_fields'] = [] + data_list.append(data_info) + else: + for img in fileio.list_dir_or_file( + dir_path=img_dir, + list_dir=False, + suffix=self.img_suffix, + recursive=True, + backend_args=self.backend_args): + if '.' in osp.basename(img): + img, img_ext = osp.splitext(img) + self.img_suffix = img_ext + self.img_suffix2 = img_ext + data_info = dict( + img_path=osp.join(img_dir, img + self.img_suffix), + img_path2=osp.join(img_dir2, img + self.img_suffix2)) + if ann_dir is not None: + seg_map = img + self.seg_map_suffix + data_info['seg_map_path'] = osp.join(ann_dir, seg_map) + data_info['label_map'] = self.label_map + data_info['reduce_zero_label'] = self.reduce_zero_label + data_info['seg_fields'] = [] + data_list.append(data_info) + data_list = sorted(data_list, key=lambda x: x['img_path']) + return data_list diff --git a/third-party/InterFormer/mmseg/datasets/bdd100k.py b/third-party/InterFormer/mmseg/datasets/bdd100k.py new file mode 100644 index 0000000000000000000000000000000000000000..8ae70b5cb29f2b34c5804129c85622bfcca6767d --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/bdd100k.py @@ -0,0 +1,30 @@ +# Copyright (c) OpenMMLab. All rights reserved. + +from mmseg.datasets.basesegdataset import BaseSegDataset +from mmseg.registry import DATASETS + + +@DATASETS.register_module() +class BDD100KDataset(BaseSegDataset): + METAINFO = dict( + classes=('road', 'sidewalk', 'building', 'wall', 'fence', 'pole', + 'traffic light', 'traffic sign', 'vegetation', 'terrain', + 'sky', 'person', 'rider', 'car', 'truck', 'bus', 'train', + 'motorcycle', 'bicycle'), + palette=[[128, 64, 128], [244, 35, 232], [70, 70, 70], [102, 102, 156], + [190, 153, 153], [153, 153, 153], [250, 170, + 30], [220, 220, 0], + [107, 142, 35], [152, 251, 152], [70, 130, 180], + [220, 20, 60], [255, 0, 0], [0, 0, 142], [0, 0, 70], + [0, 60, 100], [0, 80, 100], [0, 0, 230], [119, 11, 32]]) + + def __init__(self, + img_suffix='.jpg', + seg_map_suffix='.png', + reduce_zero_label=False, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/chase_db1.py b/third-party/InterFormer/mmseg/datasets/chase_db1.py new file mode 100644 index 0000000000000000000000000000000000000000..626ddf75e9a2a10a09ca1f298f12f4290268d504 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/chase_db1.py @@ -0,0 +1,32 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import mmengine.fileio as fileio + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class ChaseDB1Dataset(BaseSegDataset): + """Chase_db1 dataset. + + In segmentation map annotation for Chase_db1, 0 stands for background, + which is included in 2 categories. ``reduce_zero_label`` is fixed to False. + The ``img_suffix`` is fixed to '.png' and ``seg_map_suffix`` is fixed to + '_1stHO.png'. + """ + METAINFO = dict( + classes=('background', 'vessel'), + palette=[[120, 120, 120], [6, 230, 230]]) + + def __init__(self, + img_suffix='.png', + seg_map_suffix='_1stHO.png', + reduce_zero_label=False, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) + assert fileio.exists( + self.data_prefix['img_path'], backend_args=self.backend_args) diff --git a/third-party/InterFormer/mmseg/datasets/cityscapes.py b/third-party/InterFormer/mmseg/datasets/cityscapes.py new file mode 100644 index 0000000000000000000000000000000000000000..f494d62424a39581961ab705b3308e7e07bee110 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/cityscapes.py @@ -0,0 +1,30 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class CityscapesDataset(BaseSegDataset): + """Cityscapes dataset. + + The ``img_suffix`` is fixed to '_leftImg8bit.png' and ``seg_map_suffix`` is + fixed to '_gtFine_labelTrainIds.png' for Cityscapes dataset. + """ + METAINFO = dict( + classes=('road', 'sidewalk', 'building', 'wall', 'fence', 'pole', + 'traffic light', 'traffic sign', 'vegetation', 'terrain', + 'sky', 'person', 'rider', 'car', 'truck', 'bus', 'train', + 'motorcycle', 'bicycle'), + palette=[[128, 64, 128], [244, 35, 232], [70, 70, 70], [102, 102, 156], + [190, 153, 153], [153, 153, 153], [250, 170, + 30], [220, 220, 0], + [107, 142, 35], [152, 251, 152], [70, 130, 180], + [220, 20, 60], [255, 0, 0], [0, 0, 142], [0, 0, 70], + [0, 60, 100], [0, 80, 100], [0, 0, 230], [119, 11, 32]]) + + def __init__(self, + img_suffix='_leftImg8bit.png', + seg_map_suffix='_gtFine_labelTrainIds.png', + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/coco_stuff.py b/third-party/InterFormer/mmseg/datasets/coco_stuff.py new file mode 100644 index 0000000000000000000000000000000000000000..1e1574d9702330cc5b10bab084841df61e7121ff --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/coco_stuff.py @@ -0,0 +1,99 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class COCOStuffDataset(BaseSegDataset): + """COCO-Stuff dataset. + + In segmentation map annotation for COCO-Stuff, Train-IDs of the 10k version + are from 1 to 171, where 0 is the ignore index, and Train-ID of COCO Stuff + 164k is from 0 to 170, where 255 is the ignore index. So, they are all 171 + semantic categories. ``reduce_zero_label`` is set to True and False for the + 10k and 164k versions, respectively. The ``img_suffix`` is fixed to '.jpg', + and ``seg_map_suffix`` is fixed to '.png'. + """ + METAINFO = dict( + classes=( + 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', + 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', + 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', + 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', + 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', + 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', + 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', + 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', + 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', + 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', + 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', + 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', + 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', + 'scissors', 'teddy bear', 'hair drier', 'toothbrush', 'banner', + 'blanket', 'branch', 'bridge', 'building-other', 'bush', 'cabinet', + 'cage', 'cardboard', 'carpet', 'ceiling-other', 'ceiling-tile', + 'cloth', 'clothes', 'clouds', 'counter', 'cupboard', 'curtain', + 'desk-stuff', 'dirt', 'door-stuff', 'fence', 'floor-marble', + 'floor-other', 'floor-stone', 'floor-tile', 'floor-wood', 'flower', + 'fog', 'food-other', 'fruit', 'furniture-other', 'grass', 'gravel', + 'ground-other', 'hill', 'house', 'leaves', 'light', 'mat', 'metal', + 'mirror-stuff', 'moss', 'mountain', 'mud', 'napkin', 'net', + 'paper', 'pavement', 'pillow', 'plant-other', 'plastic', + 'platform', 'playingfield', 'railing', 'railroad', 'river', 'road', + 'rock', 'roof', 'rug', 'salad', 'sand', 'sea', 'shelf', + 'sky-other', 'skyscraper', 'snow', 'solid-other', 'stairs', + 'stone', 'straw', 'structural-other', 'table', 'tent', + 'textile-other', 'towel', 'tree', 'vegetable', 'wall-brick', + 'wall-concrete', 'wall-other', 'wall-panel', 'wall-stone', + 'wall-tile', 'wall-wood', 'water-other', 'waterdrops', + 'window-blind', 'window-other', 'wood'), + palette=[[0, 192, 64], [0, 192, 64], [0, 64, 96], [128, 192, 192], + [0, 64, 64], [0, 192, 224], [0, 192, 192], [128, 192, 64], + [0, 192, 96], [128, 192, 64], [128, 32, 192], [0, 0, 224], + [0, 0, 64], [0, 160, 192], [128, 0, 96], [128, 0, 192], + [0, 32, 192], [128, 128, 224], [0, 0, 192], [128, 160, 192], + [128, 128, 0], [128, 0, 32], [128, 32, 0], [128, 0, 128], + [64, 128, 32], [0, 160, 0], [0, 0, 0], [192, 128, 160], + [0, 32, 0], [0, 128, 128], [64, 128, 160], [128, 160, 0], + [0, 128, 0], [192, 128, 32], [128, 96, 128], [0, 0, 128], + [64, 0, 32], [0, 224, 128], [128, 0, 0], [192, 0, 160], + [0, 96, 128], [128, 128, 128], [64, 0, 160], [128, 224, 128], + [128, 128, 64], [192, 0, 32], [128, 96, 0], [128, 0, 192], + [0, 128, 32], [64, 224, 0], [0, 0, 64], [128, 128, 160], + [64, 96, 0], [0, 128, 192], [0, 128, 160], [192, 224, 0], + [0, 128, 64], [128, 128, 32], [192, 32, 128], [0, 64, 192], + [0, 0, 32], [64, 160, 128], [128, 64, 64], [128, 0, 160], + [64, 32, 128], [128, 192, 192], [0, 0, 160], [192, 160, 128], + [128, 192, 0], [128, 0, 96], [192, 32, 0], [128, 64, 128], + [64, 128, 96], [64, 160, 0], [0, 64, 0], [192, 128, 224], + [64, 32, 0], [0, 192, 128], [64, 128, 224], [192, 160, 0], + [0, 192, 0], [192, 128, 96], [192, 96, 128], [0, 64, 128], + [64, 0, 96], [64, 224, 128], [128, 64, 0], [192, 0, 224], + [64, 96, 128], [128, 192, 128], [64, 0, 224], [192, 224, 128], + [128, 192, 64], [192, 0, 96], [192, 96, 0], [128, 64, 192], + [0, 128, 96], [0, 224, 0], [64, 64, 64], [128, 128, 224], + [0, 96, 0], [64, 192, 192], [0, 128, 224], [128, 224, 0], + [64, 192, 64], [128, 128, 96], [128, 32, 128], [64, 0, 192], + [0, 64, 96], [0, 160, 128], [192, 0, 64], [128, 64, 224], + [0, 32, 128], [192, 128, 192], [0, 64, 224], [128, 160, 128], + [192, 128, 0], [128, 64, 32], [128, 32, 64], [192, 0, 128], + [64, 192, 32], [0, 160, 64], [64, 0, 0], [192, 192, 160], + [0, 32, 64], [64, 128, 128], [64, 192, 160], [128, 160, 64], + [64, 128, 0], [192, 192, 32], [128, 96, 192], [64, 0, 128], + [64, 64, 32], [0, 224, 192], [192, 0, 0], [192, 64, 160], + [0, 96, 192], [192, 128, 128], [64, 64, 160], [128, 224, 192], + [192, 128, 64], [192, 64, 32], [128, 96, 64], [192, 0, 192], + [0, 192, 32], [64, 224, 64], [64, 0, 64], [128, 192, 160], + [64, 96, 64], [64, 128, 192], [0, 192, 160], [192, 224, 64], + [64, 128, 64], [128, 192, 32], [192, 32, 192], [64, 64, 192], + [0, 64, 32], [64, 160, 192], [192, 64, 64], [128, 64, 160], + [64, 32, 192], [192, 192, 192], [0, 64, 160], [192, 160, 192], + [192, 192, 0], [128, 64, 96], [192, 32, 64], [192, 64, 128], + [64, 192, 96], [64, 160, 64], [64, 64, 0]]) + + def __init__(self, + img_suffix='.jpg', + seg_map_suffix='_labelTrainIds.png', + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/dark_zurich.py b/third-party/InterFormer/mmseg/datasets/dark_zurich.py new file mode 100644 index 0000000000000000000000000000000000000000..9b5393fa9e5047e81790f91829cfe4b7f33cc707 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/dark_zurich.py @@ -0,0 +1,15 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .cityscapes import CityscapesDataset + + +@DATASETS.register_module() +class DarkZurichDataset(CityscapesDataset): + """DarkZurichDataset dataset.""" + + def __init__(self, + img_suffix='_rgb_anon.png', + seg_map_suffix='_gt_labelTrainIds.png', + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/dataset_wrappers.py b/third-party/InterFormer/mmseg/datasets/dataset_wrappers.py new file mode 100644 index 0000000000000000000000000000000000000000..082c116ff4582ecc7064dba1aba3c164dd556af5 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/dataset_wrappers.py @@ -0,0 +1,136 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import collections +import copy +from typing import List, Optional, Sequence, Union + +from mmengine.dataset import ConcatDataset, force_full_init + +from mmseg.registry import DATASETS, TRANSFORMS + + +@DATASETS.register_module() +class MultiImageMixDataset: + """A wrapper of multiple images mixed dataset. + + Suitable for training on multiple images mixed data augmentation like + mosaic and mixup. + + Args: + dataset (ConcatDataset or dict): The dataset to be mixed. + pipeline (Sequence[dict]): Sequence of transform object or + config dict to be composed. + skip_type_keys (list[str], optional): Sequence of type string to + be skip pipeline. Default to None. + """ + + def __init__(self, + dataset: Union[ConcatDataset, dict], + pipeline: Sequence[dict], + skip_type_keys: Optional[List[str]] = None, + lazy_init: bool = False) -> None: + assert isinstance(pipeline, collections.abc.Sequence) + + if isinstance(dataset, dict): + self.dataset = DATASETS.build(dataset) + elif isinstance(dataset, ConcatDataset): + self.dataset = dataset + else: + raise TypeError( + 'elements in datasets sequence should be config or ' + f'`ConcatDataset` instance, but got {type(dataset)}') + + if skip_type_keys is not None: + assert all([ + isinstance(skip_type_key, str) + for skip_type_key in skip_type_keys + ]) + self._skip_type_keys = skip_type_keys + + self.pipeline = [] + self.pipeline_types = [] + for transform in pipeline: + if isinstance(transform, dict): + self.pipeline_types.append(transform['type']) + transform = TRANSFORMS.build(transform) + self.pipeline.append(transform) + else: + raise TypeError('pipeline must be a dict') + + self._metainfo = self.dataset.metainfo + self.num_samples = len(self.dataset) + + self._fully_initialized = False + if not lazy_init: + self.full_init() + + @property + def metainfo(self) -> dict: + """Get the meta information of the multi-image-mixed dataset. + + Returns: + dict: The meta information of multi-image-mixed dataset. + """ + return copy.deepcopy(self._metainfo) + + def full_init(self): + """Loop to ``full_init`` each dataset.""" + if self._fully_initialized: + return + + self.dataset.full_init() + self._ori_len = len(self.dataset) + self._fully_initialized = True + + @force_full_init + def get_data_info(self, idx: int) -> dict: + """Get annotation by index. + + Args: + idx (int): Global index of ``ConcatDataset``. + + Returns: + dict: The idx-th annotation of the datasets. + """ + return self.dataset.get_data_info(idx) + + @force_full_init + def __len__(self): + return self.num_samples + + def __getitem__(self, idx): + results = copy.deepcopy(self.dataset[idx]) + for (transform, transform_type) in zip(self.pipeline, + self.pipeline_types): + if self._skip_type_keys is not None and \ + transform_type in self._skip_type_keys: + continue + + if hasattr(transform, 'get_indices'): + indices = transform.get_indices(self.dataset) + if not isinstance(indices, collections.abc.Sequence): + indices = [indices] + mix_results = [ + copy.deepcopy(self.dataset[index]) for index in indices + ] + results['mix_results'] = mix_results + + results = transform(results) + + if 'mix_results' in results: + results.pop('mix_results') + + return results + + def update_skip_type_keys(self, skip_type_keys): + """Update skip_type_keys. + + It is called by an external hook. + + Args: + skip_type_keys (list[str], optional): Sequence of type + string to be skip pipeline. + """ + assert all([ + isinstance(skip_type_key, str) for skip_type_key in skip_type_keys + ]) + self._skip_type_keys = skip_type_keys diff --git a/third-party/InterFormer/mmseg/datasets/decathlon.py b/third-party/InterFormer/mmseg/datasets/decathlon.py new file mode 100644 index 0000000000000000000000000000000000000000..26aa4ef0d7f44e55d4400ed6151ea1f6cb3930ec --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/decathlon.py @@ -0,0 +1,96 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import copy +import os.path as osp +from typing import List + +from mmengine.fileio import load + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class DecathlonDataset(BaseSegDataset): + """Dataset for Dacathlon dataset. + + The dataset.json format is shown as follows + + .. code-block:: none + + { + "name": "BRATS", + "tensorImageSize": "4D", + "modality": + { + "0": "FLAIR", + "1": "T1w", + "2": "t1gd", + "3": "T2w" + }, + "labels": { + "0": "background", + "1": "edema", + "2": "non-enhancing tumor", + "3": "enhancing tumour" + }, + "numTraining": 484, + "numTest": 266, + "training": + [ + { + "image": "./imagesTr/BRATS_306.nii.gz" + "label": "./labelsTr/BRATS_306.nii.gz" + ... + } + ] + "test": + [ + "./imagesTs/BRATS_557.nii.gz" + ... + ] + } + """ + + def load_data_list(self) -> List[dict]: + """Load annotation from directory or annotation file. + + Returns: + list[dict]: All data info of dataset. + """ + # `self.ann_file` denotes the absolute annotation file path if + # `self.root=None` or relative path if `self.root=/path/to/data/`. + annotations = load(self.ann_file) + if not isinstance(annotations, dict): + raise TypeError(f'The annotations loaded from annotation file ' + f'should be a dict, but got {type(annotations)}!') + raw_data_list = annotations[ + 'training'] if not self.test_mode else annotations['test'] + data_list = [] + for raw_data_info in raw_data_list: + # `2:` works for removing './' in file path, which will break + # loading from cloud storage. + if isinstance(raw_data_info, dict): + data_info = dict( + img_path=osp.join(self.data_root, raw_data_info['image'] + [2:])) + data_info['seg_map_path'] = osp.join( + self.data_root, raw_data_info['label'][2:]) + else: + data_info = dict( + img_path=osp.join(self.data_root, raw_data_info)[2:]) + data_info['label_map'] = self.label_map + data_info['reduce_zero_label'] = self.reduce_zero_label + data_info['seg_fields'] = [] + data_list.append(data_info) + annotations.pop('training') + annotations.pop('test') + + metainfo = copy.deepcopy(annotations) + metainfo['classes'] = [*metainfo['labels'].values()] + # Meta information load from annotation file will not influence the + # existed meta information load from `BaseDataset.METAINFO` and + # `metainfo` arguments defined in constructor. + for k, v in metainfo.items(): + self._metainfo.setdefault(k, v) + + return data_list diff --git a/third-party/InterFormer/mmseg/datasets/drive.py b/third-party/InterFormer/mmseg/datasets/drive.py new file mode 100644 index 0000000000000000000000000000000000000000..76c0160a6b6bf4a56ff135620ff0b08dc086d1d9 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/drive.py @@ -0,0 +1,32 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import mmengine.fileio as fileio + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class DRIVEDataset(BaseSegDataset): + """DRIVE dataset. + + In segmentation map annotation for DRIVE, 0 stands for background, which is + included in 2 categories. ``reduce_zero_label`` is fixed to False. The + ``img_suffix`` is fixed to '.png' and ``seg_map_suffix`` is fixed to + '_manual1.png'. + """ + METAINFO = dict( + classes=('background', 'vessel'), + palette=[[120, 120, 120], [6, 230, 230]]) + + def __init__(self, + img_suffix='.png', + seg_map_suffix='_manual1.png', + reduce_zero_label=False, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) + assert fileio.exists( + self.data_prefix['img_path'], backend_args=self.backend_args) diff --git a/third-party/InterFormer/mmseg/datasets/dsdl.py b/third-party/InterFormer/mmseg/datasets/dsdl.py new file mode 100644 index 0000000000000000000000000000000000000000..bf7e4e61b5fdd4bcb34617c8e53b93829def443a --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/dsdl.py @@ -0,0 +1,116 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import os +from typing import Dict, List, Optional, Sequence, Union + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + +try: + from dsdl.dataset import DSDLDataset +except ImportError: + DSDLDataset = None + + +@DATASETS.register_module() +class DSDLSegDataset(BaseSegDataset): + """Dataset for dsdl segmentation. + + Args: + specific_key_path(dict): Path of specific key which can not + be loaded by it's field name. + pre_transform(dict): pre-transform functions before loading. + used_labels(sequence): list of actual used classes in train steps, + this must be subset of class domain. + """ + + METAINFO = {} + + def __init__(self, + specific_key_path: Dict = {}, + pre_transform: Dict = {}, + used_labels: Optional[Sequence] = None, + **kwargs) -> None: + + if DSDLDataset is None: + raise RuntimeError( + 'Package dsdl is not installed. Please run "pip install dsdl".' + ) + self.used_labels = used_labels + + loc_config = dict(type='LocalFileReader', working_dir='') + if kwargs.get('data_root'): + kwargs['ann_file'] = os.path.join(kwargs['data_root'], + kwargs['ann_file']) + required_fields = ['Image', 'LabelMap'] + + self.dsdldataset = DSDLDataset( + dsdl_yaml=kwargs['ann_file'], + location_config=loc_config, + required_fields=required_fields, + specific_key_path=specific_key_path, + transform=pre_transform, + ) + BaseSegDataset.__init__(self, **kwargs) + + def load_data_list(self) -> List[Dict]: + """Load data info from a dsdl yaml file named as ``self.ann_file`` + + Returns: + List[dict]: A list of data list. + """ + + if self.used_labels: + self._metainfo['classes'] = tuple(self.used_labels) + self.label_map = self.get_label_map(self.used_labels) + else: + self._metainfo['classes'] = tuple(['background'] + + self.dsdldataset.class_names) + data_list = [] + + for i, data in enumerate(self.dsdldataset): + datainfo = dict( + img_path=os.path.join(self.data_prefix['img_path'], + data['Image'][0].location), + seg_map_path=os.path.join(self.data_prefix['seg_map_path'], + data['LabelMap'][0].location), + label_map=self.label_map, + reduce_zero_label=self.reduce_zero_label, + seg_fields=[], + ) + data_list.append(datainfo) + + return data_list + + def get_label_map(self, + new_classes: Optional[Sequence] = None + ) -> Union[Dict, None]: + """Require label mapping. + + The ``label_map`` is a dictionary, its keys are the old label ids and + its values are the new label ids, and is used for changing pixel + labels in load_annotations. If and only if old classes in class_dom + is not equal to new classes in args and nether of them is not + None, `label_map` is not None. + Args: + new_classes (list, tuple, optional): The new classes name from + metainfo. Default to None. + Returns: + dict, optional: The mapping from old classes to new classes. + """ + old_classes = ['background'] + self.dsdldataset.class_names + if (new_classes is not None and old_classes is not None + and list(new_classes) != list(old_classes)): + + label_map = {} + if not set(new_classes).issubset(old_classes): + raise ValueError( + f'new classes {new_classes} is not a ' + f'subset of classes {old_classes} in class_dom.') + for i, c in enumerate(old_classes): + if c not in new_classes: + label_map[i] = 255 + else: + label_map[i] = new_classes.index(c) + return label_map + else: + return None diff --git a/third-party/InterFormer/mmseg/datasets/hrf.py b/third-party/InterFormer/mmseg/datasets/hrf.py new file mode 100644 index 0000000000000000000000000000000000000000..fd669cce26420b7e2c810ecace247a9e09350a5d --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/hrf.py @@ -0,0 +1,32 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import mmengine.fileio as fileio + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class HRFDataset(BaseSegDataset): + """HRF dataset. + + In segmentation map annotation for HRF, 0 stands for background, which is + included in 2 categories. ``reduce_zero_label`` is fixed to False. The + ``img_suffix`` is fixed to '.png' and ``seg_map_suffix`` is fixed to + '.png'. + """ + METAINFO = dict( + classes=('background', 'vessel'), + palette=[[120, 120, 120], [6, 230, 230]]) + + def __init__(self, + img_suffix='.png', + seg_map_suffix='.png', + reduce_zero_label=False, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) + assert fileio.exists( + self.data_prefix['img_path'], backend_args=self.backend_args) diff --git a/third-party/InterFormer/mmseg/datasets/hsi_drive.py b/third-party/InterFormer/mmseg/datasets/hsi_drive.py new file mode 100644 index 0000000000000000000000000000000000000000..3d46a86629e6535ee510d11bfa24caeb9fa4ab95 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/hsi_drive.py @@ -0,0 +1,42 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.datasets import BaseSegDataset +from mmseg.registry import DATASETS + +classes_exp = ('unlabelled', 'road', 'road marks', 'vegetation', + 'painted metal', 'sky', 'concrete', 'pedestrian', 'water', + 'unpainted metal', 'glass') +palette_exp = [[0, 0, 0], [77, 77, 77], [255, 255, 255], [0, 255, 0], + [255, 0, 0], [0, 0, 255], [102, 51, 0], [255, 255, 0], + [0, 207, 250], [255, 166, 0], [0, 204, 204]] + + +@DATASETS.register_module() +class HSIDrive20Dataset(BaseSegDataset): + """HSI-Drive v2.0 (https://ieeexplore.ieee.org/document/10371793), the + updated version of HSI-Drive + (https://ieeexplore.ieee.org/document/9575298), is a structured dataset for + the research and development of automated driving systems (ADS) supported + by hyperspectral imaging (HSI). It contains per-pixel manually annotated + images selected from videos recorded in real driving conditions and has + been organized according to four parameters: season, daytime, road type, + and weather conditions. + + The video sequences have been captured with a small-size 25-band VNIR + (Visible-NearlnfraRed) snapshot hyperspectral camera mounted on a driving + automobile. As a consequence, you need to modify the in_channels parameter + of your model from 3 (RGB images) to 25 (HSI images) as it is done in + configs/unet/unet-s5-d16_fcn_4xb4-160k_hsidrive-192x384.py + + Apart from the abovementioned articles, additional information is provided + in the website (https://ipaccess.ehu.eus/HSI-Drive/) from where you can + download the dataset and also visualize some examples of segmented videos. + """ + + METAINFO = dict(classes=classes_exp, palette=palette_exp) + + def __init__(self, + img_suffix='.npy', + seg_map_suffix='.png', + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/interformer_dataset.py b/third-party/InterFormer/mmseg/datasets/interformer_dataset.py new file mode 100644 index 0000000000000000000000000000000000000000..4eab8baf6e22037a78dbf5372350e0f212f8e081 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/interformer_dataset.py @@ -0,0 +1,48 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import os.path as osp + +from mmseg.registry import DATASETS +# from .custom import CustomDataset +from mmengine.dataset import BaseDataset, Compose +from .basesegdataset import BaseSegDataset + +@DATASETS.register_module() +class EgoHOSDataset(BaseSegDataset): + """EgoHOS dataset. + + Args: + split (str): Split txt file for EgoHOS. + """ + + # CLASSES = ('background', 'aeroplane') + + # PALETTE = [[0, 0, 0], [128, 0, 0], [0, 128, 0], [128, 128, 0], [0, 0, 128], + # [128, 0, 128]] + + METAINFO = dict( + # classes = ('BG', 'Left_Object1', 'Right_Object1', 'Two_Object1'), + # palette=[[0, 0, 0], [255, 0, 255], [0, 255, 255], [0, 255, 0]], + classes = ('background', 'Left_Hand', 'Right_Hand', \ + 'Left_Object1', 'Right_Object1', 'Two_Object1', \ + 'Left_Object2', 'Right_Object2', 'Two_Object2'), + palette=[[0, 0, 0], [255, 0, 0], [0, 0, 255], \ + [255, 0, 255], [0, 255, 255], [0, 255, 0], \ + [255, 204, 255], [204, 255, 255], [204, 255, 204]], +) + + # CLASSES = ('background', 'Left_Hand', 'Right_Hand', \ + # 'Left_Object1', 'Right_Object1', 'Two_Object1', \ + # 'Left_Object2', 'Right_Object2', 'Two_Object2') + + # PALETTE = [[0, 0, 0], [255, 0, 0], [0, 0, 255], \ + # [255, 0, 255], [0, 255, 255], [0, 255, 0], \ + # [255, 204, 255], [204, 255, 255], [204, 255, 204]] + + def __init__(self, **kwargs): + super(EgoHOSDataset, self).__init__( + img_suffix='.jpg', seg_map_suffix='.png', **kwargs) + + # def __init__(self, + # ann_file: str='', # ann_file for obj + # img_suffix='.jpg', + # seg_map_suffix='.png',**kwargs) -> None: \ No newline at end of file diff --git a/third-party/InterFormer/mmseg/datasets/isaid.py b/third-party/InterFormer/mmseg/datasets/isaid.py new file mode 100644 index 0000000000000000000000000000000000000000..61942ec1ea33e76c65c22d8e7fc71fb8194841dd --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/isaid.py @@ -0,0 +1,39 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import mmengine.fileio as fileio + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class iSAIDDataset(BaseSegDataset): + """ iSAID: A Large-scale Dataset for Instance Segmentation in Aerial Images + In segmentation map annotation for iSAID dataset, which is included + in 16 categories. ``reduce_zero_label`` is fixed to False. The + ``img_suffix`` is fixed to '.png' and ``seg_map_suffix`` is fixed to + '_manual1.png'. + """ + + METAINFO = dict( + classes=('background', 'ship', 'store_tank', 'baseball_diamond', + 'tennis_court', 'basketball_court', 'Ground_Track_Field', + 'Bridge', 'Large_Vehicle', 'Small_Vehicle', 'Helicopter', + 'Swimming_pool', 'Roundabout', 'Soccer_ball_field', 'plane', + 'Harbor'), + palette=[[0, 0, 0], [0, 0, 63], [0, 63, 63], [0, 63, 0], [0, 63, 127], + [0, 63, 191], [0, 63, 255], [0, 127, 63], [0, 127, 127], + [0, 0, 127], [0, 0, 191], [0, 0, 255], [0, 191, 127], + [0, 127, 191], [0, 127, 255], [0, 100, 155]]) + + def __init__(self, + img_suffix='.png', + seg_map_suffix='_instance_color_RGB.png', + ignore_index=255, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + ignore_index=ignore_index, + **kwargs) + assert fileio.exists( + self.data_prefix['img_path'], backend_args=self.backend_args) diff --git a/third-party/InterFormer/mmseg/datasets/isprs.py b/third-party/InterFormer/mmseg/datasets/isprs.py new file mode 100644 index 0000000000000000000000000000000000000000..30af53c569b05c9be1218e9a58655c36c8aa9931 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/isprs.py @@ -0,0 +1,29 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class ISPRSDataset(BaseSegDataset): + """ISPRS dataset. + + In segmentation map annotation for ISPRS, 0 is the ignore index. + ``reduce_zero_label`` should be set to True. The ``img_suffix`` and + ``seg_map_suffix`` are both fixed to '.png'. + """ + METAINFO = dict( + classes=('impervious_surface', 'building', 'low_vegetation', 'tree', + 'car', 'clutter'), + palette=[[255, 255, 255], [0, 0, 255], [0, 255, 255], [0, 255, 0], + [255, 255, 0], [255, 0, 0]]) + + def __init__(self, + img_suffix='.png', + seg_map_suffix='.png', + reduce_zero_label=True, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/levir.py b/third-party/InterFormer/mmseg/datasets/levir.py new file mode 100644 index 0000000000000000000000000000000000000000..f467481bad70a426381842dba61d85576c196eaf --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/levir.py @@ -0,0 +1,31 @@ +# Copyright (c) OpenMMLab. All rights reserved. + +from mmseg.registry import DATASETS +from .basesegdataset import BaseCDDataset + + +@DATASETS.register_module() +class LEVIRCDDataset(BaseCDDataset): + """ISPRS dataset. + + In segmentation map annotation for ISPRS, 0 is to ignore index. + ``reduce_zero_label`` should be set to True. The ``img_suffix`` and + ``seg_map_suffix`` are both fixed to '.png'. + """ + + METAINFO = dict( + classes=('background', 'changed'), + palette=[[0, 0, 0], [255, 255, 255]]) + + def __init__(self, + img_suffix='.png', + img_suffix2='.png', + seg_map_suffix='.png', + reduce_zero_label=False, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + img_suffix2=img_suffix2, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/lip.py b/third-party/InterFormer/mmseg/datasets/lip.py new file mode 100644 index 0000000000000000000000000000000000000000..3a32a193aff990ae9f819d4a0a1be82df1d049cb --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/lip.py @@ -0,0 +1,47 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class LIPDataset(BaseSegDataset): + """LIP dataset. + + The ``img_suffix`` is fixed to '.jpg' and ``seg_map_suffix`` is fixed to + '.png'. + """ + METAINFO = dict( + classes=('Background', 'Hat', 'Hair', 'Glove', 'Sunglasses', + 'UpperClothes', 'Dress', 'Coat', 'Socks', 'Pants', + 'Jumpsuits', 'Scarf', 'Skirt', 'Face', 'Left-arm', + 'Right-arm', 'Left-leg', 'Right-leg', 'Left-shoe', + 'Right-shoe'), + palette=( + [0, 0, 0], + [128, 0, 0], + [255, 0, 0], + [0, 85, 0], + [170, 0, 51], + [255, 85, 0], + [0, 0, 85], + [0, 119, 221], + [85, 85, 0], + [0, 85, 85], + [85, 51, 0], + [52, 86, 128], + [0, 128, 0], + [0, 0, 255], + [51, 170, 221], + [0, 255, 255], + [85, 255, 170], + [170, 255, 85], + [255, 255, 0], + [255, 170, 0], + )) + + def __init__(self, + img_suffix='.jpg', + seg_map_suffix='.png', + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/loveda.py b/third-party/InterFormer/mmseg/datasets/loveda.py new file mode 100644 index 0000000000000000000000000000000000000000..5c16db503adee6f1a1cac67e1dc72ff873ccd5ea --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/loveda.py @@ -0,0 +1,29 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class LoveDADataset(BaseSegDataset): + """LoveDA dataset. + + In segmentation map annotation for LoveDA, 0 is the ignore index. + ``reduce_zero_label`` should be set to True. The ``img_suffix`` and + ``seg_map_suffix`` are both fixed to '.png'. + """ + METAINFO = dict( + classes=('background', 'building', 'road', 'water', 'barren', 'forest', + 'agricultural'), + palette=[[255, 255, 255], [255, 0, 0], [255, 255, 0], [0, 0, 255], + [159, 129, 183], [0, 255, 0], [255, 195, 128]]) + + def __init__(self, + img_suffix='.png', + seg_map_suffix='.png', + reduce_zero_label=True, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/mapillary.py b/third-party/InterFormer/mmseg/datasets/mapillary.py new file mode 100644 index 0000000000000000000000000000000000000000..6c2947338ec79b3d8558cee0387a2a84e41f0421 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/mapillary.py @@ -0,0 +1,176 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class MapillaryDataset_v1(BaseSegDataset): + """Mapillary Vistas Dataset. + + Dataset paper link: + http://ieeexplore.ieee.org/document/8237796/ + + v1.2 contain 66 object classes. + (37 instance-specific) + + v2.0 contain 124 object classes. + (70 instance-specific, 46 stuff, 8 void or crowd). + + The ``img_suffix`` is fixed to '.jpg' and ``seg_map_suffix`` is + fixed to '.png' for Mapillary Vistas Dataset. + """ + METAINFO = dict( + classes=('Bird', 'Ground Animal', 'Curb', 'Fence', 'Guard Rail', + 'Barrier', 'Wall', 'Bike Lane', 'Crosswalk - Plain', + 'Curb Cut', 'Parking', 'Pedestrian Area', 'Rail Track', + 'Road', 'Service Lane', 'Sidewalk', 'Bridge', 'Building', + 'Tunnel', 'Person', 'Bicyclist', 'Motorcyclist', + 'Other Rider', 'Lane Marking - Crosswalk', + 'Lane Marking - General', 'Mountain', 'Sand', 'Sky', 'Snow', + 'Terrain', 'Vegetation', 'Water', 'Banner', 'Bench', + 'Bike Rack', 'Billboard', 'Catch Basin', 'CCTV Camera', + 'Fire Hydrant', 'Junction Box', 'Mailbox', 'Manhole', + 'Phone Booth', 'Pothole', 'Street Light', 'Pole', + 'Traffic Sign Frame', 'Utility Pole', 'Traffic Light', + 'Traffic Sign (Back)', 'Traffic Sign (Front)', 'Trash Can', + 'Bicycle', 'Boat', 'Bus', 'Car', 'Caravan', 'Motorcycle', + 'On Rails', 'Other Vehicle', 'Trailer', 'Truck', + 'Wheeled Slow', 'Car Mount', 'Ego Vehicle', 'Unlabeled'), + palette=[[165, 42, 42], [0, 192, 0], [196, 196, 196], [190, 153, 153], + [180, 165, 180], [90, 120, 150], [102, 102, 156], + [128, 64, 255], [140, 140, 200], [170, 170, 170], + [250, 170, 160], [96, 96, 96], + [230, 150, 140], [128, 64, 128], [110, 110, 110], + [244, 35, 232], [150, 100, 100], [70, 70, 70], [150, 120, 90], + [220, 20, 60], [255, 0, 0], [255, 0, 100], [255, 0, 200], + [200, 128, 128], [255, 255, 255], [64, 170, + 64], [230, 160, 50], + [70, 130, 180], [190, 255, 255], [152, 251, 152], + [107, 142, 35], [0, 170, 30], [255, 255, 128], [250, 0, 30], + [100, 140, 180], [220, 220, 220], [220, 128, 128], + [222, 40, 40], [100, 170, 30], [40, 40, 40], [33, 33, 33], + [100, 128, 160], [142, 0, 0], [70, 100, 150], [210, 170, 100], + [153, 153, 153], [128, 128, 128], [0, 0, 80], [250, 170, 30], + [192, 192, 192], [220, 220, 0], [140, 140, 20], [119, 11, 32], + [150, 0, 255], [0, 60, 100], [0, 0, 142], [0, 0, 90], + [0, 0, 230], [0, 80, 100], [128, 64, 64], [0, 0, 110], + [0, 0, 70], [0, 0, 192], [32, 32, 32], [120, 10, + 10], [0, 0, 0]]) + + def __init__(self, + img_suffix='.jpg', + seg_map_suffix='.png', + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs) + + +@DATASETS.register_module() +class MapillaryDataset_v2(BaseSegDataset): + """Mapillary Vistas Dataset. + + Dataset paper link: + http://ieeexplore.ieee.org/document/8237796/ + + v1.2 contain 66 object classes. + (37 instance-specific) + + v2.0 contain 124 object classes. + (70 instance-specific, 46 stuff, 8 void or crowd). + + The ``img_suffix`` is fixed to '.jpg' and ``seg_map_suffix`` is + fixed to '.png' for Mapillary Vistas Dataset. + """ + METAINFO = dict( + classes=( + 'Bird', 'Ground Animal', 'Ambiguous Barrier', 'Concrete Block', + 'Curb', 'Fence', 'Guard Rail', 'Barrier', 'Road Median', + 'Road Side', 'Lane Separator', 'Temporary Barrier', 'Wall', + 'Bike Lane', 'Crosswalk - Plain', 'Curb Cut', 'Driveway', + 'Parking', 'Parking Aisle', 'Pedestrian Area', 'Rail Track', + 'Road', 'Road Shoulder', 'Service Lane', 'Sidewalk', + 'Traffic Island', 'Bridge', 'Building', 'Garage', 'Tunnel', + 'Person', 'Person Group', 'Bicyclist', 'Motorcyclist', + 'Other Rider', 'Lane Marking - Dashed Line', + 'Lane Marking - Straight Line', 'Lane Marking - Zigzag Line', + 'Lane Marking - Ambiguous', 'Lane Marking - Arrow (Left)', + 'Lane Marking - Arrow (Other)', 'Lane Marking - Arrow (Right)', + 'Lane Marking - Arrow (Split Left or Straight)', + 'Lane Marking - Arrow (Split Right or Straight)', + 'Lane Marking - Arrow (Straight)', 'Lane Marking - Crosswalk', + 'Lane Marking - Give Way (Row)', + 'Lane Marking - Give Way (Single)', + 'Lane Marking - Hatched (Chevron)', + 'Lane Marking - Hatched (Diagonal)', 'Lane Marking - Other', + 'Lane Marking - Stop Line', 'Lane Marking - Symbol (Bicycle)', + 'Lane Marking - Symbol (Other)', 'Lane Marking - Text', + 'Lane Marking (only) - Dashed Line', + 'Lane Marking (only) - Crosswalk', 'Lane Marking (only) - Other', + 'Lane Marking (only) - Test', 'Mountain', 'Sand', 'Sky', 'Snow', + 'Terrain', 'Vegetation', 'Water', 'Banner', 'Bench', 'Bike Rack', + 'Catch Basin', 'CCTV Camera', 'Fire Hydrant', 'Junction Box', + 'Mailbox', 'Manhole', 'Parking Meter', 'Phone Booth', 'Pothole', + 'Signage - Advertisement', 'Signage - Ambiguous', 'Signage - Back', + 'Signage - Information', 'Signage - Other', 'Signage - Store', + 'Street Light', 'Pole', 'Pole Group', 'Traffic Sign Frame', + 'Utility Pole', 'Traffic Cone', 'Traffic Light - General (Single)', + 'Traffic Light - Pedestrians', 'Traffic Light - General (Upright)', + 'Traffic Light - General (Horizontal)', 'Traffic Light - Cyclists', + 'Traffic Light - Other', 'Traffic Sign - Ambiguous', + 'Traffic Sign (Back)', 'Traffic Sign - Direction (Back)', + 'Traffic Sign - Direction (Front)', 'Traffic Sign (Front)', + 'Traffic Sign - Parking', 'Traffic Sign - Temporary (Back)', + 'Traffic Sign - Temporary (Front)', 'Trash Can', 'Bicycle', 'Boat', + 'Bus', 'Car', 'Caravan', 'Motorcycle', 'On Rails', 'Other Vehicle', + 'Trailer', 'Truck', 'Vehicle Group', 'Wheeled Slow', 'Water Valve', + 'Car Mount', 'Dynamic', 'Ego Vehicle', 'Ground', 'Static', + 'Unlabeled'), + palette=[[165, 42, 42], [0, 192, 0], [250, 170, 31], [250, 170, 32], + [196, 196, 196], [190, 153, 153], [180, 165, 180], + [90, 120, 150], [250, 170, 33], [250, 170, 34], + [128, 128, 128], [250, 170, 35], [102, 102, 156], + [128, 64, 255], [140, 140, 200], [170, 170, 170], + [250, 170, 36], [250, 170, 160], [250, 170, 37], [96, 96, 96], + [230, 150, 140], [128, 64, 128], [110, 110, 110], + [110, 110, 110], [244, 35, 232], [128, 196, + 128], [150, 100, 100], + [70, 70, 70], [150, 150, 150], [150, 120, 90], [220, 20, 60], + [220, 20, 60], [255, 0, 0], [255, 0, 100], [255, 0, 200], + [255, 255, 255], [255, 255, 255], [250, 170, 29], + [250, 170, 28], [250, 170, 26], [250, 170, + 25], [250, 170, 24], + [250, 170, 22], [250, 170, 21], [250, 170, + 20], [255, 255, 255], + [250, 170, 19], [250, 170, 18], [250, 170, + 12], [250, 170, 11], + [255, 255, 255], [255, 255, 255], [250, 170, 16], + [250, 170, 15], [250, 170, 15], [255, 255, 255], + [255, 255, 255], [255, 255, 255], [255, 255, 255], + [64, 170, 64], [230, 160, 50], + [70, 130, 180], [190, 255, 255], [152, 251, 152], + [107, 142, 35], [0, 170, 30], [255, 255, 128], [250, 0, 30], + [100, 140, 180], [220, 128, 128], [222, 40, + 40], [100, 170, 30], + [40, 40, 40], [33, 33, 33], [100, 128, 160], [20, 20, 255], + [142, 0, 0], [70, 100, 150], [250, 171, 30], [250, 172, 30], + [250, 173, 30], [250, 174, 30], [250, 175, + 30], [250, 176, 30], + [210, 170, 100], [153, 153, 153], [153, 153, 153], + [128, 128, 128], [0, 0, 80], [210, 60, 60], [250, 170, 30], + [250, 170, 30], [250, 170, 30], [250, 170, + 30], [250, 170, 30], + [250, 170, 30], [192, 192, 192], [192, 192, 192], + [192, 192, 192], [220, 220, 0], [220, 220, 0], [0, 0, 196], + [192, 192, 192], [220, 220, 0], [140, 140, 20], [119, 11, 32], + [150, 0, 255], [0, 60, 100], [0, 0, 142], [0, 0, 90], + [0, 0, 230], [0, 80, 100], [128, 64, 64], [0, 0, 110], + [0, 0, 70], [0, 0, 142], [0, 0, 192], [170, 170, 170], + [32, 32, 32], [111, 74, 0], [120, 10, 10], [81, 0, 81], + [111, 111, 0], [0, 0, 0]]) + + def __init__(self, + img_suffix='.jpg', + seg_map_suffix='.png', + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/night_driving.py b/third-party/InterFormer/mmseg/datasets/night_driving.py new file mode 100644 index 0000000000000000000000000000000000000000..3ead91ec77cbd8e3f0a870dee3462549183e9c9b --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/night_driving.py @@ -0,0 +1,15 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .cityscapes import CityscapesDataset + + +@DATASETS.register_module() +class NightDrivingDataset(CityscapesDataset): + """NightDrivingDataset dataset.""" + + def __init__(self, + img_suffix='_leftImg8bit.png', + seg_map_suffix='_gtCoarse_labelTrainIds.png', + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/nyu.py b/third-party/InterFormer/mmseg/datasets/nyu.py new file mode 100644 index 0000000000000000000000000000000000000000..fcfda46647d25b5d16425af97a06ffb8c1f81bca --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/nyu.py @@ -0,0 +1,123 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import os.path as osp +from typing import List + +import mmengine.fileio as fileio + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class NYUDataset(BaseSegDataset): + """NYU depth estimation dataset. The file structure should be. + + .. code-block:: none + + ├── data + │ ├── nyu + │ │ ├── images + │ │ │ ├── train + │ │ │ │ ├── scene_xxx.jpg + │ │ │ │ ├── ... + │ │ │ ├── test + │ │ ├── annotations + │ │ │ ├── train + │ │ │ │ ├── scene_xxx.png + │ │ │ │ ├── ... + │ │ │ ├── test + + Args: + ann_file (str): Annotation file path. Defaults to ''. + metainfo (dict, optional): Meta information for dataset, such as + specify classes to load. Defaults to None. + data_root (str, optional): The root directory for ``data_prefix`` and + ``ann_file``. Defaults to None. + data_prefix (dict, optional): Prefix for training data. Defaults to + dict(img_path='images', depth_map_path='annotations'). + img_suffix (str): Suffix of images. Default: '.jpg' + seg_map_suffix (str): Suffix of segmentation maps. Default: '.png' + filter_cfg (dict, optional): Config for filter data. Defaults to None. + indices (int or Sequence[int], optional): Support using first few + data in annotation file to facilitate training/testing on a smaller + dataset. Defaults to None which means using all ``data_infos``. + serialize_data (bool, optional): Whether to hold memory using + serialized objects, when enabled, data loader workers can use + shared RAM from master process instead of making a copy. Defaults + to True. + pipeline (list, optional): Processing pipeline. Defaults to []. + test_mode (bool, optional): ``test_mode=True`` means in test phase. + Defaults to False. + lazy_init (bool, optional): Whether to load annotation during + instantiation. In some cases, such as visualization, only the meta + information of the dataset is needed, which is not necessary to + load annotation file. ``Basedataset`` can skip load annotations to + save time by set ``lazy_init=True``. Defaults to False. + max_refetch (int, optional): If ``Basedataset.prepare_data`` get a + None img. The maximum extra number of cycles to get a valid + image. Defaults to 1000. + ignore_index (int): The label index to be ignored. Default: 255 + reduce_zero_label (bool): Whether to mark label zero as ignored. + Default to False. + backend_args (dict, Optional): Arguments to instantiate a file backend. + See https://mmengine.readthedocs.io/en/latest/api/fileio.htm + for details. Defaults to None. + Notes: mmcv>=2.0.0rc4, mmengine>=0.2.0 required. + """ + METAINFO = dict( + classes=('printer_room', 'bathroom', 'living_room', 'study', + 'conference_room', 'study_room', 'kitchen', 'home_office', + 'bedroom', 'dinette', 'playroom', 'indoor_balcony', + 'laundry_room', 'basement', 'excercise_room', 'foyer', + 'home_storage', 'cafe', 'furniture_store', 'office_kitchen', + 'student_lounge', 'dining_room', 'reception_room', + 'computer_lab', 'classroom', 'office', 'bookstore')) + + def __init__(self, + data_prefix=dict( + img_path='images', depth_map_path='annotations'), + img_suffix='.jpg', + depth_map_suffix='.png', + **kwargs) -> None: + super().__init__( + data_prefix=data_prefix, + img_suffix=img_suffix, + seg_map_suffix=depth_map_suffix, + **kwargs) + + def _get_category_id_from_filename(self, image_fname: str) -> int: + """Retrieve the category ID from the given image filename.""" + image_fname = osp.basename(image_fname) + position = image_fname.find(next(filter(str.isdigit, image_fname)), 0) + categoty_name = image_fname[:position - 1] + if categoty_name not in self._metainfo['classes']: + return -1 + else: + return self._metainfo['classes'].index(categoty_name) + + def load_data_list(self) -> List[dict]: + """Load annotation from directory or annotation file. + + Returns: + list[dict]: All data info of dataset. + """ + data_list = [] + img_dir = self.data_prefix.get('img_path', None) + ann_dir = self.data_prefix.get('depth_map_path', None) + + _suffix_len = len(self.img_suffix) + for img in fileio.list_dir_or_file( + dir_path=img_dir, + list_dir=False, + suffix=self.img_suffix, + recursive=True, + backend_args=self.backend_args): + data_info = dict(img_path=osp.join(img_dir, img)) + if ann_dir is not None: + depth_map = img[:-_suffix_len] + self.seg_map_suffix + data_info['depth_map_path'] = osp.join(ann_dir, depth_map) + data_info['seg_fields'] = [] + data_info['category_id'] = self._get_category_id_from_filename(img) + data_list.append(data_info) + data_list = sorted(data_list, key=lambda x: x['img_path']) + return data_list diff --git a/third-party/InterFormer/mmseg/datasets/pascal_context.py b/third-party/InterFormer/mmseg/datasets/pascal_context.py new file mode 100644 index 0000000000000000000000000000000000000000..82d00a9b3086a0db81457ab9b2f79c79de4ffaa8 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/pascal_context.py @@ -0,0 +1,116 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import mmengine.fileio as fileio + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class PascalContextDataset(BaseSegDataset): + """PascalContext dataset. + + In segmentation map annotation for PascalContext, 0 stands for background, + which is included in 60 categories. ``reduce_zero_label`` is fixed to + False. The ``img_suffix`` is fixed to '.jpg' and ``seg_map_suffix`` is + fixed to '.png'. + + Args: + ann_file (str): Annotation file path. + """ + + METAINFO = dict( + classes=('background', 'aeroplane', 'bag', 'bed', 'bedclothes', + 'bench', 'bicycle', 'bird', 'boat', 'book', 'bottle', + 'building', 'bus', 'cabinet', 'car', 'cat', 'ceiling', + 'chair', 'cloth', 'computer', 'cow', 'cup', 'curtain', 'dog', + 'door', 'fence', 'floor', 'flower', 'food', 'grass', 'ground', + 'horse', 'keyboard', 'light', 'motorbike', 'mountain', + 'mouse', 'person', 'plate', 'platform', 'pottedplant', 'road', + 'rock', 'sheep', 'shelves', 'sidewalk', 'sign', 'sky', 'snow', + 'sofa', 'table', 'track', 'train', 'tree', 'truck', + 'tvmonitor', 'wall', 'water', 'window', 'wood'), + palette=[[120, 120, 120], [180, 120, 120], [6, 230, 230], [80, 50, 50], + [4, 200, 3], [120, 120, 80], [140, 140, 140], [204, 5, 255], + [230, 230, 230], [4, 250, 7], [224, 5, 255], [235, 255, 7], + [150, 5, 61], [120, 120, 70], [8, 255, 51], [255, 6, 82], + [143, 255, 140], [204, 255, 4], [255, 51, 7], [204, 70, 3], + [0, 102, 200], [61, 230, 250], [255, 6, 51], [11, 102, 255], + [255, 7, 71], [255, 9, 224], [9, 7, 230], [220, 220, 220], + [255, 9, 92], [112, 9, 255], [8, 255, 214], [7, 255, 224], + [255, 184, 6], [10, 255, 71], [255, 41, 10], [7, 255, 255], + [224, 255, 8], [102, 8, 255], [255, 61, 6], [255, 194, 7], + [255, 122, 8], [0, 255, 20], [255, 8, 41], [255, 5, 153], + [6, 51, 255], [235, 12, 255], [160, 150, 20], [0, 163, 255], + [140, 140, 140], [250, 10, 15], [20, 255, 0], [31, 255, 0], + [255, 31, 0], [255, 224, 0], [153, 255, 0], [0, 0, 255], + [255, 71, 0], [0, 235, 255], [0, 173, 255], [31, 0, 255]]) + + def __init__(self, + ann_file='', + img_suffix='.jpg', + seg_map_suffix='.png', + reduce_zero_label=False, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + ann_file=ann_file, + reduce_zero_label=reduce_zero_label, + **kwargs) + assert fileio.exists(self.data_prefix['img_path'], self.backend_args) + + +@DATASETS.register_module() +class PascalContextDataset59(BaseSegDataset): + """PascalContext dataset. + + In segmentation map annotation for PascalContext, 0 stands for background, + which is included in 60 categories. ``reduce_zero_label`` is fixed to + True. The ``img_suffix`` is fixed to '.jpg' and ``seg_map_suffix`` is + fixed to '.png'. + Noted: If the background is 255 and the ids of categories are from 0 to 58, + ``reduce_zero_label`` needs to be set to False. + + Args: + ann_file (str): Annotation file path. + """ + METAINFO = dict( + classes=('aeroplane', 'bag', 'bed', 'bedclothes', 'bench', 'bicycle', + 'bird', 'boat', 'book', 'bottle', 'building', 'bus', + 'cabinet', 'car', 'cat', 'ceiling', 'chair', 'cloth', + 'computer', 'cow', 'cup', 'curtain', 'dog', 'door', 'fence', + 'floor', 'flower', 'food', 'grass', 'ground', 'horse', + 'keyboard', 'light', 'motorbike', 'mountain', 'mouse', + 'person', 'plate', 'platform', 'pottedplant', 'road', 'rock', + 'sheep', 'shelves', 'sidewalk', 'sign', 'sky', 'snow', 'sofa', + 'table', 'track', 'train', 'tree', 'truck', 'tvmonitor', + 'wall', 'water', 'window', 'wood'), + palette=[[180, 120, 120], [6, 230, 230], [80, 50, 50], [4, 200, 3], + [120, 120, 80], [140, 140, 140], [204, 5, 255], + [230, 230, 230], [4, 250, 7], [224, 5, 255], [235, 255, 7], + [150, 5, 61], [120, 120, 70], [8, 255, 51], [255, 6, 82], + [143, 255, 140], [204, 255, 4], [255, 51, 7], [204, 70, 3], + [0, 102, 200], [61, 230, 250], [255, 6, 51], [11, 102, 255], + [255, 7, 71], [255, 9, 224], [9, 7, 230], [220, 220, 220], + [255, 9, 92], [112, 9, 255], [8, 255, 214], [7, 255, 224], + [255, 184, 6], [10, 255, 71], [255, 41, 10], [7, 255, 255], + [224, 255, 8], [102, 8, 255], [255, 61, 6], [255, 194, 7], + [255, 122, 8], [0, 255, 20], [255, 8, 41], [255, 5, 153], + [6, 51, 255], [235, 12, 255], [160, 150, 20], [0, 163, 255], + [140, 140, 140], [250, 10, 15], [20, 255, 0], [31, 255, 0], + [255, 31, 0], [255, 224, 0], [153, 255, 0], [0, 0, 255], + [255, 71, 0], [0, 235, 255], [0, 173, 255], [31, 0, 255]]) + + def __init__(self, + ann_file='', + img_suffix='.jpg', + seg_map_suffix='.png', + reduce_zero_label=True, + **kwargs): + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + ann_file=ann_file, + reduce_zero_label=reduce_zero_label, + **kwargs) + assert fileio.exists(self.data_prefix['img_path'], self.backend_args) diff --git a/third-party/InterFormer/mmseg/datasets/potsdam.py b/third-party/InterFormer/mmseg/datasets/potsdam.py new file mode 100644 index 0000000000000000000000000000000000000000..6892de3dd29fda569527342377c6e83ce0d972bf --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/potsdam.py @@ -0,0 +1,29 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class PotsdamDataset(BaseSegDataset): + """ISPRS Potsdam dataset. + + In segmentation map annotation for Potsdam dataset, 0 is the ignore index. + ``reduce_zero_label`` should be set to True. The ``img_suffix`` and + ``seg_map_suffix`` are both fixed to '.png'. + """ + METAINFO = dict( + classes=('impervious_surface', 'building', 'low_vegetation', 'tree', + 'car', 'clutter'), + palette=[[255, 255, 255], [0, 0, 255], [0, 255, 255], [0, 255, 0], + [255, 255, 0], [255, 0, 0]]) + + def __init__(self, + img_suffix='.png', + seg_map_suffix='.png', + reduce_zero_label=True, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) diff --git a/third-party/InterFormer/mmseg/datasets/refuge.py b/third-party/InterFormer/mmseg/datasets/refuge.py new file mode 100644 index 0000000000000000000000000000000000000000..4016a825a37cdd0162f9c3e72df2fcabc6984991 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/refuge.py @@ -0,0 +1,28 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import mmengine.fileio as fileio + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class REFUGEDataset(BaseSegDataset): + """REFUGE dataset. + + In segmentation map annotation for REFUGE, 0 stands for background, which + is not included in 2 categories. ``reduce_zero_label`` is fixed to True. + The ``img_suffix`` is fixed to '.png' and ``seg_map_suffix`` is fixed to + '.png'. + """ + METAINFO = dict( + classes=('background', ' Optic Cup', 'Optic Disc'), + palette=[[120, 120, 120], [6, 230, 230], [56, 59, 120]]) + + def __init__(self, **kwargs) -> None: + super().__init__( + img_suffix='.png', + seg_map_suffix='.png', + reduce_zero_label=False, + **kwargs) + assert fileio.exists( + self.data_prefix['img_path'], backend_args=self.backend_args) diff --git a/third-party/InterFormer/mmseg/datasets/stare.py b/third-party/InterFormer/mmseg/datasets/stare.py new file mode 100644 index 0000000000000000000000000000000000000000..1b997bb785f20a9225c8b7e3f9b0522bc5e5ed99 --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/stare.py @@ -0,0 +1,32 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import mmengine.fileio as fileio + +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class STAREDataset(BaseSegDataset): + """STARE dataset. + + In segmentation map annotation for STARE, 0 stands for background, which is + included in 2 categories. ``reduce_zero_label`` is fixed to False. The + ``img_suffix`` is fixed to '.png' and ``seg_map_suffix`` is fixed to + '.ah.png'. + """ + METAINFO = dict( + classes=('background', 'vessel'), + palette=[[120, 120, 120], [6, 230, 230]]) + + def __init__(self, + img_suffix='.png', + seg_map_suffix='.ah.png', + reduce_zero_label=False, + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, + seg_map_suffix=seg_map_suffix, + reduce_zero_label=reduce_zero_label, + **kwargs) + assert fileio.exists( + self.data_prefix['img_path'], backend_args=self.backend_args) diff --git a/third-party/InterFormer/mmseg/datasets/synapse.py b/third-party/InterFormer/mmseg/datasets/synapse.py new file mode 100644 index 0000000000000000000000000000000000000000..6f83b6415046667fb24086083c43083040f4487c --- /dev/null +++ b/third-party/InterFormer/mmseg/datasets/synapse.py @@ -0,0 +1,28 @@ +# Copyright (c) OpenMMLab. All rights reserved. +from mmseg.registry import DATASETS +from .basesegdataset import BaseSegDataset + + +@DATASETS.register_module() +class SynapseDataset(BaseSegDataset): + """Synapse dataset. + + Before dataset preprocess of Synapse, there are total 13 categories of + foreground which does not include background. After preprocessing, 8 + foreground categories are kept while the other 5 foreground categories are + handled as background. The ``img_suffix`` is fixed to '.jpg' and + ``seg_map_suffix`` is fixed to '.png'. + """ + METAINFO = dict( + classes=('background', 'aorta', 'gallbladder', 'left_kidney', + 'right_kidney', 'liver', 'pancreas', 'spleen', 'stomach'), + palette=[[0, 0, 0], [0, 0, 255], [0, 255, 0], [255, 0, 0], + [0, 255, 255], [255, 0, 255], [255, 255, 0], [60, 255, 255], + [240, 240, 240]]) + + def __init__(self, + img_suffix='.jpg', + seg_map_suffix='.png', + **kwargs) -> None: + super().__init__( + img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs)