Home | Tutorials | Wiki | Issues
Ask Your Question

Custom plugins causes assertion error of boost

asked 2018-06-01 02:11:19 -0500

dnikitop gravatar image

Created a custom plugin to apply force to a link. When only one of these plugins are applied to the urdf, the system works fine. When two are applied to different links, this error pops up and gazebo does not open. Also use ros_control for motor actuation. This error happens even if that is disabled as well.

public: virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
  // Store the pointer to the model
  this->model = _parent;
  this->link_name = _sdf->GetElement("BodyName")->Get<std::string>();
  this->link = model->GetLink(this->link_name);

  ros::Duration gazebo_period(model->GetWorld()->Physics()->GetMaxStepSize());
  // Listen to the update event. This event is broadcast every
  // simulation iteration.

  this->rosNode.reset(new ros::NodeHandle(link_name));

  // central_pub = n.advertise<std_msgs::Float32>("force_node_out",10);
  ros::SubscribeOptions so =
       "/" + link_name + "/for_cmd",
       boost::bind(&ModelPush::OnRosMsg, this, _1),
       ros::VoidPtr(), &this->rosQueue);
   this->rosSub = this->rosNode->subscribe(so);

  // Spin up the queue helper thread.
  this->rosQueueThread =
  std::thread(boost::bind(&ModelPush::QueueThread, this));

  this->updateConnection = event::Events::ConnectWorldUpdateEnd(
      boost::bind(&ModelPush::OnUpdate, this));

// Called by the world update start event
public:  void OnUpdate()

The error given... C:\fakepath\GazeboError.png

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-02 10:52:11 -0500

You should check if this->link is not null, you could be asking for the wrong name, and then the program crashes when you try to access it on OnUpdate.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-06-01 02:11:19 -0500

Seen: 55 times

Last updated: Jun 02 '18