ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Problem for building long baseline navigation system on UWSim

asked 2016-01-27 08:32:20 -0500

ZYS gravatar image

Since the transponder is not available on UWSim, I replace it with AUV. My idea is to make the target AUV send acoustic signal to transponder AUV and measure the travelling time of acoustic signal so that the distance between them can be calculated. In order to achieve this goal, I add talker.cpp and listener.cpp on UWSim and they can be run without error. Target AUV is talker and transponder AUV is listener and I make talker send message to listener. The code of listener and talker is shown below: talker.cpp #include "ros/ros.h"

#include "std_msgs/String.h"

#include <sstream>

int main(int argc, char **argv)

{

ros::init(argc, argv, "girona500_target");

ros::NodeHandle n;

ros::Publisher chatter_pub = n.advertise<std_msgs::string>("chatter", 1000);

ros::Rate loop_rate(10);

int count = 0;

while (ros::ok())

{

std_msgs::String msg;

std::stringstream ss;

ss << "hello world " << count;

msg.data = ss.str();

ROS_INFO("%s", msg.data.c_str());

chatter_pub.publish(msg);

ros::spinOnce();

loop_rate.sleep();

++count;

}

return 0;

}

listener.cpp:

#include "ros/ros.h"

#include "std_msgs/String.h"

void chatterCallback(const std_msgs::String::ConstPtr& msg)

{

ROS_INFO("I heard: [%s]", msg->data.c_str());

}

int main(int argc, char **argv)

{

ros::init(argc, argv, "girona500_t1");

ros::NodeHandle n;

ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);

ros::spin();

return 0;

}

And the result is shown as below:

Unfortunately, the time in the result is CPU time. It is not the travelling time of acoustic signal. So, does anyone know how to get the travelling time of acoustic signal or is it possible to get the travelling time of acoustic signal.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-01-27 10:25:46 -0500

Javier Perez gravatar image

Hi,

Even if your files are inside UWSim they are just sending messages to each other through ROS, so no simulation is involved (That is the reason why you are getting CPU time). Unfortunately, as you said, UWSim does not offer this kind of simulation capabilities at this moment.

So, depending on the precision required I would suggest to implement it yourself adding delays, missing packages... depending on the position of both AUV's. Adding a accoustic signal sim node that receives messages, keeps track of the vehicle's position and resends messages to the possible listeners, so each AUV should have a publisher and subscriber that will send/receive to the sim node.

edit flag offensive delete link more

Comments

Thanks for your suggestion. In order to get the time delay, I must know the distance between both AUV. But the GPS doesn't work underwater on the UWSim. How can I know the position of the target AUV?

ZYS gravatar image ZYS  ( 2016-01-27 12:19:47 -0500 )edit

You can get it using TF, just look for the transform from world to [nameofvehicle]. And check WorldToROSTF is configured in the scene (default scene has it).

Javier Perez gravatar image Javier Perez  ( 2016-01-28 03:03:36 -0500 )edit

Thanks for your suggestion.

ZYS gravatar image ZYS  ( 2016-01-28 09:30:36 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-01-27 08:32:20 -0500

Seen: 128 times

Last updated: Jan 27 '16