mobileroboticsskoltech / bandeja-wrapper Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
I use the following debugging code
import time
from src.RemoteControl import RemoteControl
from concurrent.futures import ThreadPoolExecutor
import subprocess
import rospy
from sensor_msgs.msg import Imu
import numpy as np
import pandas as pd
from io import StringIO
from src.TimeSync import TimeSync2
import matplotlib.pyplot as plt
HOST = '10.30.65.160' # The smartphone's IP address
mcu_imu_time = []
mcu_imu_data = []
def callback(data):
dat = data.header.stamp.secs + data.header.stamp.nsecs / 1e9
mcu_imu_time.append(dat)
dat = data.angular_velocity
mcu_imu_data.append([dat.x, dat.y, dat.z])
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber("mcu_imu", Imu, callback)
#rospy.spin()
def main():
remote = RemoteControl(HOST)
start_duration = 1
main_duration = 4
end_duration = 5
with ThreadPoolExecutor(max_workers=1) as executor:
print('imus gathering started')
future = executor.submit(remote.get_imu, 1000 * (start_duration + main_duration + end_duration), False, True)
listener()
time.sleep(start_duration)
print('start shaking')
time.sleep(main_duration)
print('put back')
time.sleep(end_duration)
rospy.signal_shutdown('it is enough')
accel_data, gyro_data = future.result()
print('stopped')
mcu_gyro_data = np.array(mcu_imu_data) - np.array(mcu_imu_data)[:200].mean(axis=0)
mcu_gyro_time = np.array(mcu_imu_time)
print(gyro_data[:200])
'''
Some other code
'''
if __name__ == '__main__':
main()
Output:
imus gathering started
start shaking
put back
stopped
6.5392947,-7.188068,-3.8377817,68005547326543
-0.0012394455,-0.0012382239,-3.2620205E-4,68005549328543
-0.0012394455,-0.0012382239,-3.2620205E-4,68005551342543
-0.0012394455,-6.273586E-4,2.846632E-4,6
...
So, in the output the first string of print(gyro_data[:200])
in main()
outputs 6.5392947,-7.188068,-3.8377817,68005547326543 in still configuration.
Maybe I should download some new version of mobile app.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.