Skip to content
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')
Comment thread
hliberacki marked this conversation as 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))
Comment thread
hliberacki marked this conversation as resolved.
data = yaml.safe_load(result.frame_yaml)

Comment thread
hliberacki marked this conversation as 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)

Comment thread
hliberacki marked this conversation as 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


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