Skip to content

Commit

Permalink
add message of datas
Browse files Browse the repository at this point in the history
  • Loading branch information
k-okada committed Nov 21, 2023
1 parent 862e299 commit dea181c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions database_talker/scripts/make_aibo_diary.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def query_activities(self, start_time, end_time):
msg = deserialise_message(msg)
meta = json.loads(meta.pairs[0].second)
activities.append((msg, meta))
rospy.logwarn(" Found {} messages".format(len(activities)))
return activities

def query_activities_days(self, days=7):
Expand Down Expand Up @@ -181,9 +182,11 @@ def make_aibo_activities_raw(self, activities):
for activities in activities:
rospy.loginfo("Found {} activities".format(len(activities)))
activities_raw = []
input_topics = []
for msg, meta in activities:
state = None
timestamp = datetime.datetime.fromtimestamp(meta['timestamp']//1000000000, JST)
input_topics.append(meta['input_topic'])
# rospy.logwarn("{} {}".format(timestamp, meta['input_topic']))
if meta['stored_type'] == 'aibo_driver/StringStatus':
if msg.status in ['', 'none']:
Expand All @@ -210,6 +213,9 @@ def make_aibo_activities_raw(self, activities):
# create activities_raw
for s in state:
activities_raw.append((timestamp, s))
if len(activities_raw) > 0:
rospy.loginfo(" {} {}".format(activities_raw[0][0], activities_raw[-1][0]))
rospy.loginfo(" {}".format({key: input_topics.count(key) for key in set(input_topics)}))
diary_activities_raw.append(activities_raw)
##
return diary_activities_raw ## (timestamp, event)
Expand Down Expand Up @@ -275,6 +281,7 @@ def make_image_activities_raw(self, activities):
def make_activity(self, activities = None):
if not activities:
activities = self.query_activities_days()

diary_activities_raw = self.make_aibo_activities_raw(activities) ## (timestamp, event)

# check today
Expand Down

0 comments on commit dea181c

Please sign in to comment.