Enquiry about Dobot Arduino "Dobot_SetPTPCmdEx was not declared in this scope"


#1

Hello i have a short question regarding problem i am facing.

Currently i am using the Arduino program for Ai Starter Cooperation with Magician Demo provided from Dobot website but i having issues with verify and upload it. It shown error for “Dobot_SetPTPCmdEx was not declared in this scope”.

How do i solve this problem? Is there an Arduino programming file for this demo with this problem already solved? Also noted that i am also novice at Arduino Programming as i am still learning about it.

Thank you for your time

The Arduino Program are these:

#include <Arduino.h>
#include <Dobot.h>
#include <Pixy2.h>
#include <Pixy2I2C.h>
#include <Pixy2CCC.h>
#include <TPixy2.h>

Pixy2I2C pixy;
bool flag = true;
#define InitPositionX 260
#define InitPositionY 0
#define InitPositionZ 60
#define InitPositionR 0

float AreaPoint[4][3] = {
{137.05, -206.94, -39},
{137.05, -244.31, -39},
{100.50, -206.94, -39},
{100.50, -244.31, -39}
};

float trayPoint[4][3] = {
{308.12, 25.92, 28},
{308.12, -15.92, 28},
{258.12, 25.92, 28},
{258.12, -15.92, 28}
};

/********** 从方块区吸取方块,放置托盘 **********/
void AreaToAIStarter()
{
for(uint8_t i=0; i<4; i++){
Dobot_SetPTPCmdEx(JUMP_XYZ, AreaPoint[i][0], AreaPoint[i][1], AreaPoint[i][2], 0);
Dobot_SetEndEffectorSuctionCupEx(true);
Dobot_SetPTPCmdEx(MOVL_XYZ, AreaPoint[i][0], AreaPoint[i][1], AreaPoint[i][2]+70, 0);
Dobot_SetPTPCmdEx(JUMP_XYZ, trayPoint[i][0], trayPoint[i][1], trayPoint[i][2], 0);
Dobot_SetEndEffectorSuctionCupEx(false);
Dobot_SetPTPCmdEx(MOVL_XYZ, trayPoint[i][0], trayPoint[i][1], trayPoint[i][2]+30, 0);
}
Dobot_SetPTPCmdEx(MOVJ_XYZ, InitPositionX, InitPositionY, InitPositionZ, InitPositionR);
}

void setup()
{
Serial.begin(115200);
pixy.init();
pixy.setLamp(1, 1);
Dobot_Init();
Dobot_SetEndEffectorParamsEx(59.7,0,0);
Dobot_SetPTPCommonParamsEx(100,100);
Dobot_SetPTPJumpParamsEx(25);
Dobot_SetPTPCmdEx(MOVJ_XYZ, InitPositionX, InitPositionY, InitPositionZ, InitPositionR);
}

void loop()
{
pixy.ccc.getBlocks();
delay(10);
pixy.ccc.getBlocks();
delay(10);
if(pixy.ccc.numBlocks == 0){
delay(3000);
Dobot_SetPTPCmdEx(MOVJ_XYZ, InitPositionX, InitPositionY, InitPositionZ, InitPositionR);
return 0;
} else if (pixy.ccc.numBlocks) {
AreaToAIStarter();
}
}


#2

What I did to make it compile was to remove Ex from each Dobot command, for example: Change Dobot_SetEndEffectorSuctionCupEx(true); to Dobot_SetEndEffectorSuctionCup(true);
I did this because I realized that on some other examples the Dobot commands were not using Ex. I hope this helps.


#3

Hello, I did remove the Ex from each Dobot command, but it prompts the following information:
<artificial>:(.text.startup+0x4dc): undefined reference to `Dobot_SetPTPCmd(unsigned char, float, float, float, float)’
collect2.exe: error: ld returned 1 exit status
exit status 1
为开发板 Arduino Mega or Mega 2560 编译时出错。


#5

Hello fikrinoor, please refer to the information I posted in the forum to solve it.


#6

Hello SebPan, your information really helps, thanks. The reason for causing this problem is that different versions of the AI-Starter Demo program are used. In the old version of the program, each instruction has Ex. The new version of the program released later does not have Ex, and has different definitions in the header file.