18 from std_msgs.msg
import String
19 from sensor_msgs.msg
import Image,CompressedImage,Range,Imu
20 from geometry_msgs.msg
import Twist,Pose
27 from miro_constants
import miro
29 from datetime
import datetime
43 self.
mode = rospy.get_param(
'control_mode',
'advanced')
47 self.
pub_mapping = rospy.Publisher(
'/imu_mapping', Twist, queue_size=0)
67 self.
last_acc[0] = imu_data.linear_acceleration.x
68 self.
last_acc[1] = imu_data.linear_acceleration.y
69 self.
last_acc[2] = imu_data.linear_acceleration.z
80 print (
'miro stay still')
86 sw_vel.linear.x = self.
last_acc[0]*50
87 sw_vel.angular.z = 0.0
95 sw_vel.angular.z = self.
last_acc[1]*0.100
97 s_vel.angular.z = self.
last_acc[1]*0.100
105 s_vel.angular.z = 0.0
108 if self.
mode ==
'advanced':
112 if self.
mode ==
'basic':
116 self.pub_mapping.publish(q)
121 if __name__==
'__main__':
122 rospy.init_node(
'imu_data_map')
mode
Control mode set from launch file.
The Class SmartwatchData allows the subscription to the smartwatch's accelerometer data and publishin...
sub_smartwatch
Subscriber to the topic /inertial a message of type Imu.
pub_mapping
Publisher on the topic /imu_mapping a message of type Twist.
last_acc
Last acelleration data received from smartwatch.
def callback_smartwatch_data
Callback function that when the data from the smartwatch are received maps them into linear and angul...