Repository navigation
Open
Labels
bugSomething isn't working
Description
Bug report
Required Info:
- Operating System:
- Ubuntu 16.04, Windows 10
- Installation type:
- source
- Version or commit hash:
- DDS implementation:
- Fast-RTPS
- Client library (if applicable):
- rclcpp, rclpy
Steps to reproduce issue
Build an rclcpp executable with the following code
#include <string>
#include "rclcpp/rclcpp.hpp"
int main(int argc, char ** argv)
{
rclcpp::init(argc, argv);
std::string node_name = "initial_params_node";
std::string namespace_ = "/";
auto node = rclcpp::Node::make_shared(node_name, namespace_);
rclcpp::spin(node);
rclcpp::shutdown();
return 0;
}Run the following python code (change the hardcoded path to initial_params_rclcpp to the above binary)
from rcl_interfaces.srv import GetParameters
import rclpy
import subprocess
import threading
import time
rclpy.init()
node = rclpy.create_node('tests_yaml')
def background_spin(node):
while rclpy.ok():
# workaround ros2/rclpy#188
rclpy.spin_once(node, timeout_sec=time.sleep(0.25))
try:
# Keep an executor running in the background
thr = threading.Thread(target=background_spin, args=(node,), daemon=True)
thr.start()
while True:
print('start loop')
proc = subprocess.Popen(['/workspace/ros2-dev0/build/test_cli/initial_params_rclcpp', '__node:=listener'])
# Using the listener node instead fixes the issue
# proc = subprocess.Popen(['ros2', 'run', 'demo_nodes_cpp', 'listener'])
try:
# print('about to create client')
client = node.create_client(GetParameters, '/listener/get_parameters')
# print('about to wait for service')
client.wait_for_service()
# Sleeping here fixes the issue
# time.sleep(1)
# print('about to send service request')
request = GetParameters.Request()
request.names = ('use_sim_time',)
client.call(request)
# print('about to destroy client')
node.destroy_client(client)
finally:
# print('about to kill subprocess')
proc.kill()
finally:
node.destroy_node()
rclpy.shutdown()Expected behavior
start loop would be printed forever
Actual behavior
start loop prints twice. The program is forever waiting in the second invocation of client.call(request)
Additional information
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
sloretz commentedon Jun 8, 2018
Possibly related to ros2/rmw_fastrtps#205