From 2c6440bd19a8e3beb31197dff30dbaf935fa42df Mon Sep 17 00:00:00 2001 From: Mathieu Geisert <mgeisert@laas.fr> Date: Thu, 26 Jun 2014 17:57:29 +0200 Subject: [PATCH] Add function getDeviceNames in robot to get the names of robots and object in the same order than in the configuration. --- include/hpp/manipulation/robot.hh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/include/hpp/manipulation/robot.hh b/include/hpp/manipulation/robot.hh index e271076e..39aadb3d 100644 --- a/include/hpp/manipulation/robot.hh +++ b/include/hpp/manipulation/robot.hh @@ -105,9 +105,25 @@ namespace hpp { return it->second; } + /// Get Device names in the same order than the compositeRobot has been + /// build + std::vector<std::string> getDeviceNames() + { + std::vector<std::string> deviceNames; + for ( Devices_t::iterator itDevice = robots_.begin() ; itDevice != + robots_.end() ; itDevice++ ) { + deviceNames.push_back((*itDevice)->name()); + } + for ( Objects_t::iterator itObject = objects_.begin() ; itObject != + objects_.end() ; itObject++ ) { + deviceNames.push_back((*itObject)->name()); + } + return deviceNames; + } + /// Print object in a stream virtual std::ostream& print (std::ostream& os) const; - + protected: /// Constructor /// \param name of the new instance, -- GitLab