Questions tagged [rospy]
The rospy tag has no usage guidance.
478 questions
0
votes
1
answer
829
views
rospy.init_node() stuck in loop
I had a problem with initializing a ROS node in python in a larger project. The following minimum reproducible example has the same issue:
...
0
votes
1
answer
73
views
where is the beginner_tutorials.srv file in the add_two_ints tutorial?
I am learning ros noetic on the page (https://wiki.ros.org/rospy_tutorials/Tutorials/WritingServiceClient)In the scripts/add_two_ints_server.py file within the beginner_tutorials package, there is a ...
0
votes
1
answer
27
views
Possible wrong ussage of transformPoint method from tf
ROS VERSION: Melodic
OS VERSION: Ubuntu 18.04
package tf version: 1.12.1
I'm trying to create a node that processes a PolygonStamped object and transform each point of it to a especified frame_id in ...
0
votes
0
answers
6
views
Call rosservice clear with rospy
I am currently using
clear_bg = rospy.ServiceProxy('/clear', std_srvs.srv.Empty)
clear_bg()
Which is said to be working on previous posts. However this is not working for me. Why?
1
vote
1
answer
53
views
ROS1 Custom messages generates strange memory graph pattern when using multiple string types
In ROS1 Noetic, I have the following custom message named Test.msg:
int32 did
string a
string b
And I have another custom message TestList.mgs:
Test[] testList
In ...
0
votes
2
answers
18
views
Is rospython subscriber thread safe?
Hey
I'm trying to write a python node, which has one class and two member functions as callback functions.
so a TimeSynchronizer and Subscriber in a node.
I saw in this link and tested that python ...
0
votes
2
answers
134
views
How to use ROS in Colab?
Now I'm a complete newbie when it comes to both ROS and Colab.
I found this code a while ago, and I want to use it in Google Colab because using the drive makes things easy due to the immensely large ...
1
vote
0
answers
50
views
Why is ROS1 Message Generation Slow in Python?
I hit a performance issue when trying to use a custom message type in ROS 1 Noetic in Python. My custom message was defined like this:
...
2
votes
2
answers
104
views
does rospy support rosparam update callbacks?
Using rospy/ROS1, I would like a callback when a certain parameter on the ROS1 parameter ...
1
vote
0
answers
18
views
Collision Checking using Moveit (python wrapper) for a set of Joint Positions
I have a set of robot joint positions which I found by sweeping through the allowed joint positions with a fixed delta. This gives me about a set of ~2 million joint positions. Now, I want to check ...
0
votes
3
answers
86
views
How to obtain list of all available topics [python]
In my gazebo model I have 9 differential drive vehicles.
When I execute rostopic list i get
...
1
vote
2
answers
25
views
(How) can a rospy node be reinitialized after ctrl+c?
TL:DR Is there a correct way to use rospy in the interactive shell? Seems stuck in shutdown after ctrl+c
Since interacting with ros from python is much more powerful than interacting via the command ...
0
votes
0
answers
16
views
Node initialization blocks with rospy for UR5e Robot Arm
I am having trouble to remotely control the UR5e robot arm using code. I am using ROS Noetic and trying to run test_move.py present in Universal Robots' repository ...
0
votes
1
answer
38
views
ROS node testing (publish/subscribe)
I am struggling with an example integration test for a ROS node (in Python). I have a node that somehow processes input data and outputs some messages based on this:
...
0
votes
0
answers
22
views
Python Multi-Robot ROS 1 environment: defining multiple robots in class form (each with their own ROS node) and accessing their class objects?
I'm interested in building a multi-robot learning environment using a simulator such as Gym for the environment and ROS 1 for handling communication between robots.
I'd like to set up my environment ...
0
votes
2
answers
11
views
Cancel rospy action with Ctrl+C
Hi to everyone,
i'm using a class in which some methods call actions as SimpleActionClient.
I create a node in the same executable i create the class instance and leave if the signal handling.
When i ...
0
votes
2
answers
100
views
Pycharm 'No module named rospy'
Pycharm IDE doesn't seem to recognize ROS modules (It underlines them and doesn't autocomplete), even though when I run the script, the interpreter does recognize them.
I should add that I am opening ...
1
vote
0
answers
162
views
Using .pyc files instead .py with roslaunch [closed]
I am working on a docker and using ROS 1 noetic as of now.
For certain reasons I do not want to distribute .py files as end user do not need to understand what is inside there. So I am using .pyc ...
0
votes
0
answers
27
views
How to publish images of a file.bag on a topic with python?
I'm a beginner with ROS, so i thank you in advance for your answers.
I have a file.bag (Video) available and I would like to publish the various frames on a specific topic at defined moments of time ...
0
votes
0
answers
25
views
Issues with asynchronously handling a Subscriber callback
I am trying to create a listener that sends a message through a Discord webhook to my Discord server. The issue that I am encountering at the moment is that I do not know how to create an asynchronous ...
0
votes
1
answer
163
views
Custom ROS Service Cannot be Imported
I have created a simple custom ROS service for ROS Noetic. My import line is:
from fishbot_ros.srv import chess_service, chess_serviceResponse
The file structure ...
2
votes
3
answers
112
views
message_filters doesn't call the callback function
I'm trying to use the message_filters in order to subscribe to two topics. Here's my code
...
0
votes
1
answer
625
views
How to add a header with timestamp to numpy_msg?
I am using the rospy with numpy tutorial to create a publisher and subscriber that send numpy arrays to listener that uses an ApproximateTimeSynchronizer. However, I receive an error when I try to ...
0
votes
1
answer
27
views
Rospy getNumSubscribers()
In rospy do you have a getNumSubscribers() function for the Publisher?
Originally posted by schizzz8 on ROS Answers with karma: 183 on 2023-06-03
Post score: 0
0
votes
1
answer
1k
views
"ERROR: Unable to communicate with master!" and "Unable to Register with master node"
Hello,
I have two computers on a local network. First of them has Ubuntu 18.04 as OS, ROS Melodic installed and connected to the network with an Ethernet cable. The other one has Windows 10 as OS, ...
0
votes
1
answer
4
views
Adding __package__ to ROS Python scripts breaks import
I wanted to do a relative import from my Python ROS node.
So I added a __package__ = 'my_package' specification to the beginning of the file (right under the ...
0
votes
1
answer
12
views
rospy and Subscriber/Publisher garbage collection
Do I need to store a reference to rospy subscribers and publishers to avoid these objects to be garbage collected?
...
0
votes
1
answer
5
views
How to get consecutive images with 3 seconds delay
Hello,
I am trying to read two consecutive images from my rostopic using rospy.Subscriber to compare the orientation between these pictures but using the code below, I found out two images I get are ...
0
votes
1
answer
32
views
Raising Exceptions in Subscriber Callbacks
ROS distribution: noetic, rospy
I want to raise specific exceptions depending on the data received from the rostopic. However, raising exceptions in the subscriber callback (user_callback) returns a ...
0
votes
1
answer
217
views
Using rospy.sleep inside a callback
My understanding is that rospy.sleep() will return control to ROS so that it can schedule any other processes that need a turn, and also waith the designated time before it "returns". I put ...
1
vote
1
answer
64
views
Should I unregister from Publishers/Subscribers when I terminate a ROS node by exiting the script?
Hi everyone.
So my question is pretty much what the title is. Is it good practice or even necessary to unregister from ROS publishers or subscribers I used inside my ROS node before terminating the ...
0
votes
1
answer
18
views
Is it possible to publish msg in rospy.on_shutdown
I want to publish message while roscore is closing. I tried to use rospy.on_shutdown but it didn't work. In wiki it says "Messages are not guaranteed to be published." for on_shutdown. I am ...
0
votes
1
answer
81
views
How to generate 'format: "32FC1; compressedDepth png"' Image in python from float array?
I think there's an answer that involves converting C++ code (https://github.com/ros-perception/image_transport_plugins/blob/noetic-devel/compressed_depth_image_transport/src/codec.cpp) to python- does ...
0
votes
3
answers
277
views
point_cloud2.read_points and then?
I have a topic publishing a point cloud of type sensors_msgs.PointCloud2. I can subscribe to it and read it using ...
0
votes
2
answers
18
views
Unable to read a file while using relative path
Hi,
I want to read a file inside python script in ros indigo in the following way -
file_name = rospy.get_param("~file", None)
Below is the snippet of ...
0
votes
1
answer
13
views
[ERROR] : Called wait_for_result when no goal exists
This is terminal output:
...
1
vote
2
answers
275
views
How do you implement a rospy KeyboardInterrupt without killing the node?
I want to run a process in a while loop that prints to screen, and exit the while loop by pressing a key or 'Ctrl+C'. But I don't want the same key press to also kill the ros node - I just want to ...
0
votes
1
answer
10
views
Making rosnode_cleanup() not wait for y/n from user
I arrived at rosnode_cleanup() after looking at #q9521 and #q285530.
I need to use rosnode.rosnode_cleanup() in my Python script, but it is blocking because it ...
0
votes
1
answer
491
views
Wait for subscriber callback to receive message - best practice
Hello, I am wondering what is the best practice in python to wait for a subscribed topic to start publishing, before using its messages in the spin method. An simplified example of what I am doing ...
0
votes
1
answer
45
views
Image Subscriber Lags (despite queue_size=1 and buff_size=2**30)
Hi,
I have been working on a Python class that will allow me to spawn an object in gazebo, take an image of the object, and then delete that object, for a given number of objects that I provide. I am ...
0
votes
1
answer
18
views
Does ROS have anything similar to a "global variable"?
I created a node that subscribes data from 3 other nodes (2 nodes publish data in 30Hz while 1 node publishes in about 10Hz). The node I created uses a transformation matrix(4x4) from the slower node (...
0
votes
3
answers
86
views
Change rospy node log level while running
Is there any way to change a rospy node's log level while it is running? http://www.ros.org/wiki/rospy/Overview/Logging says that you must pass in a parameter to ...
0
votes
3
answers
10
views
Can the log level of a (python) ROS node be changed dynamically?
I wonder if it is possible (and if not if it makes sense) to change the log level of a python node during runtime.
The node could connect to a special purpose topic where the log level for the node ...
0
votes
1
answer
368
views
Reading from topic once using rospy.wait_for_message()
Hi,
I want to read a message from a topic once, thus I tried to use wait_for_message() like this:
...
0
votes
1
answer
129
views
Simple local planner in Python?
Hello everybody,
I would like to implement my own local planner using Python for exercise purposes. Therefore, I make no use of move_base and the ROS navigation stack at all and try to implement those ...
0
votes
1
answer
64
views
Recursively get message field names in ROS2
We have the handy rosidl_runtime_py.message_to_csv() method for converting a message to CSV, but is there a similar function that will recursively get the field ...
0
votes
1
answer
124
views
vscode: rospy import error
The env I am using is ROS Noetic and VS Code along with Pylance.
launching rospy nodes is working fine
importing rospy gives a squiggle error in VSCode.
Also, python syntax is not being highlighted ...
0
votes
1
answer
2
views
Is there a way to subscribe to different topics at the same time in rospy?
I am subscribing to various topics and I wish to print them into a .csv log file, but I am not able to print any one of them outside their own callback function.
You can see the code at Click for Code ...
0
votes
2
answers
629
views
Rate and sleep function in RCLPY library for ROS2
Recently I started learning ROS2, but I've encountered one issue, I've created a package & defined a node.
...
0
votes
1
answer
20
views
TypeError: cannot marshal <type 'numpy.uint8'> objects
I am unable to set parameters to the param server using the following code:
hsv = cv2.cvtColor(image,
cv2.COLOR_BGR2HSV)
rospy.set_param("lower_h", hsv[:, :,
0].min()) rospy.set_param("...