pcb action interface

This commit is contained in:
acki
2025-05-14 21:47:28 -04:00
parent a03f22a84a
commit 4cee8b9d1a
2 changed files with 42 additions and 5 deletions

View File

@@ -28,13 +28,10 @@ namespace Modelec
~PCBActionInterface() override;
protected:
std::map<ASCState, int> asc_value_mapper_ = {
{LOW, 0},
{HIGH, 0},
};
std::map<ASCState, int> asc_value_mapper_;
std::map<int, std::map<int, int>> servo_pos_mapper_;
ASCState asc_state_ = LOW;
ASCState asc_state_;
std::map<int, int> servo_value_;
std::map<int, bool> relay_value_;

View File

@@ -153,6 +153,46 @@ namespace Modelec
relay_move_res_pub_ = this->create_publisher<modelec_interfaces::msg::ActionRelayState>(
"action/relay/move/res", 10);
asc_value_mapper_ = {
{LOW, 0},
{HIGH, 0}
};
SendOrder("ASC", {"LOW", std::to_string(0)});
SendOrder("ASC", {"HIGH", std::to_string(200)});
servo_pos_mapper_ = {
{0, {{0, 0}, {1, 0}}},
{1, {{0, 0}, {1, 0}}},
{2, {{0, 0}, {1, 0}}}
};
SendOrder("SERVO0", {"POS0", std::to_string(0)});
SendOrder("SERVO0", {"POS1", std::to_string(PI)});
SendOrder("SERVO1", {"POS0", std::to_string(0)});
SendOrder("SERVO1", {"POS1", std::to_string(PI)});
SendOrder("SERVO2", {"POS0", std::to_string(0)});
SendOrder("SERVO2", {"POS1", std::to_string(PI)});
asc_state_ = LOW;
SendMove("ASC", {"LOW"});
servo_value_ = {
{0, 0},
{1, 0},
{2, 0}
};
SendMove("SERVO0", {"POS0"});
SendMove("SERVO1", {"POS0"});
SendMove("SERVO2", {"POS0"});
relay_value_ = {
{0, false},
{1, false},
{2, false},
};
SendMove("RELAY0", {"0"});
SendMove("RELAY1", {"0"});
SendMove("RELAY2", {"0"});
}
PCBActionInterface::~PCBActionInterface()