Skip to content

Commit 85fb44c

Browse files
committed
fix(ConnectModules): Use urdf_path for _real_urdf
For now we do not generate a connected robot module using the real urdf paths, we probably should. To support display as-is in ROS, we use the control urdf as real urdf.
1 parent 85ca13d commit 85fb44c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/mc_rbdyn/RobotModule_connect.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ RobotModule RobotModule::connect(const mc_rbdyn::RobotModule & other,
138138
// Build a new MultiBodyGraph from this and other
139139
auto & mbg = out.mbg;
140140
// Add all the bodies from other
141+
// TODO: if not merging with the base of the other robot module's tree, this should
142+
// only copy useful bodies down the graph
141143
for(size_t i = 0; i < other.mb.bodies().size(); ++i)
142144
{
143145
const auto & body = other.mb.body(static_cast<int>(i));
@@ -519,13 +521,24 @@ RobotModule RobotModule::connect(const mc_rbdyn::RobotModule & other,
519521
{
520522
std::string module_yaml = fmt::format("{}/{}.yaml", out.path, out.name);
521523
out._parameters = {"json", module_yaml};
524+
// FIXME: we should also generate the merged real_urdf,
525+
// use the control urdf as a substitute for now
526+
out._real_urdf = out.urdf_path;
522527
// Connected robots do not have a canonical representation
523528
// The generated "out" module will be used as the canonical module
524529
out._canonicalParameters.clear();
525530

526531
auto yaml = mc_rtc::ConfigurationLoader<mc_rbdyn::RobotModule>::save(out, false, {}, out.mb.joint(0).dof() == 0);
527532
yaml.save(module_yaml);
528-
mc_rtc::log::info("Connection done, result module in: {}", module_yaml);
533+
mc_rtc::log::info(R"(Connection done between "{2}" and "{3}" as "{4}":
534+
- result module: {0}
535+
- urdf path: {1}
536+
- real urdf path: {5}
537+
Tips:
538+
- You may: visualize it with mc_robot_visualization json {0}
539+
- Load it with [json, {0}] as module parameters
540+
)",
541+
module_yaml, out.urdf_path, name, other.name, out.name, out._real_urdf);
529542
}
530543

531544
return out;

0 commit comments

Comments
 (0)