4 degrees of freedom parallel robot dog realizes squat function

1. Function Description

       The example in this article will realize the squatting function of the 4-DOF parallel robot dog of the R328a prototype.

2. Structure description

      The parallel driving structure of this prototype is similar to [R082] 4-DOF parallel quadruped , and the two prototypes can be compared.

      The structure of the legs of this prototype is shown in the figure below: the driving core part is a combination of two 5-bar structures.

Two five-bar structure diagrams

      The driving core part can be combined with the four-bar structure shown in the figure below to form a single-sided leg. The driving core part can be combined with the four-bar structure shown in the figure below to form a single-sided leg.

four-bar structure
unilateral leg diagram
complete machine

3. Electronic hardware

      In this example, we use the following hardware, please refer to:

main control board

Basra main control board (compatible with Arduino Uno )

expanding board

Bigfish2.1 expansion board‍

Battery 7.4V lithium battery

      Circuit connection: In order to facilitate the identification and control of the 4-DOF parallel robot dog, we first specify the front of the robot dog and the position number of the servo (as shown in the figure below):

      Connect the servos (A1, A2, B1, B2) to the ports D4, D7, D3, and D8 of the Bigfish expansion board, as shown in the figure below:

4. Function realization

       Host computer: Controller 1.0

       Lower computer programming environment: Arduino 1.8.19

       Realization idea: Realize the 4-DOF parallel robot dog standing, squatting forward, and squatting back.

4.1 Debugging the servo angle

       Use the upper computer Controller software to adjust the angle of the steering gear of the 4-DOF parallel robot dog, and record the angle of the steering gear when the robot dog is standing, squatting forward, and squatting back; squat function.

       For how to use the Controller software to debug the servo angle of the robot dog, please refer to [U002] How to drive the analog servo-Controller 1.0b software . In this experiment, after debugging, for the 4-DOF parallel robot dog standing, The steering gear angle value when squatting and back squatting is shown in the figure below:

Servo value when the robot dog is standing
The servo value when the robot dog squats forward
The servo value when the robot dog squats back

4.2 Sample program

      The following provides a reference routine for a 4-DOF parallel robot dog squatting

/*------------------------------------------------------------------------------------

  版权说明:Copyright 2023 Robottime(Beijing) Technology Co., Ltd. All Rights Reserved.

           Distributed under MIT license.See file LICENSE for detail or copy at

           https://opensource.org/licenses/MIT

           by 机器谱 2023-05-26 https://www.robotway.com/

  ------------------------------*/

/*

    本例程实现机器小狗站立、前蹲和后蹲

*/


#include<Servo.h>

#define SERVO_SPEED 60      //定义舵机转动快慢的时间

#define ACTION_DELAY 0      //定义所有舵机每个状态时间间隔


Servo myServo[4];


int f = 15;                                         //定义舵机每个状态间转动的次数,以此来确定每个舵机每次转动的角度

int servo_port[4] = {3,4,7,8};                      //定义舵机引脚

int servo_num = sizeof(servo_port) / sizeof(servo_port[0]);   //定义舵机数量

float value_init[4] = {1513,1457,1074,1545};        //定义舵机初始角度


void setup() {

  Serial.begin(9600);

  for(int i=0;i<servo_num;i++){

    ServoGo(i,value_init[i]);

  }

  delay(2000);

}


void loop() {

  Dog_squat();

}


void Dog_squat()

{

  servo_move(value_init[0],value_init[1],value_init[2],value_init[3]);//直立

  servo_move(1243,1703,1278,1299);//向后蹲下

  servo_move(value_init[0],value_init[1],value_init[2],value_init[3]);//直立

  servo_move(1715,1255,1052,1545);//向前蹲下

  servo_move(value_init[0],value_init[1],value_init[2],value_init[3]);//直立

}



void ServoStart(int which)

{

  if(!myServo[which].attached())myServo[which].attach(servo_port[which]);

  pinMode(servo_port[which], OUTPUT);

}


void ServoStop(int which)

{

  myServo[which].detach();

  digitalWrite(servo_port[which],LOW);

}


void ServoGo(int which , int where)

{

  if(where!=200)

  {

    if(where==201) ServoStop(which);

    else

    {

      ServoStart(which);

      myServo[which].write(where);

    }

  }

}


void servo_move(float value0, float value1, float value2, float value3) //舵机转动

{

 

  float value_arguments[] = {value0, value1, value2, value3};

  float value_delta[servo_num];

 

  for(int i=0;i<servo_num;i++)

  {

    value_delta[i] = (value_arguments[i] - value_init[i]) / f;

  }

 

  for(int i=0;i<f;i++)

  {

    for(int k=0;k<servo_num;k++)

    {

      value_init[k] = value_delta[k] == 0 ? value_arguments[k] : value_init[k] + value_delta[k];

    }

    for(int j=0;j<servo_num;j++)

    {

      ServoGo(j,value_init[j]);

    }

    delay(SERVO_SPEED);

  }

  delay(ACTION_DELAY);

}

5. Extended Prototype

     This prototype can be made some extensions, as shown in the figure below, a flat plate is added on the top of the prototype. This prototype can be made with explorer parts or explorer compatible parts.

And program source code prototype 3D file information content details see 4 degrees of freedom parallel robot dog - squatting

Guess you like

Origin blog.csdn.net/Robotway/article/details/131111228