From 7567fc738271c5a6c9c75697b178da4489fbe196 Mon Sep 17 00:00:00 2001 From: Sergi Hernandez Juan <shernand@iri.upc.edu> Date: Fri, 7 Oct 2016 08:42:34 +0200 Subject: [PATCH] Updated the serial number of the new CM730 controller. Minor changes to some of the examples. --- src/examples/darwin_action_test.cpp | 4 ++-- src/examples/darwin_adc_test.cpp | 4 ++-- src/examples/darwin_joint_motion_test.cpp | 24 ++++++++++++++++++++--- src/examples/darwin_manager_test.cpp | 11 ++++++----- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/examples/darwin_action_test.cpp b/src/examples/darwin_action_test.cpp index 740e75f..98fd7df 100644 --- a/src/examples/darwin_action_test.cpp +++ b/src/examples/darwin_action_test.cpp @@ -4,8 +4,8 @@ #include <iostream> -//std::string robot_device="A603LOBS"; -std::string robot_device="A4008atn"; +std::string robot_device="A603LOBS"; +//std::string robot_device="A4008atn"; int main(int argc, char *argv[]) { diff --git a/src/examples/darwin_adc_test.cpp b/src/examples/darwin_adc_test.cpp index de3b241..adbf5bd 100644 --- a/src/examples/darwin_adc_test.cpp +++ b/src/examples/darwin_adc_test.cpp @@ -3,8 +3,8 @@ #include <iostream> -//std::string robot_device="A603LOBS"; -std::string robot_device="A4008atn"; +std::string robot_device="A603LOBS"; +//std::string robot_device="A4008atn"; int main(int argc, char *argv[]) { diff --git a/src/examples/darwin_joint_motion_test.cpp b/src/examples/darwin_joint_motion_test.cpp index 20a39c8..64d0a27 100644 --- a/src/examples/darwin_joint_motion_test.cpp +++ b/src/examples/darwin_joint_motion_test.cpp @@ -35,23 +35,41 @@ int main(int argc, char *argv[]) angles.clear(); speeds.clear(); accels.clear(); + servos.push_back(23); + servos.push_back(22); servos.push_back(19); angles.push_back(45.0); + angles.push_back(45.0); + angles.push_back(45.0); + speeds.push_back(50.0); speeds.push_back(50.0); + speeds.push_back(50.0); + accels.push_back(50.0); + accels.push_back(50.0); accels.push_back(50.0); std::cout << "Start joint_motion ..." << std::endl; darwin.joints_load(JOINTS_GRP0,servos,angles,speeds,accels); darwin.joints_start(JOINTS_GRP0); - sleep(2); - darwin.joints_stop(JOINTS_GRP0); - std::cout << "done" << std::endl; + while(darwin.joints_are_moving(JOINTS_GRP0)) + { + std::cout << "moving joints ..." << std::endl; + usleep(100000); + } servos.clear(); angles.clear(); speeds.clear(); accels.clear(); + servos.push_back(23); + servos.push_back(22); servos.push_back(19); angles.push_back(-45.0); + angles.push_back(-45.0); + angles.push_back(-45.0); speeds.push_back(50.0); + speeds.push_back(50.0); + speeds.push_back(50.0); + accels.push_back(50.0); + accels.push_back(50.0); accels.push_back(50.0); darwin.joints_load(JOINTS_GRP0,servos,angles,speeds,accels); darwin.joints_start(JOINTS_GRP0); diff --git a/src/examples/darwin_manager_test.cpp b/src/examples/darwin_manager_test.cpp index 7b3fd22..3093084 100644 --- a/src/examples/darwin_manager_test.cpp +++ b/src/examples/darwin_manager_test.cpp @@ -3,21 +3,22 @@ #include <iostream> -//std::string robot_device="A603LOBS"; -std::string robot_device="A4008atn"; -std::string config_file="../src/xml/darwin_action.xml"; +std::string robot_device="A603LOBS"; +//std::string robot_device="A4008atn"; int main(int argc, char *argv[]) { int i=0,num_servos; + unsigned int present_servos; std::vector<int> servos; std::vector<double> angles,speeds,accels,offsets; try{ CDarwinRobot darwin("Darwin",robot_device,1000000,0x02); - darwin.mm_load_config(config_file); num_servos=darwin.mm_get_num_servos(); - std::cout << "Found " << num_servos << " servos" << std::endl; + present_servos=darwin.mm_get_present_servos(); + std::cout << "Found " << num_servos << " servos " << std::endl; + std::cout << "Present servos: " << present_servos << std::hex << "0x" << present_servos << std::dec << std::endl; std::cout << "Motion manager period " << darwin.mm_get_period() << " ms" << std::endl; // execute the walk ready action std::cout << "Assign servos to the action module" << std::endl; -- GitLab