6 from std_msgs.msg
import String,Bool,Int32
7 from sensor_msgs.msg
import Image,CompressedImage,Range,Imu
8 from geometry_msgs.msg
import Twist,Pose
11 from miro_msgs.msg
import platform_config,platform_sensors,platform_state,platform_mics,platform_control,core_state,core_control,core_config,bridge_config,bridge_stream
14 from opencv_apps.msg
import CircleArrayStamped
20 from miro_constants
import miro
21 from datetime
import datetime
37 self.
rate = rospy.get_param(
'rate',200)
41 self.
robot_name = rospy.get_param (
'/robot_name',
'rob01')
43 print "topic_root", topic_root
83 self.
pub_platform_control = rospy.Publisher(topic_root +
"/platform/control", platform_control, queue_size=0)
106 self.q_play.body_config = [0.0,0.0,0.0,0.0]
107 self.q_play.body_config_speed = [0.0,-1.0,-1.0,-1.0]
134 q = platform_control()
135 q.eyelid_closure = 1.0
137 r = rospy.Rate(self.
rate)
142 while not rospy.is_shutdown():
148 count_miro = count_miro +1
149 rospy.loginfo(count_miro)
153 q.eyelid_closure = 0.0
154 q.lights_raw = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
156 q.ear_rotate = [0.0,0.0]
157 q.body_config = [0.0,0.0,0.0,0.0]
158 q.body_config_speed = [0.0,-1.0,-1.0,-1.0]
159 self.pub_platform_control.publish(q)
168 self.pub_platform_control.publish(q)
175 count_bad = count_bad + 1
176 rospy.loginfo(count_bad)
179 self.pub_platform_control.publish(q)
181 q.body_vel.linear.x = 0.0
182 q.body_vel.angular.z = 0.0
183 q.lights_raw = [255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0]
184 self.pub_platform_control.publish(q)
191 self.pub_platform_control.publish(q)
196 q.body_config = [0.0,0.0,0.0,0.0]
197 q.body_config_speed = [0.0,-1.0,-1.0,-1.0]
199 self.pub_platform_control.publish(q)
206 self.pub_platform_control.publish(q)
213 self.pub_platform_control.publish(q)
217 elif count_sleep == 1
and (
not self.
activate and not self.
command ==
"Sleep"):
218 rospy.loginfo(count_sleep)
220 self.pub_platform_control.publish(q)
224 if __name__==
'__main__':
226 rospy.init_node(
'command_recognition')
228 sb.switching_commands()
robot_name
Allow to switch from real robot to simulation from launch file.
activate
Initialization of the enabling command.
q_gbb
platform_control object that rapresents the Gesture Based Behavior ("Let's go out") ...
sub_good_action
Subscriber to the topic /miro_good a message of type platform_control that rapresents the action corr...
def callback_sleep_action
Callback that receives the action to be executed when the vocal command is "Sleep".
def switching_commands
Function that check the incoming commands and publish the corresponding action The command "Miro" b...
sub_sad_action
Subscriber to the topic /miro_sad a message of type platform_control that rapresents the action corre...
def callback_good_action
Callback that receives the action to be executed when the vocal command is "Good".
sub_play_action
Subscriber to the topic /miro_follow a message of type platform_control that rapresents the action co...
q_sleep
Platform control Object that represents the sleep action ("Sleep")
pub_platform_control
Publisher to the topic /platform/control a message of type platform_control which execute Miro action...
command
Initialization of the string to evaluate.
sub_sleep_action
Subscriber to the topic /miro_sleep a message of type platform_control that rapresents the action cor...
sub_gbb
Subscriber to the topic /miro_dance a message of type platform_control that rapresents the action cor...
def callback_gbb
Callback that receives the action to be executed when the vocal command is "Let's go"...
def callback_play_action
Callback that receives the action to be executed when the vocal command is "Play".
q_good
Platform control Object that represents the miro action when it is praised ("Good") ...
q_kill
Platform control Object that represents the miro action when it is praised ("Kill") ...
q_play
Platform control Object that represents the miro action when it follows the Ball ("Play") ...
sub_kill_action
Subscriber to the topic /miro_good a message of type platform_control that rapresents the action corr...
q_sad
Platform control Object that represents the miro action when it is scolded ("Bad") ...
The class CommandRecognition handles the different incoming commands and publish on the robot the cor...
def callback_receive_command
Callback function that receive and save the user's voice command as text.
def callback_kill_action
Callback that receives the action to be executed when the vocal command is "Kill".
def callback_sad_action
Callback that receives the action to be executed when the vocal command is "Bad". ...
sub_speech_to_text
Subscriber to the topic /speech_to_text a message of type String that cointains the vocal command con...