Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failed to parse urdf error message on launch #138

Merged
merged 2 commits into from
Jan 27, 2025
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
29 changes: 28 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,35 @@ on:
- released

jobs:
get-tag:
# Pre-job to fetch the latest tag
runs-on: ubuntu-latest
outputs:
major: ${{ steps.extract_tag.outputs.major }}
minor: ${{ steps.extract_tag.outputs.minor }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure all history and tags are fetched

- name: Get latest tag
id: extract_tag
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag: $latest_tag"

# Extract major and minor version from the tag
IFS='.' read -r major minor patch <<< "$latest_tag"
echo "Major: $major"
echo "Minor: $minor"

# Set as output variables
echo "::set-output name=major::$major"
echo "::set-output name=minor::$minor"
ci:
name: ${{ matrix.distro }}
needs: get-tag # Make sure the 'ci' job waits for the 'get-tag' job to finish
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -37,7 +64,7 @@ jobs:
distro: rolling
vcs-file: .github/workflows/dependencies.repos
container:
image: ghcr.io/tesseract-robotics/tesseract_qt:${{ matrix.os }}-${{ vars.TESSERACT_DOCKER_TAG }}
image: ghcr.io/tesseract-robotics/tesseract_qt:${{ matrix.os }}-${{ needs.get-tag.outputs.major }}.${{ needs.get-tag.outputs.minor }}
env:
CCACHE_DIR: ${{ github.workspace }}/${{ matrix.distro }}/.ccache
DEBIAN_FRONTEND: noninteractive
Expand Down
52 changes: 35 additions & 17 deletions tesseract_rviz/src/environment_monitor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,29 +217,47 @@ void EnvironmentMonitorProperties::onURDFDescriptionChanged()

auto env = std::make_shared<tesseract_environment::Environment>();
auto locator = std::make_shared<tesseract_rosutils::ROSResourceLocator>();
if (env->init(urdf_xml_string, srdf_xml_string, locator))
if (urdf_xml_string.empty())
{
data_->monitor = std::make_unique<tesseract_monitoring::ROSEnvironmentMonitor>(
data_->node, env, data_->urdf_description_string_property->getStdString());
if (data_->monitor != nullptr)
{
data_->render_manager =
std::make_shared<ROSSceneGraphRenderManager>(data_->component_info, data_->scene_manager, data_->scene_node);
data_->contact_results_render_manager = std::make_shared<ROSContactResultsRenderManager>(
data_->component_info, data_->scene_manager, data_->scene_node);

Q_EMIT componentInfoChanged(data_->component_info);

auto env_wrapper =
std::make_shared<tesseract_gui::MonitorEnvironmentWrapper>(data_->component_info, data_->monitor);
tesseract_gui::EnvironmentManager::set(env_wrapper);
data_->parent->setStatus(rviz_common::properties::StatusProperty::Error, "Tesseract", "URDF parameter is empty!");
return;
}

onJointStateTopicChanged();
if (!srdf_xml_string.empty())
{
if (!env->init(urdf_xml_string, srdf_xml_string, locator))
{
data_->parent->setStatus(
rviz_common::properties::StatusProperty::Error, "Tesseract", "URDF or SRDF file failed to parse");
return;
}
}
else
{
data_->parent->setStatus(rviz_common::properties::StatusProperty::Error, "Tesseract", "URDF file failed to parse");
if (!env->init(urdf_xml_string, locator))
{
data_->parent->setStatus(
rviz_common::properties::StatusProperty::Error, "Tesseract", "URDF file failed to parse");
return;
}
}

data_->monitor = std::make_unique<tesseract_monitoring::ROSEnvironmentMonitor>(
data_->node, env, data_->urdf_description_string_property->getStdString());
if (data_->monitor != nullptr)
{
data_->render_manager =
std::make_shared<ROSSceneGraphRenderManager>(data_->component_info, data_->scene_manager, data_->scene_node);
data_->contact_results_render_manager = std::make_shared<ROSContactResultsRenderManager>(
data_->component_info, data_->scene_manager, data_->scene_node);

Q_EMIT componentInfoChanged(data_->component_info);

auto env_wrapper =
std::make_shared<tesseract_gui::MonitorEnvironmentWrapper>(data_->component_info, data_->monitor);
tesseract_gui::EnvironmentManager::set(env_wrapper);

onJointStateTopicChanged();
}
}

Expand Down
Loading