ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

CraigH92's profile - activity

2023-07-14 02:45:30 -0500 received badge  Nice Question (source)
2023-05-09 03:37:37 -0500 commented question Use callback groups to allow an Action to trigger a service of the same Node

In the example above, it calls the service from the execute_callback. In the latest version, it gets called from the h

2023-02-17 08:45:41 -0500 marked best answer Compose two components into a single process in python

The tutorial describes how to do this in C++. How do I do the same in python?

My attempt so far:

class NodeletA(Node):            
    def __init__(self):
        super().__init__('nodelet_a')

class NodeletB(Node):            
    def __init__(self):
        super().__init__('nodelet_b')

def main():   

    rclpy.init(args=None)
    executor = MultiThreadedExecutor()

    a = NodeletA()
    executor.add_node(a)

    b = NodeletB()
    executor.add_node(b)

    executor.spin()

    a.destroy_node()
    b.destroy_node()

    rclpy.shutdown()

This creates the components, but the spin method does not block like the rclpy.spin() does. The program instantly destroys the nodes and shuts down. how do I make executor.spin() blocking. The executor needs to be multithreaded because one of my nodes hosts an action server, and I need the execute_callback of the action to be non-blocking.

Thanks.

2023-02-17 08:44:12 -0500 marked best answer Why do I get deadlock when setting a future in a subscription callback? (Only with MultiThreadedExecutor) (rclpy)

I have a node that publishes message, and another node (constructed with an unset future) that sets the result of the future to the incoming message in its subscription callback. I then add both of these nodes to an executor (in the same process) and spin until the future is complete.

If I am using a MultiThreadedExecutor then the future gets set, but it gets stuck during a spin and the program never exits. If I am using a SingleThreadedExecutor then this does not happen, and the program successfully exits.

My Publisher Node looks like this:

pubnode = Node('pubnode_' + str(os.getpid()))

pub1 = pubnode.create_publisher(String, 'topic1', latching_qos)
msg1 = String()
msg1.data = "hello1"
pubnode.get_logger().info("Publishing hello1")
pub1.publish(msg1)

My Subscription Node looks like this:

future_msgs = Future()

subnode = Node('subnode_' + str(os.getpid()))
subnode.create_subscription(String, 'topic1', lambda msg : ([
        subnode.get_logger().info("Received message on topic1"),
        future_msgs.set_result(msg)
]), latching_qos)

And I start the Nodes like this:

exe = MultiThreadedExecutor() if args.exe == 'M' else SingleThreadedExecutor()
print("Using {}".format(str(type(exe))))
exe.add_node(pubnode)
exe.add_node(subnode)

future_msgs.add_done_callback(lambda fut : print("Future is done"))
exe.spin_until_future_complete(future_msgs)

print("Goodbye!")

I have also tried:

while future_msgs.done() is False:
    print('------ Begin Spin')
    exe.spin_once()
    print('------ End Spin')

But I have the same issue. The ------ Begin Spin and Received message on topic1 are printed but during the second cycle a '------ Begin Spin message is printed without a following ------ End Spin, so it must be stuck inside spin_once().

The full code can be found here, with instructions on how to run it here.

Why does this happen? Or is this a bug in ros? I will submit an issue if this is a problem with ros, and not just how I am using it. If that is the case, where should I submit the bug report?

Thanks.

Edit:

I have submitted a bug report here

2022-11-09 01:16:49 -0500 received badge  Good Question (source)
2022-03-22 01:52:36 -0500 marked best answer Where is the x86 release of ros2 foxy?

On the install page it says: "We support Ubuntu Linux Focal Fossa (20.04) 64-bit x86 and 64-bit ARM."

But in the downloads page I can only see releases for amd and arm.

Has it not been released yet? Do I need to build from source? Or should I just download the amd version?

I have a hp laptop with a 64bit Intel I5 pro, running Ubuntu 20.04

2021-12-02 03:44:12 -0500 received badge  Famous Question (source)
2021-10-04 01:56:47 -0500 received badge  Favorite Question (source)
2021-09-20 03:25:31 -0500 received badge  Famous Question (source)
2021-08-07 04:41:20 -0500 edited question Why isn't there a concept of an executor at the rcl layer?

Why isn't there a concept of an executor at the rcl layer? The rcl layer provides functions to support the implementatio

2021-08-07 04:41:01 -0500 edited question Why isn't there a concept of an executor at the rcl layer?

Why isn't there a concept of an executor at the rcl layer? The rcl layer provides functions to support the implementatio

2021-08-07 04:39:27 -0500 asked a question Why isn't there a concept of an executor at the rcl layer?

Why isn't there a concept of an executor at the rcl layer? The rcl layer provides functions to support the implementatio

2021-06-02 03:34:52 -0500 received badge  Popular Question (source)
2021-06-02 03:34:52 -0500 received badge  Notable Question (source)
2021-05-26 06:46:00 -0500 received badge  Famous Question (source)
2021-05-20 09:12:11 -0500 received badge  Nice Question (source)
2021-05-17 09:58:21 -0500 received badge  Famous Question (source)
2021-05-17 09:58:21 -0500 received badge  Notable Question (source)
2021-05-05 15:05:43 -0500 received badge  Famous Question (source)
2021-04-23 08:11:44 -0500 received badge  Notable Question (source)
2021-04-23 08:11:44 -0500 received badge  Famous Question (source)
2021-04-09 09:20:51 -0500 received badge  Famous Question (source)
2021-04-09 09:20:51 -0500 received badge  Popular Question (source)
2021-04-09 09:20:51 -0500 received badge  Notable Question (source)
2021-04-07 01:28:16 -0500 received badge  Notable Question (source)
2021-03-08 09:31:39 -0500 asked a question Use callback groups to allow an Action to trigger a service of the same Node

Use callback groups to allow an Action to trigger a service of the same Node I have a Node that hosts an Action and a Se

2021-01-13 09:51:38 -0500 received badge  Notable Question (source)
2020-12-25 21:02:28 -0500 received badge  Popular Question (source)
2020-12-24 05:47:03 -0500 edited question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-24 04:01:40 -0500 received badge  Associate Editor (source)
2020-12-24 04:01:40 -0500 edited question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-24 03:30:06 -0500 edited question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-24 03:29:25 -0500 edited question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-24 03:28:50 -0500 edited question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-24 03:27:05 -0500 edited question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-24 03:21:40 -0500 edited question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-24 03:19:10 -0500 edited question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-24 03:12:44 -0500 edited question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-23 14:32:41 -0500 commented question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

If it doesn't, perhaps a combination of both SROS and the solution I have in the original question will achieve what I w

2020-12-23 14:31:31 -0500 commented question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Hi @gvdhoorn. You raise a good point. I am still in the playing around with ideas phase, so perhaps using domains for p

2020-12-23 11:04:16 -0500 asked a question Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another?

Can a Node cross DDS Domains? And can I host a service on one domain, and call a service (with the same name) on another

2020-12-18 12:35:47 -0500 received badge  Popular Question (source)
2020-12-16 14:31:02 -0500 received badge  Famous Question (source)
2020-12-09 13:49:29 -0500 received badge  Popular Question (source)
2020-12-07 08:08:23 -0500 asked a question un-source ros2 package without closing and reopening console

un-source ros2 package without closing and reopening console Hi, On Ubuntu 20.04, ROS2 Foxy, is there a way to "reset"

2020-12-04 07:45:16 -0500 received badge  Notable Question (source)
2020-12-04 07:45:16 -0500 received badge  Popular Question (source)
2020-11-27 08:36:27 -0500 received badge  Famous Question (source)
2020-11-27 04:11:09 -0500 asked a question How to use a ros2 service to trigger an asyncio non-blocking function (without Actions)

How to use a ros2 service to trigger an asyncio non-blocking function (without Actions) The problem I am having is that:

2020-11-13 06:42:18 -0500 marked best answer rclpy: Change the output format of the default logger (RcutilsLogger)

My log messages look like:

[INFO] [1605205588.116214862] [path_to_node.subsystem_name.node_name]: Here is a log message

The bit before the actual message takes up too much horizontal space, making it hard to read in my console (I'm using terminator, and have other consoles within it). I have already tried reducing the font size, but it still rarely fits on one line.

Could I change it so it is more like:

[INFO] [node_name]: Here is a log message

Or even:

[INFO]: Here is a log message

As often I do not care where the log message has come from.

Thanks!