-
@samialperen commented on Wed Sep 12 2018 Hello, I have created a client, server and trigger like in the assignment_motor_control to move both arms of iCub simultaneously. However, instead of using IPositionControl, I am using ICartesianControl for this purpose. It works quite fine and there is no problem with it. In another source file "frame_number_listener.cpp" I want to subscribe a ROS topic and when this ROS topic is available, I want to write pose and orientation information of all joints of right and left arms to a text file. The problem is that when I try to open Could anyone give me any advice to solve this issue? I do not want to make ROS subscription in one of the client, server or trigger because the topic's frequency that I want to subscribe is high and I lost information while waiting for motions to be done. Is there an easy way to get all joint's pose? Here are my class MyModule:public yarp::os::RFModule
{
private:
.............
public:
...
bool updateModule()
{
yarp::rosmsg::std_msgs::UInt32* input_from_ros =subscriber.read();
if( input_from_ros->data > 0 )
{
yInfo() << "I heard: " << input_from_ros->data;
yarp::sig::Vector x,o;
textfile << input_from_ros->data << std::endl;
for (int i=0; i<=9; i++)
{
armL->getPose(i,x,o);
textfile << x.toString();
textfile << "\t\t";
textfile << o.toString() << std::endl;
}
}
else
{
yError() << "There is no useful data to read!";
}
return true;
}
bool LArm_config()
{
yarp::os::Property optLarm;
optLarm.put("device", "cartesiancontrollerclient");
optLarm.put("remote", "/icubSim/cartesianController/left_arm");
optLarm.put("local", "/cartesian_server/left_arm");
bool ok_L = false;
double t0_L = yarp::os::Time::now();
while (yarp::os::Time::now() - t0_L < 10.0)
{
if (drvLArm.open(optLarm))
{
ok_L = true;
break;
}
yarp::os::Time::delay(1.0);
}
if (!ok_L)
{
yError() << "Unable to open the Cartesian Controller for Left Arm";
return false;
}
drvLArm.view(armL);
armL->storeContext(&startup_context_idL);
yInfo() << "Left Arm Config is Successfull";
return true;
}
bool configure(yarp::os::ResourceFinder &rf)
{
bool LArm_bool = false;
LArm_bool = LArm_config();
subscriber.topic("/saved_frame_number");
return LArm_bool;
}
....
};
int main(int argc, char * argv[])
{
yarp::os::Network yarp;
std::string save_dir = "~/my_save_dir/";
MyModule module(save_dir);
yarp::os::ResourceFinder rf;
rf.configure(argc, argv);
module.configure(rf);
module.runModule();
return 0;
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @samialperen Most likely, the problem originates from the fact that the two programs are trying to open up a client whose ports do share the same local stem-name Opting for different local stem-names should sort it out. 👉 A couple of ending notes:
All these heads-up are also summarized in our guidelines, popping up the first time a newcomer opens an issue. |
Beta Was this translation helpful? Give feedback.
Hi @samialperen
Most likely, the problem originates from the fact that the two programs are trying to open up a client whose ports do share the same local stem-name
/cartesian_server/left_arm
causing address conflicts when running the second program in a row.Opting for different local stem-names should sort it out.
👉 A couple of ending notes:
All these heads-up are also summarized in our guidelines, popping up the first time a newcomer opens…