-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue calling robot.arm.move_pose([0.25, 0.03, 0.15, 0.0, 1.57, 0]) #1
Comments
Hi, |
The robot is connected via ethernet. |
Hi, |
Here's the script that I'm currently running: import argparse
import numpy as np
from pyniryo2 import *
ROBOT_IP = "robot_ip_address"
def main() -> None:
# receive source and sink workspaces from the command line
parser = argparse.ArgumentParser()
parser.add_argument("source_workspace", action="store", type=str, help="workspace where the items are grabbed from")
parser.add_argument("sink_workspace", action="store", type=str, help="workspace where the items are placed")
args = parser.parse_args()
source_workspace = args.source_workspace
sink_workspace = args.sink_workspace
# create a robot obj and initialize
robot_ip_address = ROBOT_IP
robot = NiryoRobot(robot_ip_address)
robot.arm.calibrate_auto()
robot.tool.update_tool()
# calculate the observation pose
workspace_poses = robot.vision.get_workspace_poses(source_workspace)
x_values = [pose.x for pose in workspace_poses]
y_values = [pose.y for pose in workspace_poses]
x = (max(x_values) - min(x_values)) / 2 + min(x_values)
y = (max(y_values) - min(y_values)) / 2 + min(y_values)
phi = np.arctan2(y, x)
short_rho = np.sqrt(x ** 2 + y ** 2) - 0.12
x = short_rho * np.cos(phi)
y = short_rho * np.sin(phi)
source_observation_pose = PoseObject(
x=x,
y=y,
z=0.3,
roll=0.0,
pitch=1.57,
yaw=phi)
# calculate the sink observation_pose
workspace_poses = robot.vision.get_workspace_poses(sink_workspace)
x_values = [pose.x for pose in workspace_poses]
y_values = [pose.y for pose in workspace_poses]
x = (max(x_values) - min(x_values)) / 2 + min(x_values)
y = (max(y_values) - min(y_values)) / 2 + min(y_values)
phi = np.arctan2(y, x)
short_rho = np.sqrt(x ** 2 + y ** 2) - 0.12
x = short_rho * np.cos(phi)
y = short_rho * np.sin(phi)
sink_observation_pose = PoseObject(
x=x,
y=y,
z=0.3,
roll=0.0,
pitch=1.57,
yaw=phi)
# move to observation pose
robot.arm.move_pose(source_observation_pose)
input_shape = ObjectShape.ANY
input_color = ObjectColor.ANY
# grab the input object
obj, obj_shape, obj_color = robot.vision.vision_pick(source_workspace, 0.01, input_shape, input_color)
while obj:
if obj_shape == ObjectShape.SQUARE:
x = (max(x_values) - min(x_values)) / 3 + min(x_values)
elif obj_shape == ObjectShape.CIRCLE:
x = 2 * (max(x_values) - min(x_values)) / 3 + min(x_values)
if obj_color == ObjectColor.RED:
y = (max(y_values) - min(y_values)) / 4 + min(y_values)
elif obj_color == ObjectColor.GREEN:
y = 2 * (max(y_values) - min(y_values)) / 4 + min(y_values)
elif obj_color == ObjectColor.BLUE:
y = 3 * (max(y_values) - min(y_values)) / 4 + min(y_values)
place_pose = PoseObject(
x=x,
y=y,
z=0.09,
roll=0.0,
pitch=1.57,
yaw=1.57)
robot.arm.move_pose(sink_observation_pose)
robot.arm.move_pose(place_pose)
robot.tool.release_with_tool()
# move to observation pose
robot.arm.move_pose(source_observation_pose)
# grab the input object
obj, obj_shape, obj_color = robot.vision.vision_pick(source_workspace, 0.01, input_shape, input_color)
# end the robot
robot.arm.move_to_home_pose()
robot.end()
if __name__ == "__main__":
main() |
Thank you for sending me the code. I do not see the line you are referring to however(move_pose([0.25, 0.03, 0.15, 0.0, 1.57, 0]))? |
It's an known issue. It come from roslibpy library. |
Occasionally if I wait for a couple minutes between running a pyniryo2 script on a separate Ubuntu 18.04 machine, I will get this error.
After trying to run the code a few more times, it will eventually succeed and pass through, but it's inconsistent.
The text was updated successfully, but these errors were encountered: