Comments (4)
Hi, do you use xArm6 or Lite6? Is there any error when running the 2006 example?
Would you please provide a simple script for us to reproduce the problem? What is the current firmware and ufactoryStudio version?
Best,
from xarm-python-sdk.
Hi Minna,
Thanks for your response! I use the Lite6. I didn´t have any errors when running the 2006 example uncustomized (with constant speed for all commands). The firmware version is 2.2.2. The studio version is also 2.2.2. Please find my code below.
In order to reproduce the error one needs a UDP sender script that sends every 1 second the new axis commands and new targetspeed. As my UDP sender sends the message every 1 second I skipped the time.sleep(1) after arm.set_servo_angle(..). I coded the UDP sender in another program, so I unfortunately can´t share it here right away.
#!/usr/bin/env python3
Software License Agreement (BSD License)
Copyright (c) 2019, UFACTORY, Inc.
All rights reserved.
Author: Vinman [email protected] [email protected]
"""
Description: joint online trajectory planning mode
"""
import os
import sys
import time
import math
import socket
sys.path.append(os.path.join(os.path.dirname(file), '../../..'))
from xarm.wrapper import XArmAPI
#######################################################
UDP_IP = "127.0.0.1"
UDP_PORT_SEND = 1005 #broadcast current axis angles and torque per axis
UDP_PORT_RECV = 1006 #receive axis commands and targetspeed from UDP client
print("UDP target IP: %s" % UDP_IP)
print("UDP target port: %s" % UDP_PORT_SEND)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock2 = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock2.bind((UDP_IP, UDP_PORT_RECV))
#######################################################
arm = XArmAPI('192.168.1.172')
arm.motion_enable(enable=True)
arm.set_mode(0)
arm.set_state(state=0)
arm.set_reduced_max_joint_speed(45,is_radian=False)
arm.set_joint_maxacc(50,is_radian=False)
arm.save_conf()
#arm.reset(wait=True)
arm.set_servo_angle(angle=[35, 0, 180, 0, 0, -90, 0], wait=True)
set mode: joint online trajectory planning mode
the running command will be interrupted when the next command is received
arm.set_mode(6)
arm.set_state(0)
time.sleep(1)
#speed = 45
#for i in range(10):
while True:
# run on mode(6)
# the running command will be interrupted, and run the new command
arm.set_servo_angle(angle=[45, 0, 180, 0, 0, -90, 0], speed=speed, wait=False)
time.sleep(1)
print("while loop 1")
if arm.warn_code==0:
temperatures=arm.temperatures
highesttemp=max(temperatures)
print("highesttemp:")
print(highesttemp)
while arm.connected and arm.state != 4 and highesttemp<60:
try:
#checking the temperatures every frame
#temperatures=arm.temperatures
#highesttemp=max(temperatures)
#print(highesttemp)
#broadcast current axis angles and torque per axis
currentangles = arm.angles
currenttorque = arm.joints_torque
MESSAGEstr = ";A1:" + str(currentangles[0]) + ";A2:" + str(currentangles[1]) + ";A3:" + str(currentangles[2])+ ";A4:" + str(currentangles[3])+ ";A5:" + str(currentangles[4])+ ";A6:" + str(currentangles[5])+ ";T1:" + str(currenttorque[0])+ ";T2:" + str(currenttorque[1])+ ";T3:" + str(currenttorque[2])+ ";T4:" + str(currenttorque[3])+ ";T5:" + str(currenttorque[4])+ ";T6:" + str(currenttorque[5])
MESSAGE = MESSAGEstr.encode('utf-8')
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT_SEND))
#receive axis commands and targetspeed from UDP client
data, addr = sock2.recvfrom(1024) # buffer size is 1024 bytes
datadecode = data.decode("utf-8")
split = datadecode.split(";")
angles = [float(x) for x in split[0:6]]
print(angles)
targetspeed = int(split[6])
if targetspeed > 45:
targetspeed = 45
print(targetspeed) #new
arm.set_servo_angle(angle=angles, speed=targetspeed, wait=False)
except:
print("No UDP Joint Command Received")
time.sleep(0.01)
arm.clean_error()
arm.motion_enable(enable=True)
arm.set_mode(0)
arm.set_state(state=0)
time.sleep(1)
arm.set_mode(6)
arm.set_state(0)
time.sleep(1)
print("Recovered")
set_mode: position mode
arm.set_mode(0)
arm.set_state(0)
print("Disconnect")
#arm.reset(wait=True)
arm.disconnect()
from xarm-python-sdk.
Hi,
When set_servo_angle returns 1, please open our UFactoryStudio software to see if there is any error, what is the error code? You can call get_err_warn_code to get the error code as well.
Best regards,
from xarm-python-sdk.
Hi, I can´t re-test this setup of switching velocity right now as I meanwhile employed another one, but might get back in a few weeks with an update on its error codes
from xarm-python-sdk.
Related Issues (20)
- Regarding impedance-control frame rates HOT 4
- Persistant balancing/vibration issue. HOT 1
- Linear track does not working when the arm is at mode 6 HOT 1
- Not able to move the 7th joint of xArm7 using set_servo_angle HOT 2
- Strange Torque Sensor Manual Mode Movements HOT 2
- xArm Lite 6 motor temperature overheating HOT 5
- Question: Understanding swapping modes and states HOT 3
- Does the impedance control support robot movements? HOT 1
- How to clear/overwrite previously sent commands? HOT 4
- Release notes for version 1.13.19
- Running gcode in Studio and with Python run_gcode_file() is not the same (Lite6) HOT 1
- Gripper is not working using official example HOT 4
- Wrong forward kinematics? HOT 5
- Speed argument ignored by `set_servo_angle_j` HOT 2
- ServoJ speed limit errors HOT 4
- Updating Release Tags HOT 1
- set_only_check_type Lite6 not working
- Trouble Recovering from Collision HOT 6
- xARM 6 Lite Python SDK change of initial joint position HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xarm-python-sdk.