Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated spin_until_future_complete #512

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tf2_ros/test/test_buffer_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ TEST_F(TestBufferServer, lookup_transform_available)
transform.rotation.w = 1.0;
setTransform("test_target_link", "test_source_link", transform);

auto spin_result = executor_.spin_until_future_complete(
auto spin_result = executor_.spin_until_complete(
result_ready_future, std::chrono::seconds(3));
ASSERT_EQ(spin_result, rclcpp::FutureReturnCode::SUCCESS);

Expand All @@ -192,7 +192,7 @@ TEST_F(TestBufferServer, lookup_transform_timeout)
"test_target_link", "test_source_link", std::chrono::seconds(1));

auto start_time = std::chrono::system_clock::now();
auto spin_result = executor_.spin_until_future_complete(
auto spin_result = executor_.spin_until_complete(
result_ready_future, std::chrono::seconds(3));
ASSERT_EQ(spin_result, rclcpp::FutureReturnCode::SUCCESS);
auto end_time = std::chrono::system_clock::now();
Expand All @@ -213,7 +213,7 @@ TEST_F(TestBufferServer, lookup_transform_delayed)
"test_target_link", "test_source_link", std::chrono::seconds(5));

// Expect executor to timeout since transform is not available yet
auto spin_result = executor_.spin_until_future_complete(
auto spin_result = executor_.spin_until_complete(
result_ready_future, std::chrono::seconds(1));
EXPECT_EQ(spin_result, rclcpp::FutureReturnCode::TIMEOUT);

Expand All @@ -228,7 +228,7 @@ TEST_F(TestBufferServer, lookup_transform_delayed)
setTransform("test_target_link", "test_source_link", transform);

// Wait some more
spin_result = executor_.spin_until_future_complete(
spin_result = executor_.spin_until_complete(
result_ready_future, std::chrono::seconds(3));
ASSERT_EQ(spin_result, rclcpp::FutureReturnCode::SUCCESS);

Expand Down
13 changes: 7 additions & 6 deletions tf2_tools/tf2_tools/view_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def main():
parser.add_argument(
'--wait-time', '-t', type=float, default=5.0,
help='Listen to the /tf topic for this many seconds before rendering the frame tree')
parser.add_argument('-o','--output', help='Output filename')
parser.add_argument('-o', '--output', help='Output filename')
hliberacki marked this conversation as resolved.
Show resolved Hide resolved
parsed_args = parser.parse_args(args=args_without_ros[1:])

node = rclpy.create_node('view_frames')
Expand All @@ -73,7 +73,7 @@ def main():
node.get_logger().info('service not available, waiting again...')

future = cli.call_async(req)
rclpy.spin_until_future_complete(node, future)
rclpy.spin_until_complete(node, future)

ret = 1
try:
Expand All @@ -83,20 +83,20 @@ def main():
node.get_logger().error('Service call failed %r' % (e,))
else:
node.get_logger().info(
'Result:'+ str(result) )
'Result:' + str(result))
hliberacki marked this conversation as resolved.
Show resolved Hide resolved
data = yaml.safe_load(result.frame_yaml)

hliberacki marked this conversation as resolved.
Show resolved Hide resolved
if parsed_args.output is not None:
frames_gv = '{:s}.gv'.format(parsed_args.output)
frames_pdf = '{:s}.pdf'.format(parsed_args.output)
else:
datetime = time.strftime('%Y-%m-%d_%H.%M.%S')
frames_gv = 'frames_{:s}.gv'.format(datetime)
frames_pdf = 'frames_{:s}.pdf'.format(datetime)

hliberacki marked this conversation as resolved.
Show resolved Hide resolved
with open(frames_gv, 'w') as f:
f.write(generate_dot(data, node.get_clock().now().seconds_nanoseconds()))

cmd = ['dot', '-Tpdf', frames_gv, '-o', frames_pdf]
subprocess.Popen(cmd).communicate()
finally:
Expand All @@ -105,6 +105,7 @@ def main():
rclpy.shutdown()
return ret


hliberacki marked this conversation as resolved.
Show resolved Hide resolved
def generate_dot(data, recorded_time):
if len(data) == 0:
return 'digraph G { "No tf data received" }'
Expand Down