Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

rostopic publish/subscribe over serial port

Hi, I'm trying to receive IMU data from simulink on a STM32 Nucleo board over port "ttyACM0" to a topic "/raw_imu" and also publish navigation plan coordinates from rostopic "/local_plan".

I'm confused about the general method of doing this. Do I make a script to run on the host computer or the STM board? I've tried the tutorials on the the wiki and this is the best I can come up with but I'm not sure where to put it. This part is only for the board publisher. (I know it's very not right but any tips would be super helpful)

#!/usr/bin/env python import roslib

import rospy from nav_msgs.msg

import Path

import serial

ros::NodeHandle nh;

ser = serial.Serial('/dev/ttyACM0', 9600)

def talker():

while not rospy.is_shutdown():





if __name__ == '__main__':

try: pub = rospy.Publisher('IMU', String)



except rospy.ROSInterruptException: