def send_spreadsheet_pub_goal(self, arg_protocol, arg_mode, arg_topic, arg_message): """ Method to send Goals to Action Server: /action_ros_iot This method is called for publishing the messages to the action server. Parameters: arg_protocol(string): Protocol used for sending the data. eg: mqtt, http. arg_mode(string): Mode of communication. eg: pub:Publishing the data, sub: Subscribing arg_topic(string): Name of the channel of communication. arg_message(string): Message to be sent through the topic. Return: goal handle: A goal handle is returned. NOTE: The data type of arg_message is dependent on the defination of the message. In this case we are using a string. """ goal = msgRosIotGoal() goal.protocol = arg_protocol goal.mode = arg_mode goal.topic = arg_topic goal.message = arg_message rospy.loginfo("Sending HTTP Goal.") goal_handle = self._ac_ros_iot.send_goal(goal, self.on_transition, None) return goal_handle
def send_goal(self, arg_protocol, arg_mode, arg_topic, arg_message): """ Function used to send goals to the action server NOTE - We have not changed the contents of the action msg, as we were not sure if that is allowed or not. Hence, parameters name and it's function will not make much sense, since we are using it for diffrent purposes than its name Parameters: arg_protocol (str): goal_protocol to be used google_apps: To send data to google sheet mqtt: To send data to mqtt server arg_mode (str): Mode of the goal (now depricated i.e. value should be "NA") arg_topic (str): Name of the sheet on which to upload data arg_message (str): Contents of the data to be uploaded Returns: goal_handle: goal_handle of the sent goal """ # Creating a Goal Message Object goal = msgRosIotGoal() goal.protocol = arg_protocol goal.mode = arg_mode goal.topic = arg_topic goal.message = arg_message rospy.loginfo("[UR5_2] Sending the goal") # Send the goal goal_handle = self._ac.send_goal(goal, self.on_transition, None) return goal_handle
def send_goal_iot(self, arg_protocol, arg_mode, arg_topic, arg_message): goal = msgRosIotGoal() goal.protocol = arg_protocol goal.mode = arg_mode goal.topic = arg_topic goal.message = arg_message goal_handle = self.ac.send_goal(goal, self.on_transition, None) return goal_handle
def send_goal_iot(self, arg_protocol, arg_mode, arg_topic, arg_message): '''SEND GOAL IOT FUNCTION USED TO PUBLISH MESSAGE ON MQTT TOPIC.''' goal = msgRosIotGoal() goal.protocol = arg_protocol goal.mode = arg_mode goal.topic = arg_topic goal.message = arg_message goal_handle = self.ac.send_goal(goal, self.on_transition, None) return goal_handle
def send_goal_iot(self, msg): print('this is send goal iot', msg) goal = msgRosIotGoal() goal.message = msg.result goal.protocol = 'http' goal.topic = str(msg.state) goal.mode = 'pub' goal_handle = self._ac1.send_goal(goal, self.on_transition1, None) print('sending goal to iot server to push data', goal) self.count1 = self.count1 + 1 self._goal_handles1.update({str(self.count1): goal_handle})
def send_goal(self, arg_protocol, arg_mode, arg_topic, arg_message): # Create a Goal Message object goal = msgRosIotGoal() goal.protocol = arg_protocol goal.mode = arg_mode goal.topic = arg_topic goal.message = arg_message rospy.loginfo("Send goal.") # self.on_transition - It is a function pointer to a function which will be called when # there is a change of state in the Action Client State Machine goal_handle = self._ac.send_goal(goal, self.on_transition, None) return goal_handle
def send_mqtt_pub_goal(self, arg_protocol, arg_mode, arg_topic, arg_message): """ Function to send Goals to Action Server: /action_ros_iot """ goal = msgRosIotGoal() goal.protocol = arg_protocol goal.mode = arg_mode goal.topic = arg_topic goal.message = arg_message rospy.loginfo("Sending Mqtt Goal.") goal_handle = self._ac_ros_iot.send_goal(goal, self.on_transition, None) return goal_handle
def send_ac_goal(self, arg_protocol, arg_mode, arg_topic, arg_message): '''********************METHOD DOCSTRING************ Name: send_ac_goal Objective: to send Goals to Action Server Arguments: protocol (mqtt/http), mode (pub/sub), topic and message Returns: goal_handle for the goal **************************************************''' # Creating a Goal Message object goal = msgRosIotGoal() goal.protocol = arg_protocol goal.mode = arg_mode goal.topic = arg_topic goal.message = arg_message rospy.loginfo("Send goal.") # self.on_transition - It is a function pointer to a function which will be called when # there is a change of state in the Action Client State Machine goal_handle = self._ac.send_goal(goal, self.on_transition, None) return goal_handle
def mqtt_sub(self): msg = msgRosIotGoal() msg.protocol = 'mqtt' msg.mode = 'sub' self.sac_iot.send_goal(msg)
def mqtt_send_goal(self, arg_protocol, arg_mode, arg_message): msg = msgRosIotGoal() msg.protocol = arg_protocol msg.mode = arg_mode msg.message = arg_message self.sac_iot.send_goal(msg)