-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10df1b9
commit 5e61a8e
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
Software/real_time/ROS_RoboBuggy/src/robobuggy/scripts/imu_magnetometer_reader.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
|
||
import rospy | ||
import math | ||
import json | ||
import time | ||
from robobuggy.msg import IMU | ||
|
||
def magnetometer_callback(data): | ||
global x | ||
global y | ||
global z | ||
x = data.X_Mag | ||
y = data.Y_Mag | ||
z = data.Z_Mag | ||
|
||
rospy.loginfo("orientation: %f", math.degrees(math.atan2(y,x))) | ||
|
||
#plot on Tkinter window | ||
pass | ||
|
||
def start_subscriber_spin(): | ||
rospy.init_node("IMU_Plotter", anonymous=True) | ||
|
||
rospy.Subscriber("IMU", IMU, magnetometer_callback) | ||
|
||
#tkinter graphics window | ||
rospy.spin() | ||
pass | ||
|
||
if __name__ == "__main__": | ||
start_subscriber_spin() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters