43 defs->defineOptionalProperty(
44 "updateFrequency", updateFrequencyHz,
"Target number of updates per second.");
45 defs->optional(gui.useCollisionModel,
47 "Use the collision model for visualization");
49 defs->optional(gui.showRobotNodeFrames,
50 "ShowRobotNodeFrames",
51 "If true, show frames of robot nodes (can be changed in RemoteGui).");
59 return "RobotToArViz";
75 VirtualRobot::RobotIO::RobotDescription::eStructure);
83 if (!trySetFilePathFromDataDir(this->robotViz, robot->getFilename()))
86 this->robotViz.
file(
"", robot->getFilename());
111 using namespace RemoteGui::Client;
116 tab.showRobotNodeFrames.setValue(gui.showRobotNodeFrames);
117 root.
add(
Label(
"Show Robot Node Frames"), {row, 0})
118 .add(tab.showRobotNodeFrames, {row, 1});
121 tab.useCollisionModel.setValue(gui.useCollisionModel);
122 root.
add(
Label(
"Use Collision Model"), {row, 0}).add(tab.useCollisionModel, {row, 1});
131 if (tab.showRobotNodeFrames.hasValueChanged())
133 std::scoped_lock lock(guiMutex);
134 gui.showRobotNodeFrames = tab.showRobotNodeFrames.getValue();
136 if (tab.useCollisionModel.hasValueChanged())
138 std::scoped_lock lock(guiMutex);
139 gui.useCollisionModel = tab.useCollisionModel.getValue();
144 RobotToArViz::updateRobotRun()
147 while (task and not task->isStopped())
151 metronome.waitForNextTick();
156 RobotToArViz::updateRobotOnce()
162 std::scoped_lock lock(guiMutex);
166 std::vector<viz::Layer> layers;
168 robotViz.
joints(robot->getConfig()->getRobotNodeJointValueMap())
169 .
pose(robot->getGlobalPose());
171 if (gui.useCollisionModel)
181 layerRobot.
add(robotViz);
186 if (gui.showRobotNodeFrames)
188 for (
const auto& node : robot->getRobotNodes())
198 RobotToArViz::trySetFilePathFromDataDir(
viz::Robot& robotViz,
const std::string& absolutePath)
201 std::filesystem::path filepath = absolutePath;
203 for (
auto it = filepath.begin(); it != filepath.end(); ++it)
209 std::filesystem::path localPath = *jt;
211 for (; jt != filepath.end(); ++jt)
217 std::string
package = *it;
219 robotViz.
file(package, localPath.string());