迁移分支
This commit is contained in:
927
src/pClientViewer/Behavior.pb.h
Normal file
927
src/pClientViewer/Behavior.pb.h
Normal file
@@ -0,0 +1,927 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: Behavior.proto
|
||||
|
||||
#ifndef GOOGLE_PROTOBUF_INCLUDED_Behavior_2eproto
|
||||
#define GOOGLE_PROTOBUF_INCLUDED_Behavior_2eproto
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3021000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <google/protobuf/arenastring.h>
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/metadata_lite.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
|
||||
#include <google/protobuf/extension_set.h> // IWYU pragma: export
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#define PROTOBUF_INTERNAL_EXPORT_Behavior_2eproto
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
namespace internal {
|
||||
class AnyMetadata;
|
||||
} // namespace internal
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct_Behavior_2eproto {
|
||||
static const uint32_t offsets[];
|
||||
};
|
||||
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Behavior_2eproto;
|
||||
namespace Behavior {
|
||||
class Coordinate;
|
||||
struct CoordinateDefaultTypeInternal;
|
||||
extern CoordinateDefaultTypeInternal _Coordinate_default_instance_;
|
||||
class WayPointBehavior;
|
||||
struct WayPointBehaviorDefaultTypeInternal;
|
||||
extern WayPointBehaviorDefaultTypeInternal _WayPointBehavior_default_instance_;
|
||||
} // namespace Behavior
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> ::Behavior::Coordinate* Arena::CreateMaybeMessage<::Behavior::Coordinate>(Arena*);
|
||||
template<> ::Behavior::WayPointBehavior* Arena::CreateMaybeMessage<::Behavior::WayPointBehavior>(Arena*);
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
namespace Behavior {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Coordinate final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Behavior.Coordinate) */ {
|
||||
public:
|
||||
inline Coordinate() : Coordinate(nullptr) {}
|
||||
~Coordinate() override;
|
||||
explicit PROTOBUF_CONSTEXPR Coordinate(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
Coordinate(const Coordinate& from);
|
||||
Coordinate(Coordinate&& from) noexcept
|
||||
: Coordinate() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline Coordinate& operator=(const Coordinate& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline Coordinate& operator=(Coordinate&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const Coordinate& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const Coordinate* internal_default_instance() {
|
||||
return reinterpret_cast<const Coordinate*>(
|
||||
&_Coordinate_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
0;
|
||||
|
||||
friend void swap(Coordinate& a, Coordinate& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(Coordinate* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(Coordinate* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
Coordinate* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<Coordinate>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Coordinate& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const Coordinate& from) {
|
||||
Coordinate::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(Coordinate* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "Behavior.Coordinate";
|
||||
}
|
||||
protected:
|
||||
explicit Coordinate(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kNameFieldNumber = 1,
|
||||
kLonFieldNumber = 2,
|
||||
kLatFieldNumber = 3,
|
||||
kDepthFieldNumber = 4,
|
||||
kSpeedFieldNumber = 5,
|
||||
};
|
||||
// string name = 1;
|
||||
void clear_name();
|
||||
const std::string& name() const;
|
||||
template <typename ArgT0 = const std::string&, typename... ArgT>
|
||||
void set_name(ArgT0&& arg0, ArgT... args);
|
||||
std::string* mutable_name();
|
||||
PROTOBUF_NODISCARD std::string* release_name();
|
||||
void set_allocated_name(std::string* name);
|
||||
private:
|
||||
const std::string& _internal_name() const;
|
||||
inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
|
||||
std::string* _internal_mutable_name();
|
||||
public:
|
||||
|
||||
// float lon = 2;
|
||||
void clear_lon();
|
||||
float lon() const;
|
||||
void set_lon(float value);
|
||||
private:
|
||||
float _internal_lon() const;
|
||||
void _internal_set_lon(float value);
|
||||
public:
|
||||
|
||||
// float lat = 3;
|
||||
void clear_lat();
|
||||
float lat() const;
|
||||
void set_lat(float value);
|
||||
private:
|
||||
float _internal_lat() const;
|
||||
void _internal_set_lat(float value);
|
||||
public:
|
||||
|
||||
// float depth = 4;
|
||||
void clear_depth();
|
||||
float depth() const;
|
||||
void set_depth(float value);
|
||||
private:
|
||||
float _internal_depth() const;
|
||||
void _internal_set_depth(float value);
|
||||
public:
|
||||
|
||||
// float speed = 5;
|
||||
void clear_speed();
|
||||
float speed() const;
|
||||
void set_speed(float value);
|
||||
private:
|
||||
float _internal_speed() const;
|
||||
void _internal_set_speed(float value);
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:Behavior.Coordinate)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
struct Impl_ {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
|
||||
float lon_;
|
||||
float lat_;
|
||||
float depth_;
|
||||
float speed_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_Behavior_2eproto;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class WayPointBehavior final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Behavior.WayPointBehavior) */ {
|
||||
public:
|
||||
inline WayPointBehavior() : WayPointBehavior(nullptr) {}
|
||||
~WayPointBehavior() override;
|
||||
explicit PROTOBUF_CONSTEXPR WayPointBehavior(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
WayPointBehavior(const WayPointBehavior& from);
|
||||
WayPointBehavior(WayPointBehavior&& from) noexcept
|
||||
: WayPointBehavior() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline WayPointBehavior& operator=(const WayPointBehavior& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline WayPointBehavior& operator=(WayPointBehavior&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const WayPointBehavior& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const WayPointBehavior* internal_default_instance() {
|
||||
return reinterpret_cast<const WayPointBehavior*>(
|
||||
&_WayPointBehavior_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
1;
|
||||
|
||||
friend void swap(WayPointBehavior& a, WayPointBehavior& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(WayPointBehavior* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(WayPointBehavior* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
WayPointBehavior* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<WayPointBehavior>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const WayPointBehavior& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const WayPointBehavior& from) {
|
||||
WayPointBehavior::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(WayPointBehavior* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "Behavior.WayPointBehavior";
|
||||
}
|
||||
protected:
|
||||
explicit WayPointBehavior(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kPointsFieldNumber = 3,
|
||||
kNameFieldNumber = 1,
|
||||
kPriorityFieldNumber = 2,
|
||||
kDurationFieldNumber = 4,
|
||||
kConstSpeedFieldNumber = 6,
|
||||
kClosedLoopFieldNumber = 5,
|
||||
kPerpetualFieldNumber = 8,
|
||||
kRepeateFieldNumber = 7,
|
||||
kMinDepthFieldNumber = 9,
|
||||
kMaxDepthFieldNumber = 10,
|
||||
};
|
||||
// repeated .Behavior.Coordinate points = 3;
|
||||
int points_size() const;
|
||||
private:
|
||||
int _internal_points_size() const;
|
||||
public:
|
||||
void clear_points();
|
||||
::Behavior::Coordinate* mutable_points(int index);
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Behavior::Coordinate >*
|
||||
mutable_points();
|
||||
private:
|
||||
const ::Behavior::Coordinate& _internal_points(int index) const;
|
||||
::Behavior::Coordinate* _internal_add_points();
|
||||
public:
|
||||
const ::Behavior::Coordinate& points(int index) const;
|
||||
::Behavior::Coordinate* add_points();
|
||||
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Behavior::Coordinate >&
|
||||
points() const;
|
||||
|
||||
// string name = 1;
|
||||
void clear_name();
|
||||
const std::string& name() const;
|
||||
template <typename ArgT0 = const std::string&, typename... ArgT>
|
||||
void set_name(ArgT0&& arg0, ArgT... args);
|
||||
std::string* mutable_name();
|
||||
PROTOBUF_NODISCARD std::string* release_name();
|
||||
void set_allocated_name(std::string* name);
|
||||
private:
|
||||
const std::string& _internal_name() const;
|
||||
inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
|
||||
std::string* _internal_mutable_name();
|
||||
public:
|
||||
|
||||
// int32 priority = 2;
|
||||
void clear_priority();
|
||||
int32_t priority() const;
|
||||
void set_priority(int32_t value);
|
||||
private:
|
||||
int32_t _internal_priority() const;
|
||||
void _internal_set_priority(int32_t value);
|
||||
public:
|
||||
|
||||
// float duration = 4;
|
||||
void clear_duration();
|
||||
float duration() const;
|
||||
void set_duration(float value);
|
||||
private:
|
||||
float _internal_duration() const;
|
||||
void _internal_set_duration(float value);
|
||||
public:
|
||||
|
||||
// float constSpeed = 6;
|
||||
void clear_constspeed();
|
||||
float constspeed() const;
|
||||
void set_constspeed(float value);
|
||||
private:
|
||||
float _internal_constspeed() const;
|
||||
void _internal_set_constspeed(float value);
|
||||
public:
|
||||
|
||||
// bool closedLoop = 5;
|
||||
void clear_closedloop();
|
||||
bool closedloop() const;
|
||||
void set_closedloop(bool value);
|
||||
private:
|
||||
bool _internal_closedloop() const;
|
||||
void _internal_set_closedloop(bool value);
|
||||
public:
|
||||
|
||||
// bool perpetual = 8;
|
||||
void clear_perpetual();
|
||||
bool perpetual() const;
|
||||
void set_perpetual(bool value);
|
||||
private:
|
||||
bool _internal_perpetual() const;
|
||||
void _internal_set_perpetual(bool value);
|
||||
public:
|
||||
|
||||
// int32 repeate = 7;
|
||||
void clear_repeate();
|
||||
int32_t repeate() const;
|
||||
void set_repeate(int32_t value);
|
||||
private:
|
||||
int32_t _internal_repeate() const;
|
||||
void _internal_set_repeate(int32_t value);
|
||||
public:
|
||||
|
||||
// float minDepth = 9;
|
||||
void clear_mindepth();
|
||||
float mindepth() const;
|
||||
void set_mindepth(float value);
|
||||
private:
|
||||
float _internal_mindepth() const;
|
||||
void _internal_set_mindepth(float value);
|
||||
public:
|
||||
|
||||
// float maxDepth = 10;
|
||||
void clear_maxdepth();
|
||||
float maxdepth() const;
|
||||
void set_maxdepth(float value);
|
||||
private:
|
||||
float _internal_maxdepth() const;
|
||||
void _internal_set_maxdepth(float value);
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:Behavior.WayPointBehavior)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
struct Impl_ {
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Behavior::Coordinate > points_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
|
||||
int32_t priority_;
|
||||
float duration_;
|
||||
float constspeed_;
|
||||
bool closedloop_;
|
||||
bool perpetual_;
|
||||
int32_t repeate_;
|
||||
float mindepth_;
|
||||
float maxdepth_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_Behavior_2eproto;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// Coordinate
|
||||
|
||||
// string name = 1;
|
||||
inline void Coordinate::clear_name() {
|
||||
_impl_.name_.ClearToEmpty();
|
||||
}
|
||||
inline const std::string& Coordinate::name() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.Coordinate.name)
|
||||
return _internal_name();
|
||||
}
|
||||
template <typename ArgT0, typename... ArgT>
|
||||
inline PROTOBUF_ALWAYS_INLINE
|
||||
void Coordinate::set_name(ArgT0&& arg0, ArgT... args) {
|
||||
|
||||
_impl_.name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
|
||||
// @@protoc_insertion_point(field_set:Behavior.Coordinate.name)
|
||||
}
|
||||
inline std::string* Coordinate::mutable_name() {
|
||||
std::string* _s = _internal_mutable_name();
|
||||
// @@protoc_insertion_point(field_mutable:Behavior.Coordinate.name)
|
||||
return _s;
|
||||
}
|
||||
inline const std::string& Coordinate::_internal_name() const {
|
||||
return _impl_.name_.Get();
|
||||
}
|
||||
inline void Coordinate::_internal_set_name(const std::string& value) {
|
||||
|
||||
_impl_.name_.Set(value, GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* Coordinate::_internal_mutable_name() {
|
||||
|
||||
return _impl_.name_.Mutable(GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* Coordinate::release_name() {
|
||||
// @@protoc_insertion_point(field_release:Behavior.Coordinate.name)
|
||||
return _impl_.name_.Release();
|
||||
}
|
||||
inline void Coordinate::set_allocated_name(std::string* name) {
|
||||
if (name != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
_impl_.name_.SetAllocated(name, GetArenaForAllocation());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (_impl_.name_.IsDefault()) {
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
}
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
// @@protoc_insertion_point(field_set_allocated:Behavior.Coordinate.name)
|
||||
}
|
||||
|
||||
// float lon = 2;
|
||||
inline void Coordinate::clear_lon() {
|
||||
_impl_.lon_ = 0;
|
||||
}
|
||||
inline float Coordinate::_internal_lon() const {
|
||||
return _impl_.lon_;
|
||||
}
|
||||
inline float Coordinate::lon() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.Coordinate.lon)
|
||||
return _internal_lon();
|
||||
}
|
||||
inline void Coordinate::_internal_set_lon(float value) {
|
||||
|
||||
_impl_.lon_ = value;
|
||||
}
|
||||
inline void Coordinate::set_lon(float value) {
|
||||
_internal_set_lon(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.Coordinate.lon)
|
||||
}
|
||||
|
||||
// float lat = 3;
|
||||
inline void Coordinate::clear_lat() {
|
||||
_impl_.lat_ = 0;
|
||||
}
|
||||
inline float Coordinate::_internal_lat() const {
|
||||
return _impl_.lat_;
|
||||
}
|
||||
inline float Coordinate::lat() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.Coordinate.lat)
|
||||
return _internal_lat();
|
||||
}
|
||||
inline void Coordinate::_internal_set_lat(float value) {
|
||||
|
||||
_impl_.lat_ = value;
|
||||
}
|
||||
inline void Coordinate::set_lat(float value) {
|
||||
_internal_set_lat(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.Coordinate.lat)
|
||||
}
|
||||
|
||||
// float depth = 4;
|
||||
inline void Coordinate::clear_depth() {
|
||||
_impl_.depth_ = 0;
|
||||
}
|
||||
inline float Coordinate::_internal_depth() const {
|
||||
return _impl_.depth_;
|
||||
}
|
||||
inline float Coordinate::depth() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.Coordinate.depth)
|
||||
return _internal_depth();
|
||||
}
|
||||
inline void Coordinate::_internal_set_depth(float value) {
|
||||
|
||||
_impl_.depth_ = value;
|
||||
}
|
||||
inline void Coordinate::set_depth(float value) {
|
||||
_internal_set_depth(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.Coordinate.depth)
|
||||
}
|
||||
|
||||
// float speed = 5;
|
||||
inline void Coordinate::clear_speed() {
|
||||
_impl_.speed_ = 0;
|
||||
}
|
||||
inline float Coordinate::_internal_speed() const {
|
||||
return _impl_.speed_;
|
||||
}
|
||||
inline float Coordinate::speed() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.Coordinate.speed)
|
||||
return _internal_speed();
|
||||
}
|
||||
inline void Coordinate::_internal_set_speed(float value) {
|
||||
|
||||
_impl_.speed_ = value;
|
||||
}
|
||||
inline void Coordinate::set_speed(float value) {
|
||||
_internal_set_speed(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.Coordinate.speed)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// WayPointBehavior
|
||||
|
||||
// string name = 1;
|
||||
inline void WayPointBehavior::clear_name() {
|
||||
_impl_.name_.ClearToEmpty();
|
||||
}
|
||||
inline const std::string& WayPointBehavior::name() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.name)
|
||||
return _internal_name();
|
||||
}
|
||||
template <typename ArgT0, typename... ArgT>
|
||||
inline PROTOBUF_ALWAYS_INLINE
|
||||
void WayPointBehavior::set_name(ArgT0&& arg0, ArgT... args) {
|
||||
|
||||
_impl_.name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
|
||||
// @@protoc_insertion_point(field_set:Behavior.WayPointBehavior.name)
|
||||
}
|
||||
inline std::string* WayPointBehavior::mutable_name() {
|
||||
std::string* _s = _internal_mutable_name();
|
||||
// @@protoc_insertion_point(field_mutable:Behavior.WayPointBehavior.name)
|
||||
return _s;
|
||||
}
|
||||
inline const std::string& WayPointBehavior::_internal_name() const {
|
||||
return _impl_.name_.Get();
|
||||
}
|
||||
inline void WayPointBehavior::_internal_set_name(const std::string& value) {
|
||||
|
||||
_impl_.name_.Set(value, GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* WayPointBehavior::_internal_mutable_name() {
|
||||
|
||||
return _impl_.name_.Mutable(GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* WayPointBehavior::release_name() {
|
||||
// @@protoc_insertion_point(field_release:Behavior.WayPointBehavior.name)
|
||||
return _impl_.name_.Release();
|
||||
}
|
||||
inline void WayPointBehavior::set_allocated_name(std::string* name) {
|
||||
if (name != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
_impl_.name_.SetAllocated(name, GetArenaForAllocation());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (_impl_.name_.IsDefault()) {
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
}
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
// @@protoc_insertion_point(field_set_allocated:Behavior.WayPointBehavior.name)
|
||||
}
|
||||
|
||||
// int32 priority = 2;
|
||||
inline void WayPointBehavior::clear_priority() {
|
||||
_impl_.priority_ = 0;
|
||||
}
|
||||
inline int32_t WayPointBehavior::_internal_priority() const {
|
||||
return _impl_.priority_;
|
||||
}
|
||||
inline int32_t WayPointBehavior::priority() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.priority)
|
||||
return _internal_priority();
|
||||
}
|
||||
inline void WayPointBehavior::_internal_set_priority(int32_t value) {
|
||||
|
||||
_impl_.priority_ = value;
|
||||
}
|
||||
inline void WayPointBehavior::set_priority(int32_t value) {
|
||||
_internal_set_priority(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.WayPointBehavior.priority)
|
||||
}
|
||||
|
||||
// repeated .Behavior.Coordinate points = 3;
|
||||
inline int WayPointBehavior::_internal_points_size() const {
|
||||
return _impl_.points_.size();
|
||||
}
|
||||
inline int WayPointBehavior::points_size() const {
|
||||
return _internal_points_size();
|
||||
}
|
||||
inline void WayPointBehavior::clear_points() {
|
||||
_impl_.points_.Clear();
|
||||
}
|
||||
inline ::Behavior::Coordinate* WayPointBehavior::mutable_points(int index) {
|
||||
// @@protoc_insertion_point(field_mutable:Behavior.WayPointBehavior.points)
|
||||
return _impl_.points_.Mutable(index);
|
||||
}
|
||||
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Behavior::Coordinate >*
|
||||
WayPointBehavior::mutable_points() {
|
||||
// @@protoc_insertion_point(field_mutable_list:Behavior.WayPointBehavior.points)
|
||||
return &_impl_.points_;
|
||||
}
|
||||
inline const ::Behavior::Coordinate& WayPointBehavior::_internal_points(int index) const {
|
||||
return _impl_.points_.Get(index);
|
||||
}
|
||||
inline const ::Behavior::Coordinate& WayPointBehavior::points(int index) const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.points)
|
||||
return _internal_points(index);
|
||||
}
|
||||
inline ::Behavior::Coordinate* WayPointBehavior::_internal_add_points() {
|
||||
return _impl_.points_.Add();
|
||||
}
|
||||
inline ::Behavior::Coordinate* WayPointBehavior::add_points() {
|
||||
::Behavior::Coordinate* _add = _internal_add_points();
|
||||
// @@protoc_insertion_point(field_add:Behavior.WayPointBehavior.points)
|
||||
return _add;
|
||||
}
|
||||
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Behavior::Coordinate >&
|
||||
WayPointBehavior::points() const {
|
||||
// @@protoc_insertion_point(field_list:Behavior.WayPointBehavior.points)
|
||||
return _impl_.points_;
|
||||
}
|
||||
|
||||
// float duration = 4;
|
||||
inline void WayPointBehavior::clear_duration() {
|
||||
_impl_.duration_ = 0;
|
||||
}
|
||||
inline float WayPointBehavior::_internal_duration() const {
|
||||
return _impl_.duration_;
|
||||
}
|
||||
inline float WayPointBehavior::duration() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.duration)
|
||||
return _internal_duration();
|
||||
}
|
||||
inline void WayPointBehavior::_internal_set_duration(float value) {
|
||||
|
||||
_impl_.duration_ = value;
|
||||
}
|
||||
inline void WayPointBehavior::set_duration(float value) {
|
||||
_internal_set_duration(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.WayPointBehavior.duration)
|
||||
}
|
||||
|
||||
// bool closedLoop = 5;
|
||||
inline void WayPointBehavior::clear_closedloop() {
|
||||
_impl_.closedloop_ = false;
|
||||
}
|
||||
inline bool WayPointBehavior::_internal_closedloop() const {
|
||||
return _impl_.closedloop_;
|
||||
}
|
||||
inline bool WayPointBehavior::closedloop() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.closedLoop)
|
||||
return _internal_closedloop();
|
||||
}
|
||||
inline void WayPointBehavior::_internal_set_closedloop(bool value) {
|
||||
|
||||
_impl_.closedloop_ = value;
|
||||
}
|
||||
inline void WayPointBehavior::set_closedloop(bool value) {
|
||||
_internal_set_closedloop(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.WayPointBehavior.closedLoop)
|
||||
}
|
||||
|
||||
// float constSpeed = 6;
|
||||
inline void WayPointBehavior::clear_constspeed() {
|
||||
_impl_.constspeed_ = 0;
|
||||
}
|
||||
inline float WayPointBehavior::_internal_constspeed() const {
|
||||
return _impl_.constspeed_;
|
||||
}
|
||||
inline float WayPointBehavior::constspeed() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.constSpeed)
|
||||
return _internal_constspeed();
|
||||
}
|
||||
inline void WayPointBehavior::_internal_set_constspeed(float value) {
|
||||
|
||||
_impl_.constspeed_ = value;
|
||||
}
|
||||
inline void WayPointBehavior::set_constspeed(float value) {
|
||||
_internal_set_constspeed(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.WayPointBehavior.constSpeed)
|
||||
}
|
||||
|
||||
// int32 repeate = 7;
|
||||
inline void WayPointBehavior::clear_repeate() {
|
||||
_impl_.repeate_ = 0;
|
||||
}
|
||||
inline int32_t WayPointBehavior::_internal_repeate() const {
|
||||
return _impl_.repeate_;
|
||||
}
|
||||
inline int32_t WayPointBehavior::repeate() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.repeate)
|
||||
return _internal_repeate();
|
||||
}
|
||||
inline void WayPointBehavior::_internal_set_repeate(int32_t value) {
|
||||
|
||||
_impl_.repeate_ = value;
|
||||
}
|
||||
inline void WayPointBehavior::set_repeate(int32_t value) {
|
||||
_internal_set_repeate(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.WayPointBehavior.repeate)
|
||||
}
|
||||
|
||||
// bool perpetual = 8;
|
||||
inline void WayPointBehavior::clear_perpetual() {
|
||||
_impl_.perpetual_ = false;
|
||||
}
|
||||
inline bool WayPointBehavior::_internal_perpetual() const {
|
||||
return _impl_.perpetual_;
|
||||
}
|
||||
inline bool WayPointBehavior::perpetual() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.perpetual)
|
||||
return _internal_perpetual();
|
||||
}
|
||||
inline void WayPointBehavior::_internal_set_perpetual(bool value) {
|
||||
|
||||
_impl_.perpetual_ = value;
|
||||
}
|
||||
inline void WayPointBehavior::set_perpetual(bool value) {
|
||||
_internal_set_perpetual(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.WayPointBehavior.perpetual)
|
||||
}
|
||||
|
||||
// float minDepth = 9;
|
||||
inline void WayPointBehavior::clear_mindepth() {
|
||||
_impl_.mindepth_ = 0;
|
||||
}
|
||||
inline float WayPointBehavior::_internal_mindepth() const {
|
||||
return _impl_.mindepth_;
|
||||
}
|
||||
inline float WayPointBehavior::mindepth() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.minDepth)
|
||||
return _internal_mindepth();
|
||||
}
|
||||
inline void WayPointBehavior::_internal_set_mindepth(float value) {
|
||||
|
||||
_impl_.mindepth_ = value;
|
||||
}
|
||||
inline void WayPointBehavior::set_mindepth(float value) {
|
||||
_internal_set_mindepth(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.WayPointBehavior.minDepth)
|
||||
}
|
||||
|
||||
// float maxDepth = 10;
|
||||
inline void WayPointBehavior::clear_maxdepth() {
|
||||
_impl_.maxdepth_ = 0;
|
||||
}
|
||||
inline float WayPointBehavior::_internal_maxdepth() const {
|
||||
return _impl_.maxdepth_;
|
||||
}
|
||||
inline float WayPointBehavior::maxdepth() const {
|
||||
// @@protoc_insertion_point(field_get:Behavior.WayPointBehavior.maxDepth)
|
||||
return _internal_maxdepth();
|
||||
}
|
||||
inline void WayPointBehavior::_internal_set_maxdepth(float value) {
|
||||
|
||||
_impl_.maxdepth_ = value;
|
||||
}
|
||||
inline void WayPointBehavior::set_maxdepth(float value) {
|
||||
_internal_set_maxdepth(value);
|
||||
// @@protoc_insertion_point(field_set:Behavior.WayPointBehavior.maxDepth)
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace Behavior
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_Behavior_2eproto
|
||||
50
src/pClientViewer/CMakeLists.txt
Normal file
50
src/pClientViewer/CMakeLists.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
#--------------------------------------------------------
|
||||
# The CMakeLists.txt for: pClientViewer
|
||||
# Author(s): Xiaobin Zeng
|
||||
#--------------------------------------------------------
|
||||
|
||||
SET(SRC
|
||||
ClientViewer.cpp
|
||||
ClientViewer_Info.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
SET(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
FIND_LIBRARY(DUNE_LIB dune-core /usr/local/lib /usr/local/lib/DUNE)
|
||||
FIND_PATH(DUNE_INCLUDE DUNE/IMC.hpp /usr/local/include /usr/local/include/DUNE)
|
||||
include_directories(${DUNE_INCLUDE})
|
||||
|
||||
# include(FindProtobuf)
|
||||
# find_package(Protobuf REQUIRED)
|
||||
# include_directories(${Protobuf_INCLUDE_DIR})
|
||||
|
||||
# protobuf_generate_cpp(PROTO_SRC PROTO_HEADER Behavior.proto)
|
||||
# add_library(proto ${PROTO_HEADER} ${PROTO_SRC})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
#find_package (jsoncpp NO_MODULE REQUIRED)
|
||||
|
||||
include_directories(/usr/include/jsoncpp/)
|
||||
link_directories(/usr/local/lib/)
|
||||
|
||||
ADD_EXECUTABLE(pClientViewer ${SRC})
|
||||
|
||||
TARGET_LINK_LIBRARIES(pClientViewer
|
||||
${MOOS_LIBRARIES}
|
||||
${CMAKE_DL_LIBS}
|
||||
${SYSTEM_LIBS}
|
||||
${DUNE_LIB}
|
||||
mbutil
|
||||
m
|
||||
pthread
|
||||
jsoncpp
|
||||
# jsoncpp_lib_static
|
||||
# protobuf
|
||||
# protoc
|
||||
# proto
|
||||
# ${PROTOBUF_LIBRARY}
|
||||
)
|
||||
|
||||
|
||||
873
src/pClientViewer/ClientViewer.cpp
Normal file
873
src/pClientViewer/ClientViewer.cpp
Normal file
@@ -0,0 +1,873 @@
|
||||
/************************************************************/
|
||||
/* NAME: Xiaobin Zeng */
|
||||
/* ORGN: MIT */
|
||||
/* FILE: ClientViewer.cpp */
|
||||
/* DATE: */
|
||||
/************************************************************/
|
||||
|
||||
#include <iterator>
|
||||
#include "ClientViewer.h"
|
||||
//#include "Behavior.pb.h"
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define UDP_RECEIVE_PORT 6001
|
||||
#define TCP_SEND_PORT 8000
|
||||
#define TCP_FILE_RECEIVE_PORT 8001
|
||||
//#define TCP_SERVER_ADDRESS "10.25.0.230" //树莓派
|
||||
#define TCP_SERVER_ADDRESS "127.0.0.1"
|
||||
// #define TCP_SERVER_ADDRESS "10.25.0.163"
|
||||
// #define TCP_SERVER_ADDRESS "10.25.0.160"
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Constructor
|
||||
|
||||
ClientViewer::ClientViewer()
|
||||
{
|
||||
udpReceiveBuffer = new uint8_t[65535];
|
||||
tcpReceiveBuffer = new uint8_t[65535];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Destructor
|
||||
|
||||
ClientViewer::~ClientViewer()
|
||||
{
|
||||
// udpCommEvent.Stop();
|
||||
// tcpCommEvent.Stop();
|
||||
delete udpReceiveBuffer;
|
||||
delete tcpReceiveBuffer;
|
||||
|
||||
// if (sock_tcp_send)
|
||||
// {
|
||||
// delete sock_tcp_send;
|
||||
// sock_tcp_send = NULL;
|
||||
// }
|
||||
|
||||
// if (sock_udp_receive)
|
||||
// {
|
||||
// delete sock_udp_receive;
|
||||
// sock_udp_receive = NULL;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Procedure: OnNewMail
|
||||
|
||||
bool ClientViewer::OnNewMail(MOOSMSG_LIST &NewMail)
|
||||
{
|
||||
MOOSMSG_LIST::iterator p;
|
||||
|
||||
for(p=NewMail.begin(); p!=NewMail.end(); p++)
|
||||
{
|
||||
CMOOSMsg &msg = *p;
|
||||
string key = msg.GetKey();
|
||||
string comm = msg.GetCommunity();
|
||||
double dval = msg.GetDouble();
|
||||
string sval = msg.GetString();
|
||||
string msrc = msg.GetSource();
|
||||
double mtime = msg.GetTime();
|
||||
bool mdbl = msg.IsDouble();
|
||||
bool mstr = msg.IsString();
|
||||
std::cout << key << " : " << sval << std::endl;
|
||||
if(key == "Command")
|
||||
{
|
||||
if (sval == "SetPlan1") //PlanDB
|
||||
{
|
||||
std::string systemName = "CCU Neptus 0_163";
|
||||
std::string plan_1_Spec = SetPlan1(systemName, MOOS::Time());
|
||||
DUNE::IMC::PlanDB msg;
|
||||
msg.setTimeStamp();
|
||||
msg.type = DUNE::IMC::PlanDB::TypeEnum::DBT_REQUEST;
|
||||
msg.op = DUNE::IMC::PlanDB::OperationEnum::DBOP_SET;
|
||||
msg.plan_id.assign("BHV_Waypoint");
|
||||
msg.info = plan_1_Spec;
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
|
||||
}
|
||||
if (sval == "SetPlan2") //PlanDB
|
||||
{
|
||||
std::string systemName = "CCU Neptus 0_163";
|
||||
std::string plan_2_Spec = SetPlan2(systemName, MOOS::Time());
|
||||
//std::cout << plan_2_Spec << std::endl;
|
||||
DUNE::IMC::PlanDB msg;
|
||||
msg.setTimeStamp();
|
||||
msg.type = DUNE::IMC::PlanDB::TypeEnum::DBT_REQUEST;
|
||||
msg.op = DUNE::IMC::PlanDB::OperationEnum::DBOP_SET;
|
||||
msg.plan_id.assign("BHV_Waypoint");
|
||||
msg.info = plan_2_Spec;
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "ModifyPlan1") //PlanDB
|
||||
{
|
||||
std::string systemName = "CCU Neptus 0_163";
|
||||
std::string plan_1_Spec = ModifyPlan1(systemName, MOOS::Time());
|
||||
DUNE::IMC::PlanDB msg;
|
||||
msg.setTimeStamp();
|
||||
msg.type = DUNE::IMC::PlanDB::TypeEnum::DBT_REQUEST;
|
||||
msg.op = DUNE::IMC::PlanDB::OperationEnum::DBOP_SET;
|
||||
msg.plan_id.assign("BHV_Waypoint");
|
||||
msg.info = plan_1_Spec;
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "GetPlanList") //PlanDB
|
||||
{
|
||||
DUNE::IMC::PlanDB msg;
|
||||
msg.setTimeStamp();
|
||||
msg.type = DUNE::IMC::PlanDB::TypeEnum::DBT_REQUEST;
|
||||
msg.op = DUNE::IMC::PlanDB::OperationEnum::DBOP_GET_STATE;
|
||||
msg.plan_id.assign("Test");
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "SetThrust") //SetEntityParameters
|
||||
{
|
||||
double timeStamp = MOOS::Time();
|
||||
DUNE::IMC::SetEntityParameters msg;
|
||||
msg.setTimeStamp(timeStamp);
|
||||
msg.name = "Thrust";
|
||||
DUNE::IMC::EntityParameter subMsg;
|
||||
subMsg.setTimeStamp(timeStamp);
|
||||
SetEntityStatus(subMsg, "Pwm", generateEntityValue("30", "int"));
|
||||
msg.params.push_back(subMsg);
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "SetIndicatorLight") //SetEntityParameters
|
||||
{
|
||||
double timeStamp = MOOS::Time();
|
||||
DUNE::IMC::SetEntityParameters msg;
|
||||
msg.setTimeStamp(timeStamp);
|
||||
msg.name = "IndicatorLight";
|
||||
DUNE::IMC::EntityParameter subMsg;
|
||||
subMsg.setTimeStamp(timeStamp);
|
||||
SetEntityStatus(subMsg, "Status", generateEntityValue("1", "int"));
|
||||
msg.params.push_back(subMsg);
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "StartPlan1") //PlanControl
|
||||
{
|
||||
DUNE::IMC::PlanControl msg;
|
||||
msg.setTimeStamp();
|
||||
msg.type = DUNE::IMC::PlanControl::TypeEnum::PC_REQUEST;
|
||||
msg.op = DUNE::IMC::PlanControl::OperationEnum::PC_START;
|
||||
msg.plan_id = "east_waypt_survey";
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "StartPlan2") //PlanControl
|
||||
{
|
||||
DUNE::IMC::PlanControl msg;
|
||||
msg.setTimeStamp();
|
||||
msg.type = DUNE::IMC::PlanControl::TypeEnum::PC_REQUEST;
|
||||
msg.op = DUNE::IMC::PlanControl::OperationEnum::PC_START;
|
||||
msg.plan_id = "west_waypt_survey";
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "StopPlan1") //PlanControl
|
||||
{
|
||||
DUNE::IMC::PlanControl msg;
|
||||
msg.setTimeStamp();
|
||||
msg.type = DUNE::IMC::PlanControl::TypeEnum::PC_REQUEST;
|
||||
msg.op = DUNE::IMC::PlanControl::OperationEnum::PC_STOP;
|
||||
msg.plan_id = "east_waypt_survey";
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "StopPlan2") //PlanControl
|
||||
{
|
||||
DUNE::IMC::PlanControl msg;
|
||||
msg.setTimeStamp();
|
||||
msg.type = DUNE::IMC::PlanControl::TypeEnum::PC_REQUEST;
|
||||
msg.op = DUNE::IMC::PlanControl::OperationEnum::PC_STOP;
|
||||
msg.plan_id = "west_waypt_survey";
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "RemoteActions") //PlanControl
|
||||
{
|
||||
DUNE::IMC::RemoteActions msg;
|
||||
msg.setTimeStamp();
|
||||
Json::Value executeCommand;
|
||||
executeCommand["Thrust"] = -100;
|
||||
executeCommand["Heading"] = -27.5;
|
||||
Json::StreamWriterBuilder builder;
|
||||
msg.actions = Json::writeString(builder, executeCommand);
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "VehicleCommand") //PlanControl
|
||||
{
|
||||
DUNE::IMC::VehicleCommand msg;
|
||||
msg.setTimeStamp();
|
||||
msg.type = DUNE::IMC::VehicleCommand::TypeEnum::VC_REQUEST;
|
||||
msg.command = 1;
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "GetLogBook") //PlanControl
|
||||
{
|
||||
DUNE::IMC::LogBookControl msg;
|
||||
msg.setTimeStamp();
|
||||
msg.command = DUNE::IMC::LogBookControl::CommandEnum::LBC_GET;
|
||||
DUNE::IMC::LogBookEntry msgLogBookEntry;
|
||||
msgLogBookEntry.type = DUNE::IMC::LogBookEntry::TypeEnum::LBET_INFO;
|
||||
msgLogBookEntry.context = "LIST";
|
||||
msg.msg.push_back(msgLogBookEntry);
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "RetrLogBook1") //PlanControl
|
||||
{
|
||||
DUNE::IMC::LogBookControl msg;
|
||||
msg.setTimeStamp();
|
||||
msg.command = DUNE::IMC::LogBookControl::CommandEnum::LBC_GET;
|
||||
DUNE::IMC::LogBookEntry msgLogBookEntry;
|
||||
msgLogBookEntry.type = DUNE::IMC::LogBookEntry::TypeEnum::LBET_INFO;
|
||||
msgLogBookEntry.context = "RETR";
|
||||
|
||||
Json::Value retrFile;
|
||||
retrFile["lauv-150/2023-11-16/103058"]["auv"]["file"] = "auvData.mdat";
|
||||
|
||||
Json::StreamWriterBuilder builder;
|
||||
msgLogBookEntry.text = Json::writeString(builder, retrFile);
|
||||
msg.msg.push_back(msgLogBookEntry);
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "RetrLogBook2") //PlanControl
|
||||
{
|
||||
DUNE::IMC::LogBookControl msg;
|
||||
msg.setTimeStamp();
|
||||
msg.command = DUNE::IMC::LogBookControl::CommandEnum::LBC_GET;
|
||||
DUNE::IMC::LogBookEntry msgLogBookEntry;
|
||||
msgLogBookEntry.type = DUNE::IMC::LogBookEntry::TypeEnum::LBET_INFO;
|
||||
msgLogBookEntry.context = "RETR";
|
||||
|
||||
Json::Value retrFile;
|
||||
retrFile["lauv-150/2023-11-16/103058"]["command"]["file"] = "clientCommand.txt";
|
||||
|
||||
Json::StreamWriterBuilder builder;
|
||||
msgLogBookEntry.text = Json::writeString(builder, retrFile);
|
||||
msg.msg.push_back(msgLogBookEntry);
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "RetrLogBook3") //PlanControl
|
||||
{
|
||||
DUNE::IMC::LogBookControl msg;
|
||||
msg.setTimeStamp();
|
||||
msg.command = DUNE::IMC::LogBookControl::CommandEnum::LBC_GET;
|
||||
DUNE::IMC::LogBookEntry msgLogBookEntry;
|
||||
msgLogBookEntry.type = DUNE::IMC::LogBookEntry::TypeEnum::LBET_INFO;
|
||||
msgLogBookEntry.context = "RETR";
|
||||
|
||||
Json::Value retrFile;
|
||||
retrFile["lauv-150/2023-11-16/103058"]["mission"]["file"] = "missionHistory.txt";
|
||||
|
||||
Json::StreamWriterBuilder builder;
|
||||
msgLogBookEntry.text = Json::writeString(builder, retrFile);
|
||||
msg.msg.push_back(msgLogBookEntry);
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
if (sval == "DeleLogBook") //PlanControl
|
||||
{
|
||||
DUNE::IMC::LogBookControl msg;
|
||||
msg.setTimeStamp();
|
||||
msg.command = DUNE::IMC::LogBookControl::CommandEnum::LBC_CLEAR;
|
||||
DUNE::IMC::LogBookEntry msgLogBookEntry;
|
||||
msgLogBookEntry.type = DUNE::IMC::LogBookEntry::TypeEnum::LBET_INFO;
|
||||
msgLogBookEntry.context = "DELE";
|
||||
|
||||
Json::Value retrFile;
|
||||
retrFile["lauv-150/2023-11-16/103058"]["auv"]["file"] = "auvData.mdat";
|
||||
retrFile["lauv-150/2023-11-16/103058"]["command"]["file"] = "clientCommand.txt";
|
||||
retrFile["lauv-150/2023-11-16/105131"]["mission"]["file"] = "missionHistory.txt";
|
||||
|
||||
Json::StreamWriterBuilder builder;
|
||||
msgLogBookEntry.text = Json::writeString(builder, retrFile);
|
||||
msg.msg.push_back(msgLogBookEntry);
|
||||
tcpSendToServer(&msg, TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Procedure: OnConnectToServer
|
||||
|
||||
bool ClientViewer::OnConnectToServer()
|
||||
{
|
||||
RegisterVariables();
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool ClientViewer::Iterate()
|
||||
{
|
||||
DUNE::IMC::Message * receiveUDPMessage;
|
||||
|
||||
while ((receiveUDPMessage = imcPollUDP()) != NULL)
|
||||
{
|
||||
processMessage(receiveUDPMessage);
|
||||
free(receiveUDPMessage);
|
||||
}
|
||||
|
||||
DUNE::IMC::Message * receiveTCPMessage;
|
||||
while ((receiveTCPMessage = imcPollTCP()) != NULL)
|
||||
{
|
||||
processMessage(receiveTCPMessage);
|
||||
free(receiveTCPMessage);
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
// bool processMessageCallback(DUNE::IMC::Message * message)
|
||||
// {
|
||||
// int type = message->getId();
|
||||
// if (type == DUNE::IMC::Announce::getIdStatic())
|
||||
// {
|
||||
// DUNE::IMC::Announce * msg = dynamic_cast<DUNE::IMC::Announce *>(message);
|
||||
// // printf("server receive %s: %lf, %lf, %lf, %lf\n", \
|
||||
// // msg->getName(), msg->getTimeStamp(), msg->lat, msg->lon, msg->height);
|
||||
// printf("server receive %s: %lf, %lf, %lf, %lf\n", \
|
||||
// msg->getName(), msg->getTimeStamp(), msg->lat*180/M_PI, msg->lon*180/M_PI, msg->height);
|
||||
// }
|
||||
// if (type == DUNE::IMC::PlanDB::getIdStatic())
|
||||
// {
|
||||
// DUNE::IMC::PlanDB * msg = dynamic_cast<DUNE::IMC::PlanDB *>(message);
|
||||
// printf("server receive %s: %lf, %d, %d\n", msg->getName(), msg->getTimeStamp(), msg->type, msg->op);
|
||||
// printf("%s\n", msg->info.c_str());
|
||||
// }
|
||||
// if (type == DUNE::IMC::PlanControlState::getIdStatic())
|
||||
// {
|
||||
// DUNE::IMC::PlanControlState * msg = dynamic_cast<DUNE::IMC::PlanControlState *>(message);
|
||||
|
||||
// printf("server receive %s: %lf, %s, %s, %u\n", \
|
||||
// msg->getName(), msg->getTimeStamp(), msg->plan_id.c_str(), msg->man_id.c_str(), msg->state);
|
||||
// }
|
||||
// if (type == DUNE::IMC::MsgList::getIdStatic())
|
||||
// {
|
||||
// DUNE::IMC::MsgList * msgList = dynamic_cast<DUNE::IMC::MsgList *>(message);
|
||||
// printf("server receive %s: %lf\n", msgList->getName(), msgList->getTimeStamp());
|
||||
// DUNE::IMC::MessageList<DUNE::IMC::Message>::const_iterator iter1 = msgList->msgs.begin();
|
||||
// for (; iter1 != msgList->msgs.end(); ++iter1)
|
||||
// {
|
||||
// DUNE::IMC::EntityParameters *entityParameter = static_cast<DUNE::IMC::EntityParameters *>(*iter1);
|
||||
// DUNE::IMC::MessageList<DUNE::IMC::EntityParameter>::const_iterator iter2 = entityParameter->params.begin();
|
||||
// for (; iter2 != entityParameter->params.end(); ++iter2)
|
||||
// {
|
||||
// DUNE::IMC::EntityParameter *subEntityParameter = static_cast<DUNE::IMC::EntityParameter *>(*iter2);
|
||||
// std::cout << entityParameter->name << ": " << subEntityParameter->name << ", " << subEntityParameter->value << std::endl;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (type == DUNE::IMC::EstimatedState::getIdStatic())
|
||||
// {
|
||||
// DUNE::IMC::EstimatedState * msg = dynamic_cast<DUNE::IMC::EstimatedState *>(message);
|
||||
// // printf("server receive %s: %lf, (%f, %f, %f), (%f, %f, %f)\n",
|
||||
// // msg->getName(), msg->getTimeStamp(),
|
||||
// // msg->lat, msg->lon, msg->depth,
|
||||
// // msg->phi, msg->theta, msg->psi);
|
||||
// printf("server receive %s: %lf, (%f, %f, %f), (%f, %f, %f)\n",
|
||||
// msg->getName(), msg->getTimeStamp(),
|
||||
// msg->lat*180/M_PI, msg->lon*180/M_PI, msg->depth*180/M_PI,
|
||||
// msg->phi*180/M_PI, msg->theta*180/M_PI, msg->psi*180/M_PI);
|
||||
// }
|
||||
// if (type == DUNE::IMC::VehicleState::getIdStatic())
|
||||
// {
|
||||
// DUNE::IMC::VehicleState * msg = dynamic_cast<DUNE::IMC::VehicleState *>(message);
|
||||
// printf("server receive %s: %lf, %u\n",
|
||||
// msg->getName(), msg->getTimeStamp(), msg->op_mode);
|
||||
// }
|
||||
// if (type == DUNE::IMC::LogBookControl::getIdStatic())
|
||||
// {
|
||||
// DUNE::IMC::LogBookControl * msg = dynamic_cast<DUNE::IMC::LogBookControl *>(message);
|
||||
// printf("server receive %s: %lf, %u\n",
|
||||
// msg->getName(), msg->getTimeStamp(), msg->command);
|
||||
|
||||
// DUNE::IMC::MessageList<DUNE::IMC::LogBookEntry>::const_iterator iter = msg->msg.begin();
|
||||
// for (; iter != msg->msg.end(); ++iter)
|
||||
// {
|
||||
// DUNE::IMC::LogBookEntry *msgLogBookEntry = static_cast<DUNE::IMC::LogBookEntry *>(*iter);
|
||||
// std::cout << msgLogBookEntry->type << ", " << msgLogBookEntry->text << std::endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Procedure: OnStartUp()
|
||||
// happens before connection is open
|
||||
|
||||
bool ClientViewer::OnStartUp()
|
||||
{
|
||||
initLon = -70.330400;
|
||||
initLat = 43.825300;
|
||||
initAlt = 0;
|
||||
|
||||
// udpCommEvent.SetPeriod(1);
|
||||
// udpCommEvent.SetCallback(processMessageCallback,NULL);
|
||||
// udpCommEvent.Start();
|
||||
|
||||
// tcpCommEvent.SetPeriod(1);
|
||||
// tcpCommEvent.SetCallback(processMessageCallback,NULL);
|
||||
// tcpCommEvent.Start();
|
||||
|
||||
sock_udp_receive.bind(UDP_RECEIVE_PORT, DUNE::Network::Address::Any, false);
|
||||
m_poll_0.add(sock_udp_receive);
|
||||
|
||||
try
|
||||
{
|
||||
sock_tcp_send.connect(TCP_SERVER_ADDRESS, TCP_SEND_PORT);
|
||||
sock_tcp_send.setKeepAlive(true);
|
||||
m_poll_1.add(sock_tcp_send);
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
std::cerr << e.what() << '\n';
|
||||
}
|
||||
|
||||
char local_ip2[INET_ADDRSTRLEN] = {0};
|
||||
get_local_ip_using_create_socket(local_ip2);
|
||||
ethernetIP = local_ip2;
|
||||
|
||||
RegisterVariables();
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
std::string ClientViewer::SetPlan1(std::string sourceName, double stamp)
|
||||
{
|
||||
struct WayPointBehavior behavior;
|
||||
behavior.source = sourceName;
|
||||
behavior.priority = -1;
|
||||
behavior.points.clear();
|
||||
behavior.name = "east_waypt_survey";
|
||||
behavior.priority = 10;
|
||||
struct Landmark station_1 = {"station_1", -70.328891,43.824429, 10, 3, -1, -1, "point"};
|
||||
struct Landmark station_2 = {"station_2", -70.327885,43.824676, 8, 5, -1, -1, "point"};
|
||||
struct Landmark station_3 = {"station_3", -70.327867,43.823622, 6, 7, -1, -1, "point"};
|
||||
struct Landmark station_4 = {"station_4", -70.328765,43.823622, 4, 9, -1, -1, "point"};
|
||||
behavior.points.push_back(station_1);
|
||||
behavior.points.push_back(station_2);
|
||||
behavior.points.push_back(station_3);
|
||||
behavior.points.push_back(station_4);
|
||||
behavior.duration = -1;
|
||||
behavior.constSpeed = -1;
|
||||
behavior.repeat = 1;
|
||||
behavior.closedLoop = true;
|
||||
behavior.perpetual = false;
|
||||
behavior.minDepth = -1;
|
||||
behavior.maxDepth = -1;
|
||||
|
||||
Json::Value behaviorConfig;
|
||||
behaviorConfig["taskName"] = behavior.name;
|
||||
behaviorConfig["taskId"] = "1";
|
||||
behaviorConfig["sourceName"] = behavior.source;
|
||||
behaviorConfig["sourceAddress"] = ethernetIP;
|
||||
behaviorConfig["clientStamp"] = stamp;
|
||||
behaviorConfig["boardStamp"] = -1;
|
||||
behaviorConfig["priority"] = behavior.priority;
|
||||
behaviorConfig["duration"] = behavior.duration;
|
||||
behaviorConfig["closedLoop"] = behavior.closedLoop;
|
||||
behaviorConfig["constSpeed"] = behavior.constSpeed;
|
||||
behaviorConfig["repeat"] = behavior.repeat;
|
||||
behaviorConfig["perpetual"] = behavior.perpetual;
|
||||
behaviorConfig["minDepth"] = behavior.minDepth;
|
||||
behaviorConfig["maxDepth"] = behavior.maxDepth;
|
||||
behaviorConfig["origin"]["lon"] = initLon;
|
||||
behaviorConfig["origin"]["lat"] = initLat;
|
||||
behaviorConfig["origin"]["altitude"] = initAlt;
|
||||
|
||||
Json::Value station;
|
||||
station["name"] = station_1.name;
|
||||
station["lon"] = station_1.lon;
|
||||
station["lat"] = station_1.lat;
|
||||
station["depth"] = station_1.depth;
|
||||
station["speed"] = station_1.speed;
|
||||
station["north"] = station_1.north;
|
||||
station["east"] = station_1.east;
|
||||
station["type"] = station_1.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
station["name"] = station_2.name;
|
||||
station["lon"] = station_2.lon;
|
||||
station["lat"] = station_2.lat;
|
||||
station["depth"] = station_2.depth;
|
||||
station["speed"] = station_2.speed;
|
||||
station["north"] = station_2.north;
|
||||
station["east"] = station_2.east;
|
||||
station["type"] = station_2.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
station["name"] = station_3.name;
|
||||
station["lon"] = station_3.lon;
|
||||
station["lat"] = station_3.lat;
|
||||
station["depth"] = station_3.depth;
|
||||
station["speed"] = station_3.speed;
|
||||
station["north"] = station_3.north;
|
||||
station["east"] = station_3.east;
|
||||
station["type"] = station_3.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
station["name"] = station_4.name;
|
||||
station["lon"] = station_4.lon;
|
||||
station["lat"] = station_4.lat;
|
||||
station["depth"] = station_4.depth;
|
||||
station["speed"] = station_4.speed;
|
||||
station["north"] = station_4.north;
|
||||
station["east"] = station_4.east;
|
||||
station["type"] = station_4.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
Json::StreamWriterBuilder builder;
|
||||
std::string behaviorSpecString = Json::writeString(builder, behaviorConfig);
|
||||
|
||||
return behaviorSpecString;
|
||||
}
|
||||
|
||||
std::string ClientViewer::SetPlan2(std::string sourceName, double stamp)
|
||||
{
|
||||
struct WayPointBehavior behavior;
|
||||
behavior.source = sourceName;
|
||||
behavior.priority = -1;
|
||||
behavior.points.clear();
|
||||
behavior.name = "west_waypt_survey";
|
||||
behavior.priority = 10;
|
||||
struct Landmark station_1 = {"station_1", -70.331532,43.824194, 9, 4, -1, -1, "track"};
|
||||
struct Landmark station_2 = {"station_2", -70.330328,43.824299, 7, 6, -1, -1, "track"};
|
||||
struct Landmark station_3 = {"station_3", -70.330346,43.823518, 5, 8, -1, -1, "track"};
|
||||
struct Landmark station_4 = {"station_4", -70.331406,43.823206, 3, 10, -1, -1, "track"};
|
||||
behavior.points.push_back(station_1);
|
||||
behavior.points.push_back(station_2);
|
||||
behavior.points.push_back(station_3);
|
||||
behavior.points.push_back(station_4);
|
||||
behavior.duration = -1;
|
||||
behavior.constSpeed = -1;
|
||||
behavior.repeat = -1;
|
||||
behavior.closedLoop = true;
|
||||
behavior.perpetual = true;
|
||||
behavior.minDepth = -1;
|
||||
behavior.maxDepth = -1;
|
||||
|
||||
Json::Value behaviorConfig;
|
||||
behaviorConfig["taskName"] = behavior.name;
|
||||
behaviorConfig["taskId"] = "2";
|
||||
behaviorConfig["sourceName"] = behavior.source;
|
||||
behaviorConfig["sourceAddress"] = ethernetIP;
|
||||
behaviorConfig["clientStamp"] = stamp;
|
||||
behaviorConfig["boardStamp"] = -1;
|
||||
behaviorConfig["priority"] = behavior.priority;
|
||||
behaviorConfig["duration"] = behavior.duration;
|
||||
behaviorConfig["closedLoop"] = behavior.closedLoop;
|
||||
behaviorConfig["constSpeed"] = behavior.constSpeed;
|
||||
behaviorConfig["repeat"] = behavior.repeat;
|
||||
behaviorConfig["perpetual"] = behavior.perpetual;
|
||||
behaviorConfig["minDepth"] = behavior.minDepth;
|
||||
behaviorConfig["maxDepth"] = behavior.maxDepth;
|
||||
behaviorConfig["origin"]["lon"] = initLon;
|
||||
behaviorConfig["origin"]["lat"] = initLat;
|
||||
behaviorConfig["origin"]["altitude"] = initAlt;
|
||||
Json::Value station;
|
||||
station["name"] = station_1.name;
|
||||
station["lon"] = station_1.lon;
|
||||
station["lat"] = station_1.lat;
|
||||
station["depth"] = station_1.depth;
|
||||
station["speed"] = station_1.speed;
|
||||
station["north"] = station_1.north;
|
||||
station["east"] = station_1.east;
|
||||
station["type"] = station_1.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
station["name"] = station_2.name;
|
||||
station["lon"] = station_2.lon;
|
||||
station["lat"] = station_2.lat;
|
||||
station["depth"] = station_2.depth;
|
||||
station["speed"] = station_2.speed;
|
||||
station["north"] = station_2.north;
|
||||
station["east"] = station_2.east;
|
||||
station["type"] = station_2.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
station["name"] = station_3.name;
|
||||
station["lon"] = station_3.lon;
|
||||
station["lat"] = station_3.lat;
|
||||
station["depth"] = station_3.depth;
|
||||
station["speed"] = station_3.speed;
|
||||
station["north"] = station_3.north;
|
||||
station["east"] = station_3.east;
|
||||
station["type"] = station_3.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
station["name"] = station_4.name;
|
||||
station["lon"] = station_4.lon;
|
||||
station["lat"] = station_4.lat;
|
||||
station["depth"] = station_4.depth;
|
||||
station["speed"] = station_4.speed;
|
||||
station["north"] = station_4.north;
|
||||
station["east"] = station_4.east;
|
||||
station["type"] = station_4.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
Json::StreamWriterBuilder builder;
|
||||
std::string behaviorSpecString = Json::writeString(builder, behaviorConfig);
|
||||
|
||||
return behaviorSpecString;
|
||||
}
|
||||
|
||||
std::string ClientViewer::ModifyPlan1(std::string sourceName, double stamp)
|
||||
{
|
||||
struct WayPointBehavior behavior;
|
||||
behavior.source = sourceName;
|
||||
behavior.priority = -1;
|
||||
behavior.points.clear();
|
||||
behavior.name = "east_waypt_survey";
|
||||
behavior.priority = 10;
|
||||
struct Landmark station_1 = {"station_1", -70.328891,43.824429, 9, 2, -1, -1, "track"};
|
||||
struct Landmark station_2 = {"station_2", -70.327885,43.824676, 7, 4, -1, -1, "point"};
|
||||
struct Landmark station_3 = {"station_3", -70.327867,43.823622, 5, 6, -1, -1, "track"};
|
||||
struct Landmark station_4 = {"station_4", -70.328765,43.823622, 3, 8, -1, -1, "point"};
|
||||
behavior.points.push_back(station_1);
|
||||
behavior.points.push_back(station_2);
|
||||
behavior.points.push_back(station_3);
|
||||
behavior.points.push_back(station_4);
|
||||
behavior.duration = -1;
|
||||
behavior.constSpeed = -1;
|
||||
behavior.repeat = 3;
|
||||
behavior.closedLoop = true;
|
||||
behavior.perpetual = false;
|
||||
behavior.minDepth = -1;
|
||||
behavior.maxDepth = -1;
|
||||
|
||||
Json::Value behaviorConfig;
|
||||
behaviorConfig["taskName"] = behavior.name;
|
||||
behaviorConfig["taskId"] = "1";
|
||||
behaviorConfig["sourceName"] = behavior.source;
|
||||
behaviorConfig["sourceAddress"] = ethernetIP;
|
||||
behaviorConfig["clientStamp"] = stamp;
|
||||
behaviorConfig["boardStamp"] = -1;
|
||||
behaviorConfig["priority"] = behavior.priority;
|
||||
behaviorConfig["duration"] = behavior.duration;
|
||||
behaviorConfig["closedLoop"] = behavior.closedLoop;
|
||||
behaviorConfig["constSpeed"] = behavior.constSpeed;
|
||||
behaviorConfig["repeat"] = behavior.repeat;
|
||||
behaviorConfig["perpetual"] = behavior.perpetual;
|
||||
behaviorConfig["minDepth"] = behavior.minDepth;
|
||||
behaviorConfig["maxDepth"] = behavior.maxDepth;
|
||||
behaviorConfig["origin"]["lon"] = initLon;
|
||||
behaviorConfig["origin"]["lat"] = initLat;
|
||||
behaviorConfig["origin"]["altitude"] = initAlt;
|
||||
Json::Value station;
|
||||
station["name"] = station_1.name;
|
||||
station["lon"] = station_1.lon;
|
||||
station["lat"] = station_1.lat;
|
||||
station["depth"] = station_1.depth;
|
||||
station["speed"] = station_1.speed;
|
||||
station["north"] = station_1.north;
|
||||
station["east"] = station_1.east;
|
||||
station["type"] = station_1.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
station["name"] = station_2.name;
|
||||
station["lon"] = station_2.lon;
|
||||
station["lat"] = station_2.lat;
|
||||
station["depth"] = station_2.depth;
|
||||
station["speed"] = station_2.speed;
|
||||
station["north"] = station_2.north;
|
||||
station["east"] = station_2.east;
|
||||
station["type"] = station_2.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
station["name"] = station_3.name;
|
||||
station["lon"] = station_3.lon;
|
||||
station["lat"] = station_3.lat;
|
||||
station["depth"] = station_3.depth;
|
||||
station["speed"] = station_3.speed;
|
||||
station["north"] = station_3.north;
|
||||
station["east"] = station_3.east;
|
||||
station["type"] = station_3.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
station["name"] = station_4.name;
|
||||
station["lon"] = station_4.lon;
|
||||
station["lat"] = station_4.lat;
|
||||
station["depth"] = station_4.depth;
|
||||
station["speed"] = station_4.speed;
|
||||
station["north"] = station_4.north;
|
||||
station["east"] = station_4.east;
|
||||
station["type"] = station_4.type;
|
||||
behaviorConfig["points"].append(station);
|
||||
Json::StreamWriterBuilder builder;
|
||||
std::string behaviorSpecString = Json::writeString(builder, behaviorConfig);
|
||||
|
||||
return behaviorSpecString;
|
||||
}
|
||||
|
||||
DUNE::IMC::Message * ClientViewer::imcPollUDP()
|
||||
{
|
||||
if (m_poll_0.poll(0))
|
||||
{
|
||||
DUNE::Network::Address addr;
|
||||
uint16_t rv = sock_udp_receive.read(udpReceiveBuffer, 65535, &addr);
|
||||
DUNE::IMC::Message * msg = DUNE::IMC::Packet::deserialize(udpReceiveBuffer, rv);
|
||||
return msg;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DUNE::IMC::Message * ClientViewer::imcPollTCP()
|
||||
{
|
||||
if (m_poll_1.poll(0))
|
||||
{
|
||||
uint16_t rv = sock_tcp_send.read(tcpReceiveBuffer, 65535);
|
||||
DUNE::IMC::Message * msg = DUNE::IMC::Packet::deserialize(tcpReceiveBuffer, rv);
|
||||
return msg;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ClientViewer::tcpSendToServer(DUNE::IMC::Message * msg, std::string addr, int port)
|
||||
{
|
||||
|
||||
DUNE::Utils::ByteBuffer bb;
|
||||
try {
|
||||
DUNE::IMC::Packet::serialize(msg, bb);
|
||||
return sock_tcp_send.write(bb.getBuffer(), msg->getSerializationSize());
|
||||
}
|
||||
catch (std::runtime_error& e)
|
||||
{
|
||||
MOOSTrace ("ERROR sending %s to %s:%d: %s\n", msg->getName(), addr.c_str(), port, e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ClientViewer::processMessage(DUNE::IMC::Message * message) {
|
||||
|
||||
int type = message->getId();
|
||||
if (type == DUNE::IMC::Announce::getIdStatic())
|
||||
{
|
||||
DUNE::IMC::Announce * msg = dynamic_cast<DUNE::IMC::Announce *>(message);
|
||||
printf("server receive %s: %lf, %lf, %lf, %lf\n", \
|
||||
msg->getName(), msg->getTimeStamp(), msg->lat*180/M_PI, msg->lon*180/M_PI, msg->height);
|
||||
}
|
||||
if (type == DUNE::IMC::PlanDB::getIdStatic())
|
||||
{
|
||||
DUNE::IMC::PlanDB * msg = dynamic_cast<DUNE::IMC::PlanDB *>(message);
|
||||
printf("server receive %s: %lf, %d, %d\n", msg->getName(), msg->getTimeStamp(), msg->type, msg->op);
|
||||
printf("%s\n", msg->info.c_str());
|
||||
}
|
||||
if (type == DUNE::IMC::PlanControlState::getIdStatic())
|
||||
{
|
||||
DUNE::IMC::PlanControlState * msg = dynamic_cast<DUNE::IMC::PlanControlState *>(message);
|
||||
|
||||
printf("server receive %s: %lf, %s, %s, %u\n", \
|
||||
msg->getName(), msg->getTimeStamp(), msg->plan_id.c_str(), msg->man_id.c_str(), msg->state);
|
||||
}
|
||||
if (type == DUNE::IMC::MsgList::getIdStatic())
|
||||
{
|
||||
DUNE::IMC::MsgList * msgList = dynamic_cast<DUNE::IMC::MsgList *>(message);
|
||||
printf("server receive %s: %lf\n", msgList->getName(), msgList->getTimeStamp());
|
||||
DUNE::IMC::MessageList<DUNE::IMC::Message>::const_iterator iter1 = msgList->msgs.begin();
|
||||
for (; iter1 != msgList->msgs.end(); ++iter1)
|
||||
{
|
||||
DUNE::IMC::EntityParameters *entityParameter = static_cast<DUNE::IMC::EntityParameters *>(*iter1);
|
||||
DUNE::IMC::MessageList<DUNE::IMC::EntityParameter>::const_iterator iter2 = entityParameter->params.begin();
|
||||
for (; iter2 != entityParameter->params.end(); ++iter2)
|
||||
{
|
||||
DUNE::IMC::EntityParameter *subEntityParameter = static_cast<DUNE::IMC::EntityParameter *>(*iter2);
|
||||
std::cout << entityParameter->name << ": " << subEntityParameter->name << ", " << subEntityParameter->value << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type == DUNE::IMC::EstimatedState::getIdStatic())
|
||||
{
|
||||
DUNE::IMC::EstimatedState * msg = dynamic_cast<DUNE::IMC::EstimatedState *>(message);
|
||||
printf("server receive %s: %lf, (%f, %f, %f), (%f, %f, %f)\n",
|
||||
msg->getName(), msg->getTimeStamp(),
|
||||
msg->lat*180/M_PI, msg->lon*180/M_PI, msg->depth*180/M_PI,
|
||||
msg->phi*180/M_PI, msg->theta*180/M_PI, msg->psi*180/M_PI);
|
||||
}
|
||||
if (type == DUNE::IMC::VehicleState::getIdStatic())
|
||||
{
|
||||
DUNE::IMC::VehicleState * msg = dynamic_cast<DUNE::IMC::VehicleState *>(message);
|
||||
printf("server receive %s: %lf, %u\n",
|
||||
msg->getName(), msg->getTimeStamp(), msg->op_mode);
|
||||
}
|
||||
if (type == DUNE::IMC::LogBookControl::getIdStatic())
|
||||
{
|
||||
DUNE::IMC::LogBookControl * msg = dynamic_cast<DUNE::IMC::LogBookControl *>(message);
|
||||
printf("server receive %s: %lf, %u\n",
|
||||
msg->getName(), msg->getTimeStamp(), msg->command);
|
||||
|
||||
DUNE::IMC::MessageList<DUNE::IMC::LogBookEntry>::const_iterator iter = msg->msg.begin();
|
||||
for (; iter != msg->msg.end(); ++iter)
|
||||
{
|
||||
DUNE::IMC::LogBookEntry *msgLogBookEntry = static_cast<DUNE::IMC::LogBookEntry *>(*iter);
|
||||
std::cout << msgLogBookEntry->type << ", " << msgLogBookEntry->context << ", " << msgLogBookEntry->text << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Procedure: RegisterVariables
|
||||
|
||||
void ClientViewer::RegisterVariables()
|
||||
{
|
||||
Register("Command", 0);
|
||||
Register("Key", 0);
|
||||
Register("Value", 0);
|
||||
}
|
||||
|
||||
int ClientViewer::SetEntityStatus(DUNE::IMC::EntityParameter& subMsg, std::string name, std::string value)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
subMsg.name = name;
|
||||
subMsg.value = value;
|
||||
|
||||
result = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string ClientViewer::generateEntityName(std::string parentName, std::string childName)
|
||||
{
|
||||
Json::Value outputJsonValue;
|
||||
outputJsonValue["parent"] = parentName;
|
||||
outputJsonValue["child"] = childName;
|
||||
Json::StreamWriterBuilder builder;
|
||||
std::string outputJsonString = Json::writeString(builder, outputJsonValue);
|
||||
return outputJsonString;
|
||||
}
|
||||
|
||||
std::string ClientViewer::generateEntityValue(std::string value, std::string type)
|
||||
{
|
||||
Json::Value outputJsonValue;
|
||||
outputJsonValue["value"] = value;
|
||||
outputJsonValue["type"] = type;
|
||||
Json::StreamWriterBuilder builder;
|
||||
std::string outputJsonString = Json::writeString(builder, outputJsonValue);
|
||||
return outputJsonString;
|
||||
}
|
||||
|
||||
|
||||
int ClientViewer::get_local_ip_using_create_socket(char* str_ip)
|
||||
{
|
||||
int status = -1;
|
||||
int af = AF_INET;
|
||||
int sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
struct sockaddr_in remote_addr;
|
||||
struct sockaddr_in local_addr;
|
||||
char *local_ip = NULL;
|
||||
socklen_t len = 0;
|
||||
|
||||
remote_addr.sin_family = AF_INET;
|
||||
remote_addr.sin_port = htons(53);
|
||||
remote_addr.sin_addr.s_addr = inet_addr("1.1.1.1");
|
||||
|
||||
len = sizeof(struct sockaddr_in);
|
||||
status = connect(sock_fd, (struct sockaddr*)&remote_addr, len);
|
||||
if(status != 0 ){
|
||||
printf("connect err \n");
|
||||
}
|
||||
|
||||
len = sizeof(struct sockaddr_in);
|
||||
getsockname(sock_fd, (struct sockaddr*)&local_addr, &len);
|
||||
|
||||
local_ip = inet_ntoa(local_addr.sin_addr);
|
||||
if(local_ip)
|
||||
{
|
||||
strcpy(str_ip, local_ip);
|
||||
status = 0;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
101
src/pClientViewer/ClientViewer.h
Normal file
101
src/pClientViewer/ClientViewer.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/************************************************************/
|
||||
/* NAME: Xiaobin Zeng */
|
||||
/* ORGN: MIT */
|
||||
/* FILE: ClientViewer.h */
|
||||
/* DATE: */
|
||||
/************************************************************/
|
||||
|
||||
#ifndef ClientViewer_HEADER
|
||||
#define ClientViewer_HEADER
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "MOOS/libMOOS/MOOSLib.h"
|
||||
#include "MOOS/libMOOS/Utils/MOOSThread.h"
|
||||
#include "MOOS/libMOOS/Utils/PeriodicEvent.h"
|
||||
#include <DUNE/DUNE.hpp>
|
||||
// #include "UDPCommunicationEvent.h"
|
||||
// #include "TCPCommunicationEvent.h"
|
||||
|
||||
struct Landmark {
|
||||
std::string name;
|
||||
float lon;
|
||||
float lat;
|
||||
float depth;
|
||||
float speed;
|
||||
float north;
|
||||
float east;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
struct WayPointBehavior
|
||||
{
|
||||
std::string name;
|
||||
std::string source;
|
||||
int priority;
|
||||
std::vector<Landmark> points;
|
||||
float duration;
|
||||
bool closedLoop;
|
||||
float constSpeed;
|
||||
int repeat;
|
||||
bool perpetual;
|
||||
float minDepth;
|
||||
float maxDepth;
|
||||
};
|
||||
|
||||
class ClientViewer : public CMOOSApp
|
||||
{
|
||||
public:
|
||||
ClientViewer();
|
||||
~ClientViewer();
|
||||
|
||||
protected: // Standard MOOSApp functions to overload
|
||||
bool OnNewMail(MOOSMSG_LIST &NewMail);
|
||||
bool Iterate();
|
||||
bool OnConnectToServer();
|
||||
bool OnStartUp();
|
||||
void RegisterVariables();
|
||||
void processMessage(DUNE::IMC::Message * message);
|
||||
|
||||
private:
|
||||
DUNE::IMC::Message * imcPollTCP();
|
||||
DUNE::IMC::Message * imcPollUDP();
|
||||
DUNE::Network::TCPSocket sock_tcp_send;
|
||||
DUNE::Network::UDPSocket sock_udp_receive;
|
||||
|
||||
bool tcpSendToServer(DUNE::IMC::Message * msg, std::string addr, int port);
|
||||
int get_local_ip_using_create_socket(char* str_ip);
|
||||
std::string SetPlan1(std::string sourceName, double stamp);
|
||||
std::string SetPlan2(std::string sourceName, double stamp);
|
||||
std::string ModifyPlan1(std::string sourceName, double stamp);
|
||||
int SetEntityStatus(DUNE::IMC::EntityParameter& subMsg, std::string name, std::string value);
|
||||
std::string generateEntityName(std::string parentName, std::string childName);
|
||||
std::string generateEntityValue(std::string value, std::string type);
|
||||
|
||||
DUNE::IO::Poll m_poll_0;
|
||||
DUNE::IO::Poll m_poll_1;
|
||||
DUNE::IO::Poll m_poll_2;
|
||||
uint8_t* udpReceiveBuffer;
|
||||
uint8_t* tcpReceiveBuffer;
|
||||
std::string SetPlan1();
|
||||
std::string SetPlan2();
|
||||
std::string ethernetIP;
|
||||
float initLon;
|
||||
float initLat;
|
||||
float initAlt;
|
||||
|
||||
CMOOSThread udpThread;
|
||||
|
||||
// UDPCommunicationEvent udpCommEvent;
|
||||
// TCPCommunicationEvent tcpCommEvent;
|
||||
};
|
||||
|
||||
#endif
|
||||
115
src/pClientViewer/ClientViewer_Info.cpp
Normal file
115
src/pClientViewer/ClientViewer_Info.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/****************************************************************/
|
||||
/* NAME: Xiaobin Zeng */
|
||||
/* ORGN: MIT Cambridge MA */
|
||||
/* FILE: ClientViewer_Info.cpp */
|
||||
/* DATE: Dec 29th 1963 */
|
||||
/****************************************************************/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include "ClientViewer_Info.h"
|
||||
#include "ColorParse.h"
|
||||
#include "ReleaseInfo.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// Procedure: showSynopsis
|
||||
|
||||
void showSynopsis()
|
||||
{
|
||||
blk("SYNOPSIS: ");
|
||||
blk("------------------------------------ ");
|
||||
blk(" The pClientViewer application is used for ");
|
||||
blk(" ");
|
||||
blk(" ");
|
||||
blk(" ");
|
||||
blk(" ");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// Procedure: showHelpAndExit
|
||||
|
||||
void showHelpAndExit()
|
||||
{
|
||||
blk(" ");
|
||||
blu("=============================================================== ");
|
||||
blu("Usage: pClientViewer file.moos [OPTIONS] ");
|
||||
blu("=============================================================== ");
|
||||
blk(" ");
|
||||
showSynopsis();
|
||||
blk(" ");
|
||||
blk("Options: ");
|
||||
mag(" --alias","=<ProcessName> ");
|
||||
blk(" Launch pClientViewer with the given process name ");
|
||||
blk(" rather than pClientViewer. ");
|
||||
mag(" --example, -e ");
|
||||
blk(" Display example MOOS configuration block. ");
|
||||
mag(" --help, -h ");
|
||||
blk(" Display this help message. ");
|
||||
mag(" --interface, -i ");
|
||||
blk(" Display MOOS publications and subscriptions. ");
|
||||
mag(" --version,-v ");
|
||||
blk(" Display the release version of pClientViewer. ");
|
||||
blk(" ");
|
||||
blk("Note: If argv[2] does not otherwise match a known option, ");
|
||||
blk(" then it will be interpreted as a run alias. This is ");
|
||||
blk(" to support pAntler launching conventions. ");
|
||||
blk(" ");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// Procedure: showExampleConfigAndExit
|
||||
|
||||
void showExampleConfigAndExit()
|
||||
{
|
||||
blk(" ");
|
||||
blu("=============================================================== ");
|
||||
blu("pClientViewer Example MOOS Configuration ");
|
||||
blu("=============================================================== ");
|
||||
blk(" ");
|
||||
blk("ProcessConfig = pClientViewer ");
|
||||
blk("{ ");
|
||||
blk(" AppTick = 4 ");
|
||||
blk(" CommsTick = 4 ");
|
||||
blk(" ");
|
||||
blk("} ");
|
||||
blk(" ");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// Procedure: showInterfaceAndExit
|
||||
|
||||
void showInterfaceAndExit()
|
||||
{
|
||||
blk(" ");
|
||||
blu("=============================================================== ");
|
||||
blu("pClientViewer INTERFACE ");
|
||||
blu("=============================================================== ");
|
||||
blk(" ");
|
||||
showSynopsis();
|
||||
blk(" ");
|
||||
blk("SUBSCRIPTIONS: ");
|
||||
blk("------------------------------------ ");
|
||||
blk(" NODE_MESSAGE = src_node=alpha,dest_node=bravo,var_name=FOO, ");
|
||||
blk(" string_val=BAR ");
|
||||
blk(" ");
|
||||
blk("PUBLICATIONS: ");
|
||||
blk("------------------------------------ ");
|
||||
blk(" Publications are determined by the node message content. ");
|
||||
blk(" ");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// Procedure: showReleaseInfoAndExit
|
||||
|
||||
void showReleaseInfoAndExit()
|
||||
{
|
||||
showReleaseInfo("pClientViewer", "gpl");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
18
src/pClientViewer/ClientViewer_Info.h
Normal file
18
src/pClientViewer/ClientViewer_Info.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/****************************************************************/
|
||||
/* NAME: Xiaobin Zeng */
|
||||
/* ORGN: MIT Cambridge MA */
|
||||
/* FILE: ClientViewer_Info.h */
|
||||
/* DATE: Dec 29th 1963 */
|
||||
/****************************************************************/
|
||||
|
||||
#ifndef ClientViewer_INFO_HEADER
|
||||
#define ClientViewer_INFO_HEADER
|
||||
|
||||
void showSynopsis();
|
||||
void showHelpAndExit();
|
||||
void showExampleConfigAndExit();
|
||||
void showInterfaceAndExit();
|
||||
void showReleaseInfoAndExit();
|
||||
|
||||
#endif
|
||||
|
||||
52
src/pClientViewer/main.cpp
Normal file
52
src/pClientViewer/main.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/************************************************************/
|
||||
/* NAME: Xiaobin Zeng */
|
||||
/* ORGN: MIT */
|
||||
/* FILE: main.cpp */
|
||||
/* DATE: */
|
||||
/************************************************************/
|
||||
|
||||
#include <string>
|
||||
#include "MBUtils.h"
|
||||
#include "ColorParse.h"
|
||||
#include "ClientViewer.h"
|
||||
#include "ClientViewer_Info.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
string mission_file;
|
||||
string run_command = argv[0];
|
||||
|
||||
for(int i=1; i<argc; i++) {
|
||||
string argi = argv[i];
|
||||
if((argi=="-v") || (argi=="--version") || (argi=="-version"))
|
||||
showReleaseInfoAndExit();
|
||||
else if((argi=="-e") || (argi=="--example") || (argi=="-example"))
|
||||
showExampleConfigAndExit();
|
||||
else if((argi == "-h") || (argi == "--help") || (argi=="-help"))
|
||||
showHelpAndExit();
|
||||
else if((argi == "-i") || (argi == "--interface"))
|
||||
showInterfaceAndExit();
|
||||
else if(strEnds(argi, ".moos") || strEnds(argi, ".moos++"))
|
||||
mission_file = argv[i];
|
||||
else if(strBegins(argi, "--alias="))
|
||||
run_command = argi.substr(8);
|
||||
else if(i==2)
|
||||
run_command = argi;
|
||||
}
|
||||
|
||||
if(mission_file == "")
|
||||
showHelpAndExit();
|
||||
|
||||
cout << termColor("green");
|
||||
cout << "pClientViewer launching as " << run_command << endl;
|
||||
cout << termColor() << endl;
|
||||
|
||||
ClientViewer ClientViewer;
|
||||
|
||||
ClientViewer.Run(run_command.c_str(), mission_file.c_str());
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
9
src/pClientViewer/pClientViewer.moos
Normal file
9
src/pClientViewer/pClientViewer.moos
Normal file
@@ -0,0 +1,9 @@
|
||||
//------------------------------------------------
|
||||
// pClientViewer config block
|
||||
|
||||
ProcessConfig = pClientViewer
|
||||
{
|
||||
AppTick = 4
|
||||
CommsTick = 4
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user