TimSchneider42 / franky

High-Level Motion Library for Collaborative Robots
https://timschneider42.github.io/franky/
GNU Lesser General Public License v3.0
29 stars 8 forks source link

The robot do jerky sound. #9

Open chaitanyantr opened 3 months ago

chaitanyantr commented 3 months ago

Issue: The franka emika robot doing jerky sounds.

when the robot is moving from one waypoint to other way point. Observations:- 5 different robots in my lab do same sounds.(probably not a hardware issue) what code?:- The default code of moving from m1 to m2. What language:- python sample code

# A point-to-point motion in the joint space
m1 = JointWaypointMotion([JointWaypoint([-0.3, 0.1, 0.3, -1.4, 0.1, 1.8, 0.7])])

# A motion in joint space with multiple waypoints
m2 = JointWaypointMotion([
    JointWaypoint([-0.3, 0.1, 0.3, -1.4, 0.1, 1.8, 0.7]),
    JointWaypoint([0.0, 0.3, 0.3, -1.5, -0.2, 1.5, 0.8]),
    JointWaypoint([0.1, 0.4, 0.3, -1.4, -0.3, 1.7, 0.9])
])

robot.move(m1)
robot.move(m2)

Whole code.

import math
from scipy.spatial.transform import Rotation
from franky import JointWaypointMotion, JointWaypoint, JointPositionStopMotion, CartesianMotion, \
    CartesianWaypointMotion, CartesianWaypoint, Affine, Twist, RobotPose, ReferenceType, CartesianPoseStopMotion, \
    CartesianState, JointState
from franky import Robot

robot = Robot("172.16.0.2")

# Recover from errors
robot.recover_from_errors()

# Set velocity, acceleration and jerk to 5% of the maximum
robot.relative_dynamics_factor = 0.05

# A point-to-point motion in the joint space
m1 = JointWaypointMotion([JointWaypoint([-0.3, 0.1, 0.3, -1.4, 0.1, 1.8, 0.7])])

# A motion in joint space with multiple waypoints
m2 = JointWaypointMotion([
    JointWaypoint([-0.3, 0.1, 0.3, -1.4, 0.1, 1.8, 0.7]),
    JointWaypoint([0.0, 0.3, 0.3, -1.5, -0.2, 1.5, 0.8]),
    JointWaypoint([0.1, 0.4, 0.3, -1.4, -0.3, 1.7, 0.9])
])

robot.move(m1)
robot.move(m2)
TimSchneider42 commented 3 months ago

Hi,

Which robot are you using?

I noticed this behavior, too, with our Franka Panda in joint position control mode. What seemed strange to me was that even when I commanded the current joint position RobotState.q as a target, these noises were audible. However, I did not really have time to look into this issue much further.

If you would like to investigate this issue further, I suggest doing two things:

  1. Test whether the issue persists with older franky versions (like 0.8.0)
  2. Profile the commanded and actual joint trajectories of the robot. You can achieve this by using Motion.register_callback as such before executing the motion:
    
    traj = []

def cb(robot_state: franky.RobotState, time_step: float, rel_time: float, abs_time: float, control_signal: franky.ControlSignal):

This function will get called for every control update the robot does (1kHz).

# Time, current pos, desired pos, current vel, desired vel, desired acc, next commanded pos
traj.append((abs_time, robot_state.q, robot_state.dq, robot_state.dq, robot_state.dq_d, robot_state.ddq_d, control_signal.q))

m1.register_callback(cb) robot.move(m1)

Plot the trajectories, e.g. with matplotlib



I am happy to help if you need any assistance with this.

Best,
Tim