Questions tagged [rospy]
The rospy tag has no usage guidance.
478 questions
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
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:
...
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
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
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
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
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 ...
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 ...
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
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
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 ...
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
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
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 ...
0
votes
1
answer
13
views
[ERROR] : Called wait_for_result when no goal exists
This is terminal output:
...
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
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
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
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("...
0
votes
1
answer
44
views
How to correctly return an array of ints from service?
I have the following code:
RouteRemainder.srv:
---
int64[] route_remainder
routes_manager,py:
...
0
votes
1
answer
58
views
How to correctly translate a pose along an axis?
I have a pose of my robot base_link in the map frame. I'd like to translate this 0.2 m along ...
0
votes
1
answer
67
views
How to remove lag in marker publishing?
I am publishing markers in a subscriber callback so that whenever new data is received on a topic a marker is created. Markers are published and displayed well at first but after a while markers are ...
0
votes
1
answer
50
views
Attempting to read Battery % via Mavros
I have a quadcopter running a Pixhawk flight controller. I am also running a RPI 4 companion board, and I have a serious of nodes setup for flight and a number of other operations. One node is my ...
0
votes
1
answer
2
views
Error calling Service in rospy
Been trying to call this Service implemented in the following code as such:
...
0
votes
2
answers
23
views
publish after processing data from 2 synced subscribers (rospy)
I want to make one node to subscribe 2 topics synchronously, process those data, and publish it.
I know that publishing and subscribing data with single node is possible, but have never seen any ...
0
votes
1
answer
162
views
Confused about spinOnce and sleep
I want to go a little deeper into the "why" from a technical perspective. Not just you must do this, but why. I've looked at the rospy source code but I am still not sure about the following....
0
votes
1
answer
63
views
Can't send binary String messages in ROS Noetic via rospy
I have to send binary String messages via the ROS message bus. That worked out perfectly with Python 2.7 and ROS Melodic, but fails with ROS Noetic. Here's some example code (of course I don't just ...
0
votes
2
answers
47
views
Minimal working example for RViz marker publishing
Does anyone know of a complete minimal working example to publish a marker that can be visualised in RViz written in Python?
...
0
votes
2
answers
142
views
Is there a way to extract specific info or lines from a ROS topic?
echo /joint_states has the following output (shortened).
I made a node (using the rospy tutorial) to subscribe to /joint_states and I want the.py script to print() just the position list for use ...
0
votes
1
answer
9
views
unable to publish Path waypoints for pure pursuit
These are the initial line of my rospy code:
...
0
votes
1
answer
77
views
Get valid frames from `tf2_ros.Buffer` based on `cache_time`
tf2_ros.Buffer offers a cache_time argument in both C++ and Python implementations.
C++ doc
Python code
However, on calling ...
0
votes
1
answer
25
views
SyntaxError in tcpros_base (Noetic, RPi, Python)
I am new to ROS and am probably making an obvious mistake. I am running Noetic on Raspberry Pi 4 and it appears to have installed correctly. Specifically, I am trying to build a very simple node (...
0
votes
1
answer
76
views
A ROS message that contains no data, Signal only?
Hello all,
Newbie here with ROS, and I have to say I love it. Its a lot of fun and I can only imagine the possibilities. With that said.
I haven't had any luck finding anything of its kind, but does ...