From f8aba10c5184f815b65b2bc3f11ddf9beca8d71d Mon Sep 17 00:00:00 2001 From: Loic Delattre Date: Fri, 10 Mar 2023 09:14:55 +0100 Subject: [PATCH] make file and Robot_arm good --- Robot_arm.cpp | 18 +++++++++--------- makefile | 9 +++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Robot_arm.cpp b/Robot_arm.cpp index 067c16c..b6fcc4c 100644 --- a/Robot_arm.cpp +++ b/Robot_arm.cpp @@ -3,7 +3,7 @@ #include #include "DynamixelHandler.h" -using namespcae std +using namespace std; // Global variables DynamixelHandler _oDxlHandler; @@ -18,15 +18,15 @@ float _maxJointAngle = 180.0f; int main() { cout << "===Initialization of the Dynamixel Motor communication====" << endl; -_ oDxlHandler.setDeviceName(_poppyDxlPortName); -_ oDxlHandler.setProtocolVersion(_poppyDxlProtocol); -_ oDxlHandler.openPort(); -_ oDxlHandler.setBaudRate(_poppyDxlBaudRate); -_ oDxlHandler.enableTorque(true); + _oDxlHandler.setDeviceName(_poppyDxlPortName); + _oDxlHandler.setProtocolVersion(_poppyDxlProtocol); + _oDxlHandler.openPort(); + _oDxlHandler.setBaudRate(_poppyDxlBaudRate); + _oDxlHandler.enableTorque(true); cout << endl; // read current joint position vector l_vCurrentJointPosition; -_ oDxlHandler.readCurrentJointPosition(l_vCurrentJointPosition); + _oDxlHandler.readCurrentJointPosition(l_vCurrentJointPosition); // display current joint position cout << "vCurrentJointPosition= (" << endl; for (int l_joint=0; l_joint < l_vCurrentJointPosition.size(); l_joint++) @@ -35,8 +35,8 @@ _ oDxlHandler.readCurrentJointPosition(l_vCurrentJointPosition); // wait 1s this_thread::sleep_for(chrono::milliseconds(1000)); cout << "===Closing the Dynamixel Motor communication====" << endl; -_ oDxlHandler.enableTorque(false); -_ oDxlHandler.closePort(); + _oDxlHandler.enableTorque(false); + _oDxlHandler.closePort(); cout << endl; return 0; } \ No newline at end of file diff --git a/makefile b/makefile index ddf32df..d99c69b 100644 --- a/makefile +++ b/makefile @@ -1,10 +1,11 @@ -all: Robot_arm - g++ Robot_arm.o -o Robot_arm.exe –L/usr/local/lib –ldxl_x64_cpp -lrt +all: Robot_arm DynamixelHandler + g++ DynamixelHandler.o Robot_arm.o -o Robot_arm.exe -L/usr/local/lib -ldxl_x64_cpp -lrt Robot_arm: Robot_arm.cpp - g++ -c Robot_arm.cpp + g++ -c Robot_arm.cpp -I/home/ros/SOFTWARE/toolkit-dynamixel/include - +DynamixelHandler: /home/ros/SOFTWARE/toolkit-dynamixel/src/DynamixelHandler.cpp + g++ -c -I/home/ros/SOFTWARE/toolkit-dynamixel/include /home/ros/SOFTWARE/toolkit-dynamixel/src/DynamixelHandler.cpp clean: rm *.o