diff --git a/mycobot_280/mycobot_280jn/config/mycobot.rviz b/mycobot_280/mycobot_280jn/config/mycobot_jn.rviz similarity index 78% rename from mycobot_280/mycobot_280jn/config/mycobot.rviz rename to mycobot_280/mycobot_280jn/config/mycobot_jn.rviz index 51ba33e..a3590c8 100644 --- a/mycobot_280/mycobot_280jn/config/mycobot.rviz +++ b/mycobot_280/mycobot_280jn/config/mycobot_jn.rviz @@ -9,7 +9,7 @@ Panels: - /RobotModel1 - /TF1 Splitter Ratio: 0.5 - Tree Height: 775 + Tree Height: 579 - Class: rviz/Selection Name: Selection - Class: rviz/Tool Properties @@ -18,17 +18,18 @@ Panels: - /2D Nav Goal1 - /Publish Point1 Name: Tool Properties - Splitter Ratio: 0.588679016 + Splitter Ratio: 0.5886790156364441 - Class: rviz/Views Expanded: - /Current View1 Name: Views Splitter Ratio: 0.5 - Class: rviz/Time - Experimental: false Name: Time SyncMode: 0 SyncSource: "" +Preferences: + PromptSaveOnExit: true Toolbars: toolButtonStyle: 2 Visualization Manager: @@ -40,7 +41,7 @@ Visualization Manager: Color: 160; 160; 164 Enabled: true Line Style: - Line Width: 0.0299999993 + Line Width: 0.029999999329447746 Value: Lines Name: Grid Normal Cell Count: 0 @@ -122,7 +123,8 @@ Visualization Manager: Value: true joint6_flange: Value: true - Marker Scale: 0.300000012 + Marker Alpha: 1 + Marker Scale: 0.30000001192092896 Name: TF Show Arrows: true Show Axes: true @@ -153,7 +155,10 @@ Visualization Manager: - Class: rviz/FocusCamera - Class: rviz/Measure - Class: rviz/SetInitialPose + Theta std deviation: 0.2617993950843811 Topic: /initialpose + X std deviation: 0.5 + Y std deviation: 0.5 - Class: rviz/SetGoal Topic: /move_base_simple/goal - Class: rviz/PublishPoint @@ -163,33 +168,33 @@ Visualization Manager: Views: Current: Class: rviz/Orbit - Distance: 1.20289087 + Distance: 1.2028908729553223 Enable Stereo Rendering: - Stereo Eye Separation: 0.0599999987 + Stereo Eye Separation: 0.05999999865889549 Stereo Focal Distance: 1 Swap Stereo Eyes: false Value: false + Field of View: 0.7853981852531433 Focal Point: - X: -0.0706475973 - Y: -0.0814988762 - Z: 0.107583851 + X: -0.07064759731292725 + Y: -0.0814988762140274 + Z: 0.10758385062217712 Focal Shape Fixed Size: true - Focal Shape Size: 0.0500000007 + Focal Shape Size: 0.05000000074505806 Invert Z Axis: false Name: Current View - Near Clip Distance: 0.00999999978 - Pitch: 0.440398335 + Near Clip Distance: 0.009999999776482582 + Pitch: 0.44039833545684814 Target Frame: - Value: Orbit (rviz) - Yaw: 0.430389732 + Yaw: 0.43038973212242126 Saved: ~ Window Geometry: Displays: collapsed: false - Height: 1056 + Height: 876 Hide Left Dock: false Hide Right Dock: false - QMainWindow State: 000000ff00000000fd00000004000000000000016a00000396fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006100fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000002800000396000000d700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000022f00000396fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000002800000396000000ad00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000073f0000003efc0100000002fb0000000800540069006d006501000000000000073f0000030000fffffffb0000000800540069006d006501000000000000045000000000000000000000039a0000039600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + QMainWindow State: 000000ff00000000fd00000004000000000000016a000002cefc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000002ce000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000022f000002cefc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000002ce000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007380000003efc0100000002fb0000000800540069006d0065010000000000000738000003bc00fffffffb0000000800540069006d0065010000000000000450000000000000000000000393000002ce00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 Selection: collapsed: false Time: @@ -198,6 +203,6 @@ Window Geometry: collapsed: false Views: collapsed: false - Width: 1855 - X: 65 - Y: 24 + Width: 1848 + X: 72 + Y: 27 diff --git a/mycobot_280/mycobot_280jn/launch/detect_marker.launch b/mycobot_280/mycobot_280jn/launch/detect_marker.launch index 444638e..c41a96f 100644 --- a/mycobot_280/mycobot_280jn/launch/detect_marker.launch +++ b/mycobot_280/mycobot_280jn/launch/detect_marker.launch @@ -1,7 +1,7 @@ - + diff --git a/mycobot_280/mycobot_280jn/launch/detect_marker_with_topic.launch b/mycobot_280/mycobot_280jn/launch/detect_marker_with_topic.launch index 2bba726..c4222af 100644 --- a/mycobot_280/mycobot_280jn/launch/detect_marker_with_topic.launch +++ b/mycobot_280/mycobot_280jn/launch/detect_marker_with_topic.launch @@ -4,7 +4,7 @@ - + diff --git a/mycobot_280/mycobot_280jn/launch/mycobot_follow.launch b/mycobot_280/mycobot_280jn/launch/mycobot_follow.launch index 7511e1f..f5c89e8 100644 --- a/mycobot_280/mycobot_280jn/launch/mycobot_follow.launch +++ b/mycobot_280/mycobot_280jn/launch/mycobot_follow.launch @@ -1,7 +1,7 @@ - + diff --git a/mycobot_280/mycobot_280jn/launch/simple_gui.launch b/mycobot_280/mycobot_280jn/launch/simple_gui.launch index d1b31e0..79c92ee 100644 --- a/mycobot_280/mycobot_280jn/launch/simple_gui.launch +++ b/mycobot_280/mycobot_280jn/launch/simple_gui.launch @@ -1,10 +1,10 @@ - - + + - + @@ -14,9 +14,9 @@ - - + + diff --git a/mycobot_280/mycobot_280jn/launch/slider_control.launch b/mycobot_280/mycobot_280jn/launch/slider_control.launch index ac42e42..63fdaa3 100644 --- a/mycobot_280/mycobot_280jn/launch/slider_control.launch +++ b/mycobot_280/mycobot_280jn/launch/slider_control.launch @@ -3,7 +3,7 @@ --> - + diff --git a/mycobot_280/mycobot_280jn/launch/teleop_keyboard.launch b/mycobot_280/mycobot_280jn/launch/teleop_keyboard.launch index f3a84db..d915aae 100644 --- a/mycobot_280/mycobot_280jn/launch/teleop_keyboard.launch +++ b/mycobot_280/mycobot_280jn/launch/teleop_keyboard.launch @@ -1,10 +1,10 @@ - - + + - + @@ -14,9 +14,9 @@ - - + + diff --git a/mycobot_280/mycobot_280jn/launch/test.launch b/mycobot_280/mycobot_280jn/launch/test.launch index dbb1f00..4fa06e4 100644 --- a/mycobot_280/mycobot_280jn/launch/test.launch +++ b/mycobot_280/mycobot_280jn/launch/test.launch @@ -1,14 +1,14 @@ - - + + - + diff --git a/mycobot_280/mycobot_280jn/scripts/follow_display.py b/mycobot_280/mycobot_280jn/scripts/follow_display.py index 52d18b7..68e8095 100755 --- a/mycobot_280/mycobot_280jn/scripts/follow_display.py +++ b/mycobot_280/mycobot_280jn/scripts/follow_display.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # encoding:utf8 import time @@ -15,16 +15,16 @@ def talker(): rospy.init_node("display", anonymous=True) print("Try connect real mycobot...") - # port = rospy.get_param("~port", "/dev/ttyTHS1") - # baud = rospy.get_param("~baud", 1000000) - ip=rospy.get_param('~ip','192.168.125.226') - netport=rospy.get_param('~netport',9000) - # print("port: {}, baud: {}\n".format(port, baud)) - print('ip:{},port:{}'.format(ip,netport)) + port = rospy.get_param("~port", "/dev/ttyTHS1") + baud = rospy.get_param("~baud", 1000000) + # ip=rospy.get_param('~ip','192.168.125.226') + # netport=rospy.get_param('~netport',9000) + print("port: {}, baud: {}\n".format(port, baud)) + # print('ip:{},port:{}'.format(ip,netport)) try: - # mycobot = MyCobot(port, baud) - mycobot=MyCobotSocket(ip,netport) - mycobot.connect() + mycobot = MyCobot(port, baud) + # mycobot=MyCobotSocket(ip,netport) + # mycobot.connect() except Exception as e: print(e) print( diff --git a/mycobot_280/mycobot_280jn/scripts/listen_real.py b/mycobot_280/mycobot_280jn/scripts/listen_real.py index 1d38b61..aea0d53 100755 --- a/mycobot_280/mycobot_280jn/scripts/listen_real.py +++ b/mycobot_280/mycobot_280jn/scripts/listen_real.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # encoding:utf-8 # license removed for brevity import time diff --git a/mycobot_280/mycobot_280jn/scripts/listen_real_of_topic.py b/mycobot_280/mycobot_280jn/scripts/listen_real_of_topic.py index ea3df92..89f9430 100755 --- a/mycobot_280/mycobot_280jn/scripts/listen_real_of_topic.py +++ b/mycobot_280/mycobot_280jn/scripts/listen_real_of_topic.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 import math import rospy diff --git a/mycobot_280/mycobot_280jn/scripts/simple_gui.py b/mycobot_280/mycobot_280jn/scripts/simple_gui.py index 9f4c791..41f9258 100755 --- a/mycobot_280/mycobot_280jn/scripts/simple_gui.py +++ b/mycobot_280/mycobot_280jn/scripts/simple_gui.py @@ -1,6 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- -import Tkinter as tk +# import Tkinter as tk +import tkinter as tk from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus import rospy import time @@ -33,7 +34,7 @@ class Window: # 计算 Tk 根窗口的 x 和 y 坐标 x = (self.ws / 2) - 190 y = (self.hs / 2) - 250 - self.win.geometry("430x370+{}+{}".format(x, y)) + self.win.geometry("430x400+{}+{}".format(int(x), int(y))) # layout,布局 self.set_layout() # input section,输入部分 diff --git a/mycobot_280/mycobot_280jn/scripts/slider_control.py b/mycobot_280/mycobot_280jn/scripts/slider_control.py index 4bf44b9..bf58aae 100755 --- a/mycobot_280/mycobot_280jn/scripts/slider_control.py +++ b/mycobot_280/mycobot_280jn/scripts/slider_control.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # encoding:utf-8 """[summary] This file obtains the joint angle of the manipulator in ROS, @@ -16,7 +16,7 @@ from pymycobot.mycobot import MyCobot from pymycobot.mycobotsocket import MyCobotSocket -ms = None +mc = None def callback(data): @@ -26,24 +26,24 @@ def callback(data): for index, value in enumerate(data.position): data_list.append(value) - ms.send_radians(data_list, 80) + mc.send_radians(data_list, 80) # time.sleep(0.5) def listener(): - global ms + global mc rospy.init_node("control_slider", anonymous=True) rospy.Subscriber("joint_states", JointState, callback) - # port = rospy.get_param("~port", "/dev/ttyTHS1") - # baud = rospy.get_param("~baud", 1000000) - # print(port, baud) - # mc = MyCobot(port, baud) - ip=rospy.get_param("~ip",'192.168.125.226') - port=rospy.get_param("~port",9000) - print(ip,port) - ms=MyCobotSocket(ip,port) - ms.connect() + port = rospy.get_param("~port", "/dev/ttyTHS1") + baud = rospy.get_param("~baud", 1000000) + print(port, baud) + mc = MyCobot(port, baud) + # ip=rospy.get_param("~ip",'192.168.125.226') + # port=rospy.get_param("~port",9000) + # print(ip,port) + # ms=MyCobotSocket(ip,port) + # ms.connect() # spin() simply keeps python from exiting until this node is stopped # spin()只是阻止python退出,直到该节点停止 diff --git a/mycobot_280/mycobot_280jn/scripts/teleop_keyboard.py b/mycobot_280/mycobot_280jn/scripts/teleop_keyboard.py index e5ee716..110f8a4 100755 --- a/mycobot_280/mycobot_280jn/scripts/teleop_keyboard.py +++ b/mycobot_280/mycobot_280jn/scripts/teleop_keyboard.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # encoding=utf-8 from __future__ import print_function from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus diff --git a/mycobot_280/mycobot_280jn_moveit/launch/moveit.rviz b/mycobot_280/mycobot_280jn_moveit/launch/moveit.rviz index 38b3736..8d7460d 100644 --- a/mycobot_280/mycobot_280jn_moveit/launch/moveit.rviz +++ b/mycobot_280/mycobot_280jn_moveit/launch/moveit.rviz @@ -9,8 +9,8 @@ Panels: - /MotionPlanning1/Scene Robot1 - /MotionPlanning1/Planning Request1 - /MotionPlanning1/Planned Path1 - Splitter Ratio: 0.742560029 - Tree Height: 325 + Splitter Ratio: 0.7425600290298462 + Tree Height: 172 - Class: rviz/Help Name: Help - Class: rviz/Views @@ -18,6 +18,8 @@ Panels: - /Current View1 Name: Views Splitter Ratio: 0.5 +Preferences: + PromptSaveOnExit: true Toolbars: toolButtonStyle: 2 Visualization Manager: @@ -29,7 +31,7 @@ Visualization Manager: Color: 160; 160; 164 Enabled: true Line Style: - Line Width: 0.0299999993 + Line Width: 0.029999999329447746 Value: Lines Name: Grid Normal Cell Count: 0 @@ -45,16 +47,14 @@ Visualization Manager: Class: moveit_rviz_plugin/MotionPlanning Enabled: true Move Group Namespace: "" - MoveIt_Allow_Approximate_IK: false + MoveIt_Allow_Approximate_IK: true MoveIt_Allow_External_Program: false MoveIt_Allow_Replanning: false MoveIt_Allow_Sensor_Positioning: false - MoveIt_Goal_Tolerance: 0 MoveIt_Planning_Attempts: 10 MoveIt_Planning_Time: 5 + MoveIt_Use_Cartesian_Path: false MoveIt_Use_Constraint_Aware_IK: true - MoveIt_Warehouse_Host: 127.0.0.1 - MoveIt_Warehouse_Port: 33829 MoveIt_Workspace: Center: X: 0 @@ -118,20 +118,21 @@ Visualization Manager: State Display Time: 0.05 s Trail Step Size: 1 Trajectory Topic: move_group/display_planned_path + Use Sim Time: false Planning Metrics: Payload: 1 Show Joint Torques: false Show Manipulability: false Show Manipulability Index: false Show Weight Limit: false - TextHeight: 0.0799999982 + TextHeight: 0.07999999821186066 Planning Request: Colliding Link Color: 255; 0; 0 Goal State Alpha: 1 Goal State Color: 250; 128; 0 - Interactive Marker Size: 0 + Interactive Marker Size: 0.12999999523162842 Joint Violation Color: 255; 0; 255 - Planning Group: mycobot_arm + Planning Group: arm_group Query Goal State: true Query Start State: true Show Workspace: false @@ -142,7 +143,7 @@ Visualization Manager: Scene Geometry: Scene Alpha: 1 Scene Color: 50; 230; 50 - Scene Display Time: 0.200000003 + Scene Display Time: 0.20000000298023224 Show Scene Geometry: true Voxel Coloring: Z-Axis Voxel Rendering: Occupied Voxels @@ -210,30 +211,30 @@ Visualization Manager: Views: Current: Class: rviz/XYOrbit - Distance: 1.39158678 + Distance: 1.3915867805480957 Enable Stereo Rendering: - Stereo Eye Separation: 0.0599999987 + Stereo Eye Separation: 0.05999999865889549 Stereo Focal Distance: 1 Swap Stereo Eyes: false Value: false + Field of View: 0.7853981852531433 Focal Point: - X: 0.113567002 - Y: 0.105920002 - Z: 2.23518001e-07 + X: 0.11356700211763382 + Y: 0.10592000186443329 + Z: 2.2351800055275817e-07 Focal Shape Fixed Size: true - Focal Shape Size: 0.0500000007 + Focal Shape Size: 0.05000000074505806 Invert Z Axis: false Name: Current View - Near Clip Distance: 0.00999999978 - Pitch: 0.439796686 + Near Clip Distance: 0.009999999776482582 + Pitch: 0.0647968053817749 Target Frame: joint1 - Value: XYOrbit (rviz) - Yaw: 2.5317657 + Yaw: 3.026766300201416 Saved: ~ Window Geometry: Displays: collapsed: false - Height: 1028 + Height: 876 Help: collapsed: false Hide Left Dock: false @@ -242,9 +243,9 @@ Window Geometry: collapsed: false MotionPlanning - Trajectory Slider: collapsed: false - QMainWindow State: 000000ff00000000fd0000000100000000000002ad000003befc0200000007fb000000100044006900730070006c0061007900730100000028000001da000000d700fffffffb0000000800480065006c00700000000342000000bb0000007300fffffffb0000000a0056006900650077007300000003b0000000b0000000ad00fffffffb0000000c00430061006d00650072006100000002ff000001610000000000000000fb0000001e004d006f00740069006f006e00200050006c0061006e006e0069006e00670100000374000001890000000000000000fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c006900640065007201000002080000004a0000004a00fffffffb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e006701000002580000018e0000018300ffffff00000471000003be00000001000000020000000100000002fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + QMainWindow State: 000000ff00000000fd0000000100000000000001f300000312fc0200000007fb000000100044006900730070006c006100790073010000003d0000013d000000c900fffffffb0000000800480065006c00700000000342000000bb0000006e00fffffffb0000000a0056006900650077007300000003b0000000b0000000a400fffffffb0000000c00430061006d00650072006100000002ff000001610000000000000000fb0000001e004d006f00740069006f006e00200050006c0061006e006e0069006e00670100000374000001890000000000000000fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720100000180000000410000004100fffffffb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e006701000001c7000001880000017d00ffffff0000053f0000031200000001000000020000000100000002fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 Views: collapsed: false - Width: 1828 - X: 92 - Y: 24 + Width: 1848 + X: 72 + Y: 27 diff --git a/mycobot_280/mycobot_280jn_moveit/scripts/sync_plan.py b/mycobot_280/mycobot_280jn_moveit/scripts/sync_plan.py index 8cdd97e..ed14da6 100644 --- a/mycobot_280/mycobot_280jn_moveit/scripts/sync_plan.py +++ b/mycobot_280/mycobot_280jn_moveit/scripts/sync_plan.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 import time import rospy from sensor_msgs.msg import JointState diff --git a/mycobot_ai/ai_mecharm_270/scripts/advance_detect_obj_color.py b/mycobot_ai/ai_mecharm_270/scripts/advance_detect_obj_color.py index 90c4967..04d3b0a 100644 --- a/mycobot_ai/ai_mecharm_270/scripts/advance_detect_obj_color.py +++ b/mycobot_ai/ai_mecharm_270/scripts/advance_detect_obj_color.py @@ -131,23 +131,23 @@ class Object_detect(Movement): # pump_control pi def gpio_status(self, flag): if flag: - # self.GPIO.output(20, 0) + self.GPIO.output(20, 0) self.GPIO.output(21, 0) else: - # self.GPIO.output(20, 1) + self.GPIO.output(20, 1) self.GPIO.output(21, 1) # 开启吸泵 m5 def pump_on(self): # 让2号位工作 - # self.mc.set_basic_output(2, 0) + self.mc.set_basic_output(2, 0) # 让5号位工作 self.mc.set_basic_output(5, 0) # 停止吸泵 m5 def pump_off(self): # 让2号位停止工作 - # self.mc.set_basic_output(2, 1) + self.mc.set_basic_output(2, 1) # 让5号位停止工作 self.mc.set_basic_output(5, 1) diff --git a/mycobot_ai/ai_mecharm_270/scripts/advance_detect_obj_img_folder.py b/mycobot_ai/ai_mecharm_270/scripts/advance_detect_obj_img_folder.py index 43da98f..7f95c4c 100644 --- a/mycobot_ai/ai_mecharm_270/scripts/advance_detect_obj_img_folder.py +++ b/mycobot_ai/ai_mecharm_270/scripts/advance_detect_obj_img_folder.py @@ -123,23 +123,23 @@ class Object_detect(Movement): # pump_control pi def gpio_status(self, flag): if flag: - # self.GPIO.output(20, 0) + self.GPIO.output(20, 0) self.GPIO.output(21, 0) else: - # self.GPIO.output(20, 1) + self.GPIO.output(20, 1) self.GPIO.output(21, 1) # 开启吸泵 m5 def pump_on(self): # 让2号位工作 - # self.mc.set_basic_output(2, 0) + self.mc.set_basic_output(2, 0) # 让5号位工作 self.mc.set_basic_output(5, 0) # 停止吸泵 m5 def pump_off(self): # 让2号位停止工作 - # self.mc.set_basic_output(2, 1) + self.mc.set_basic_output(2, 1) # 让5号位停止工作 self.mc.set_basic_output(5, 1) diff --git a/mycobot_ai/ai_mycobot_280/scripts/advance_detect_obj_color.py b/mycobot_ai/ai_mycobot_280/scripts/advance_detect_obj_color.py index da893b8..7d7f562 100755 --- a/mycobot_ai/ai_mycobot_280/scripts/advance_detect_obj_color.py +++ b/mycobot_ai/ai_mycobot_280/scripts/advance_detect_obj_color.py @@ -127,23 +127,23 @@ class Object_detect(Movement): def gpio_status(self, flag): if flag: - # self.GPIO.output(20, 0) + self.GPIO.output(20, 0) self.GPIO.output(21, 0) else: - # self.GPIO.output(20, 1) + self.GPIO.output(20, 1) self.GPIO.output(21, 1) # 开启吸泵 m5 def pump_on(self): # 让2号位工作 - # self.mc.set_basic_output(2, 0) + self.mc.set_basic_output(2, 0) # 让5号位工作 self.mc.set_basic_output(5, 0) # 停止吸泵 m5 def pump_off(self): # 让2号位停止工作 - # self.mc.set_basic_output(2, 1) + self.mc.set_basic_output(2, 1) # 让5号位停止工作 self.mc.set_basic_output(5, 1) # Grasping motion diff --git a/mycobot_ai/ai_mycobot_280/scripts/advance_detect_obj_img_folder.py b/mycobot_ai/ai_mycobot_280/scripts/advance_detect_obj_img_folder.py index 68a1432..84e8b77 100755 --- a/mycobot_ai/ai_mycobot_280/scripts/advance_detect_obj_img_folder.py +++ b/mycobot_ai/ai_mycobot_280/scripts/advance_detect_obj_img_folder.py @@ -131,23 +131,23 @@ class Object_detect(Movement): def gpio_status(self, flag): if flag: - # self.GPIO.output(20, 0) + self.GPIO.output(20, 0) self.GPIO.output(21, 0) else: self.GPIO.output(20, 1) - # self.GPIO.output(21, 1) + self.GPIO.output(21, 1) # 开启吸泵 m5 def pump_on(self): # 让2号位工作 - # self.mc.set_basic_output(2, 0) + self.mc.set_basic_output(2, 0) # 让5号位工作 self.mc.set_basic_output(5, 0) # 停止吸泵 m5 def pump_off(self): # 让2号位停止工作 - # self.mc.set_basic_output(2, 1) + self.mc.set_basic_output(2, 1) # 让5号位停止工作 self.mc.set_basic_output(5, 1) diff --git a/mycobot_communication/launch/communication_jsnn.launch b/mycobot_communication/launch/communication_jsnn.launch index b49eba0..3472501 100644 --- a/mycobot_communication/launch/communication_jsnn.launch +++ b/mycobot_communication/launch/communication_jsnn.launch @@ -1,10 +1,10 @@ - - + + - + diff --git a/mycobot_communication/scripts/mycobot_services.py b/mycobot_communication/scripts/mycobot_services.py index cbf1b75..af4dbf7 100755 --- a/mycobot_communication/scripts/mycobot_services.py +++ b/mycobot_communication/scripts/mycobot_services.py @@ -1,5 +1,5 @@ #!/usr/bin/env python2 -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -* import time import rospy import os @@ -32,7 +32,10 @@ def acquire(lock_file): else: lock_file_fd = fd break + # print('pid waiting for lock:%d'% pid) + + time.sleep(1.0) current_time = time.time() if lock_file_fd is None: @@ -46,7 +49,6 @@ def release(lock_file_fd): os.close(lock_file_fd) return None - def create_handle(): global mc rospy.init_node("mycobot_services") @@ -149,6 +151,8 @@ def toggle_pump(req): mc.set_basic_output(req.Pin1, 1) mc.set_basic_output(req.Pin2, 1) release(lock) + + return PumpStatusResponse(True)