Gazebo | Ignition | Community
Ask Your Question

Error when setting dynamically created joints axis in Gazebo 1.8.0

asked 2013-05-14 10:00:56 -0500

AndreiHaidu gravatar image

updated 2013-05-15 13:45:10 -0500


I am using Gazebo 1.8.0, during the simulation I create dynamically joints between objects, but when I set their axis I get the following error (this used to work on older Gazebo versions):

Error [] Missing element description for [axis]
gazebo: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr<T>::operator->() const [with T = sdf::Element]: Assertion `px != 0' failed.

This happens when I use the SetAxis() function

math::Vector3 axis;
this->myJoint->SetAxis(0, axis);

Without it, the joint creation works without any problems.
I noticed a similar error in this question, not sure if they are related, plus it says that it is fixed since release 1.6.3

UPDATE!!! (the working code, thanks to @scpeters, after adding the Load() function):

// create the joint for the given model
    this->myJoint = this->model->GetWorld()->GetPhysicsEngine()->CreateJoint("revolute",  this->model);

// attach joint to links
    this->myJoint->Attach(spatula_link, palm_link);

// load the joint, and set up its anchor point
    this->myJoint->Load(spatula_link, palm_link, math::Pose(spatula_link->GetWorldPose().pos, math::Quaternion()));

// set the axis of revolution
    this->myJoint->SetAxis(0, axis);

// set other joint attributes
    this->myJoint->SetAttribute("stop_cfm",0, this->stop_cfm);
    this->myJoint->SetAttribute("stop_erp",0, this->stop_erp);
    this->myJoint->SetAttribute("hi_stop",0, this->hi_stop);
    this->myJoint->SetAttribute("lo_stop",0, this->lo_stop);

Thanks, Andrei

edit retag flag offensive close merge delete


Can you show a bit more code that you use for creating the joints? I think the order in which you call the functions matters. For example in [VRCPlugin::AddJoint](, the order is joint = world->GetPhysicsEngine()->CreateJoint(), then joint->Attach(), then joint->Load(), then joint->SetAxis(), then eventually joint->Init().

scpeters gravatar imagescpeters ( 2013-05-14 23:50:02 -0500 )edit

Hey, thanks for the answer, It worked after I used the `Load()` function, but without `Init()` because then it sets some configured values to default ones. You should write your answer with the example link as an answer so I can mark it resolved. Cheers

AndreiHaidu gravatar imageAndreiHaidu ( 2013-05-15 03:30:17 -0500 )edit

If you don't mind posting what you did, I'll upvote it.

scpeters gravatar imagescpeters ( 2013-05-15 13:19:56 -0500 )edit

I'm battling with this problem on this package: (self contained) I get a crash when linking two models, and it seems I'm doing it like everyone else. The crash is: ***** Internal Program Error - assertion (self->inertial != __null) failed in static void gazebo::physics::ODELink::MoveCallback(dBodyID): /tmp/buildd/gazebo4-4.1.3/gazebo/physics/ode/ Inertial pointer is NULL

awesomebytes gravatar imageawesomebytes ( 2016-04-19 09:55:03 -0500 )edit

The package is finished with my bug solved, you can attach any two links of the simulation and later detach them: should work on gazebo 2, 4 & 7.

awesomebytes gravatar imageawesomebytes ( 2016-04-22 07:07:29 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-15 14:45:58 -0500

scpeters gravatar image

Answered in edited question.

edit flag offensive delete link more

Question Tools


Asked: 2013-05-14 10:00:56 -0500

Seen: 842 times

Last updated: May 15 '13