↧
Action client not receiving result when server publishes too quickly
↧
What is the best way to perform query and response over Tcp/Ip network?
Hello All,
> ROS distro: Indigo
> Ubuntu 14.04
I have been trying to do some query and response with my sensor using TCP/IP protocol. However, after proceeding to some extent, I totally doubt the efficiency of what I am writing. I would really appreciate any input or advice on the same. So here is the scenario:
I have a sensor that takes in data packets (Modbus data packets, don't worry about Modbus) as query throws out response in data packets over TCP/IP network (all using static IP). My work can divide into 3 sequences as of now. Each sequence consists of a series of query and response using these data packets. I already have the TCP socket communication established. So no worries about that. My data packets are in HEXADECIMAL format. E.g.
{0x00, 0x84, 0x00, 0x00, 0x00, 0x06, 0x54, 0x01, 0x00, 0x01, 0x00, 0x03};
Now based on the type of response I get from the sensor my Robot vehicle and arm moves accordingly, i.e. unless this sensor signals that it is ok to move the arm shall not move. My approach was to create nodes and subscribe to a topic lets say "write" that would write to the sensor and listen to a topic let say "read" that publishes from this network and based on the response and write back to "write" again same. In between also thought of sending out the status i receive as another topic for my arm to subscribe to and based on that it would move.
However, now my concerns:
1. I believe I am oversimplifying the case in hand. The code or my approach doesn't look efficient.
2. My hex packets need to be sent as strings as my TCP send function that I am inheriting from my TCP class only supports string messages ( don't want to change that ). I don't have an issue with that, as I can change the hex packet to decimal manually and convert it to string or some conversion, however it becomes tedious when I need to do that at every step after every few seconds or milliseconds slowing down the process heavily. What would be a good approach to make this happen in a faster way?
3. I might consider these sequences as an action (not much oriented with actionlib yet), and send out statuses. That is what is expected from me, however, that is a later stage.
4. The response is a not human readable string. How can I decode it and access specific bytes/bits and read the sensor status? To be specific, my packets have header bytes and then the tail bytes contains the message.
5. Is the topic approach good? What else can I do to make the messaging and response more efficient?
I would further edit my question. It's already long, let's do step by step. Thanks in advance.
↧
↧
Get HZ & BW from Rostopic Programatically
Hi everyone,
I want to write a program in python and I need the value of HZ and BW (on specific topic).
How can I do it (Using rostopic or something else)?
thanks in advance!
↧
Don't get all rostopic echo data
I have a node which publishes data 3 times. But when I look at the results of the rostopic echo, I only get the last two cycles. I have tried this with different counts, but rostopic echo always misses the first cycle.
std_msgs::Int16MultiArray head;
ros::init(argc,argv, "xxxxxx");
ros::NodeHandle nh;
pubheader=nh.advertise::Int16MultiArray>("Audio_head",1);
ros::Rate loop_rate(1);
int i,j;
for(j=0;j<3;j++)
{
head.data.clear();
for(i=0;i < headersize;i++)
{
head.data.push_back(header.ROSheader[i]);
}
pubheader.publish(head);
ros::spinOnce();
loop_rate.sleep();
}
Any reason that only the last two instances are echoed?
Thanks
↧
Is there anything wrong with the arguments?
Well,I typed the command just the same as what is on the `ros_by_example`.Here it is:`rostopic pub -r 10 /cmd_vel gemoetry_msgs/Twist '{linear:{x:0.2,y:0,z:0},angular:{x:0,y:0,z:0.5}}'`,but it seems types don't match:`rostopic: error: Argument error: while scanning a plain scalar
in "", line 1, column 10:
{linear:{x:0.2,y:0,z:0},angular:{x:0,y:0, ...
^
found unexpected ':'
in "", line 1, column 11:
{linear:{x:0.2,y:0,z:0},angular:{x:0,y:0,z ...
^
Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.
`
↧
↧
what is /rostopic_10245_1493704203398
`/rostopic_10245_1493704203398` appears when I run `rosnode list`. Is it by default? The list of number affixed are random or not?
And it has subscriptions of my node.The relevant info of it presents as follows:
Node [/rostopic_10245_1493704203398]
Publications:
* /rosout [rosgraph_msgs/Log]
Subscriptions:
* /odometry/filtered [nav_msgs/Odometry]
Services:
* /rostopic_10245_1493704203398/set_logger_level
* /rostopic_10245_1493704203398/get_loggers
contacting node http://idriver-ThinkPad-E450:42951/ ...
Pid: 10245
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound
* transport: TCPROS
* topic: /odometry/filtered
* to: /ekf_navigation_node (http://idriver-ThinkPad-E450:39280/)
* direction: inbound
* transport: TCPROS
Can someone enlighten it to me?I do appreciate your help.
↧
How should a subscriber interpret multiple messages upon subscription?
If I have multiple nodes who each latch a message onto a particular topic, a node that later subscribes to that topic will receive multiple messages immediately upon subscription. If those message types do not include a timestamped header, how should that message pair be interpreted?
The way I wish (and previously thought) topics were conceptualized, a topic would represent a stream of messages that supersede each other (like, the current position of something). In that case, it seems like latching should be "per topic". When a new subscriber subscribes to the topic, it makes perfect sense that they would like to see what the current state of the topic is, even before another message is published. In this case, I would expect that when a publisher latches a message, any other latched message should be unlatched -- future subscribers will want the most recent message on that topic, regardless of source, and messages prior to the most recent one are now obsolete. And this is, in fact, the behavior that publishers in the same node have.
But, when the publishers are in different nodes, multiple messages are sent to a new subscriber. This is different from my conceptualization. I understand that the way topics work, in fact, is that latched messages are resent by their publisher (on a per-node basis) to a new subscriber whenever it detects that new subscriber. But WHY does this behavior happen? What is the rationale behind having all publishers with latched messages send them upon a new subscription? In my conceptualization, the idea is "a new subscriber should be able to know the current state of the topic upon subscription, and that state is defined by the most recent message published to the topic". What is the equivalent idea for receiving multiple messages upon subscription?
EDIT: To clarify, the difference between a new subscriber connecting to a topic and immediately receiving two latched messages, and an old subscriber receiving those messages when they were published, is that approximate time synchronization is lost. Assume a topic with superseding messages (and see gvdhoorn's answer for why that might not be a good assumption) that don't include a timestamped header. If publisher 1 publishes and latches message 1, and then an hour later, publisher 2 publishes and latches message 2, the old subscriber knows that message 2 represents the true state of the topic. The new subscriber receives message 1 and message 2 in a random order upon subscription and has no way of knowing which message represents the state of the topic. See answers for responses to this.
↧
Synchronous communication with gazebo
Hi,
I am trying to implement a robot controller using ros + gazebo - So, what I want it to tell gazebo a particular command and then gazebo should return the state after 1 second. And after that it should pause itself.Now, I do some processing and again give a command - and it should again run for only 1 second.
I need my actions to be used for equal amounts of time.
↧
rostopic got stuck in publishing and latching message for 3.0 seconds"
Hi all,
I'm not sure whether this is a bug or not, but I'm seeing that occasionally if I do something like:
I typed the below command into the terminal:
rostopic pub -1 app_pub std_msgs/String -- '"{\"pub_name\": \"example\"}"'
Obviously I am trying to publish a message through app_pub topic. Most of time it works well showing with "publishing and latching message for 3.0 seconds". After 3 seconds, the terminal shows it is ready to type in new command line.
Unfortunately it gets stuck in "publishing and latching message for 3.0 seconds" sometimes. It cannot be interrupted even using ctrl+C.
Any ideas will be helpful. Thanks
↧
↧
ueye node not publishing image messages 2
I am trying to implement LSD SLAM using UI-1221LE-M-GL.
#[ WARN] [1498582927.697497827]: Loaded uEye SDK 4.82.16. Expecting 4.60.5.
#[ INFO] [1498582927.698806226]: Found 1 uEye camera.
#[ INFO] [1498582927.949965618]: Opened camera UI122xLE-M 4102718110
#[ WARN] [1498582928.158007664]: Failed to load intrinsics for camera from file
I obtain this error when I try rosrun ueye camera. And also I am not able to find anything in rostopic List
/rosout
/rosout_agge
Above are the nodes which appear.
I am using Ros indigo and linux 14.04 LTS. The daemon is also running.
Also I tried to find the IDS software suite version 4.60.5 but currently only the new version 4.82.2 is available.
Kindly suggest the steps required to resolve the error or any other sources which can provide the correct procedure.
↧
how to publish a complex msg via launch file?
I set a msg named NavigationPoint and its definition is that:
std_msgs/Header header
geometry_msgs/Pose pose
time arrival_time
int32 formation
int32[] parameters.
And now I want to publish the msg via launch file like that :
But I think the format is not correct .If anyone know the true format I'll always appreciate that!
↧
Getting stuck on ROS for Raspbian Jessie
I am following this tutorial on installing ROS Kinetic on Raspbian Jessie and I got stuck Building the Catkin Workspace.
/etc/dphys-swapfile has been configure to
CONF_SWAPFILE=/mnt/sda2/swap.file
CONF_SWAPSIZE=1024
/sda2 is a 1TB external Hard Disk. It does not have a file "swap.file" though. How should I create it?
`free -h`
now gives me
total used free shared buffers cached
Mem: 859M 778M 81M 48M 84M 381M
-/+ buffers/cache: 312M 547M
Swap: 1.0G 0B 1.0G
Running
`sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j2`
causes me to get stuck and terminal shows
[100%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
[100%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
↧
rostopic echo Int32MultiArray as hex
I'm looking for a way to use `rostopic echo` to print a `Int32MultiArray` message data as hex values instead of decimal. I've tried piping to `xxd` but it's printing the hex for the ASCII text representing the numbers.
Here's an example Int32MultiArray. I'm using the plotting format flag `-p` only to reduce the clutter. I'd like to see this:
rostopic echo -p /test_topic
%time,field.layout.data_offset,field.data0,field.data1,field.data2,field.data3
1499982217479538917,0,20805,1,21,22
1499982219479435920,0,20805,1,21,22
1499982223479465007,0,20805,1,21,22
1499982225479479074,0,20805,1,21,22
Looks something like this:
%time,field.layout.data_offset,field.data0,field.data1,field.data2,field.data3
1499982217479538917,0x0,0x5145,0x1,0x15,0x16
1499982219479435920,0x0,0x5145,0x1,0x15,0x16
1499982223479465007,0x0,0x5145,0x1,0x15,0x16
1499982225479479074,0x0,0x5145,0x1,0x15,0x16
I've even tried using wireshark to look at the raw message but that's a challenge to trace down.
↧
↧
Rostopic on Mac
I am continuing my quest to get ROS working on my Mac. I deleted my old ros_catkin_ws fully, and then redid the installation script (I know, it's not complete or supported, but I have to try.) For a change I thought I should try kinetic-ors-com-wet-install.
All went well ,without errors. And roscore started up fine.
Then this:
bash-3.2$ rostopic -h
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
Anyone have a pointer for me on that one/ Thanks!
↧
Why are these topics appearing?
This is a basic question. I've "installed" all the bits for a Turtlebot3 on my ubuntu running in vmware.
I have run roscore.
I have explicitly run a single script which creates a single new topic, cmd_vel.
But when I list `rostopic list` is see a long list of topics (see below).
It is clear that those topic come from the Turtlebot3 installed code. But my question is what ended up "invoking it"? As the only thing I've run are roscore and my little script, lots of other code must be in play to declare those topics.
Can someone please clarify?
Here's the list:
/camera/depth/camera_info
/camera/depth/image_raw
/camera/depth/points
/camera/parameter_descriptions
/camera/parameter_updates
/camera/rgb/camera_info
/camera/rgb/image_raw
/camera/rgb/image_raw/compressed
/camera/rgb/image_raw/compressed/parameter_descriptions
/camera/rgb/image_raw/compressed/parameter_updates
/camera/rgb/image_raw/compressedDepth
/camera/rgb/image_raw/compressedDepth/parameter_descriptions
/camera/rgb/image_raw/compressedDepth/parameter_updates
/camera/rgb/image_raw/theora
/camera/rgb/image_raw/theora/parameter_descriptions
/camera/rgb/image_raw/theora/parameter_updates
/clock
/cmd_vel
/joint_states
/mobile_base/commands/motor_power
/mobile_base/commands/reset_odometry
/mobile_base/commands/velocity
/mobile_base/events/bumper
/mobile_base/events/cliff
/mobile_base/sensors/imu_data
/odom
/rosout
/rosout_agg
/tf
↧
Can't navigate and use camera at the same time
I am working on a project that requires both navigation and object recognition modules. The problem I have is that modules work when they are run individually but as soon as I try to run them simultaneously then one fails. I I start amcl first I can do the navigation but there is no data from the /camera/rgb/image_mono (although there is data on the /camera/ir/image_raw topic) topic even after running roslaunch openni_launch openni.launch.
If I start openni.launch first then in amcl I get the error :
extrapolation error looking up robot pose.
Can I not do both at the same time when using the /camera/rgb/image_mono topic?
I am using the Kinect Sensor that comes with the turtlebot for both recognition and navigation. The ros distribution is groovy.
↧
how to rostopic pub msg with array members
When i want to publish msg like this:
Header header
uint32 seq
time stamp
string frame_id
Point point
float64 x
float64 y
float64 z
i can use the following cmd:
rostopic pub pt geometry_msgs/PointStamped '{stamp: now, frame_id: base_link}' '[1.0, 2.0, 3.0]'
or
rostopic pub pt geometry_msgs/PointStamped '{stamp: now, frame_id: base_link}' '[1.0, 2.0, 3.0]'
what command should i use to publish **msgs with array members** like:
std_msgs/Header header
string[] joint_names
trajectory_msgs/MultiDOFJointTrajectoryPoint[] points
geometry_msgs/Transform[] transforms
geometry_msgs/Twist[] velocities
geometry_msgs/Twist[] accelerations
duration time_from_start
↧
↧
How can I wrap rostopic into a Python library
I would like to use the rostopic functionality (e.g. to measure the publishing rate of a topic) in Python and encapsualted in a library. One possible way would be to (a) create a wrapper which calls rostopic with Python's subprocess. Another possibility would be to (b) use the Python classes like e.g. [ROSTopicHz in this function](https://github.com/ros/ros_comm/blob/lunar-devel/tools/rostopic/src/rostopic/__init__.py#L293). Both approaches have pros and cons. What approach do you recommend?
Side note for alternative (a): The problem with rostopic is that it was designed with interactive and not "automated" command line interaction in mind. For example: After invocation rostopic does not terminate on it's own but needs to be forced to. As a result it's not straightforward to get it's output from stdout (but requires to terminate the spawned child process it is running in explicitly after stdout has been captured).
Side not for alternative (b): The problem with this approach is that the classes itself don't provide all required setup functionality like creating a subscriber (refer hyperlinked example above). In the end one would re-implement a lot of the functionality which is already present in the [command line interface specific functions](https://github.com/ros/ros_comm/blob/lunar-devel/tools/rostopic/src/rostopic/__init__.py#L2095).
↧
rostopic import error
I am following the Ros Nodes tutorial http://wiki.ros.org/ROS/Tutorials/UnderstandingNodes and have come across an error at point 6 in the website above^^.
When I try to run the '$ rosnode list' command in the new terminal window, I receive the error below:
import rostopic
ImportError: No module named rostopic
and therefore cannot continue the tutorial.
Has anyone overcome this problem?
↧
How to republish image to multiple topics with CameraInfoManager?
Hello,
My program takes the capture image from a webcam and dividing it into 4 images by splitting the main capture.
I want to publish those 4 images in a 4 different topics in the same ros package, same cpp file, but when I try to do that with creating 4 different camera_info_manager I get the error:
Tried to advertise a service that is already advertised in this node [/camera/set_camera_info]
Any ideas how to solve my issue and how to create 4 different rostopics ?
thanks.
↧