//
// Created by bastian on 01.04.22.
//

#include "SetRobotVelocity.h"


BT::NodeStatus BT::SetRobotVelocity::tick() {
    double velocity;
    if(!getInput<double>("velocity",velocity)){
        std::cout<<"No velocity given."<<std::endl;
        return NodeStatus::FAILURE;
    }
    connection->setSpeedMultiplier(velocity);
    return NodeStatus::SUCCESS;
}

BT::PortsList BT::SetRobotVelocity::providedPorts() {
    return {
            InputPort<double>("velocity"),
    };
}

BT::SetRobotVelocity::SetRobotVelocity(const std::string &name, const BT::NodeConfiguration &config, std::shared_ptr<MoveConnection> connection) : SyncActionNode(
        name, config) {
    this->connection = connection;
}
