PR2 / pr2_controllers

The controllers that run in realtime on the PR2 and supporting packages.
47 stars 35 forks source link

Joint calibration controller uses non realtime safe in update loop (ros ticket #3949) #293

Closed ahendrix closed 11 years ago

ahendrix commented 11 years ago

You may be able to correct me about this update loop stuff, but I thought "push back" wasn't safe in the update loop.

From pr2_calibration_controllers/src/joint_calibration_controller.cpp

{{{ case MOVING_TOHIGH: { vc.setCommand(searchvelocity);

if (actuator_->state_.calibration_reading_ & 1)
{
  pr2_hardware_interface::Actuator a;
  pr2_mechanism_model::JointState j;
  std::vector<pr2_hardware_interface::Actuator*> fake_a;
  std::vector<pr2_mechanism_model::JointState*> fake_j;
  fake_a.push_back(&a);
  fake_j.push_back(&j);

  fake_a[0]->state_.position_ = actuator_->state_.last_calibration_rising_edge_;
  transmission_->propagatePosition(fake_a, fake_j);

  // Where was the joint when the optical switch triggered?
  fake_a[0]->state_.position_ = actuator_->state_.last_calibration_rising_edge_;
  transmission_->propagatePosition(fake_a, fake_j);

  // What is the actuator position at the joint's zero?
  assert(joint_->joint_->calibration);
  fake_j[0]->position_ = fake_j[0]->position_ - reference_position_;
  transmission_->propagatePositionBackwards(fake_j, fake_a);

  actuator_->state_.zero_offset_ = fake_a[0]->state_.position_;
  joint_->calibrated_ = true;

  state_ = CALIBRATED;
  vc_.setCommand(0.0);
}

}}}

trac data:

ahendrix commented 11 years ago

[sglaser] r34337