25 #include <alcommon/albroker.h> 26 #include <alcommon/albrokermanager.h> 27 #include <alproxies/almotionproxy.h> 33 int main(
int argc,
char** argv )
36 string pip =
"127.0.0.1";
37 ros::init(argc, argv,
"romeo_dcm_driver");
42 cerr<<
"Could not contact master!\nQuitting... "<<endl;
46 string broker_name =
"Romeo Driver Broker";
48 int broker_port = 54000;
50 string broker_ip =
"0.0.0.0";
53 n_p.
param(
"RobotIP", pip,
string(
"127.0.0.1"));
54 n_p.
param(
"RobotPort", pport,9559);
55 n_p.
param(
"DriverBrokerPort", broker_port, 54000);
56 n_p.
param(
"DriverBrokerIP", broker_ip,
string(
"0.0.0.0"));
63 broker = AL::ALBroker::createBroker(broker_name,broker_ip,broker_port,pip,pport,0);
71 catch (
const AL::ALError& e)
73 ROS_ERROR(
"Could not create ALMotionProxy.");
76 m_motionProxy->stiffnessInterpolation(
"LArm", 1.0
f, 2.0
f);
77 m_motionProxy->stiffnessInterpolation(
"RArm", 1.0
f, 2.0
f);
86 ROS_ERROR(
"Failed to connect to Broker at %s:%d!",pip.c_str(),pport);
91 AL::ALBrokerManager::setInstance(broker->fBrokerManager.lock());
92 AL::ALBrokerManager::getInstance()->addBroker(broker);
97 if(!romeo->connected())
99 ROS_ERROR(
"Could not connect to Romeo robot!");
100 AL::ALBrokerManager::getInstance()->killAllBroker();
101 AL::ALBrokerManager::kill();
109 if(broker->isModulePresent(
"Romeo"))
110 ROS_INFO(
"Romeo Module loaded succesfully!");
113 ROS_ERROR(
"Romeo Module is not loaded!");
120 AL::ALBrokerManager::getInstance()->killAllBroker();
121 AL::ALBrokerManager::kill();
127 ROS_INFO(
"finished sleeping... " );
128 AL::ALProxy tempMotion(
"ALMotion", pip, pport);
129 tempMotion.callVoid(
"setStiffnesses",
"LArm",0.0
f);
130 tempMotion.callVoid(
"setStiffnesses",
"RArm",0.0
f);
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const