Skip to content

Commit

Permalink
reporter.py now starts time of run on takeoff.
Browse files Browse the repository at this point in the history
Due to differences in simulation hardware, reporter.py now starts the clock after the drone's takeoff.
This change should only reduce the logged time by the reporter and will not increase recorded times.
  • Loading branch information
Winter-Guerra committed Mar 8, 2019
1 parent 636c815 commit ca00b61
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions flightgoggles_reporter/src/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import yaml
import signal
from std_msgs.msg import Empty
from sensor_msgs.msg import Imu

class Gate():
## Constructor for class gate
Expand Down Expand Up @@ -70,13 +71,14 @@ def isEvent(self,point, tol):
return False



class ReporterNode():
## Constructor for the ReporterNode
def __init__(self):

nextEventId = 0
eventTol = 1.0

self.startTime = -1
rate = 150.

# Log the event data for output
Expand All @@ -102,7 +104,6 @@ def __init__(self):
if (timeout == -1):
rospy.logerr("Timeout not specified!")
rospy.signal_shutdown("Challenge parameter [timeout] could not be read")
rospy.Timer(rospy.Duration(timeout), self.timerCallback)

rospy.Subscriber("/uav/collision", Empty, self.collisionCallback)

Expand All @@ -123,7 +124,12 @@ def __init__(self):
rospy.signal_shutdown("Location not specified in correct format")
gates.append(Gate(loc, inflation))

time_start = rospy.Time.now().to_sec()
imuSub = rospy.Subscriber("/uav/sensors/imu", Imu, self.imuCallback)
while (self.startTime == -1):
pass
imuSub.unregister()
time_start = self.startTime
rospy.Timer(rospy.Duration(timeout), self.timerCallback)
while not rospy.is_shutdown():
# Get the transformation of the drone in the world
try:
Expand All @@ -150,6 +156,9 @@ def __init__(self):

rospy.sleep(1./rate)

def imuCallback(self,data):
self.startTime=data.header.stamp.to_sec()

## @brief timerCallback callback for elapsed timer to enable the reporter to timeout
# @param self the object pointer
# @param event timer event
Expand Down

0 comments on commit ca00b61

Please sign in to comment.