MiRo-Training
The aim of the project is to develop a software architecture for interacting with Miro using vocal and gestural commands.
 All Classes Files Functions Variables
bad.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 ################################################################
4 
5 import rospy
6 from std_msgs.msg import String
7 from sensor_msgs.msg import Image,CompressedImage,Range,Imu
8 from geometry_msgs.msg import Twist,Pose
9 import random
10 
11 import miro_msgs
12 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
13 
14 import opencv_apps
15 from opencv_apps.msg import CircleArrayStamped
16 
17 import math
18 import numpy
19 import time
20 import sys
21 from miro_constants import miro
22 
23 from datetime import datetime
24 
25 ## \file bad.py
26 ## \brief The node bad.py implements the action corresponding to the command "Bad".
27 ## @n The Robot moves down its head and inclines it. It turns its back to the user and change its light pattern from Blue to Red.
28 ##
29 
30 ## \brief The class SadMode implements a robot sad behaviour
31 
32 class SadMode():
33 
34 
35  ## Constructor
36  def __init__(self):
37 
38  ## Node rate
39  self.rate = rospy.get_param('rate',200)
40  ## Publisher to the topic /miro_sad a message of type platform_control which corresponds to the "Bad" action.
41  self.pub_platform_control = rospy.Publisher('/miro_sad',platform_control,queue_size=0)
42 
43  ## Function that sets the parameters of the structure platform_control corresponding to action "Bad".
44  def miro_sad(self):
45 
46  r = rospy.Rate(self.rate)
47  q = platform_control()
48 
49  while not rospy.is_shutdown():
50 
51  q.eyelid_closure = 0.3
52  q.body_config = [0.0,1.0,0.2,0.1]
53  q.body_config_speed = [0.0,-1.0,-1.0,-1.0]
54  q.lights_raw = [0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255]
55  q.tail = -1.0
56  q.ear_rotate = [1.0,1.0]
57  q.body_vel.linear.x = 0.0
58  q.body_vel.angular.z = 0.2
59  self.pub_platform_control.publish(q)
60  r.sleep()
61 
62 if __name__== '__main__':
63  rospy.init_node('bad')
64  sad = SadMode()
65  sad.miro_sad()
pub_platform_control
Publisher to the topic /miro_sad a message of type platform_control which corresponds to the "Bad" ac...
Definition: bad.py:41
def miro_sad
Function that sets the parameters of the structure platform_control corresponding to action "Bad"...
Definition: bad.py:44
rate
Node rate.
Definition: bad.py:39
The class SadMode implements a robot sad behaviour.
Definition: bad.py:32
def __init__
Constructor.
Definition: bad.py:36