Added Root & new Thing ref. constructor
This commit is contained in:
parent
17de9db0be
commit
3f8eadf8cc
24
Thing.cpp
24
Thing.cpp
@ -20,11 +20,27 @@ namespace RoboidControl {
|
|||||||
|
|
||||||
#pragma region Init
|
#pragma region Init
|
||||||
|
|
||||||
// Thing::Thing(unsigned char thingType)
|
Thing Root = Thing(Thing::Type::Undetermined, Root);
|
||||||
// : Thing(IsolatedParticipant::Isolated(), thingType) {}
|
|
||||||
|
|
||||||
Thing::Thing(Participant* owner,
|
Thing::Thing(unsigned char thingType, Thing& parent) {
|
||||||
unsigned char thingType) {
|
this->type = thingType;
|
||||||
|
|
||||||
|
this->position = Spherical::zero;
|
||||||
|
this->positionUpdated = true;
|
||||||
|
this->orientation = SwingTwist::identity;
|
||||||
|
this->orientationUpdated = true;
|
||||||
|
this->hierarchyChanged = true;
|
||||||
|
|
||||||
|
this->linearVelocity = Spherical::zero;
|
||||||
|
this->angularVelocity = Spherical::zero;
|
||||||
|
|
||||||
|
// std::cout << "add thing [" << (int)this->id << "] to owner "
|
||||||
|
// << this->owner->ipAddress << ":" << this->owner->port <<
|
||||||
|
// std::endl;
|
||||||
|
this->owner->Add(this, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Thing::Thing(Participant* owner, unsigned char thingType) {
|
||||||
// unsigned char thingId) {
|
// unsigned char thingId) {
|
||||||
if (owner == nullptr)
|
if (owner == nullptr)
|
||||||
owner = IsolatedParticipant::Isolated();
|
owner = IsolatedParticipant::Isolated();
|
||||||
|
18
Thing.h
18
Thing.h
@ -41,10 +41,9 @@ class Thing {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#pragma region Init
|
#pragma region Init
|
||||||
|
static Thing Root; // = Thing(Type::Undetermined, Root);
|
||||||
|
|
||||||
/// @brief Create a new thing without communication abilities
|
Thing(unsigned char thingType = Type::Undetermined, Thing& parent = Root);
|
||||||
/// @param thingType The type of thing (can use Thing::Type)
|
|
||||||
//Thing(unsigned char thingType = Type::Undetermined);
|
|
||||||
|
|
||||||
/// @brief Create a new thing for a participant
|
/// @brief Create a new thing for a participant
|
||||||
/// @param owner The owning participant
|
/// @param owner The owning participant
|
||||||
@ -61,9 +60,12 @@ class Thing {
|
|||||||
/// @param thingId The ID of the thing, leave out or set to zero to generate
|
/// @param thingId The ID of the thing, leave out or set to zero to generate
|
||||||
/// an ID
|
/// an ID
|
||||||
/// @note The owner will be the same as the owner of the parent thing
|
/// @note The owner will be the same as the owner of the parent thing
|
||||||
Thing(Thing* parent, unsigned char thingType = 0); //, unsigned char thingId = 0);
|
Thing(Thing* parent,
|
||||||
|
unsigned char thingType = 0); //, unsigned char thingId = 0);
|
||||||
|
|
||||||
static Thing Reconstruct(Participant* owner, unsigned char thingType, unsigned char thingId);
|
static Thing Reconstruct(Participant* owner,
|
||||||
|
unsigned char thingType,
|
||||||
|
unsigned char thingId);
|
||||||
|
|
||||||
#pragma endregion Init
|
#pragma endregion Init
|
||||||
|
|
||||||
@ -201,9 +203,11 @@ class Thing {
|
|||||||
/// parent's orientation
|
/// parent's orientation
|
||||||
SwingTwist orientation;
|
SwingTwist orientation;
|
||||||
|
|
||||||
/// @brief The linear velocity of the thing in local space, in meters per second
|
/// @brief The linear velocity of the thing in local space, in meters per
|
||||||
|
/// second
|
||||||
Spherical linearVelocity;
|
Spherical linearVelocity;
|
||||||
/// @brief The angular velocity of the thing in local space, in degrees per second
|
/// @brief The angular velocity of the thing in local space, in degrees per
|
||||||
|
/// second
|
||||||
Spherical angularVelocity;
|
Spherical angularVelocity;
|
||||||
|
|
||||||
#pragma endregion Pose
|
#pragma endregion Pose
|
||||||
|
Loading…
x
Reference in New Issue
Block a user