Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all 119 articles
Browse latest View live

Problem regarding header files in Arduino

$
0
0
When I run Arduino IDE using the command "arduino" and compile it, I get the error that "sabertooth.h" and "kangaroo.h " doesn't exist, when I open it using the command "sudo arduino" I get the error that "ros.h" doesn't exist (and all other header files also). When I run it using the icon, I get the error that my custom message file from ROS doesn't exist, I don’t know where to ask this question, so asking this here. I am using ROS Kinetic on Ubuntu 16.04. I have made a package called diff_robot and a message file called ultra_readings.msg This is the initial part of the code #include #include #include #include #include #include #include Sabertooth ST(128); #include #include #include #include #include #define BNO055_SAMPLERATE_DELAY_MS (100) Adafruit_BNO055 bno = Adafruit_BNO055(55); KangarooSerial K(Serial3); KangarooChannel K1(K, '1'); KangarooChannel K2(K, '2'); These are the errors: When I open Arduino IDE with"arduino" command in terminal Arduino_code.ino:7:24: fatal error: Sabertooth.h: No such file or directory compilation terminated. When I open Arduino IDE with "sudo arduino" command in terminal Arduino_code.ino:1:17: fatal error: ros.h: No such file or directory compilation terminated. When I open Arduino IDE by clicking on its icon /home/user/Documents/DL_1234/ROSHS/robot_catkin_ws/src/diff_robot/src/Arduino_code/Arduino_code.ino:5:39: fatal error: diff_robot/ultra_readings.h: No such file or directory #include ^ compilation terminated. exit status 1 Error compiling for board Arduino Mega ADK.

rospy ColorRGBA array messages changing all vectors

$
0
0
So I'm trying to make certain LED's change color on certain events, I wrote a small program to test these changes import rospy from ledtracker.msg import ColorArray from std_msgs.msg import ColorRGBA def publisher(): pub = rospy.Publisher('/ledscape_ros/array', ColorArray, queue_size=10) rospy.init_node('userstracker_vectors', anonymous=True) rate=rospy.Rate(0.2) msg = ColorRGBA() msg.r = 0.0 msg.g = 0.0 msg.b = 255.0 msg.a = 255.0 msga = ColorArray() for i in range(221): msga.leds.append(msg) while not rospy.is_shutdown(): rospy.loginfo('Publishing') msga.leds[10].r = 255.0 pub.publish(msga) rate.sleep() if __name__ == '__main__': try: publisher() except rospy.ROSInterruptException: pass If i try this, all LED's get colored red. I tried adding: msg2 = ColorRGBA() msg2.r = 255.0 msga.leds.insert(10, msg2) print(msga.leds[10]) print(msga.leds[11]) to see if that would help the problem but it didn't , this time it correctly colors only the 10th LED but then after the first iteration it continues to color the 11th and then the 12th and so forth till it has colored all LED's after the 10th. Is there something I'm missing on how to publish this array? the message is simply std_msgs/ColorRGBA[] leds Thanks in advance!

What is the difference between a topic and a message?

$
0
0
A very newbie question for sure, but I'm having a little trouble distinguishing between topics and messages. I understand that topics are the named "channels" published and subscribed by nodes and messages are the details of the data carried on the topics so they seem like pretty much the same thing. Can you ever have multiple message types sent across one topic? If not then why the distinction between the two?

Where do I publish a robot's status?

$
0
0
I would like to trigger a LED or another indicator when ROS is running and or a specific package is ready. Would I do this as a service or a message? How would I track it when its not ready any longer? I'd also Like to create an indicator when an action is running or completed. As above would i create my own message type and pub sub to that - if so when? Anyone point me to some tutorials that can help me accomplish this? Keith

Subscriber not receiving messages even though publisher is continuously publishing on the given same topic

$
0
0
Hey! Had a question I needed your clarification with! I have a publisher that continuously publishes onto a topic, and I have a subscriber node that is defined as a part of the class. For some reason, the subscriber is not receiving any messages, but when I do rostopic echo for the topic I am publishing my data on, I can see the proper data over there. I understand that this is the simple ROS setup, but for some reason, I am not able to debug this..Would you have any particular places that I can look for bugs ?

ros::desrialize messages

$
0
0
Hello. I'm building a system based on ros messages (not using ros message transferring system, only its messages). I'm using python zmq system to send ros messages, and cpp zmq to receive it. On the sending side I'm using this code to serialize the msg: s1 = StringIO() s.serialize(s1) socket.send_multipart(s1.buflist) which s is of type ros message type. On the receiving side i'm using : ros::serialization::IStream s(m.message_start, m.num_bytes - (m.message_start - m.buf.get())); deserialize(s, message); which message is ros message type and m is of type ros::SerializedMessage, and deserialize is ros's deserialize function I manage to deserialize alot of ros's messages(std msgs and my own created messages) but some I cannot deserialize and get the following error: terminate called after throwing an instance of 'ros::serialization::StreamOverrunException' what(): Buffer Overrun How come I can deserialize some of them and some not, considering all of them are ros like messages?

Looking for existing Electromyograph EMG/EEG, or voltage messages

$
0
0
I am in the process of implementing a ROSBag writer for an electromyograh device. Before implementing my own messages, I would like to know if such messages already exist. Basically I al looking for Electromyograph EMG/EEG messages, or, if they don't exist, a basic voltage message of the type: Header header float64 voltage float64 variance

ROS2 Custom Messages Not Found

$
0
0
While trying to run my python script, I get `ModuleNotFoundError: No module named 'lightring_msgs'`. I know the message types are being generated; the package files are in the install directory. Why can't python find the module? My project layout /lightring_driver /lightring_driver package.xml setup.cfg setup.py /lightring_msgs /msg CMakeLists.txt package.xml setup.cfg lightring_msgs/CMakeLists.txt cmake_minimum_required(VERSION 3.5) project(lightring_msgs) # Default to C++14 if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() find_package(ament_cmake REQUIRED) find_package(builtin_interfaces REQUIRED) find_package(rosidl_default_generators REQUIRED) rosidl_generate_interfaces(lightring_msgs "msg/LightringCommand.msg" DEPENDENCIES builtin_interfaces ) ament_package() lightring_msgs/package.xml lightring_msgs0.0.0TODO: Package descriptionjacobTODO: License declarationbuiltin_interfacesament_cmakerosidl_default_generatorsrosidl_default_runtimerosidl_interface_packagesament_cmake

Message for publishing roll, pitch, yaw without converting to quaternion

$
0
0
Hi there, I have been looking for a way to publish roll, pitch, yaw angles without change them to quaternions but I didn't find that kind of message after googling for a while. I know I can write my own types of messages but I don't want to reinvent the wheel if is the case. So, does anyone know a standar message with pose and orientation being the angles in rpy form? Regards, Juan Sandubete López.

Understanding messages MDSum

$
0
0
I am trying to understand how the MD5Sum of the messages is being calculated following this [link](http://wiki.ros.org/ROS/Technical%20Overview#Message_serialization_and_msg_MD5_sums) So far, I undestand that a plain message like std_msgs/Header translates to: uint32 seq time stamp string frame_id And if I paste that block of text into [this online MD5Sum calculator](http://www.password-generator-tool.com/md5-hash-generator) it correctly gives me the Header hash: 2176decaecbce78abc3b96ef049fabed Now, for complex messages, the documentation states that: "*In order to catch changes that occur in embedded message types, the MD5 text is concatenated with the MD5 text of each of the embedded types, in the order that they appear.*" So, how that would translate to a message like geometry_msgs/Vector3Stamped ? I tried combinations like this: Header header Vector3 vector uint32 seq time stamp string frame_id float64 x float64 y float64 z or like this: Header header Vector3 vector 2176decaecbce78abc3b96ef049fabed 4a842b65f413084dc2b10fb484ea7f17 Also with capital letters but none gives me the correct Vector3Stamped MD5Sum of 7b324c7325e683bf02a9b14b01090ec7

ros2 rti dds cross communications example?

$
0
0
Does anyone know of an example of an RTI connext DDS node reading/writing with a ROS2 node? I have been using RTI connext for the last few years and am jumping back into ROS, via ROS2. However, i am at a loss as to how to take my IDLs and turn them into a .msg. For example: what would this look like as a .msg? depth.idl and fluidpressure.idl depth.idl: include "fluid pressure.idl" module robot { const octet WATER_TYPE_SALT = 1; struct depth { sensor::msg::dds::fluidpressure pressure; string id; //@key float depth; }; }; fluidpressure.idl: module sensor { module msg { module dds { struct fluidpressure { double fluid_pressure; double variance; }; }; }; }; Is it as simple as saying: depth.msg: const byte WATER_TYPE_SALT = 1 sensor/msg/dds/fluidpressure pressure float32 depth and fluidpressure.idl: double32 fluid_pressure double32 variance ? Thanks Jim

finding the right action name and package names to import for smach

$
0
0
hi, i am creating a state machine which calls multiple actions and services but having trouble finding the right package/service names to import. the examples on tutorial pages are not helping much on this mather. the action topic names are known to me. Which commands or methods should i use to locate/determine them. thanks...

Subscribing multiple topics with different rate

$
0
0
Hey there, I´m currently new at ROS but made yet all the beginner tutorials at the ROS homepage. First I implemented a simple publisher and subscriber and it worked. Now I want to create something like the following: - Node A which publishes a string with rate(1) to topic “test_01” , variable var01 - Node B which publishes an int with rate(1) to topic “test_02”, variable var02 - Node C which publishes an int with rate(10) to topic “test_03” , variable var03 I want to have the following workflow: an node D which subscribes to all three nodes A-C and producing the following output on the screen: **cout <<“%s %i %i” << var01 var02 var03 << endl;** So each time a message is published, the cout should performed with the actual variables. As I understood so far, CallbackQueues (http://wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning#CallbackQueue::callAvailable.28.29_and_callOne.28.29) might be the right strategy, but after hours of trying without success I don´t have any idea how to implement the workflow… Happy about every hint 😊

Messages aren't built

$
0
0
I've downloaded a ROS package and I would like to use its messages in my program, however, for some weird reason the messages aren't built and thus I get an error. My package.xml has this: nerian_stereo my CMakeLists.txt has this: find_package(catkin REQUIRED COMPONENTS rospy message_runtime std_msgs nerian_stereo ) and my code file has this: from nerian_stereo import * self.camera_info = rospy.Subscriber("/nerian_stereo/stereo_camera_info", StereoCameraInfo ,self.stereo_camera_cb) however I still get this annoying error of: NameError: global name 'StereoCameraInfo' is not defined What's wrong? I also observed my `catkin_make` and I see that this package is not built at all, the output does not show its name. Is there yet another file which needs to be edited? EDIT: Here is the message: http://docs.ros.org/api/nerian_stereo/html/msg/StereoCameraInfo.html

What is the correct (standard) way of using sensor_msgs/TimeReference?

$
0
0
I am writing a node that indirectly interfaces with a GPS receiver. I want to match the interface of the [NMEA Navsat Driver](http://wiki.ros.org/nmea_navsat_driver), for convenience, but I don't fully understand how the [sensor_msgs/TimeReference](http://docs.ros.org/api/sensor_msgs/html/msg/TimeReference.html) message is to be used, especially since there is a delay between receiving the GPS message and being able to publish it. I would think that the correct way to use it is to adjust the header of the message to contain the ROS time when the GPS message was received, and put the GPS time in the message. Is this correct? Is this in line with what other nodes produce or use? If not, what is the preferred method?

In publish raise ROSSerializationException(str(e))

$
0
0
In my package that I created, there are 3 nodes currently. I also generate a custom message which is "AnchorScan". First node does some stuff and only publishes from `/IPS` topic. Second node subscribes to the `/IPS` topic, takes the information, do some stuff and publishes another information from `/selectedAnchors` topic. Until now everything works fine. But; Third node subscribes to the `/selectedAnchors` topic and does some calculations however does not publish anything from `/position` topic. After I run this command on terminal rostopic echo /position I received that kind of exception. I tried to change the queue size, rate etc. but nothing worked fine. All raised error is here: Traceback (most recent call last): File /home/user/my_ws/src/my_pkg/src/pkg_name/3rd_node.py", line 366, in position_pub_sub() File "/home/user/my_ws/src/my_pkg/src/pkg_name/3rd_node.py", line 324, in position_pub_sub pub.publish(msg) File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 886, in publish raise ROSSerializationException(str(e)) rospy.exceptions.ROSSerializationException: field x must be a list or tuple type Thank you in advance for any help!!! https://github.com/ros/ros_comm/issues/1691#issue-431540502 --- Edit: Here is my code: #!/usr/bin/env python # license removed for brevity import rospy from math import sqrt from random import randint from random import uniform from collections import OrderedDict from std_msgs.msg import String from my_pkg.msg import AnchorScan class CalcPos2D3AIte: def __init__(self, SX, SY, SZ, AX, AY, AZ, BX, BY, BZ, TZ, das, dbs): ## DO STUFF ## DO STUFF ## DO STUFF pre_TY = (N2 -(M21*N1/M11))/(M22-(M21*M12/M11)) pre_TX = ((-1*M21*N1/M11) + (M21*M12/M11)*pre_TY)/(-1*M21) TX = pre_TX TY = pre_TY self.TX_cm = int(TX*100) self.TY_cm = int(TY*100) self.TZ_cm = int(TZ*100) def position_pub_sub(): rospy.init_node('test2_positioning_node', anonymous=True) rospy.Subscriber('selectedAnchors', AnchorScan, callback) pub = rospy.Publisher('position', AnchorScan, queue_size=2) rate = rospy.Rate(10) while not rospy.is_shutdown(): if var_control: msg = AnchorScan() tagpos = CalcPos2D3AIte(SX, SY, SZ, AX, AY, AZ, BX, BY, BZ, TZ,das, dbs) msg.x = tagpos.TX_cm msg.y = tagpos.TY_cm msg.z = tagpos.TZ_cm pub.publish(msg) pub_info = "\nTX = %f \nTY = %f \nTZ = %f \n\n" % (tagpos.TX_cm,tagpos.TY_cm,tagpos.TZ_cm) rospy.loginfo(pub_info) rate.sleep() Here is my AnchorScan.msg what it looks like: # Timestamp #Header header int32[] AnchorID float64[] x float64[] y float64[] z float64 distance # according to "S" float64[] DDOA_of_anchors

How to provide variance field in sensor_msgs/FluidPressure messages?

$
0
0
I'm writing a ROS driver for a pressure sensor and while I really only need to publish the 'pressure' field, I'd like to also fill out the other field which is 'variance' for the sake of completeness. I wanted to know if this is something that pressure sensors typically provide on their own or if this would be something that my ROS driver would have to calculate? What, if anything, is this field useful for? If it's something I have to calculate, is it simply the [average of the squared differences from the mean](https://www.mathsisfun.com/data/standard-deviation.html)?

Teraranger tower evo doesnt publish the data from each of its sensors.I've tried to use Range and LaserScan from sensor_msgs and even built the custom msg RangeArray but it doesnt work

$
0
0
enter code here[ERROR] [1560244035.890227391]: Client [/range_ahead] wants topic /ranges to have datatype/md5sum [sensor_msgs/Range/c005c34273dc426c67a020a87bc24148], but our version has [teraranger_array/RangeArray/4c1d9b3ff03219d31e41c86817a72ba8]. Dropping connection. [ERROR] [1560244036.895534180]: Client [/range_ahead] wants topic /ranges to have datatype/md5sum [sensor_msgs/Range/c005c34273dc426c67a020a87bc24148], but our version has [teraranger_array/RangeArray/4c1d9b3ff03219d31e41c86817a72ba8]. Dropping connection. and the error when running rostopic echo /ranges ERROR: Cannot load message class for [teraranger_array/RangeArray]. Are your messages built?

ImportError: No module named msg - standard ROS message

$
0
0
Hi, I am trying to use `geodesy` package https://github.com/ros-geographic-info/geographic_info I have installed the stack using `apt-get`. I can include the messages in `.cpp` files however in Python I get this: import rospy import geodesy.utm rospy.init_node('gd_test') Results in: Traceback (most recent call last): File "gd_test.py", line 2, in import geodesy.utm File "/opt/ros/kinetic/lib/python2.7/dist-packages/geodesy/utm.py", line 54, in from geographic_msgs.msg import GeoPoint ImportError: No module named msg I don't see `setup.py` in `geodesy` package, could it be possible that the Python environment is not set up right? Can this package be used as a standard package or do I have to clone it into my catkin_ws?
Viewing all 119 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>