Release thing method added

This commit is contained in:
Pascal Serrarens 2024-10-22 11:25:38 +02:00
parent f77b00f639
commit 9b6bce5155
2 changed files with 10 additions and 3 deletions

View File

@ -31,7 +31,7 @@ Roboid::Roboid(Propulsion *propulsion) : Roboid() {
propulsion->roboid = this;
}
void Passer::RoboidControl::Roboid::SetName(char *name) { this->name = name; }
void Roboid::SetName(const char *name) { this->name = name; }
#include <Arduino.h>
void Roboid::Update(unsigned long currentTimeMs) {
@ -119,3 +119,9 @@ void Roboid::AddChild(Thing *child) {
this->perception->AddSensor(childSensor);
}
}
void Passer::RoboidControl::Roboid::Release(Thing *child) {
if (RemoveChild(child) != nullptr)
this->perception->AddTrackedObject(nullptr, Spherical16::zero,
SwingTwist16::identity, child->type);
}

View File

@ -20,8 +20,8 @@ public:
/// @param propulsion The Propulsion implementation to use for this Roboid
Roboid(Propulsion *propulsion);
char *name = nullptr;
void SetName(char *name);
const char *name = nullptr;
void SetName(const char *name);
/// @brief Update the state of the Roboid
/// @param currentTimeMs The time in milliseconds when calling this
@ -67,6 +67,7 @@ public:
virtual void SetOrientation(SwingTwist16 worldOrientation);
virtual void AddChild(Thing *child) override;
void Release(Thing *child);
private:
/// @brief The position of the roboid in carthesian coordinates in world space