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

rosserial wire

$
0
0
Hello everyone. I can't seem to be able to use Wire.h in arduino with the rosserial library. Each time I try, I get this message : [WARN] [WallTime: 1395811454.890221] Serial Port read returned short (expected 1 bytes, received 0 instead). [WARN] [WallTime: 1395811454.891349] Serial Port read failure: [ERROR] [WallTime: 1395803426.139769] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino I admit, I have both groovy and hydro on my computer but I installed the ros library using rosserial in groovy with grovvy sourced and right now I'm using groovy and not hydro. Here are all the source and command I use on setup : alias groovy='source /opt/ros/groovy/setup.bash && source /home/ros/catkin_ws/devel/setup.bash && export EDITOR='nano' && export ROS_PACKAGE_PATH=/home/ros/catkin_ws/src:/opt/ros/groovy/share:/opt/ros/groovy/stacks' Hydro is thus not a factor and if I remove Wire.h from my arduino project the connection is successful and I can publish data. Any help in order to help sove this problem will be appreciate and rewarded with... heu... love <3. Thanks a lot. [EDIT for the comments] @billtecteacher What I mean is, for the error to be appear I have to had `#include ` at the begin of the code @balto I rebuild the ros_lib for groovy using cd /libraries rm -rf ros_lib rosrun rosserial_arduino make_libraries.py .

Bluetooth communication problem with arduino over rosserial_arduino and rosserial_python

$
0
0
Hi, I am using an Arduino Uno in combination with a Sparkfun Bluetooth Mate Gold modem to interface with my ROS hydro framework running on a host. The communication is established with the rosserial_python node on the host and the rosserial_arduino code uploaded to the Arduino. When I upload the blink_led example described in [this tutorial](http://wiki.ros.org/rosserial_arduino/Tutorials/Blink), I get the following error after running the rosserial_python node on the host: [ERROR] [WallTime: 1395914292.667126] Mismatched protocol version in packet: lost sync or rosserial_python is from different ros release than the rosserial client [INFO] [WallTime: 1395914292.667822] Protocol version of client is unrecognized, expected Rev 1 (rosserial 0.5+) The error is usually thrown after a few seconds, before the error is thrown everything works fine and I can blink the LED. I already tried the following measures without success: - Set a baudrate of 115200 instead of 57600 on the host side, the bluetooth modem and the Arduino UART. - Compile the rosserial code from source instead of using the latest debian binaries (results in a different error complaining about unexpected message lengths). - Recompile the ros_lib library in the Arduino sketchbook. - Increase the delay times in the Arduino code. - Remove all subscribers in the Arduino code and just init the node. When I try to run the system over bluetooth, the modem is connected to the TX/RX pins of the arduino (TX to RX, RX to TX) and the USB cable removed. When I disconnect the bluetooth modem from the Arduino and connect the Arduino over a USB cable to the host, everything runs fine. Can anyone help me with this issue?

publishing before configure when using rosserial

$
0
0
Hellow all, I'm trying to use rosserial with an Arduino UNO (or Duemilanove I have the sme problem with both of them) to retrieve informaion given by an IMU. First I increased the message buffer size like this : namespace ros { #if defined(__AVR_ATmega8__) || defined(__AVR_ATmega168__) /* downsize our buffers */ typedef NodeHandle_ NodeHandle; #elif defined(__AVR_ATmega328P__) // typedef NodeHandle_ NodeHandle; typedef NodeHandle_ NodeHandle; #else typedef NodeHandle_ NodeHandle; #endif } in ros.h in ros_lib **and** in the rosserial_arduino folder. This is because at first I had an error telling me the buffer size was to small. Then I'm trying to publish a sensor_msgs::Imu through a publisher but It always fail. Here is the error message I have : ros@ros-K56CM:~$ rosrun rosserial_python serial_node.py /dev/ttyUSB0 [INFO] [WallTime: 1397029727.199687] ROS Serial Python Node [INFO] [WallTime: 1397029727.213908] Connecting to /dev/ttyUSB0 at 57600 baud [ERROR] [WallTime: 1397029729.700241] Tried to publish before configured, topic id 30 [ERROR] [WallTime: 1397029744.688688] Lost sync with device, restarting... [ERROR] [WallTime: 1397029745.117519] Tried to publish before configured, topic id 30 And then the arduino freeze. If I start the restart it, it runs again and freeze when serial_node.py asked for the publisher. I know it freeze because I make a led blink all the time and it stop blinking after the first error message. Here is my code : ros::NodeHandle nh; sensor_msgs::Imu imu_msg; ros::Publisher pub_imu( "/imu", &imu_msg); char frameid[] = "/imu"; #define PIN 13 int flag; void setup() { //Serial.begin(57600); nh.initNode(); nh.advertise(pub_imu); imu_msg.header.frame_id = frameid; imu_msg.header.stamp=nh.now(); pinMode(PIN,OUTPUT); flag=0; } void loop() { blinking(); delay(1000); writeData(); pub_imu.publish(&imu_msg); nh.spinOnce(); } I'm not even doing any operation nor anything complexe so I'm really lost at what is my problem :S. Furthermore, everything work fine with the ultrasonic example... Any help will be appreciated. Thank you.

failed to connect to xbee

$
0
0
I am trying to follow this tutorial :http://wiki.ros.org/rosserial_xbee/Tutorials/Example%20Network However, when i run the command rosrun rosserial_xbee setup_xbee.py -C /dev/ttyUSB0 0 for configuring my xbee, i get an error saying "Failed to connect to the xbee." i am using the sparkfun xbee explorer. WHat am i doing wrong? The xbee is conneced to /dev/ttyUSB0

how to run a LSM303 compass on ROS?

$
0
0
I just bought a LSM303DLHC compass that i want to run on ROS using rosserial_arduino? Can anybody tell me what exactly are the things i need to do? I have all the libraries and packages ready... but I am confused about how to start interfacing the arduino code with ROS? Please help...

Non existing package

$
0
0
1. Created a package of my own after installing the package rosserial, this went well. I've been following the [create a package tutorial.](http://wiki.ros.org/ROS/Tutorials/CreatingPackage) 2. When listing the dependencies it claims that the package rosserial is missing as seen below. 3. What have I missed ? ---------- $ $ catkin_create_pkg serial_test01 std_msgs rospy roscpp rosserial $ Created file serial_test01/CMakeLists.txt Created file serial_test01/package.xml Created folder serial_test01/include/serial_test01 Created folder serial_test01/src Successfully created files in ~/catkin_ws/serial_test01. Please adjust the values in package.xml. $ $ $ rospack depends1 serial_test01 [rospack] Error: package/stack 'serial_test01' depends on non-existent package 'rosserial' and rosdep claims that it is not a system dependency. Check the ROS_PACKAGE_PATH or try calling 'rosdep update' $ $ ----------

how to communicate with 32- bit controller and ROs running on PC over USB via UART

$
0
0
Hello, I am a newbie to the ROS, want to use the ROS for an indoor navigation robot which goes as below: indoor navigation robot, which has sensors like stereo camera’s, ultra sonic sensors, kinect, encoders for the motors etc. which are all connected to a 32-bit micro controller (Atmel), all the commands for the actuators will be given by this controller, and the data from all the sensors are read by the controller (using SPI, UART I2C etc.). I want to send the Sensor dat to the PC (running with ROS on Linux) fixed on to the Robot and use the libraries for navigation, mapping etc. available in ROS. But my first question is How can I send the data from the micro controller to the PC, I have Checked over the internet, The option was to use the “roserial” library. I can use the available UART port on my micro controller, but How can I transmit this data to PC which will be connected via a USB.? How can I open a USB port on the PC and send data on that port, which should be received by the micro controller on the UART..? Many Thanks in Advance.

rosserial between two computers running full ros

$
0
0
I'd like to communicate over serial between two computers running full ros. All the tutorials are for embedded devices and arduinos. I feel like this has to be simple, but I'm clearly missing something and your help is greatly appreciated. I've tried running the "rosrun rosserial_python serial_node.py" on both computers simultaneously, but the serial nodes are unable to establish a connection and instead throwing an error. I'm guessing that this is because you need the roscore on one computer to run the rosserial host, while the other computer is the client? I've tried having just one computer run the rosserial_python serial_node.py, assuming the other computer automatically generates the client library upon initialization of any new nodes once you've installed rosserial, but alas this doesn't work (a.k.a. I am unable to publish/ subscribe to topics across computers). Do I need to write custom code for the client computer or something? My setup: A pc running Ubuntu 12.04 with full ROS, a Beaglebone Black running Ubuntu 12.04 with full ROS, serial communication via 3DR Radios (USB0 on the pc and UART ttyO1 on the Beaglebone Black). rosserial is installed in both computers.

rosserial arduino Serial Port read failure

$
0
0
Hi, I've written a small sensor_msgs::Imu publisher on a arduino micro which works for a short time but crashes after some seconds with following status: [INFO] [WallTime: 1402665675.175567] Note: publish buffer size is 512 bytes [INFO] [WallTime: 1402665675.176102] Setup publisher on /imu_data [sensor_msgs/Imu] [WARN] [WallTime: 1402665687.484972] Serial Port read returned short (expected 1 bytes, received 0 instead). [WARN] [WallTime: 1402665687.485703] Serial Port read failure: [ERROR] [WallTime: 1402665699.934101] Lost sync with device, restarting... I supposed this might be some buffer overflow, which is why I increased the nh.spinOnce() during the loop to no effect. What does the message mean and how can I fix it? Thnx in advance.

Rosserial Arduino Problem

$
0
0
Hi, i just started using ROS and i'm trying to use rosserial_arduino. I'm trying to get the examples working but I have some problems, when I launch: rosrun rosserial_python serial_node.py /dev/ttyACM0 I have this error on the console: [ERROR] [WallTime: 1402855665.112426] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino I read other threads and i loaded the sketch on a Mega 2650 and a UNO with atmega328 to exclude memory issues but i have always the same error. Some additional information: $rospack find rosserial [rospack] Error: stack/package rosserial not found $rospack find rosserial_arduino /opt/ros/hydro/share/rosserial_arduino $rospack find rosserial_python /opt/ros/hydro/share/rosserial_python $rosmsg show Adc [rosserial_arduino/Adc]: uint16 adc0 uint16 adc1 uint16 adc2 uint16 adc3 uint16 adc4 uint16 adc5 I'm running Hydro on Ubuntu 13.04 64-bit Any help would be appreciated

Cannot install rosserial in ros indigo

$
0
0
When tried to install rosserial using `sudo apt-get install ros-indigo-rosserial` it returns an error `E: Unable to locate package ros-indigo-rosserial` I am using ros indigo on ubuntu 14.04

unable to read the data from micro controller on ROS

$
0
0
I want to send the data from my robot to ROS over UART, I tried using rosserial but was uncessful, then I tried using the code mentioned in the below link but still I face some problems. I am using the code as mentioned in the link: (answers.ros.org/question/10114/how-can-ros-communicate-with-my-microcontroller/) The controller I am using is a 32-bit ARM Controller which sends data over UART to PC (ROS running on Linux) over ttyUSB0 for every 100ms, but I can not see any received data from micro controller on PC, the entire "ucResponse" buffer is only with zero's. I have checked that the data from micro-controller is coming properly out. Can any one has any idea what is going wrong..? Thanks in advance

error in rosserial_arduino

$
0
0
i use fuerte want to install arduino with ROS this error display when run any example in ros_lib `In file included from button_example.cpp:5:0: /home/msamir/sketchbook/libraries/ros_lib/ros.h:38:29: fatal error: ros/node_handle.h: No such file or directory compilation terminated.`

How to write a node that uses libusb?

$
0
0
Hi all, I need to write a node to listen to a usb port via libusb. I used to do that with a simple cpp program, but I had to use sudo to open the port. How can I rosrun such a program? By the way, I am also interested in how rosserial pkg. does the trick. Because I think open a serial port also require root privilege.

Enabling timer overflow interrupt breaks rosserial

$
0
0
**Background** I'm trying to get rosserial working to communicate with a Colorduino. The colorduino has an ATmega 328 chip and the driver for it uses timer2 to refresh the matrix at 80hz. **Problem** Enabling the overflow interrupt on timer2 using: `TIMSK2 |= ((1<

Getting Started Using ROS on a Micro Controller

$
0
0
Hello, I'm relatively new with Robotics as I've previously only done things with Parallax's robot kits. I'd like to start learning ROS but there doesn't seem to be any starting help. To begin with I need to get a computer with Ubuntu as the Windows version is limited. The bigger question is, what MicroController do I need? I was under the assumption when I used the Parallax Basic-Stamp 2 that my desktop software that I programmed with translated my program into something the chip understands. But is this universal? Can I pick pretty much any microcontroller in the world to use with the ROS system? Please help guys as I'm completely lost.

Segmentation Fault

$
0
0
Hi Everyone, sorry for an other segmentaion fault question, but i really dont see it. Im generating on an arduino a message which has an array that holds multiple sensor readings. The arduino is publishing with 13.7Hz. On the ROS side i subscribe to that data and want to create for each sensor reading a single range message with an unique frame_id for a later transform. Little Ros Graph: /serial_node -> /range_data -> /sensor_state_publisher -> /ir_1_data , ir_2_data, ir_3_data, ir_4_data, ir_5_data , ir_6_data, ir_7_data Every now and then i get a segmention fault error, when starting the node on the ros side. I tried to deallocate the used arrays in the destructor, to clear them and to rize them. When im changing the average rate to a higher value, the segmentation error accures more often. I also tried to set up the buffer size. Nothing helped. Did someone see my mistake, or is the hole programm bs and not usable for my need. Here my code: #include #include #include class SensorStatePublisher { public: SensorStatePublisher() { state_listener = nh.subscribe("/range_data",100000, &SensorStatePublisher::sensor_msg_callback, this); ir_1_publisher = nh.advertise("/ir_1_data", 100000); ir_2_publisher = nh.advertise("/ir_2_data", 100000); ir_3_publisher = nh.advertise("/ir_3_data", 100000); ir_4_publisher = nh.advertise("/ir_4_data", 100000); ir_5_publisher = nh.advertise("/ir_5_data", 100000); ir_6_publisher = nh.advertise("/ir_6_data", 100000); ir_7_publisher = nh.advertise("/ir_7_data", 100000); } void sensor_msg_callback(const range_msgs::SensorStatesConstPtr &msg); void publish_range_msg(void); void populate_range_msg(void); private: ros::NodeHandle nh; ros::Subscriber state_listener; ros::Publisher ir_1_publisher, ir_2_publisher, ir_3_publisher, ir_4_publisher, ir_5_publisher, ir_6_publisher, ir_7_publisher; // Message Elements std_msgs::Header _header; int _radiation_type; float _field_of_view, _min_range, _max_range; std::vector _sensor_ranges; // Range Messages, one for every Sensor std::vector range_msgs; protected: }; void SensorStatePublisher::sensor_msg_callback(const range_msgs::SensorStatesConstPtr &msg) { _sensor_ranges.clear(); // Save All Metadata _header = msg->header; _field_of_view = msg->field_of_view; _min_range = msg->min_range; _max_range = msg->max_range; // Save Every Arrayelement Of The Message for (int i = 0; i < msg->range.size() ; ++i) { _sensor_ranges.push_back(msg->range[i]); } _sensor_ranges.resize(msg->range.size()); } void SensorStatePublisher::populate_range_msg(void) { range_msgs.clear(); // Populate New Range Message With Saved Data sensor_msgs::Range new_range; new_range.header = _header; new_range.field_of_view = _field_of_view; new_range.min_range = _min_range; new_range.max_range = _max_range; // Save Data In An Array of Ranges for (int i = 0; i < _sensor_ranges.size(); ++i){ std::ostringstream oss; oss << "ir_" << i+1 << "_link"; new_range.header.frame_id = oss.str(); new_range.range = _sensor_ranges.at(i); range_msgs.push_back(new_range); } range_msgs.resize(_sensor_ranges.size()); } void SensorStatePublisher::publish_range_msg(void) { // Publish All Elements of the Range Array ir_1_publisher.publish(range_msgs[0]); ir_2_publisher.publish(range_msgs[1]); ir_3_publisher.publish(range_msgs[2]); ir_4_publisher.publish(range_msgs[3]); ir_5_publisher.publish(range_msgs[4]); ir_6_publisher.publish(range_msgs[5]); ir_7_publisher.publish(range_msgs[6]); } int main(int argc, char** argv) { ros::init(argc, argv, "sensor_state_publishe"); SensorStatePublisher statePublisher; ros::Rate r(10); while(ros::ok()) { statePublisher.populate_range_msg(); statePublisher.publish_range_msg(); r.sleep(); ros::spinOnce(); } return 0; } Thanks for every help and excuse my little noob cpp/ros programm. ;)

Running serial_node.py in rosserial gives error as "Creation of Publisher failed: unpack requires a string argument of length 4"

$
0
0
I am using ROS Hydro with rosserial library, Running the node serial_node.py as mentioned below: rosrun rosserial_python serial_node.py Gives the error continuously as **Creation of Publisher failed: unpack requires a string argument of length 4**. I am using an ARM (Atmel) 32-bit microcontroller to send the data on to the ROS over UART. The code in the microcontroller goes in accordance with the protocol mentioned in the overview of the rosserial The code in the micro controller is as follows, u8_Ros_TxBuff[0] = Sync_Flag; //Sync Flag (Value: 0xff) u8_Ros_TxBuff[1] = 0xfe; //Protocol_Version_Sync; u8_Ros_TxBuff[2] = 5 ; // message length - low byte u8_Ros_TxBuff[3] = 0 ;// message length - high byte u8_Ros_TxBuff[4] = checksum_MessageLength(); // Checksum over message length u8_Ros_TxBuff[5] = ID_PUBLISHER ; //Topic ID - Low Byte u8_Ros_TxBuff[6] = 0; //Topic ID - High Byte u8_Ros_TxBuff[7] = 1; //Serialized Message Data u8_Ros_TxBuff[8] = 7; // Serialized Message Data u8_Ros_TxBuff[9] = 9; // Serialized Message Data u8_Ros_TxBuff[10] = 2; // Serialized Message Data u8_Ros_TxBuff[11] = 7; // Serialized Message Data u8_Ros_TxBuff[12] = checksum_MessageTopicID() ; // Checksum over Topic ID and Message Data even the check sum's are calculated as per the protocol. the 13 bytes are send over UART at 5700bps for every 10ms. I can see the data coming from the micro-controller correctly. But when I run the node serial_node.py on ROS it gives the error: Creation of Publisher failed: unpack requires a string argument of length 4 I have checked the rosserial overview once again: there is something called **topic negotiation** as follows, Before data transfer can begin, the PC/Tablet side must query the Arduino or other embedded device for the names and types of topics which will be published or subscribed to. Topic negotiation consists of a query for topics, a response with the number of topics, and packets to define each topic. The request for topics uses a topic ID of 0. The query for topics will look like: 0xff 0xfd 0x00 0x00 0xff 0x00 0x00 0xff A series of response packets (message type rosserial_msgs/TopicInfo, each containing information about a particular topic, with the following data in place of the serialized message: uint16 topic_id string topic_name string message_type string md5sum int32 buffer_size Here, the topic name is the name of the topic, for instance "cmd_vel", and message type is the type of the message, for instance "geometry_msgs/Twist". If a response packet is not received correctly, another query may be sent. New in 0.3.0 MD5 checksums are now transmitted to verify that both the sender and receiver are using the same message. How can I achieve this **Topic Negotiation** on my micro controller using C-code. Please help me out, if any one has an idea. thanks in advance.

Array size limited to 255 in rosserial

$
0
0
I'm trying to send a PointCloud2 message from a windows machine to the ROS master via rosserial_windows. The message includes a data array that needs to hold 512x424x2 bytes, but the data_length field as generated by rosserial is a uint8 and limited to 255. Is there a way to make a larger array, or is this something that needs to be modified in rosserial?

rosserial - port/baud parameters

$
0
0
Hello, After having my arduino rosserial node break spontaneously after an update to rosserial, I narrowed down the reason to a change in serial_node.py. My launch file parameters for baud rate and port would no longer get passed to serial_node.py correctly, making it default to ttyUSB0 and 57600 bps. [serial_node.py](https://github.com/ros-drivers/rosserial/blob/groovy-devel/rosserial_python/nodes/serial_node.py): port_name = rospy.get_param('~port','/dev/ttyUSB0') baud = int(rospy.get_param('~baud','57600')) ... rospy.init_node("serial_node") From my end, this is caused by serial_node.py trying to load these parameters before it initializes the node. Changing the node to initialize before loading parameters, the proper port/baud rate get passed to the node from the launch file. No one else seems to have noticed this problem, is there a more obvious reason why my launch file parameters are no longer working?
Viewing all 314 articles
Browse latest View live


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