mirror of
https://github.com/elephantrobotics/mycobot_ros.git
synced 2026-07-14 09:00:53 +00:00
fix bug
This commit is contained in:
parent
f8335430d4
commit
021fad8d5d
3 changed files with 12 additions and 15 deletions
|
|
@ -13,7 +13,7 @@
|
||||||
<rosparam param="source_list" subst_value="true">["joint_states"]</rosparam>
|
<rosparam param="source_list" subst_value="true">["joint_states"]</rosparam>
|
||||||
</node>
|
</node>
|
||||||
|
|
||||||
<!-- mycobot-topics -->
|
<!-- mypalletizer-topics -->
|
||||||
<include file="$(find mypalletizer_communication)/launch/communication_topic_pi.launch">
|
<include file="$(find mypalletizer_communication)/launch/communication_topic_pi.launch">
|
||||||
<arg name="port" value="$(arg port)" />
|
<arg name="port" value="$(arg port)" />
|
||||||
<arg name="baud" value="$(arg baud)" />
|
<arg name="baud" value="$(arg baud)" />
|
||||||
|
|
|
||||||
|
|
@ -144,15 +144,13 @@ class Object_detect(Movement):
|
||||||
def move(self, x, y, color):
|
def move(self, x, y, color):
|
||||||
# send Angle to move mypal260
|
# send Angle to move mypal260
|
||||||
print(color)
|
print(color)
|
||||||
# self.pub_angles(self.move_angles[0], 20)
|
|
||||||
self.mc.send_angles(self.move_angles[0], 20)
|
self.mc.send_angles(self.move_angles[0], 20)
|
||||||
# print("move_angles\n")
|
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
# send coordinates to move mypal260
|
# send coordinates to move mypal260
|
||||||
self.mc.send_coords([x, y, 160, -82.17], 20, 2)
|
self.mc.send_coords([x, y, 160, -82.17], 20, 0)
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
self.mc.send_coords([x, y, 99, -82.17], 20, 1)
|
self.mc.send_coords([x, y, 90, -82.17], 20, 0)
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
|
|
||||||
# open pump
|
# open pump
|
||||||
|
|
@ -160,11 +158,11 @@ class Object_detect(Movement):
|
||||||
self.gpio_status(True)
|
self.gpio_status(True)
|
||||||
else:
|
else:
|
||||||
self.pub_pump(True, self.Pin)
|
self.pub_pump(True, self.Pin)
|
||||||
time.sleep(0.5)
|
time.sleep(1.5)
|
||||||
|
|
||||||
self.mc.send_angle(2, 0, 20)
|
self.mc.send_angle(2, 0, 20)
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
self.mc.send_angle(3, -18, 20)
|
self.mc.send_angle(3, -5, 20)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# self.pub_angles(self.move_angles[2], 20)
|
# self.pub_angles(self.move_angles[2], 20)
|
||||||
|
|
@ -182,7 +180,7 @@ class Object_detect(Movement):
|
||||||
# self.pub_marker(
|
# self.pub_marker(
|
||||||
# self.move_coords[4][0]/1000.0, self.move_coords[4][1]/1000.0, self.move_coords[4][2]/1000.0)
|
# self.move_coords[4][0]/1000.0, self.move_coords[4][1]/1000.0, self.move_coords[4][2]/1000.0)
|
||||||
|
|
||||||
self.mc.send_coords(self.move_coords[color], 20, 1)
|
self.mc.send_coords(self.move_coords[color], 20, 0)
|
||||||
self.pub_marker(self.move_coords[color][0]/1000.0, self.move_coords[color]
|
self.pub_marker(self.move_coords[color][0]/1000.0, self.move_coords[color]
|
||||||
[1]/1000.0, self.move_coords[color][2]/1000.0)
|
[1]/1000.0, self.move_coords[color][2]/1000.0)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
@ -372,7 +370,6 @@ class Object_detect(Movement):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
# open the camera
|
# open the camera
|
||||||
|
|
|
||||||
|
|
@ -116,11 +116,11 @@ mc = MyPalletizer("/dev/ttyAMA0", 1000000)
|
||||||
# print(mc.get_angles())
|
# print(mc.get_angles())
|
||||||
# print(mc.get_coords())
|
# print(mc.get_coords())
|
||||||
|
|
||||||
mc.release_all_servos()
|
# mc.release_all_servos()
|
||||||
while True:
|
# while True:
|
||||||
print("angles:%s"%mc.get_angles())
|
# print("angles:%s"%mc.get_angles())
|
||||||
print("coords:%s"%mc.get_coords())
|
# print("coords:%s"%mc.get_coords())
|
||||||
print("\n")
|
# print("\n")
|
||||||
|
|
||||||
# mc.set_servo_calibration(1)
|
# mc.set_servo_calibration(1)
|
||||||
# mc.set_servo_calibration(2)
|
# mc.set_servo_calibration(2)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue