Train Vision Object By Script icon Train Vision Object By Script Train camera vision objects via controlcommand(), attach camera, start learning, monitor progress, and return object name for scripts. Try it →
Australia
Asked
Resolved Resolved by DJ Sures!

Jerky Servo Motion

I started working with a JD robot a couple of days ago. I am looking to create fluid motion from pose to pose.

I am programming the motion via the Script Collection (Python). This is resulting in a relatively smooth motion at a constant speed, but I would like to create acceleration or motion profiles to make the motion look more lifelike. Below is my python code to wave

shoulder = 3
bicep = 4
elbow = 5
grip = 6

def moveServo(port, pos, speed=0):
  Servo.SetSpeed(port, speed)
  Servo.SetPosition(port, pos)

def wave(iter=0):
  moveServo(elbow, 50, 1)
  moveServo(grip, 70, 1)
  moveServo(bicep, 70 if iter == 0 else 110, 3)
  sleep(400)
  moveServo(elbow, 0, 1)
  moveServo(grip, 90, 1)
  moveServo(bicep, 90, 3)
  sleep(400)

def armhome():
  moveServo(elbow, 90, 2)
  moveServo(bicep, 20, 2)
  moveServo(grip, 90, 2)
  moveServo(shoulder, 90, 2)

moveServo(shoulder, 0)
moveServo(elbow, 0)
moveServo(grip, 90)
moveServo(bicep, 90)
sleep(1000)

wave()
wave(1)
sleep(1000)
armhome()
sleep(3000)

I have also messed around with creating motion in a "Robot Skill" via a c# workflow. I've noticed the motion from servos in this is very jerk though. Below is a snippet of my code from that:

private void button1_Click(object sender, EventArgs e)
{
   ARC.LogManager.Log("clicked the button!");
   ARC.EZBManager.EZBs[0].Servo.SetServoPosition(EZ_B.Servo.ServoPortEnum.D0, 10);
   Thread.Sleep(1000);
   ARC.EZBManager.EZBs[0].Servo.SetServoPosition(EZ_B.Servo.ServoPortEnum.D0, 170);
}

My questions are:

  1. Can you adjust the speed of the servos with numbers with decimals in either python or c#? i.e. 1.5 speed instead of 1 or 2?
  2. Is there a better way to control servos in C# such that the motion will be more smooth?
  3. Are there some other ways to control the servos which may result in more fluid, life-like motion that I haven't thought of?

Thank you in advance.



Related Hardware (view all EZB hardware)
JD Humanoid by EZ-Robot
JD humanoid robot kit - WiFi-enabled, 16 DOF with metal-gear servos; easy, fun, educational, available from the EZ-Robot online store.
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

Related Robot Skill (view all robot skills)
Servo Speed by Synthiam
Adjust servo/PWM speed (0-20) between two positions to quickly experiment and tune motion; select board/port; settings aren't saved.

ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

Author Avatar
PRO
Australia
#2  

Thank you for the help! This works