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

chives_onion's profile - activity

2023-07-26 10:55:34 -0500 commented answer Nav2 and costmap_2d nodes

@Myzhar have you tried compiling nav2_costmap_2d from source? It takes time for changes to make it into deb packages, an

2023-07-19 11:04:51 -0500 received badge  Citizen Patrol (source)
2023-07-14 10:34:38 -0500 answered a question ROS2 launch file: how to convert LaunchArgument to string

From @AndyZe 's comment, I took inspiration from the way the UR package defines nodes within an OpaqueFunction. My desir

2023-06-14 08:51:25 -0500 edited answer xacro processing in ROS 2 YAML launch files (or XML)?

In an xml launch file I was able to process my xacro via <node pkg="robot_state_publisher" exec="robot_state_publish

2023-06-14 08:51:25 -0500 received badge  Editor (source)
2023-06-13 19:00:12 -0500 received badge  Necromancer (source)
2023-06-13 18:56:40 -0500 answered a question xacro processing in ROS 2 YAML launch files (or XML)?

In an xml launch file I was able to process my xacro via <node pkg="robot_state_publisher" exec="robot_state_publish

2023-06-08 10:33:22 -0500 answered a question the robot does not know its position when it is activated what is the solution with ros so that it knows its place and I work with lidar

It sounds like you're new to ROS, so I'd recommend checking out all the available tutorials found here. This tutorial c

2023-06-08 10:33:22 -0500 received badge  Rapid Responder (source)
2023-06-06 15:25:55 -0500 answered a question Docker: gazebo: cannot connect to X server

I'm unsure of your setup, but I was able to solve a similar issue with uninstalling Docker Desktop and installing Docker

2023-05-26 09:19:43 -0500 commented answer Ros2 Custom message tutorial: No such file or directory

I was getting No such file or directory #include "geometry_msgs/msg/detail/point__struct.h" which was solved by adding D

2023-05-25 08:23:34 -0500 marked best answer How to view Jenkins jobs in ROS Index

I am developing on an amd64 system and would like to be able to quickly see if there are binaries available for packages on other architectures (arm).

The ROS1 wiki has a handy section in the Package Links that shows all the Jenkins jobs, but I can't seem to find the same information in ROS Index for ROS2 packages.

How can I see what binaries are available for a ROS2 package?

2023-05-25 08:23:32 -0500 commented answer How to view Jenkins jobs in ROS Index

I was indeed just looking for available binaries, but your answer will help me track releases more closely. Thank you mu

2023-05-24 14:47:39 -0500 received badge  Organizer (source)
2023-05-24 14:45:27 -0500 asked a question How to view Jenkins jobs in ROS Index

How to view Jenkins jobs in ROS Index I am developing on an amd64 system and would like to be able to quickly see if the

2022-06-16 09:07:53 -0500 received badge  Famous Question (source)
2022-06-16 09:07:53 -0500 received badge  Notable Question (source)
2022-05-18 23:18:56 -0500 received badge  Nice Question (source)
2021-09-29 02:12:58 -0500 received badge  Nice Answer (source)
2021-09-28 15:45:41 -0500 commented question Wifi setup on turtlebot3 waffle pi

This seems to be a RPi question and not directly related to ROS. You'll have better luck getting an answer if you ask yo

2021-09-28 15:33:06 -0500 commented question error loading <rosparam> file does not exist

Are you sure ekff.yaml is located where you think it is? In a terminal, could you navigate to where the file is, run pwd

2021-09-28 15:33:06 -0500 received badge  Commentator
2021-09-28 15:25:08 -0500 answered a question How do detect the point cloud is in front of you?

The pointcloud message doesn't encode a concept of 'in front'. The message header has a frame_id field that should corre

2021-09-28 15:25:08 -0500 received badge  Rapid Responder (source)
2021-09-08 02:13:03 -0500 received badge  Famous Question (source)
2021-09-08 02:13:03 -0500 received badge  Notable Question (source)
2021-07-15 09:23:09 -0500 received badge  Popular Question (source)
2021-06-24 09:27:35 -0500 commented question teb_local_planner goes crazy and drives against walls

My initial thought would be an issue with your localization. How does your robot know where it is? You could, for examp

2021-06-23 08:08:55 -0500 commented question TEB oscillates when close to goal in tight spaces

Thanks @jayess, I've updated the question to include a dropbox link to the bag.

2021-06-23 08:05:13 -0500 edited question TEB oscillates when close to goal in tight spaces

TEB oscillates when close to goal in tight spaces I have a differential drive robot that I'm commanding to visit a serie

2021-06-22 17:13:41 -0500 commented question TEB oscillates when close to goal in tight spaces

I'm having difficulty attaching my bag file. I've tried both .bag and .zip, but it doesn't seem to be added. I'm also ex

2021-06-22 17:06:58 -0500 asked a question TEB oscillates when close to goal in tight spaces

TEB oscillates when close to goal in tight spaces I have a differential drive robot that I'm commanding to visit a serie

2021-04-21 08:45:57 -0500 received badge  Critic (source)
2021-03-25 13:47:36 -0500 received badge  Popular Question (source)
2021-02-11 15:18:19 -0500 commented question How to properly set JACKAL_URDF_EXTRAS?

Did you re-source your terminal after adding the new paths? For the git discrepancy, are you sure you're in the same br

2021-01-28 09:11:46 -0500 answered a question smach kinetic on raspberry pi 3

If you check the Jenkins jobs tab on the smach docs under kinetic you'll notice a binary for buster is missing, meaning

2021-01-28 09:11:46 -0500 received badge  Rapid Responder (source)
2021-01-08 16:43:36 -0500 asked a question Proper handling of cancelled actionlib goal

Proper handling of cancelled actionlib goal I have an actionlib SimpleActionServer with the purpose of processing sonar

2020-12-29 06:44:52 -0500 received badge  Enlightened (source)
2020-12-23 15:19:45 -0500 marked best answer async/await in subscriber callback

I have a ros node that needs to communicate with a non-ros over a tcp asynchronous socket connection. This node will be subscribed to a variety of topics and needs to send data over the socket connection when a message is received (by calling the socket writer within the subscriber callback).

My issue is that I cannot use async/await syntax for a subscriber callback since rospy.Subscriber() does not allow the callback to be awaited.

Ubuntu20 Ros Noetic Python 3.8.2

Here's a MWE:

A generic publisher, representing one of several nodes generating data I eventually want to send over the socket:

 #!/usr/bin/env python3

import rospy 
from std_msgs.msg import String

def sample_publisher():
    rospy.init_node('question_pub')
    pub = rospy.Publisher('topic_name', String, queue_size=10)
    rate = rospy.Rate(1)
    msg = String(data="sample message")

    rospy.loginfo("starting publish loop")
    while not rospy.is_shutdown():
        pub.publish(msg)
        rospy.loginfo("finished pub'in")
        rate.sleep()

if __name__ == '__main__':
    sample_publisher()

The subscriber in question:

#!/usr/bin/env python3


import rospy
from std_msgs.msg import String
import asyncio

class listener_handle:
    def __init__(self):
        rospy.init_node('question_sub')
        self.server_address = '127.0.0.1'
        self.port = 51222

    def activate_subscribers(self):
        #separated to ensure async writer is defined before first message
        rospy.Subscriber("topic_name", String, self.callback)

    async def connect2server(self):
        self.reader, self.writer = await asyncio.open_connection(self.server_address, self.port)

    async def async_spin(self):
        rospy.loginfo("beginning node spin")
        while not rospy.is_shutdown():
            #want bidirectional messages
            recvData = await self.reader.read(100)
            rospy.loginfo("got {} from socket server".format(recvData.decode()))

    async def callback(self, data):
        rospy.loginfo("callback received value of {}".format(data.data))
        self.writer.write(data.data.encode())
        await self.writer.drain()


async def main():
    h = listener_handle()
    await h.connect2server()
    h.activate_subscribers()
    await h.async_spin()

if __name__ == '__main__':
    asyncio.run(main())

which errors on startup with

/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py:750: RuntimeWarning: coroutine 'listener_handle.callback' was never awaited
  cb(msg)

and, for reference, the socket server I'm trying to connect to:

#!/usr/bin/env python3

import asyncio

async def handle_echo(reader, writer):
    print("client connected, waiting for msg")
    data = await reader.read(100)
    message = data.decode()

    print("Received {}".format(message))

    writer.write(data)
    #immediately send back to subscriber client
    await writer.drain()
    print("Close the connection")
    writer.close()

async def main():
    server = await asyncio.start_server(
        handle_echo, '127.0.0.1', 51222)

    print("server started up")
    async with server:
        await server.serve_forever()

asyncio.run(main())

I've attempted to make the subscriber asynchronous but it is not awaitable.

I know the subscribers themselves work asynchronously, but I looked for a few hours and was unable to find any examples using the asyncio library like this.

How can I use await within a rospy subscriber callback? Thanks in advance!

2020-12-23 15:19:40 -0500 received badge  Student (source)
2020-12-15 16:11:04 -0500 received badge  Famous Question (source)
2020-11-02 23:47:24 -0500 received badge  Famous Question (source)
2020-10-30 09:50:08 -0500 received badge  Good Answer (source)
2020-10-30 03:37:14 -0500 received badge  Nice Answer (source)
2020-10-29 15:40:13 -0500 received badge  Rapid Responder (source)
2020-10-29 15:40:13 -0500 answered a question Should the origin of base_link and odom be the same?

There are ROS Enhancement Proposals (REPs) that can be thought of as standards.Check out REP 105 for a description of p

2020-10-17 16:19:38 -0500 received badge  Notable Question (source)