Skip to content

Commit

Permalink
[drake_ros] Use modern drake::systems::Event API
Browse files Browse the repository at this point in the history
As of Drake v1.20, the old API is deprecated.
  • Loading branch information
jwnimmer-tri committed Aug 14, 2023
1 parent 656bbc7 commit a09719a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 1 addition & 5 deletions drake_ros/core/ros_publisher_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ RosPublisherSystem::RosPublisherSystem(

if (publish_triggers.find(drake::systems::TriggerType::kPerStep) !=
publish_triggers.end()) {
DeclarePerStepEvent(drake::systems::PublishEvent<double>(
[this](const drake::systems::Context<double>& context,
const drake::systems::PublishEvent<double>&) {
PublishInput(context);
}));
this->DeclarePerStepPublishEvent(&RosPublisherSystem::PublishInput);
}
// ^^^ Mostly copied from LcmPublisherSystem ^^^
}
Expand Down
10 changes: 5 additions & 5 deletions drake_ros/core/ros_subscriber_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ void RosSubscriberSystem::DoCalcNextUpdateTime(

// Create a unrestricted event and tie the handler to the corresponding
// function.
drake::systems::UnrestrictedUpdateEvent<double>::UnrestrictedUpdateCallback
callback = [this, serialized_message{std::move(message)}](
const drake::systems::Context<double>&,
const drake::systems::UnrestrictedUpdateEvent<double>&,
drake::systems::State<double>* state) {
auto callback = [this, serialized_message{std::move(message)}](
const drake::systems::System<double>&,
const drake::systems::Context<double>&,
const drake::systems::UnrestrictedUpdateEvent<double>&,
drake::systems::State<double>* state) {
// Deserialize the message and store it in the abstract state on the
// context
drake::systems::AbstractValues& abstract_state =
Expand Down

0 comments on commit a09719a

Please sign in to comment.