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
45 changes: 32 additions & 13 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ c-compiler = "*"
cxx-compiler = "*"
pkg-config = "*"
qt-main = "*"
nlohmann_json = "*"
nlohmann_json = "3.11.3.*"
tomlplusplus = "3.3.0.*"
rust = ">=1.96.0,<1.97"

# ─── Workspace tasks ────────────────────────────────────────────────────────────
Expand Down
16 changes: 8 additions & 8 deletions ros2_ws/src/mobile_manipulator_hmi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,19 @@ find_package(rai_interfaces REQUIRED) # custom Utilization message
# add source directory to include path
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

# --- nlohmann/json dependency ---
include(FetchContent)
FetchContent_Declare(
json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.3 # or latest
)
FetchContent_MakeAvailable(json)
# --- nlohmann/json dependency (from conda-forge) ---
find_package(nlohmann_json REQUIRED)

# --- toml++ dependency (config.toml parsing, from conda-forge) ---
find_package(tomlplusplus REQUIRED)

set(PROJECT_SOURCES
main.cpp
ZoomableGraphicsView.h
ZoomableGraphicsView.cpp
Config.h
ModelConfig.h
ModelConfig.cpp
LogItemWidget.h
LogItemWidget.cpp
LogView.h
Expand Down Expand Up @@ -127,6 +126,7 @@ target_link_libraries(MobileManipulatorHMI PRIVATE
cv_bridge::cv_bridge
${OpenCV_LIBS} # OpenCV provides targets like OpenCV::Core, but ${OpenCV_LIBS} is usually set
nlohmann_json::nlohmann_json
tomlplusplus::tomlplusplus
)

# Install targets
Expand Down
2 changes: 0 additions & 2 deletions ros2_ws/src/mobile_manipulator_hmi/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ namespace HardcodedConfig {
const static char UserPromptTopic[] = "/user_tasks";
const static char OrchestratorHeartbeat[] = "/orchestrator/heartbeat"; // TODO: Get actual topic names
//
const static QString SelectedLLMModel = "gpt-oss-20B";
const static QString SelectedVLMModel = "LFM2-VL-3B | Gemma4-4B";
const static char VLMTopic[] = "/vlm_topic";
const static char EmergencyStopTopic[] = "/emergency_stop";

Expand Down
72 changes: 72 additions & 0 deletions ros2_ws/src/mobile_manipulator_hmi/ModelConfig.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (C) 2026 Advanced Micro Devices, Inc.
// Developed by Robotec.ai sp. z o.o.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "ModelConfig.h"

#include <QStringList>
#include <toml++/toml.h>

QString defaultModelConfigPath()
{
const QString demoRoot = qEnvironmentVariable("DEMO_ROOT");
if (!demoRoot.isEmpty()) {
return demoRoot + "/config.toml";
}
return QStringLiteral("config.toml");
}

ModelNames loadModelNames(const QString &configPath)
{
ModelNames names{QStringLiteral("unknown"), QStringLiteral("unknown")};

toml::table config;
try {
config = toml::parse_file(configPath.toStdString());
} catch (const std::exception &) {
return names;
}

const toml::table *endpoints = config["endpoints"].as_table();
if (!endpoints) {
return names;
}

// LLM: the endpoint referenced by [general].llm
if (auto llmRef = config["general"]["llm"].value<std::string>()) {
if (auto model = (*endpoints)[*llmRef]["model"].value<std::string>()) {
names.llm = QString::fromStdString(*model);
}
}

// VLM: every distinct model served by an endpoint of type "vlm"
QStringList vlmModels;
for (const auto &[endpointName, node] : *endpoints) {
const toml::table *endpoint = node.as_table();
if (!endpoint || (*endpoint)["type"].value_or(std::string{}) != "vlm") {
continue;
}
if (auto model = (*endpoint)["model"].value<std::string>()) {
const QString modelName = QString::fromStdString(*model);
if (!vlmModels.contains(modelName)) {
vlmModels << modelName;
}
}
}
if (!vlmModels.isEmpty()) {
names.vlm = vlmModels.join(QStringLiteral(" | "));
}

return names;
}
31 changes: 31 additions & 0 deletions ros2_ws/src/mobile_manipulator_hmi/ModelConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (C) 2026 Advanced Micro Devices, Inc.
// Developed by Robotec.ai sp. z o.o.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include <QString>

struct ModelNames {
QString llm;
QString vlm;
};

// $DEMO_ROOT/config.toml when DEMO_ROOT is set, otherwise ./config.toml
// (which may be a symlink placed next to the HMI's working directory).
QString defaultModelConfigPath();

// Reads the inference SSOT (config.toml) and returns the model names to
// display. Never throws: a missing or malformed file yields "unknown".
ModelNames loadModelNames(const QString &configPath);
6 changes: 4 additions & 2 deletions ros2_ws/src/mobile_manipulator_hmi/hmiWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <QTransform>
#include <QTime>
#include "LogView.h"
#include "ModelConfig.h"
#include "ParseRaiData.h"

QString HRIMessageToString(const ParseRaiData::HRIMessage& msg)
Expand Down Expand Up @@ -273,8 +274,9 @@ HMIWindow::HMIWindow(QWidget *parent)
ui->graphicsViewMap->setDragMode(QGraphicsView::RubberBandDrag);
ui->graphicsViewMap->setRenderHint(QPainter::Antialiasing);
ui->graphicsViewMap->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
ui->llm_text_field->setText(HardcodedConfig::SelectedLLMModel);
ui->vlm_text_field->setText(HardcodedConfig::SelectedVLMModel);
const ModelNames models = loadModelNames(defaultModelConfigPath());
ui->llm_text_field->setText(models.llm);
ui->vlm_text_field->setText(models.vlm);

logView_ = new LogView(this);
queueView_ = new LogView(this);
Expand Down
Loading