From dea181c4b66d9f59e2f3118dced8b982b8ea9c3a Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Tue, 21 Nov 2023 19:25:50 +0900 Subject: [PATCH] add message of datas --- database_talker/scripts/make_aibo_diary.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/database_talker/scripts/make_aibo_diary.py b/database_talker/scripts/make_aibo_diary.py index 295e29f967..3cfb0fcb24 100755 --- a/database_talker/scripts/make_aibo_diary.py +++ b/database_talker/scripts/make_aibo_diary.py @@ -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): @@ -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']: @@ -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) @@ -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