Coder Social home page Coder Social logo

xarm-developer / xarm-python-sdk Goto Github PK

View Code? Open in Web Editor NEW
148.0 16.0 98.0 1.36 MB

Python SDK for UFACTORY robots, 850, xArm5/6/7, and Lite6.

Home Page: https://www.ufactory.cc

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
collaborative-robot robotic-arm

xarm-python-sdk's People

Contributors

danielpmorton avatar hashb avatar huttonge avatar makrabbithole avatar schoolmater avatar vimior avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xarm-python-sdk's Issues

Lite6 - Gripper API Causes Errors

In python (3.8.6 in my case), you try to use:

arm.open_lite6_gripper()
arm.close_lite6_gripper()
arm.stop_lite6_gripper()

It causes this error:
[SDK][ERROR][2022-10-27 15:48:42][base.py:340] - - API -> set_tgpio_digital(ionum=0, value=1) -> code=1
[SDK][ERROR][2022-10-27 15:48:42][base.py:340] - - API -> set_tgpio_digital(ionum=1, value=0) -> code=1

In studio:
End module Communication Error

Gripper hangs in velocity control

This script (in which arm is an instance of XArmAPI) hangs indefinitely:

...
arm.clear_warnings_errors()
arm.motion_enable(enable=True)
arm.set_mode(4)
arm.set_collision_sensitivity(3)
arm.set_state(0)

code, pos = arm.get_gripper_position()
arm.set_gripper_position(pos)
...

Without the call to set_gripper_position it does not hang. The infinite loop is in this line in the SDK. It looks like it's hanging because the arm state has been silently reset to 1 (sleep), so the loop here runs forever.

Is it possible to use the gripper in velocity mode?

Can't clear ControllerError 12 with SDK

Servo 2 threw a "Drive Overloaded" error and we can't seem to clear it in software.
Our code is:

from xarm import XArmAPI


api = XArmAPI(port="192.168.1.232", is_radian=True, do_not_open=False)

api.clean_error()
api.motion_enable()
api.set_state(0)

which prints the following every time we run it:

SDK_VERSION: 1.9.0
FIRMWARE_VERSION: v1.8.10, PROTOCOL: V1, DETAIL: 6,6,XI1300,AC1300,v1.8.10
change prot_flag to 3
ControllerError, code: 12
servo_error_code, servo_id=2, status=1, code=33
[motion_enable], xArm is not ready to move

Presumably restarting the control box will solve the issue (there's no load on the robot currently) but hardware access to the robot is disruptive. How can we clear this error using the SDK?

time-consumimg increased

Thanks for your great work!
When I using this SDK on PC and on a jetson board, I found the time-consuming of get_forward_kinematics and get_inverse_kinematics increased a lot on jetson. In my understanding, these calculations are done by the robot arm side, not on the jetson side.
Can someone explain why the time consumption increase? I'm confused.

[SDK][ERROR] When sending command after changing mode. (Lite 6)

Hi,
I am encountering an issue when trying to work with the python sdk with the Lite 6 robot arm. I need to in runtime switch the arm modes and then command either joints rotations, goal positions, cartesian speeds, etc... As you can tell all of these use a different arm mode. I can use with no issues the all those commands as long as in that script I do not switch modes, however, when I set for example mode 5, call vc_set_cartesian_velocity(), then, change to mode 0 and call set_position() this is what I get:
[SDK][ERROR][2022-10-27 10:28:09][base.py:340] - - API -> vc_set_joint_velocity -> code=9, speeds=[0.3141592653589793, 0.0, 0.0, 0.0, 0.0, 0.0, 0], is_sync=True
and the robot is blocked, until I connect and disconnect the connection.

If you need any more details, please let me know. Any help is appreciated. Thanks!

`realtime_joint_speeds` are incorrect after connection loss

Hello,
We've noticed that a connection loss (due to an E-Stop or killing the script communicating with the robot) sometimes causes the realtime_joint_speeds API call to return obviously incorrect values upon re-connection until the robot moves for the first time. This does not happen if the control box is restarted.
Specifically, until the robot moves realtime_joint_speeds returns a constant list with entries of up to several rad/sec.
Our hypothesis is that for some reason it's returning the last value before connection was lost, as the output seems proportional to whatever the joint speeds were at that time.
We noticed this issue with a vacuum gripper attached, but we're not sure if that's relevant.

Best,
Josh

Function for get_tool_position

I found python functions for get_position, set_position, and set_tool_position, but I can’t find one for get_tool_position.

How do you get the current tool position in x,y,z,pitch,yaw,roll or axis angle?

Thanks!

Changing motion target smoothly

We have the following issue that we would like advice on.

We send commands to the xArm, to go to some joints: JointsA.
While the robot is in motion, we compute the robot to go to some joints: JointsB.

We would like the robot to ignore the rest of JointsA (Which it does), and start motion towards JointsB. BUT. The robot appears to stop motion completely and then start moving to JointsB, and we would like a smooth transition.

Is this possible in the current API?

"set_only_check_type" seems not working

Thank you for the great products and SDK!

I'm using xArm7 and want to check self-collisions in paths between randomly-generated robot positions. set_only_check_type method seems the perfect for this purpose, but I cannot utilize this function.

Here is a sample code.

from xarm.wrapper import XArmAPI
arm = XArmAPI(port="192.168.0.69", is_radian=False)

arm.clean_error()
arm.motion_enable(enable=True)
arm.set_mode(0)
arm.set_state(0)

arm.set_only_check_type(only_check_type=0) # normal mode, manipulator moves
arm.set_servo_angle(angle=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], wait=True) # zero position

arm.set_only_check_type(only_check_type=3) # set xarm not to move, just motion check

code1 = arm.set_servo_angle(angle=[50.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], wait=True) # this motion ok
code2 = arm.set_servo_angle(angle=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], wait=True) # back to zero
code3 = arm.set_servo_angle(angle=[0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 0.0], wait=True) # this motion causes self-collision

print(f"return code from first check: {code1}") # should be 0, and actually 0
print(f"return code from second check: {code2}") # ditto
print(f"return code from third check: {code3}") # should NOT be 0, but actually 0
print(f"result: {arm.only_check_result}") # this is also 0

SDK version

SDK_VERSION: 1.11.2
FIRMWARE_VERSION: v1.11.1, PROTOCOL: V1, DETAIL: 7,7,XS1303,AC1300,v1.11.1

As commented, although the path to the third position causes self-collision, the returned code3 is 0 as well as arm.only_check_result. If you remove arm.set_only_check_type(only_check_type=3), then the robot moves and raises a self-collision error as supposed. I checked other motion methods (set_position and set_position_aa) and the results are the same.

Am I using the method in a wrong way? I would be very happy if you could address the problem.

State of sdk

Hi there
Just wanted to ask since I am thinking of buying an xarm whether the python sdk is comparable to the c++, Ros or direct programming of the controller in terms of latency, full API support etc.?

Thank you and kind regards

How to correctly set IP, router, broadcast and DNS addresses

Hi,

In order to be able to communicate with the xarm while having internet connectivity, I need to change the IP address of the xarm.

I was wondering if it is also necessary to change the Broadcast address, the router address and the DNS1 address to reflect my local network's address range (it is 192.168.0.1 - 192.168.255), for example my desktop has 192.168.0.47.

My xarm has the following network configuration:
Screenshot from 2022-10-14 14-26-06

My router is at 192.168.0.1
My /etc/resolv.con says that my DNS server is: nameserver 127.0.0.53

Are the following changes correct and necessary?:
IP to 192.168.0.100 (my choice)
Broadcast to 192.168.0.255
Routers to 192.168.0.1
and
DNS1 to 127.0.0.53

Thanks a lot!

SDK 1.11.5 - Relative moves with X value are opposite - Bug

Example:

What was working:
arm.set_position_aa(axis_angle_pose=[-10, 10, 0, 0, 0, ], relative=True, wait=True, speed=200,is_tool_coord=True)

What is now required:
arm.set_position_aa(axis_angle_pose=[10, 10, 0, 0, 0, ], relative=True, wait=True, speed=200,is_tool_coord=True)


It appears that with relative moves the value of X must now be opposite from what it was before 1.11.5

How to control xArm offline

I already program the xArm through xArm blockly studio using laptop. Now want to control the xArm without any laptop which control the xArm offline by using the triggered button. Already tried to set offline task to one of the input button but nothing happen when pressing the set button. Anyone has tried to run the xArm offline that could provide some guidelines on this?

Timeout on velocity control mode

I recently experimented with velocity control mode, and I have a feature request to ensure safety.

When running a velocity command, and the cable connecting the computer to the robot is disconnected, the robot continues to move indefinitely. A simple feature to prevent this would be a timeout option on vc_set_joint_velocity, which will write all zeros if no new command is received in the allotted time (or even estop).

With this, I could set velocity set-points and if my code dies, or the computer is disconnected, then the robot will stop moving and I will know the system is safe.

Details on Impedance/Force Control Example

Is it possible to have some details of the impedance control/force control example provided in the SDK. May be a paper which outlines the implementation in this package and some more info on example?

Error code map bug

In xarm/code/config/x_code.py there appears to be a bug in the GripperError _code_map.
Below is the current version:

class GripperError(BaseCode):
    def __init__(self, code, status=0):
        self._code_map = GripperError
        super(GripperError, self).__init__(code, status=status)

And this is the recommended change - the self._code_map line should be changed to reference GripperErrorCodeMap instead of GripperError

class GripperError(BaseCode):
    def __init__(self, code, status=0):
        self._code_map = GripperErrorCodeMap
        super(GripperError, self).__init__(code, status=status)

roll offset

i wanted to set the offset to 180°, so that it's zero position is [0,0,0,0,0,0] instead of [0,0,0,180,0,0].
but if you put a roll offset, one of these issus happened the robot can only turn one way
either the R+ and R- make the robot got the same direction of the rotation or one of the R+/R- doesn't do anything.

Online trajectory planning does not work

Greetings!
I am trying 1010-cartesian_online_trajectory_planning example.

As it said in comments: "the running command will be interrupted, and run the new command". So I expect that the next command immediately interrupts the previous one. Instead next command is executed only after the previous one is finished.

Please, could you help me to figure it out?

I use:

  • xArm 7
  • Firmware 1.9.0
  • Python SDK 1.11.0

What is error code 25: Planning Error?

Hello,

We occasionally see a controller error 25, typically when there's nothing obviously wrong. The docs just say this is a "Planning Error" -- what does this mean?

Not to move some joints of xArm

I want to fix some joints and move only 3rd, 4th, 5th, and 6th joint of xArm7.
When I wrote the below code, all of joints can move.

joint = self.arm.get_inverse_kinematics(x,y,z,roll,pitch,yaw)
angles = [joint[1][0], joint[1][1], joint[1][2], joint[1][3], joint[1][4], joint[1][5], joint[1][6]]
return self.arm.set_servo_angle_j(angles)

How can I fix some joints in mode1 (servo motion) ?

Velocity control breaks `realtime_joint_speeds`

In velocity control mode, the values in XArmAPI.realtime_joint_speeds seem to be constant. This is despite the robot's velocity obviously changing in response to velocity commands sent via vc_set_joint_velocity.

The constant values in our case are [-0.0001913145970320329, -8.029435412026942e-05, -0.0003226289991289377, -5.9169465203012805e-06, 0.00039677994209341705, 0.000555296428501606, 0.0], but I assume there's nothing significant about these.

Is there another way to get the current joint velocities in velocity control mode?

What command does the "enable robot" button in the XArm Studio gui send?

If an arm collides and we determine we can recover, we attempt to programmatically re-enable the robot as below:

        xArmAPI.clean_warn()
        xArmAPI.clean_error()
        xArmAPI.motion_enable(True)
        xArmAPI.set_state(0)

This works most of the time, but sometimes the robot remains in an error state until we open the XArm Studio gui and press "enable robot" manually -- at which point we usually hear the joint locks disengage.

Is it possible to replicate whatever command the "enable robot" button sends programatically?

ability to set static IPs for each robot

Currently each xArm seems to ship with a hardcoded static IP (192.168.1.XXX). In our setup, we have multiple of these robots, and would like to treat them as interchangeable.

Since each robot has a separate IP address, we have to maintain a list and ping each ip until we find which robot we are connected to.

If we could have all our robots have the same IP, this problem would go away. Is there any means to accomplish this?

Questions about IO port setting

I want to set the IO1 port through Python, that is, connect the IO port of the yellow line.
use arm.set_gpio_digital(1, 1) ,I wonder if this is correct.

And the file gpio.py prompts me that the first parameter must be 1 or 2. I want to know which I/O port level is controlled when it is set to 1, and which I/O port level is controlled when it is set to 2.

thanks for your help!

offline is_joint_limit

hi there,

can i get the is_joint_limit value without the arm attached, just offline as a python function?

Velocity control mode acceleration

Greetings!
How can I control acceleration in velocity control mode?
I use vc_set_cartesian_velocity method to set target velocity. But it seems that arm gains speed very slowly.
I have already tried set_tcp_maxacc method and nothing changed.

Looking for your help!

How does position-triggered IO work?

I would expect

        xyz = self.get_position()[1][:3]
        code = self.set_cgpio_digital_with_xyz(
            gpio_port, value, xyz=xyz, fault_tolerance_radius=float("inf")
        )

to have the same result as

        code = self.set_cgpio_digital(gpio_port, value)

but the latter works and the former seemingly does nothing.
Firmware & SDK are version 1.10.0.

set_joints_torque

hi there,

how can i set the torque for the xarm? when i enter "set_joints_torque" the respond will be

[SDK][ERROR][2022-04-07 07:54:22][base.py:338] - - API -> set_joints_torque -> code=3, joints_torque=[0, 0, 0, 0, 0, 0, 0]

no matter which mode i choose?

Question about the get_servo_angle function

Hi,

I'm coming over here from your ROS packages. While there, I was told that you can only reliably get the servo joint positions at a max rate of 5Hz. Is that the case with the get_servo_angle function here as well? Otherwise, what is the max rate I can reliably call this function?

How to interpret the error and warn code

When I command to the robot to move to a position, I received these messages in the terminal:

[SDK][ERROR][2021-06-05 20:27:06][base.py:1524] - - list index out of range
[SDK][WARNING][2021-06-05 20:27:06][base.py:1225] - - ReportDataException: length=0, data_len=233, state=0, mode=0, collis_sens=0, teach_sens=0, error_code=95, warn_code=62
servo_error_code, servo_id=1, status=219, code=15
servo_error_code, servo_id=2, status=73, code=64

How should I interpret these messages?

Issue with get_cgpio_digital

Problem:

Using the function set_cgpio_digital changes the state of a cgpio pin to either high or low on the control box. Unfortunately, the corresponding getter get_cgpio_digital does not returned the changed value.

Potential Solution:

Calling arm.get_cgpio_state()[1][5] >> 9 & 0x0001 where the 9 is the correct ionum seems to work correctly after a call to set_cgpio_digital(9, 1). If get_cgpio_digital(9) is meant to not be the corresponding getter function to set_cgpio_digital(9, 1), I would advise changing the name.

How to know the current cmd when I set wait=False

I sent a sequence of joint angles using set_servo_angle() with wait=False.
In the same time, I would like to scynchornize xarm with other devices.
So, is it possible to know which cmd is in action during the arm's motion in this situation?
Thanks a lot!

Maybe bug? Out of sync last_angles (SDK version 1.6.10)

I was having a problem with set_servo_angle() where it looked like the robot was just doing
something random. I tracked down the problem to last_used_angles being uninitialized.
I fixed my SDK with a call to _sync() as seen below. I probably should have forked the repo and
all that but this was so tiny a change I figured it wasn't worth it ... sorry ... :-)

  • Andre

xarm/x3/xarm.py (line 312)

   def set_servo_angle(self, servo_id=None, angle=None, speed=None, mvacc=None, mvtime=None,
                        relative=False, is_radian=None, wait=False, timeout=None, radius=None, **kwargs):
        assert ((servo_id is None or servo_id == 8) and isinstance(angle, Iterable)) \
            or (1 <= servo_id <= 7 and angle is not None and not isinstance(angle, Iterable)), \
            'param servo_id or angle error'

        # ALS: line below fixes my problem
        self._sync()

        last_used_angle = self._last_angles.copy()
        last_used_joint_speed = self._last_joint_speed
        last_used_joint_acc = self._last_joint_acc
        is_radian = self._default_is_radian if is_radian is None else is_radian

Motion delay in teleoperation

Greetings!
In a recent project, we try to integrate Xarm6 in a teleoperation system as the slave robot. Specifically, the real-time pose of the master robot is obtained with its SDK and set as the target pose of the slave robot (Xarm6).
For this purpose, we use the build in function arm.set_position in the unblocky way. However, from our test, there is an obvious time decay for the motion between the master and the slave robot.
We guess the efficiency of the motion planner leads this problem. So do you have any advice to achieve the real-time servo motion in a more effiecient way? Or what is the most efficient way to perform the motion in this case as your recommendation?
Thanks in advance!

End force sensor

Is the end force sensor referred here included in the arm or is it an external sensor?

Motion planning in joint space

Hi, to whom it may concern.
I am wondering that how to do motion planning in joint space, namely, given a list of joint angles such as [[0, 0, 0, 0, 0, 0, 0], [10, 10, 10, 10, 0, 0, 0], [10, 10, 10, 10, 10, 10, 10], ...], how to move xarm fluently without any stop among the trejectory using python SDK? Thanks a lot for you response!

Can I edit IK of xArm7?

I can control the end of xArm7 in mode1 (servo motion) using below code.

arm = XArmAPI(ip)
joint = arm.get_inverse_kinematics(pose)
angles = [joint[1][0], joint[1][1], joint[1][2], joint[1][3], joint[1][4], joint[1][5], joint[1][6]]
arm.set_servo_angle_j(angles)

However, I made an end effector of xArm7, and I want to control the end of it.
So, I want to edit IK model of this SDK.
Can I edit it? If I can, could you tell me how to edit?

Controller and servo error for joint 6

Hi, I ran into the following error when trying to run the example code 2001-move_joint.py for xarm6 on ubuntu 20. Can you help me with this error please? I could not find any help or documentation online besides rebooting. Thank you in advance!

SDK_VERSION: 1.9.0
FIRMWARE_VERSION: v1.9.0, PROTOCOL: V1, DETAIL: 6,6,XI1203,XX0000,v1.9.0
change prot_flag to 3
ControllerError, code: 16
servo_error_code, servo_id=6, status=1, code=18
[motion_enable], xArm is not ready to move
[motion_enable], xArm is not ready to move
[motion_enable], xArm is not ready to move
[SDK][ERROR][2022-05-25 11:15:15][base.py:338] - - API -> move_gohome -> code=1, velo=0.3490658503988659, acc=8.726646259971648
[SDK][ERROR][2022-05-25 11:15:15][base.py:338] - - API -> set_servo_angle -> code=1, angles=[1.5707963267948966, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:15][base.py:338] - - API -> set_servo_angle -> code=1, angles=[1.5707963267948966, 0.0, -1.0471975511965976, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:15][base.py:338] - - API -> set_servo_angle -> code=1, angles=[1.5707963267948966, -0.5235987755982988, -1.0471975511965976, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:15][base.py:338] - - API -> set_servo_angle -> code=1, angles=[0.0, -0.5235987755982988, -1.0471975511965976, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:15][base.py:338] - - API -> set_servo_angle -> code=1, angles=[0.0, 0.0, -1.0471975511965976, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:15][base.py:338] - - API -> set_servo_angle -> code=1, angles=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[motion_enable], xArm is not ready to move
[motion_enable], xArm is not ready to move
[SDK][ERROR][2022-05-25 11:15:18][base.py:338] - - API -> move_gohome -> code=1, velo=0.8726646259971648, acc=8.726646259971648
[SDK][ERROR][2022-05-25 11:15:18][base.py:338] - - API -> set_servo_angle -> code=1, angles=[1.5707963267948966, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:18][base.py:338] - - API -> set_servo_angle -> code=1, angles=[1.5707963267948966, 0.0, -1.0471975511965976, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:18][base.py:338] - - API -> set_servo_angle -> code=1, angles=[1.5707963267948966, -0.5235987755982988, -1.0471975511965976, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:18][base.py:338] - - API -> set_servo_angle -> code=1, angles=[0.0, -0.5235987755982988, -1.0471975511965976, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:18][base.py:338] - - API -> set_servo_angle -> code=1, angles=[0.0, 0.0, -1.0471975511965976, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[SDK][ERROR][2022-05-25 11:15:18][base.py:338] - - API -> set_servo_angle -> code=1, angles=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], velo=0.8726646259971648, acc=8.726646259971648, radius=None
(0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) (0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
[motion_enable], xArm is not ready to move
[motion_enable], xArm is not ready to move
[SDK][ERROR][2022-05-25 11:15:20][base.py:338] - - API -> move_gohome -> code=1, velo=0.8726646259971648, acc=8.726646259971648

Move commands ignoring some or all parameters / skipping the command

I am attempting to run basic move functions on an xArm 6, however some of the functions I am calling appear to not work correctly or at all. Calling move_gohome() does nothing regardless of the parameters; the arm stays in place. Calling set_servo_cartesian() ignores the velocity and acceleration provided as parameters, and moves with max speed and acceleration, usually causing it to (falsely) detect a collision due to the high jerk. The full program I attempted to run is attached below.

import sys
import math
import time
import datetime
import random
import traceback
import threading
import armLib

try:
    from xarm.tools import utils
except:
    pass
from xarm import version
from xarm.wrapper import XArmAPI

def pprint(*args, **kwargs):
    try:
        stack_tuple = traceback.extract_stack(limit=2)[0]
        print('[{}][{}] {}'.format(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())), stack_tuple[1], ' '.join(map(str, args))))
    except:
        print(*args, **kwargs)

pprint('xArm-Python-SDK Version:{}'.format(version.__version__))

arm = XArmAPI('192.168.1.207', baud_checkset=False)
arm.clean_warn()
arm.clean_error()
arm.motion_enable(True)
arm.set_mode(1)
arm.set_state(0)
time.sleep(1)


angles = [0, 0, -45, 0, 0, 0]

code = arm.move_gohome(speed = 100, mvacc = 100)
print(code)
time.sleep(1)
pose = [307, 0, 112, 180, 0, 0]
code = arm.set_servo_cartesian(pose, speed=100, mvacc=100, mvtime=1)
print(code)
time.sleep(2)
pose = [307, 100, 112, 180, 0, 0]
code = arm.set_servo_cartesian(pose, speed=100, mvacc=100, mvtime=1)
print(code)

time.sleep(5)

How to Set Position of Elbow for Xarm7

Hi,

For my application I need to control the position of the elbow of my xarm7 to avoid collisions with the environment.

Is there any way I can bias the IK solution to a desired elbow configuration?
I couldn't find any parameter for the in the API.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.