Skip to content

Commit

Permalink
Fix #31: RxROS operators should use subscribe_on rather than observe_on
Browse files Browse the repository at this point in the history
  • Loading branch information
henrik7264 authored and gavanderhoorn committed Oct 7, 2019
1 parent 024a92b commit 6218d6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rxros/include/rxros/rxros.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ namespace rxros
auto publish_to_topic(const std::string &topic, const uint32_t queue_size = 10) {
return [=](auto&& source) {
ros::Publisher publisher(rxros::node::get_handle().advertise<T>(topic, queue_size));
source.observe_on(rxcpp::synchronize_new_thread()).subscribe(
source.subscribe_on(rxcpp::synchronize_new_thread()).subscribe(
[=](const T& msg) {publisher.publish(msg);});
return source;};}

Expand Down
4 changes: 2 additions & 2 deletions rxros_tf/include/rxros_tf/rxros_tf.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ namespace rxros
auto send_transform() {
return [=](auto&& source) {
tf::TransformBroadcaster transformBroadcaster;
source.observe_on(rxcpp::synchronize_new_thread()).subscribe(
source.subscribe_on(rxcpp::synchronize_new_thread()).subscribe(
[&](const tf::StampedTransform& stf) {transformBroadcaster.sendTransform(stf);});
return source;};}


auto send_transform(const std::string &parent_frameId, const std::string &child_frameId) {
return [=](auto&& source) {
tf::TransformBroadcaster transformBroadcaster;
source.observe_on(rxcpp::synchronize_new_thread()).subscribe(
source.subscribe_on(rxcpp::synchronize_new_thread()).subscribe(
[&](const tf::Transform& tf) {transformBroadcaster.sendTransform(tf::StampedTransform(tf, ros::Time::now(), parent_frameId, child_frameId));});
return source;};}

Expand Down

0 comments on commit 6218d6e

Please sign in to comment.