Skip to content

Commit

Permalink
Avoid exporting SolidReference to URDF (#4102)
Browse files Browse the repository at this point in the history
* Avoid exporting SolidReference to URDF

* changelog

* Update docs/reference/changelog-r2022.md

Co-authored-by: Benjamin Hug <[email protected]>

Co-authored-by: Olivier Michel <[email protected]>
Co-authored-by: Benjamin Hug <[email protected]>
  • Loading branch information
3 people authored Jan 12, 2022
1 parent 85016b2 commit f0d15ee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/reference/changelog-r2022.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Webots R2022 Change Log


## Webots R2022a Revision 1
Released on XX XX, 2022.

- Bug fixes
- Fixed the URDF exportation of [SolidReference](solidreference.md) nodes ([#4102](https://github.com/cyberbotics/webots/pull/4102)).

## Webots R2022a
Released on December 21th, 2022.

Expand Down
2 changes: 1 addition & 1 deletion src/webots/nodes/WbBallJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ void WbBallJoint::updateJointAxisRepresentation() {

void WbBallJoint::writeExport(WbVrmlWriter &writer) const {
if (writer.isUrdf() && solidEndPoint()) {
warn(tr("Exporting 'BallJoint' nodes to URDF is currently not supported"));
this->warn("Exporting 'BallJoint' nodes to URDF is currently not supported");
return;
}
WbBasicJoint::writeExport(writer);
Expand Down
6 changes: 6 additions & 0 deletions src/webots/nodes/WbJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "WbNodeUtilities.hpp"
#include "WbPositionSensor.hpp"
#include "WbRobot.hpp"
#include "WbSolidReference.hpp"
#include "WbWrenRenderingContext.hpp"

#include <wren/config.h>
Expand Down Expand Up @@ -321,6 +322,11 @@ const QString WbJoint::urdfName() const {

void WbJoint::writeExport(WbVrmlWriter &writer) const {
if (writer.isUrdf() && solidEndPoint()) {
if (dynamic_cast<WbSolidReference *>(mEndPoint->value())) {
this->warn("Exporting a Joint node with a SolidRefernce endpoint to URDF is not supported.");
return;
}

const WbNode *const parentRoot = findUrdfLinkRoot();
const WbVector3 currentOffset = solidEndPoint()->translation() - anchor();
const WbVector3 translation = solidEndPoint()->translationFrom(parentRoot) - currentOffset + writer.jointOffset();
Expand Down

0 comments on commit f0d15ee

Please sign in to comment.