User Tools

Site Tools


neurali:husky_python1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
neurali:husky_python1 [2016/07/09 21:30]
profpro created
neurali:husky_python1 [2020/06/08 22:20] (current)
Line 1: Line 1:
 +[[neurali:husky codice python]]
  
 +<code python >
 +
 +#!/usr/bin/env python
 +PKG = 'numpy_tutorial'
 +import roslib
 +#roslib.load_manifest(PKG)
 +
 +import rospy
 +# from rospy_tutorials.msg import Floats
 +# import sys, rospy, cv, cv2
 +# from std_msgs.msg import String
 +from geometry_msgs.msg import Twist, Point, Point32, Polygon
 +from sensor_msgs.msg import Image, LaserScan, Joy
 +import numpy as np
 +from rospy.numpy_msg import numpy_msg
 +
 +from sensor_msgs.msg import Imu
 +
 +def callback(data):
 +    # print rospy.get_name(), "I heard %s"%str(data)
 +    # print type(data) <class 'rospy.numpy_msg.Numpy_sensor_msgs__Imu
 + print "ruota?",data.angular_velocity.z
 + print "avanti?",data.linear_acceleration.x
 +
 +def listener():
 +    rospy.init_node('listener')
 +    rospy.Subscriber("imu/data", numpy_msg(Imu), callback) # topic name imu/data???
 +    rospy.spin()
 +
 +if __name__ == '__main__':
 +    listener()
 +
 +</code>
neurali/husky_python1.txt ยท Last modified: 2020/06/08 22:20 (external edit)