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

Rosserial_arduino use on an arduino uno with IMU (I2C/Wire library)

$
0
0
Hey! I have been testing the **rosserial_arduino** (http://wiki.ros.org/rosserial) in order to run a ROS node on arduino. I tested some of the examples and thought I had the hang of it. (In case it's useful: I'm running Ubuntu 14.04 on a macbook pro). However I'm unable to get the arduino node to publish information from the **IMU connected to the arduino UNO**. The IMU is the **MPU9150** and I'm using an implementation of the **I2Cdev** library found here: https://github.com/richards-tech/MPU9150Lib (I have tried a different library, in order to understand if the problem was related to this specific library, but ended up with the same problem). If I only use the MPU9150 library, that is, if I don't try to use resserial, I'm able to get the IMU data on the arduino and print it on the serial monitor. However, if I try to use rosserial I'm unable to make the node work. When I run the serial_node from rosserial I get the following output: nmirod@nmirod:/$ rosrun rosserial_python serial_node.py _port:=/dev/ttyACM1 _baud:=57600 [INFO] [WallTime: 1422735802.267338] ROS Serial Python Node [INFO] [WallTime: 1422735802.270908] Connecting to /dev/ttyACM1 at 57600 baud /home/nmirod/catkin_ws/src/rosserial/rosserial_python/src/rosserial_python/SerialClient.py:336: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information. self.pub_diagnostics = rospy.Publisher('/diagnostics', diagnostic_msgs.msg.DiagnosticArray) [ERROR] [WallTime: 1422735819.375623] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino Notice that the SyntaxWarning appears even in the tutorial examples. After some testing it seems that this problem is related to the use of the Wire library. Commenting the functions that perform the initialization and reading of the IMU, I' able to get a msg on the desired topic (although constant). However, if I try to run the node as it is, I get the "Unable to sync with device" error. Is this problem associated with the "Wire library"/I2C communication? Can you help me out? **EDIT:** Is it possible to use Serial.print()'s in combination with rosserial? When I wrote this sketch I had the caution to remove all debug prints, to be sure it wouldn't scramble the communication with ros. However, when I was out of options I decided to try to use some Serial.print()'s for debugging and it seems that using Serial.begin(57600) solved the problem (same baud rate as the node). Althought the problem seems to be solved I still would like to understand what's going on so that if something similar happens down the road I know what to do.

Viewing all articles
Browse latest Browse all 314


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