forked from ipab-rad/baxter_myo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_baxter.py
executable file
·41 lines (35 loc) · 1.02 KB
/
start_baxter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python
import time
import rospy
import cv_bridge
import cv
import rospkg
from baxter_myo.arm_controller import ArmController
from baxter_myo.config_reader import ConfigReader
from sensor_msgs.msg import (
Image
)
def send_image():
"""
Send the image located at the specified path to the head
display on Baxter.
@param path: path to the image file to load and send
"""
rp = rospkg.RosPack()
path = rp.get_path('baxter_myo') \
+ '/share/' + 'good_face.jpg'
img = cv.LoadImage(path)
msg = cv_bridge.CvBridge().cv_to_imgmsg(img, encoding="bgr8")
pub = rospy.Publisher('/robot/xdisplay', Image, latch=True)
pub.publish(msg)
rospy.sleep(1)
def main():
rospy.init_node("baxter_myo")
c = ConfigReader("demo_config")
c.parse_all()
s = ArmController('right', c.right_angles, c.push_thresh, c.mode)
send_image()
while not rospy.is_shutdown():
s.step()
if __name__ == "__main__":
main()