diff --git a/src/dynamixel_motor_group.cpp b/src/dynamixel_motor_group.cpp index d780f185d14d2d1fc75e04c5ef33a72897c25bbd..8cd9adf0d12a289f4495323cf8bd2ea82ce09fae 100644 --- a/src/dynamixel_motor_group.cpp +++ b/src/dynamixel_motor_group.cpp @@ -934,7 +934,9 @@ void CDynamixelMotorGroup::load_config(std::string &filename) dyn_motor_group_config_t::dyn_motor_config_iterator iterator; std::vector<TDynamixel_compliance> compliance; std::vector<TDynamixel_pid> pid; + std::string full_path,path; struct stat buffer; + size_t found; unsigned int i=0; this->clear(); @@ -947,11 +949,14 @@ void CDynamixelMotorGroup::load_config(std::string &filename) this->dyn_server->config_bus(cfg->bus_id(),cfg->baudrate()); pid.resize(cfg->dyn_motor_config().size()); compliance.resize(cfg->dyn_motor_config().size()); + found=filename.find_last_of("/"); + path=filename.substr(0,found+1); for(iterator=cfg->dyn_motor_config().begin(),i=0;iterator!=cfg->dyn_motor_config().end();iterator++,i++) { this->init_motor(iterator->id()); // load the configuration file - std::auto_ptr<dynamixel_motor_config_t> motor(dynamixel_motor_config(iterator->config_file().c_str(),xml_schema::flags::dont_validate)); + full_path=path+iterator->config_file(); + std::auto_ptr<dynamixel_motor_config_t> motor(dynamixel_motor_config(full_path.c_str(),xml_schema::flags::dont_validate)); this->set_position_range(i,motor->min_angle(),motor->max_angle()); this->set_temperature_limit(i,motor->temp_limit()); this->set_voltage_limits(i,motor->min_voltage(),motor->max_voltage()); diff --git a/src/examples/test_dynamixel_motor_group.cpp b/src/examples/test_dynamixel_motor_group.cpp index f80dd301f1b39dd1dc66b07c58aa4c12ad9e525e..9c44294384ebd908e2efe468b22ff7182404e44b 100644 --- a/src/examples/test_dynamixel_motor_group.cpp +++ b/src/examples/test_dynamixel_motor_group.cpp @@ -25,32 +25,33 @@ int main(int argc, char *argv[]) group.load_config(config_file); angles.resize(2); angles[0]=90; - angles[1]=-90; + angles[1]=-10; speeds.resize(2); speeds[0]=100; - speeds[1]=50; + speeds[1]=20; group.move_absolute_angle(angles,speeds); sleep(5); angles.resize(2); angles[0]=-90; - angles[1]=90; + angles[1]=10; group.move_absolute_angle(angles,speeds); - sleep(5); + sleep(5); // relative motion angles[0]=10; - angles[1]=-10; + angles[1]=-1; for(i=0;i<10;i++) { + std::cout << "relative move" << std::endl; group.move_relative_angle(angles,speeds); sleep(1); } // torque motion - torques.resize(2); - torques[0]=100.0; - torques[1]=-50; - group.move_torque(torques); - sleep(4); - group.stop(); +// torques.resize(2); +// torques[0]=100.0; +// torques[1]=-50; +// group.move_torque(torques); +// sleep(4); +// group.stop(); #endif } }catch(CException &e){ diff --git a/src/xml/dyn_group_config.xml b/src/xml/dyn_group_config.xml index 48864feed344cf19b166a902c2977495ac6b025b..ac4a86718957c649812f87a7469e4793cf90e9d7 100755 --- a/src/xml/dyn_group_config.xml +++ b/src/xml/dyn_group_config.xml @@ -3,14 +3,14 @@ <dyn_motor_group_config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="dyn_motor_group_cfg_file.xsd"> - <bus_id>A4012B3G</bus_id> + <bus_id>A400gaIt</bus_id> <baudrate>1000000</baudrate> <dyn_motor_config> <id>1</id> - <config_file>../src/xml/dyn_config.xml</config_file> + <config_file>dyn_config.xml</config_file> </dyn_motor_config> <dyn_motor_config> - <id>3</id> - <config_file>../src/xml/dyn_config.xml</config_file> + <id>2</id> + <config_file>dyn_config.xml</config_file> </dyn_motor_config> </dyn_motor_group_config>