[DEV] update new ETK
This commit is contained in:
parent
be2137f13c
commit
ec8f53cfcc
@ -49,7 +49,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISE
|
|||||||
#include <dynamic_reconfigure/server.h>
|
#include <dynamic_reconfigure/server.h>
|
||||||
#include <nao_dcm_camera/NaoDCMCameraConfig.h>
|
#include <nao_dcm_camera/NaoDCMCameraConfig.h>
|
||||||
|
|
||||||
using std::string;
|
using etk::String;
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ private:
|
|||||||
AL::ALVideoDeviceProxy video_proxy_;
|
AL::ALVideoDeviceProxy video_proxy_;
|
||||||
public:
|
public:
|
||||||
// Constructor/Destructor
|
// Constructor/Destructor
|
||||||
NaoCamera(boost::shared_ptr<AL::ALBroker> broker, const std::string& name);
|
NaoCamera(boost::shared_ptr<AL::ALBroker> broker, const etk::String& name);
|
||||||
~NaoCamera();
|
~NaoCamera();
|
||||||
|
|
||||||
bool initialize();
|
bool initialize();
|
||||||
|
@ -23,7 +23,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISE
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "nao_dcm_camera/nao_camera.h"
|
#include "nao_dcm_camera/nao_camera.h"
|
||||||
|
|
||||||
using std::vector;
|
using etk::Vector;
|
||||||
|
|
||||||
NaoCamera::NaoCamera(boost::shared_ptr<AL::ALBroker> broker, const string &name)
|
NaoCamera::NaoCamera(boost::shared_ptr<AL::ALBroker> broker, const string &name)
|
||||||
: AL::ALModule(broker,name),is_connected_(false),reconfiguring_(false)
|
: AL::ALModule(broker,name),is_connected_(false),reconfiguring_(false)
|
||||||
|
@ -61,8 +61,8 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISE
|
|||||||
|
|
||||||
#include <diagnostic_updater/diagnostic_updater.h>
|
#include <diagnostic_updater/diagnostic_updater.h>
|
||||||
|
|
||||||
using std::string;
|
using etk::String;
|
||||||
using std::vector;
|
using etk::Vector;
|
||||||
|
|
||||||
namespace AL
|
namespace AL
|
||||||
{
|
{
|
||||||
@ -131,36 +131,36 @@ private:
|
|||||||
AL::DCMProxy dcm_proxy_;
|
AL::DCMProxy dcm_proxy_;
|
||||||
|
|
||||||
// IMU
|
// IMU
|
||||||
vector<string> imu_names_;
|
vector<etk/String.hpp> imu_names_;
|
||||||
// Sonars
|
// Sonars
|
||||||
vector<string> sonar_names_;
|
vector<etk/String.hpp> sonar_names_;
|
||||||
// FSRs
|
// FSRs
|
||||||
vector<string> fsr_names_;
|
vector<etk/String.hpp> fsr_names_;
|
||||||
// Tactile
|
// Tactile
|
||||||
vector<string> tactile_names_;
|
vector<etk/String.hpp> tactile_names_;
|
||||||
// Bumper
|
// Bumper
|
||||||
vector<string> bumper_names_;
|
vector<etk/String.hpp> bumper_names_;
|
||||||
// Joints
|
// Joints
|
||||||
vector<string> joints_names_;
|
vector<etk/String.hpp> joints_names_;
|
||||||
vector<string> joint_temperature_names_;
|
vector<etk/String.hpp> joint_temperature_names_;
|
||||||
// Battery
|
// Battery
|
||||||
vector<string> battery_names_;
|
vector<etk/String.hpp> battery_names_;
|
||||||
// LEDs
|
// LEDs
|
||||||
vector<string> led_names_;
|
vector<etk/String.hpp> led_names_;
|
||||||
|
|
||||||
// Joint States
|
// Joint States
|
||||||
hardware_interface::JointStateInterface jnt_state_interface_;
|
hardware_interface::JointStateInterface jnt_state_interface_;
|
||||||
hardware_interface::PositionJointInterface jnt_pos_interface_;
|
hardware_interface::PositionJointInterface jnt_pos_interface_;
|
||||||
|
|
||||||
int number_of_joints_;
|
int number_of_joints_;
|
||||||
vector<string> joint_names_;
|
vector<etk/String.hpp> joint_names_;
|
||||||
vector<double> joint_commands_;
|
vector<double> joint_commands_;
|
||||||
vector<double> joint_angles_;
|
vector<double> joint_angles_;
|
||||||
vector<double> joint_velocities_;
|
vector<double> joint_velocities_;
|
||||||
vector<double> joint_efforts_;
|
vector<double> joint_efforts_;
|
||||||
public:
|
public:
|
||||||
// Constructor/Destructor
|
// Constructor/Destructor
|
||||||
Nao(boost::shared_ptr<AL::ALBroker> broker, const std::string& name);
|
Nao(boost::shared_ptr<AL::ALBroker> broker, const etk::String& name);
|
||||||
~Nao();
|
~Nao();
|
||||||
|
|
||||||
bool initialize();
|
bool initialize();
|
||||||
@ -188,10 +188,10 @@ public:
|
|||||||
// ALMemoryProxy Wrapper Methods
|
// ALMemoryProxy Wrapper Methods
|
||||||
void insertDataToMemory(const string& key, const AL::ALValue& value);
|
void insertDataToMemory(const string& key, const AL::ALValue& value);
|
||||||
AL::ALValue getDataFromMemory(const string& key);
|
AL::ALValue getDataFromMemory(const string& key);
|
||||||
void subscribeToEvent(const std::string& name, const std::string& callback_module,
|
void subscribeToEvent(const etk::String& name, const etk::String& callback_module,
|
||||||
const std::string& callback_method);
|
const etk::String& callback_method);
|
||||||
void subscribeToMicroEvent(const std::string& name, const std::string& callback_module,
|
void subscribeToMicroEvent(const etk::String& name, const etk::String& callback_module,
|
||||||
const std::string& callback_method, const string& callback_message="");
|
const etk::String& callback_method, const string& callback_message="");
|
||||||
void unsubscribeFromEvent(const string& name, const string& callback_module);
|
void unsubscribeFromEvent(const string& name, const string& callback_module);
|
||||||
void unsubscribeFromMicroEvent(const string& name, const string& callback_module);
|
void unsubscribeFromMicroEvent(const string& name, const string& callback_module);
|
||||||
void raiseEvent(const string& name, const AL::ALValue& value);
|
void raiseEvent(const string& name, const AL::ALValue& value);
|
||||||
|
@ -53,7 +53,7 @@ bool Nao::initialize()
|
|||||||
"Device/SubDeviceList/InertialSensor/AccelerometerX/Sensor/Value",
|
"Device/SubDeviceList/InertialSensor/AccelerometerX/Sensor/Value",
|
||||||
"Device/SubDeviceList/InertialSensor/AccelerometerY/Sensor/Value",
|
"Device/SubDeviceList/InertialSensor/AccelerometerY/Sensor/Value",
|
||||||
"Device/SubDeviceList/InertialSensor/AccelerometerZ/Sensor/Value"};
|
"Device/SubDeviceList/InertialSensor/AccelerometerZ/Sensor/Value"};
|
||||||
imu_names_ = vector<string>(imu, end(imu));
|
imu_names_ = vector<etk/String.hpp>(imu, end(imu));
|
||||||
|
|
||||||
// Sonar Memory Keys
|
// Sonar Memory Keys
|
||||||
const char* sonar[] = {"Device/SubDeviceList/US/Left/Sensor/Value",
|
const char* sonar[] = {"Device/SubDeviceList/US/Left/Sensor/Value",
|
||||||
@ -76,7 +76,7 @@ bool Nao::initialize()
|
|||||||
"Device/SubDeviceList/US/Right/Sensor/Value7",
|
"Device/SubDeviceList/US/Right/Sensor/Value7",
|
||||||
"Device/SubDeviceList/US/Right/Sensor/Value8",
|
"Device/SubDeviceList/US/Right/Sensor/Value8",
|
||||||
"Device/SubDeviceList/US/Right/Sensor/Value9"};
|
"Device/SubDeviceList/US/Right/Sensor/Value9"};
|
||||||
sonar_names_ = vector<string>(sonar, end(sonar));
|
sonar_names_ = vector<etk/String.hpp>(sonar, end(sonar));
|
||||||
|
|
||||||
// Foot Contact Memory Keys
|
// Foot Contact Memory Keys
|
||||||
const char* fsr[] = {"Device/SubDeviceList/LFoot/FSR/FrontLeft/Sensor/Value",
|
const char* fsr[] = {"Device/SubDeviceList/LFoot/FSR/FrontLeft/Sensor/Value",
|
||||||
@ -93,7 +93,7 @@ bool Nao::initialize()
|
|||||||
"Device/SubDeviceList/LFoot/FSR/CenterOfPressure/Y/Sensor/Value",
|
"Device/SubDeviceList/LFoot/FSR/CenterOfPressure/Y/Sensor/Value",
|
||||||
"Device/SubDeviceList/RFoot/FSR/CenterOfPressure/X/Sensor/Value",
|
"Device/SubDeviceList/RFoot/FSR/CenterOfPressure/X/Sensor/Value",
|
||||||
"Device/SubDeviceList/RFoot/FSR/CenterOfPressure/Y/Sensor/Value"};
|
"Device/SubDeviceList/RFoot/FSR/CenterOfPressure/Y/Sensor/Value"};
|
||||||
fsr_names_ = vector<string>(fsr, end(fsr));
|
fsr_names_ = vector<etk/String.hpp>(fsr, end(fsr));
|
||||||
|
|
||||||
// Tactile Memory Keys
|
// Tactile Memory Keys
|
||||||
const char* tactile[] = {"Device/SubDeviceList/Head/Touch/Front/Sensor/Value",
|
const char* tactile[] = {"Device/SubDeviceList/Head/Touch/Front/Sensor/Value",
|
||||||
@ -105,19 +105,19 @@ bool Nao::initialize()
|
|||||||
"Device/SubDeviceList/RHand/Touch/Back/Sensor/Value",
|
"Device/SubDeviceList/RHand/Touch/Back/Sensor/Value",
|
||||||
"Device/SubDeviceList/RHand/Touch/Left/Sensor/Value",
|
"Device/SubDeviceList/RHand/Touch/Left/Sensor/Value",
|
||||||
"Device/SubDeviceList/RHand/Touch/Right/Sensor/Value"};
|
"Device/SubDeviceList/RHand/Touch/Right/Sensor/Value"};
|
||||||
tactile_names_ = vector<string>(tactile, end(tactile));
|
tactile_names_ = vector<etk/String.hpp>(tactile, end(tactile));
|
||||||
|
|
||||||
// Bumper Memory Keys
|
// Bumper Memory Keys
|
||||||
const char* bumper[] = {"Device/SubDeviceList/LFoot/Bumper/Left/Sensor/Value",
|
const char* bumper[] = {"Device/SubDeviceList/LFoot/Bumper/Left/Sensor/Value",
|
||||||
"Device/SubDeviceList/LFoot/Bumper/Right/Sensor/Value",
|
"Device/SubDeviceList/LFoot/Bumper/Right/Sensor/Value",
|
||||||
"Device/SubDeviceList/RFoot/Bumper/Left/Sensor/Value",
|
"Device/SubDeviceList/RFoot/Bumper/Left/Sensor/Value",
|
||||||
"Device/SubDeviceList/RFoot/Bumper/Right/Sensor/Value"};
|
"Device/SubDeviceList/RFoot/Bumper/Right/Sensor/Value"};
|
||||||
bumper_names_ = vector<string>(bumper, end(bumper));
|
bumper_names_ = vector<etk/String.hpp>(bumper, end(bumper));
|
||||||
|
|
||||||
// Battery Memory Keys
|
// Battery Memory Keys
|
||||||
const char* battery[] = {"Device/SubDeviceList/Battery/Charge/Sensor/Value",
|
const char* battery[] = {"Device/SubDeviceList/Battery/Charge/Sensor/Value",
|
||||||
"Device/SubDeviceList/Battery/Temperature/Sensor/Value"};
|
"Device/SubDeviceList/Battery/Temperature/Sensor/Value"};
|
||||||
battery_names_ = vector<string>(battery, end(battery));
|
battery_names_ = vector<etk/String.hpp>(battery, end(battery));
|
||||||
|
|
||||||
// LED Memory Keys
|
// LED Memory Keys
|
||||||
const char* led[] = {"Device/SubDeviceList/ChestBoard/Led/Blue/Actuator/Value",
|
const char* led[] = {"Device/SubDeviceList/ChestBoard/Led/Blue/Actuator/Value",
|
||||||
@ -209,7 +209,7 @@ bool Nao::initialize()
|
|||||||
"Device/SubDeviceList/RFoot/Led/Blue/Actuator/Value",
|
"Device/SubDeviceList/RFoot/Led/Blue/Actuator/Value",
|
||||||
"Device/SubDeviceList/RFoot/Led/Green/Actuator/Value",
|
"Device/SubDeviceList/RFoot/Led/Green/Actuator/Value",
|
||||||
"Device/SubDeviceList/RFoot/Led/Red/Actuator/Value"};
|
"Device/SubDeviceList/RFoot/Led/Red/Actuator/Value"};
|
||||||
led_names_ = vector<string>(led, end(led));
|
led_names_ = vector<etk/String.hpp>(led, end(led));
|
||||||
|
|
||||||
// Joints Initialization
|
// Joints Initialization
|
||||||
const char* joint[] = {"HeadYaw",
|
const char* joint[] = {"HeadYaw",
|
||||||
@ -238,9 +238,9 @@ bool Nao::initialize()
|
|||||||
"RKneePitch",
|
"RKneePitch",
|
||||||
"RAnklePitch",
|
"RAnklePitch",
|
||||||
"RAnkleRoll"};
|
"RAnkleRoll"};
|
||||||
joint_names_ = vector<string>(joint, end(joint));
|
joint_names_ = vector<etk/String.hpp>(joint, end(joint));
|
||||||
|
|
||||||
for(vector<string>::iterator it=joint_names_.begin();it!=joint_names_.end();it++)
|
for(vector<etk/String.hpp>::iterator it=joint_names_.begin();it!=joint_names_.end();it++)
|
||||||
{
|
{
|
||||||
if((*it=="RHand" || *it=="LHand" || *it == "RWristYaw" || *it == "LWristYaw") && (body_type_ == "H21"))
|
if((*it=="RHand" || *it=="LHand" || *it == "RWristYaw" || *it == "LWristYaw") && (body_type_ == "H21"))
|
||||||
{
|
{
|
||||||
@ -248,10 +248,10 @@ bool Nao::initialize()
|
|||||||
it--;
|
it--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
joints_names_.push_back("Device/SubDeviceList/"+(*it)+"/Position/Sensor/Value");
|
joints_names_.pushBack("Device/SubDeviceList/"+(*it)+"/Position/Sensor/Value");
|
||||||
if(*it!="RHipYawPitch")
|
if(*it!="RHipYawPitch")
|
||||||
{
|
{
|
||||||
joint_temperature_names_.push_back("Device/SubDeviceList/"+(*it)+"/Temperature/Sensor/Value");
|
joint_temperature_names_.pushBack("Device/SubDeviceList/"+(*it)+"/Temperature/Sensor/Value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
number_of_joints_ = joint_names_.size();
|
number_of_joints_ = joint_names_.size();
|
||||||
@ -847,7 +847,7 @@ void Nao::publishBaseFootprint(const ros::Time &ts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tf::Vector3 new_origin = (tf_odom_to_right_foot.getOrigin() + tf_odom_to_left_foot.getOrigin())/2.0;
|
tf::Vector3 new_origin = (tf_odom_to_right_foot.getOrigin() + tf_odom_to_left_foot.getOrigin())/2.0;
|
||||||
double height = std::min(tf_odom_to_left_foot.getOrigin().getZ(), tf_odom_to_right_foot.getOrigin().getZ());
|
double height = etk::min(tf_odom_to_left_foot.getOrigin().getZ(), tf_odom_to_right_foot.getOrigin().getZ());
|
||||||
new_origin.setZ(height);
|
new_origin.setZ(height);
|
||||||
|
|
||||||
double roll, pitch, yaw;
|
double roll, pitch, yaw;
|
||||||
@ -1115,7 +1115,7 @@ void Nao::checkBattery(diagnostic_updater::DiagnosticStatusWrapper &stat)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int status = 0;
|
int status = 0;
|
||||||
string message = "Battery: "+boost::lexical_cast<string>(float(batt[0])*100.0f)+"\% charged! ";
|
string message = "Battery: "+boost::lexical_cast<etk/String.hpp>(float(batt[0])*100.0f)+"\% charged! ";
|
||||||
if(float(batt[0])*100.0f<50.0f)
|
if(float(batt[0])*100.0f<50.0f)
|
||||||
status = 1;
|
status = 1;
|
||||||
else if(float(batt[0])*100.0f<20.0f)
|
else if(float(batt[0])*100.0f<20.0f)
|
||||||
|
@ -25,7 +25,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISE
|
|||||||
#include <alcommon/albroker.h>
|
#include <alcommon/albroker.h>
|
||||||
#include <alcommon/albrokermanager.h>
|
#include <alcommon/albrokermanager.h>
|
||||||
|
|
||||||
using std::string;
|
using etk::String;
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user