Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ jobs:
with:
python-version: 3.11

# Install clang + libc++ (needed for C++17 build with Bazel)
- name: Install clang and libc++
# Install clang + libstdc++ (needed for C++17 build with Bazel)
- name: Install clang and libstdc++
run: |
sudo apt-get update
sudo apt-get install -y clang libc++-dev libc++abi-dev
sudo apt-get install -y clang libstdc++-14-dev

# Mount Bazel cache
- name: Mount bazel caches
Expand Down
2 changes: 1 addition & 1 deletion libs/api/include/rtbot/OperatorJson.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class OperatorJson {
} else if (type == "Add") {
j["value"] = std::dynamic_pointer_cast<Add>(op)->get_value();
} else if (type == "Ignore") {
j["value"] = std::dynamic_pointer_cast<Ignore>(op)->get_count();
j["count"] = std::dynamic_pointer_cast<Ignore>(op)->get_count();
} else if (type == "Linear") {
j["coefficients"] = std::dynamic_pointer_cast<Linear>(op)->get_coefficients();
} else if (type == "PeakDetector") {
Expand Down
8 changes: 6 additions & 2 deletions libs/api/src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ using json = nlohmann::json;

void to_json(json& j, const ProgramMsgBatch& batch) {
j = json::object();
for (const auto& [op_id, op_batch] : batch) {
for (const auto& op_kv : batch) {
const auto& op_id = op_kv.first;
const auto& op_batch = op_kv.second;
j[op_id] = json::object();
for (const auto& [port_name, msgs] : op_batch) {
for (const auto& port_kv : op_batch) {
const auto& port_name = port_kv.first;
const auto& msgs = port_kv.second;
j[op_id][port_name] = json::array();
for (const auto& msg : msgs) {
if (auto* num_msg = dynamic_cast<const Message<NumberData>*>(msg.get())) {
Expand Down
2 changes: 1 addition & 1 deletion libs/core/include/rtbot/Input.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Input : public Operator {
if (!PortType::is_valid_port_type(type)) {
throw std::runtime_error("Unknown port type: " + type);
}
PortType::add_port(*this, type, true, true);
PortType::add_port(*this, type, true, false, true);
last_sent_times_.push_back(0);
port_type_names_.push_back(type);
}
Expand Down
8 changes: 4 additions & 4 deletions libs/core/include/rtbot/Join.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Join : public Operator {
throw std::runtime_error("Unknown port type: " + type);
}

PortType::add_port(*this, type, true, false); // input only
PortType::add_port(*this, type, true, false, false); // input only
data_time_tracker_[num_data_ports() - 1] = std::set<timestamp_t>();
port_type_names_.push_back(type);
}
Expand All @@ -40,7 +40,7 @@ class Join : public Operator {
if (!PortType::is_valid_port_type(type)) {
throw std::runtime_error("Unknown port type: " + type);
}
PortType::add_port(*this, type, false, true); // output only
PortType::add_port(*this, type, false, false, true); // output only
}
}

Expand All @@ -55,7 +55,7 @@ class Join : public Operator {
throw std::runtime_error("Unknown port type: " + type);
}

PortType::add_port(*this, type, true, true);
PortType::add_port(*this, type, true, false, true);
data_time_tracker_[num_data_ports() - 1] = std::set<timestamp_t>();
port_type_names_.push_back(type);
}
Expand All @@ -70,7 +70,7 @@ class Join : public Operator {

std::string port_type = PortType::get_port_type<T>();
for (size_t i = 0; i < num_ports; ++i) {
PortType::add_port(*this, port_type, true, true);
PortType::add_port(*this, port_type, true, false, true);
data_time_tracker_[i] = std::set<timestamp_t>();
port_type_names_.push_back(port_type);
}
Expand Down
2 changes: 1 addition & 1 deletion libs/core/include/rtbot/Output.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Output : public Operator {
port_type_names_.push_back(type);

// Add input port and matching output port
PortType::add_port(*this, type, true, true); // input port
PortType::add_port(*this, type, true, false, true); // input port
}
}

Expand Down
4 changes: 2 additions & 2 deletions libs/core/include/rtbot/Pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Pipeline : public Operator {
throw std::runtime_error("Unknown input port type: " + type);
}
// Add data input port
PortType::add_port(*this, type, true, false);
PortType::add_port(*this, type, true, false, false);
input_port_types_.push_back(type);
}

Expand All @@ -42,7 +42,7 @@ class Pipeline : public Operator {
throw std::runtime_error("Unknown output port type: " + type);
}
// Add output port
PortType::add_port(*this, type, false, true);
PortType::add_port(*this, type, false, false, true);
output_port_types_.push_back(type);
}
}
Expand Down
11 changes: 6 additions & 5 deletions libs/core/include/rtbot/PortType.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,30 @@ class PortType {

// Helper method to add port of specified type to an operator
template <typename OperatorType>
static void add_port(OperatorType& op, const std::string& port_type, bool is_data = true, bool add_output = false) {
static void add_port(OperatorType& op, const std::string& port_type, bool is_data = true, bool is_control = false,
bool add_output = false) {
if (port_type == NUMBER) {
if (is_data)
op.template add_data_port<NumberData>();
else
else if (is_control)
op.template add_control_port<NumberData>();
if (add_output) op.template add_output_port<NumberData>();
} else if (port_type == BOOLEAN) {
if (is_data)
op.template add_data_port<BooleanData>();
else
else if (is_control)
op.template add_control_port<BooleanData>();
if (add_output) op.template add_output_port<BooleanData>();
} else if (port_type == VECTOR_NUMBER) {
if (is_data)
op.template add_data_port<VectorNumberData>();
else
else if (is_control)
op.template add_control_port<VectorNumberData>();
if (add_output) op.template add_output_port<VectorNumberData>();
} else if (port_type == VECTOR_BOOLEAN) {
if (is_data)
op.template add_data_port<VectorBooleanData>();
else
else if (is_control)
op.template add_control_port<VectorBooleanData>();
if (add_output) op.template add_output_port<VectorBooleanData>();
} else {
Expand Down
Loading