Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jsk_robot_startup/smach_to_mail] Not use yaml file to set address #76

Open
wants to merge 1 commit into
base: smach_to_state
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 8 additions & 21 deletions jsk_robot_common/jsk_robot_startup/scripts/smach_to_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import base64
import cv2
import datetime
import os
import pickle
import rospy
import sys
import yaml

from cv_bridge import CvBridge
from jsk_robot_startup.msg import Email
Expand All @@ -30,27 +28,16 @@ def __init__(self):
self.bridge = CvBridge()
self.smach_state_list = {} # for status list
self.smach_state_subject = {} # for status subject
yaml_path = rospy.get_param(
'~email_info', "/var/lib/robot/email_info.yaml")
if os.path.exists(yaml_path):
with open(yaml_path) as yaml_f:
self.email_info = yaml.load(yaml_f)
rospy.loginfo(
"{} is loaded as email config file.".format(yaml_path))
rospy.loginfo(self.email_info)
self.sender_address = self.email_info['sender_address']
self.receiver_address = self.email_info['receiver_address']
if rospy.has_param("~sender_address"):
self.sender_address = rospy.get_param("~sender_address")
else:
if rospy.has_param("~sender_address"):
self.sender_address = rospy.get_param("~sender_address")
else:
rospy.logerr("Please set rosparam {}/sender_address".format(
rospy.logerr("Please set rosparam {}/sender_address".format(
rospy.get_name()))
if rospy.has_param("~receiver_address"):
self.receiver_address = rospy.get_param("~receiver_address")
else:
rospy.logerr("Please set rosparam {}/receiver_address".format(
rospy.get_name()))
if rospy.has_param("~receiver_address"):
self.receiver_address = rospy.get_param("~receiver_address")
else:
rospy.logerr("Please set rosparam {}/receiver_address".format(
rospy.get_name()))


def _status_cb(self, msg):
Expand Down