Questions tagged [rospy]
The rospy tag has no usage guidance.
478 questions
0
votes
1
answer
35
views
Unable to use functions from custom imported module
Hi there,
I'm a novice experimenting on making and using custom modules (python) having functions that is required for my rosnode. I can do the same in normal python, but I am struggling with the ...
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
99
views
Get timestamp of current message starting from zero in rospy
I seem to have a misunderstanding regarding time in ros, especially sim-time.
Aim
I process a rosbag that contains many pointcloud2s and want to transform the timestamps of the incoming pointcloud to ...
0
votes
1
answer
6
views
custom messge usage in python
i wrote a smal python node
...
0
votes
1
answer
27
views
Subscriber in /odom topic from gazebo loses first message
Hello!
I have a robot in a gazebo environment that publishes the odometry data on the topic /odom. I have a node that subscribes to that topic and uses the odometry data. I save the data from the ...
0
votes
1
answer
6
views
How to start a ROS image_raw subscriber python code in boot up
I am a using ROS Noetic in ubuntu 20.04. I am creating an application to read camera and save . i have two launch files to read camera and publish to ros, then I created two python codes to subscribe ...
0
votes
1
answer
68
views
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 ...
0
votes
1
answer
77
views
Using Rospy to check on empty topic
Hi,
I want to code a simple publisher and subscriber.
However, I realized that whenever Ros is subscribing to a topic, e.g.:
rospy.subscriber("/chatter",string,callback)
it will always wait ...
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 ...
0
votes
1
answer
23
views
unknown error handler name 'rosmsg'
I m trying the rosserial tutorials from the official site in ros melodic. While running the Serial_node.py I m getting this error :
...
0
votes
1
answer
11
views
how does one index array in rospy?
I need the size of a custom array msg type. (The type is geometry_msgs/PoseStamped[] PoseStampedArray.)
I need to iterate on the msg if it is not empty and I would very much like to get the last ...
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
6
views
rospy Subscriber callback threading test
I try to use rospy Subscriber callback handler to manipulate some object but it doesn't work like i would like to.
In,subscriber handler is look like this :
...
0
votes
2
answers
339
views
Missing packages after installing rosdep based on python3-rosdep2 in Noetic
After the installation of Noetic on ubuntu 20.04, I started to redo the tutorials. When I wanted to see the dependencies of beginner_tutorials package, I couldn't use the #rosdep command!
...
0
votes
1
answer
10
views
Importing a service in python defined by others
I am stuck in something that should be pretty easy... I have a service called "set_odometry", which I can use doing rosservice from the bash. This service is installed from apt-get so I don'...
0
votes
1
answer
19
views
How to deal with multiple subscribers and callbacks for different topics in rospy?
Hello I have a code snippet here which 8 subscribers for 8 different message types. Earlier I used to have only four subscribersand it used to run very fast but with 8 subscribers the subscription of ...
0
votes
1
answer
12
views
Smach get value from subscriber topic
I'm pretty new to ROS, and I'm working with SMACH. I have an Arduino UNO with 4 LEDs (green ,yellow, red and blue) and one button.
What I'm trying to achieve is a sort of traffic light simulator. My ...
0
votes
1
answer
18
views
How to access ChannelFloat32 in python?
Hello, I'm on melodic and try to subscribe to a ChannelFloat32 message, but I neither can import the type nor have an Idea how to access that. How can I do that?
Originally posted by bionade24 on ROS ...
0
votes
1
answer
193
views
Best way of publishing to /clock topic type rosgraph_msgs/Clock?
Ultimately I need to publish an accelerated time to the /clock topic which the rest of my simulation nodes are using. I have managed to concoct two separate launch files;
the first launch file ...
0
votes
1
answer
407
views
Import error for rospy in Python3.6 script
I've tried import rospy into a python script that requires python3.6, but it gives me the error:
ModuleNotFoundError: No module named 'rospy'
I'm able to successfully import the rospy into a python3.5 ...
0
votes
2
answers
5
views
Using ROS namespaces programmaticaly
It seems like the simple question, but is it possible to control robots with different ROS namespaces in one launch file programmaticaly? For example, i want to move robot1 one meter forward, and ...
0
votes
1
answer
4
views
subscriber callback in a python class is overwriting the class variables with the most recent data before the first callback processing finishes
I am on ROS Melodic. When a subscriber is receiving data at a faster rate than it could process, the class variables are being updated before the callback process is finished.
For example, when I run ...
0
votes
1
answer
14
views
Custom ROS message with unit8[] in python!
I have a PacketMsg.msg as follows in my package:
uint8[] buf
I would like to decode /topic ...
0
votes
2
answers
11
views
Service Server and Client not working when launch by launch file
Hello all.
I am using a pandas data frame to format instructions and the data frame is hosted in a service server. I then have a client that is imported into a position supervising node. The client is ...
0
votes
1
answer
26
views
OccupancyGrid not getting published - Python
Hi, so I want to publish an occupancy grid of a map.png file I have.
After running this node, I do rostopic list but it doesn't show me any published map. Can someone tell what am I doing wrong?
...
0
votes
1
answer
42
views
get all the active namespaces rospy | roscpp
In my project, multiple robots may be spawned both at launch and at runtime, each under a certain namespace. Generally, that is 'robot_ID' where ID == a robot-...
0
votes
1
answer
25
views
Link in rviz teleports between original and transformed position with tf2
Here's a video of what I'm referring to.
I'm using rviz to display a transformation using a tf2 broadcaster, but link1 keeps popping back and forth between its specified location from the URDF, and ...
0
votes
1
answer
10
views
Moveit Commander Plan Fail
I'm using rospy and moveit_commander to control a robot. It works wonderfully, except I cannot find a way in the API to handle a path planning failure. The ...
0
votes
1
answer
8
views
rospy message_converter outputs zero while in the terminal I got different output for the same topic
ROS Kinetic
Ubuntu 16.04
Python 3.5
I am using diff_drive_controller to publish rwheel_angular_vel_motor and lwheel_angular_vel_motor topics. My goal is to take messages published by those topics and ...
0
votes
1
answer
2
views
How to store two data of consecutive frames for computation?
I am using ROS Kinetic on ubuntu 16.04.
The application I am trying to do is to obtain messages from the VRPN optitrack system and use these data to
construct a data array that displays variables in ...
0
votes
1
answer
1
view
subcribing to 2 topics and publishing selected data in same node
hello everyone. i have two messages publishing on their message with their topic name. now i want to subscribe these two topics and publish a new topic which will take some selected data from one ...
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
1
answer
1
view
[Theorical] Python use in ROS
Hi everyone,
I'm new using python in ROS but I've been developing robots solution for a little time in C++. The thing is that when you want to use a ROS C++ node you must configure CMakeLists.txt ...
0
votes
1
answer
5
views
python node bad interpreter
the c++ version is working but python shows the following :
rosrun hello_world talker.py
/opt/ros/lunar/bin/rosrun:
/home/kamal/catkin_ws/src/hello_world/script/talker.py:
usr/bin/env: bad ...
0
votes
1
answer
314
views
Difference between rospy.spin and rospy.sleep
Hi There!
Whats the difference between rospy.spin nad rospy.sleep? Does rospy.rate affect rospy.spin?
Originally posted by Marseiliais on ROS Answers with karma: 31 on 2019-09-02
Post score: 3
0
votes
1
answer
172
views
Passing Multiple Arguments to Subscriber Callback function in python
Hi All,
I am wrote the following code to track position of my robot in rviz using markers.
...
0
votes
2
answers
216
views
Importing std_msgs.msg with Python
Hi guys, I am following the ROS Beginner's Tutorials, on the part Writing a Simple Publisher and Subscriber (Python). In the publisher code given, there is a line which says from std_msgs.msg import ...
0
votes
1
answer
31
views
How to connect remote roscore with python in runtime
The following is the implementation using roscpp:
std::map<std::string, std::string> remappings;
remappings["__master"] = master_url;
remappings["__hostname"] = host_url;
ros:...
0
votes
1
answer
3
views
Where I can find a list of dependencies?
I don't know where find or what dependencies to use when I will create a package dependencies. It's possible create a depends? For example, in the Tutorial I see rospy, roscpp and std_msgs. Where I ...
0
votes
1
answer
129
views
How to pass multiple arguments to rospy node through command line?
I'm looking for a notation like this
rosrun my_package my_node.py arg1 arg2 arg3
That I can cun in the terminal, that will enable me to pass arguments to a ROS ...
0
votes
1
answer
12
views
How to get the Quaternion from Matrix with python
Hello,
I found below code which is using for get the Quaternion values from Matrix.
Then, I would like to do the same work with it, but it's C++ programming language.
I can't find any similar python ...
0
votes
1
answer
20
views
Why does rospy::wait_for_message get stucked even though messages are being published?
I am using this method in my python script
rospy.wait_for_message("/my_topic", Bool, timeout=None)
The /my_topic ...
0
votes
1
answer
138
views
How to transform a vector in rospy?
I couldn't find any tutorials for my situation.
I have a vector (23.7, 0, 0) and I want to transform (only rotation no translation needed) it into another frame which is RPY (0.39, 0, 1.64).
I'm ...
0
votes
1
answer
11
views
Please explain how the Subscriber works
Hello,
Could someone explain to me how the rospy.Subscriber('topic', msg, callback) method works. As I noticed we don't need to loop that method to update and check the topic iteratively. It is doing ...
0
votes
1
answer
1
view
rospy tf get frame_id of trans, rot
Hey there,
Assume I have three tf's:
1): marker_1 relative to world
2): marker_2 relative to world
3): marker_3 relative to world
Now I want to get the marker name that is closest to marker_1. Is ...
0
votes
1
answer
17
views
How to publish sim time at desired frequency
Hi, I want to run the simulated time at frequency of 1Hz by publishing to the /clock topic and set rosparam /use_sim_time to be ...
0
votes
1
answer
30
views
How to read data from txt file python
I have a python script which reads data from 4 txt files and stores the values in 4 numpy arrays. I put the txt files in the same directory with my python node, but when I run the node the files ...
0
votes
1
answer
11
views
Own nav path has closed loop in rviz
Hi,
I want to make simple path following for differential drive robot,
So, I generated nav.msg/Path with own points and publish it, but in rviz I see my path with connection between start and end ...
0
votes
1
answer
4
views
How to read msg from /odom at time series n and (n-1)
Hi there, I hope to compare the message from the consecutive time series n and (n-1) from /odom in python. I am confused about how to store the msg at time n-1 and time n at the same time, especially ...
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
...