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

rubot's profile - activity

2019-04-22 12:43:59 -0500 received badge  Famous Question (source)
2018-11-29 05:47:41 -0500 received badge  Famous Question (source)
2018-09-11 15:41:50 -0500 received badge  Notable Question (source)
2018-09-07 10:44:55 -0500 received badge  Notable Question (source)
2018-08-27 03:11:59 -0500 received badge  Famous Question (source)
2018-07-25 14:40:04 -0500 commented answer Renaming a topic inside a bag file

how can you actually replace a topic name by another? how could one change the code for that?

2018-07-19 06:56:37 -0500 received badge  Enthusiast
2018-07-12 15:54:16 -0500 received badge  Teacher (source)
2018-07-12 15:54:16 -0500 received badge  Self-Learner (source)
2018-07-12 13:09:07 -0500 answered a question How can i apply two sensor messages on one frame?

Since my second problem had something to do with boost i decided to post an other question here. The problem was that i

2018-07-12 13:02:04 -0500 received badge  Popular Question (source)
2018-07-12 13:00:10 -0500 commented answer Huge error message from boost using time_synchronizer

this was exactly the problem! first i switched the numbers but in the end it is better to be more consistent with the ar

2018-07-12 12:56:04 -0500 marked best answer Huge error message from boost using time_synchronizer

This is the modified example code of the message_filters package

#include <ros/ros.h>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2_ros/transform_broadcaster.h>
#include <geometry_msgs/PointStamped.h>
#include <geometry_msgs/TransformStamped.h>
#include <sensor_msgs/Imu.h>
#include <message_filters/subscriber.h>
#include <message_filters/time_synchronizer.h>

void callback(const geometry_msgs::PointStampedConstPtr& msg,
                      const sensor_msgs::ImuConstPtr& imuMsg){

  static tf2_ros::TransformBroadcaster tf2_broadcaster;
  geometry_msgs::TransformStamped transformStamped;

  transformStamped.header.stamp = ros::Time::now();
  transformStamped.header.frame_id = "ts_frame";
  transformStamped.child_frame_id = "prism_frame";
  transformStamped.transform.translation.x = msg->point.x;
  transformStamped.transform.translation.y = msg->point.y;
  transformStamped.transform.translation.z = msg->point.z;
  tf2::Quaternion q;
  transformStamped.transform.rotation.x = imuMsg->orientation.x;
  transformStamped.transform.rotation.y = imuMsg->orientation.y;
  transformStamped.transform.rotation.z = imuMsg->orientation.z;
  transformStamped.transform.rotation.w = imuMsg->orientation.w;

  tf2_broadcaster.sendTransform(transformStamped);
}

int main(int argc, char** argv){
  ros::init(argc, argv, "tf_ts2prism");
  ros::NodeHandle nh;

  message_filters::Subscriber<sensor_msgs::Imu> imu_sub(nh, "/imu/data_raw", 1);
  message_filters::Subscriber<geometry_msgs::PointStamped> point_sub(nh, "/ts_points", 1);

  message_filters::TimeSynchronizer<sensor_msgs::Imu, geometry_msgs::PointStamped> sync(imu_sub, point_sub, 10);
  sync.registerCallback(boost::bind(&callback, _1, _2));

  ros::spin();
  return 0;
}

the error message is not understandable:

warning: format not a string literal and no format arguments [-Wformat-security]
In file included from /usr/include/boost/bind.hpp:22:0,
                 from /opt/ros/kinetic/include/ros/publisher.h:35,
                 from /opt/ros/kinetic/include/ros/node_handle.h:32,
                 from /opt/ros/kinetic/include/ros/ros.h:45,
                 from /opt/ros/kinetic/include/message_filters/subscriber.h:38,
                 from /home/mango/tut_ws/src/totalstation/src/tf_ts2prism.cpp:47:
/usr/include/boost/bind/bind.hpp: In instantiation of ‘void boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<void>, F&, A&, int) [with F = void (*)(const boost::shared_ptr<const sensor_msgs::Imu_<std::allocator<void> > >&, const boost::shared_ptr<const sensor_msgs::CameraInfo_<std::allocator<void> > >&); A = boost::_bi::list9<const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&, const boost::shared_ptr<const sensor_msgs::CameraInfo_<std::allocator<void> > >&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&>; A1 = boost::arg<1>; A2 = boost::arg<2>]’:
/usr/include/boost/bind/bind.hpp:1102:50:   required from ‘boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F, L>::operator()(A1&&, A2&&, A3&&, A4&&, A5&&, A6&&, A7&&, A8&&, A9&&) [with A1 = const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&; A2 = const boost::shared_ptr<const sensor_msgs::CameraInfo_<std::allocator<void> > >&; A3 = const boost::shared_ptr<const message_filters::NullType>&; A4 = const boost::shared_ptr<const message_filters::NullType>&; A5 = const boost::shared_ptr<const message_filters::NullType>&; A6 = const boost::shared_ptr<const message_filters::NullType>&; A7 = const boost::shared_ptr<const message_filters::NullType>&; A8 = const boost::shared_ptr<const message_filters::NullType>&; A9 = const boost::shared_ptr<const message_filters::NullType>&; R = void; F = void (*)(const boost::shared_ptr<const sensor_msgs::Imu_<std::allocator<void> > >&, const boost::shared_ptr<const sensor_msgs::CameraInfo_<std::allocator<void> > >&); L = boost::_bi::list2<boost ...
(more)
2018-07-12 12:47:43 -0500 received badge  Notable Question (source)
2018-07-12 12:41:18 -0500 commented answer How can i apply two sensor messages on one frame?

yes, i did. i added my code and the error message to the question

2018-07-12 12:38:18 -0500 edited question How can i apply two sensor messages on one frame?

How can i apply two sensor messages on one frame? I have a sensor which measures a position of one frame and the other s

2018-07-12 12:35:24 -0500 edited question Huge error message from boost using time_synchronizer

Huge error message from boost using time_synchronizer This is the modified example code of the message_filters package

2018-07-12 11:59:13 -0500 edited question Huge error message from boost using time_synchronizer

Huge error message from boost using time_synchronizer This is the modified example code of the message_filters package

2018-07-12 11:39:42 -0500 asked a question Huge error message from boost using time_synchronizer

Huge error message from boost using time_synchronizer This is the modified example code of the message_filters package

2018-07-12 11:27:39 -0500 commented answer How can i apply two sensor messages on one frame?

By compiling the example code everything works fine, but when i add a sensor_msgs::Imu object to the message_filters::Su

2018-07-12 11:26:46 -0500 commented answer How can i apply two sensor messages on one frame?

By compiling the example code everything works fine, but when i add a sensor_msgs::Imu object boost starts to complain

2018-07-12 10:54:22 -0500 received badge  Popular Question (source)
2018-07-12 10:39:33 -0500 marked best answer How can i apply two sensor messages on one frame?

I have a sensor which measures a position of one frame and the other sensor measures the rotation. If I'm subscribing on those two sensor topics, how can i define a transform which gets both of the sensor data, position and rotation?

im also quite new to c++... Is it possible to write something like

void callbackFunc(const geometry_msgs::PointStampedConstPtr& msg, 
                  const sensor_msgs::ImuConstPrt& imuMsg){
//defining transformStamped and Broadcaster
tfStamped.translation.x = msg->point.x;
...// until translation.z
tf.Stamped.rotation.x  = imuMsg->orientation.x;
..// until rotation.w
}

int main(......){
ros::Subscriber sub = node.subscribe("....");
}

is it possible to realize it this way?

edit:

my current code is:

#include <ros/ros.h>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2_ros/transform_broadcaster.h>
#include <geometry_msgs/PointStamped.h>
#include <geometry_msgs/TransformStamped.h>
#include <sensor_msgs/Imu.h>
#include <message_filters/subscriber.h>
#include <message_filters/time_synchronizer.h>

void callback(const geometry_msgs::PointStampedConstPtr& msg,
                      const sensor_msgs::ImuConstPtr& imuMsg){

  static tf2_ros::TransformBroadcaster tf2_broadcaster;
  geometry_msgs::TransformStamped transformStamped;

  transformStamped.header.stamp = ros::Time::now();
  transformStamped.header.frame_id = "ts_frame";
  transformStamped.child_frame_id = "prism_frame";
  transformStamped.transform.translation.x = msg->point.x;
  transformStamped.transform.translation.y = msg->point.y;
  transformStamped.transform.translation.z = msg->point.z;
  tf2::Quaternion q;
  transformStamped.transform.rotation.x = imuMsg->orientation.x;
  transformStamped.transform.rotation.y = imuMsg->orientation.y;
  transformStamped.transform.rotation.z = imuMsg->orientation.z;
  transformStamped.transform.rotation.w = imuMsg->orientation.w;

  tf2_broadcaster.sendTransform(transformStamped);
}

int main(int argc, char** argv){
  ros::init(argc, argv, "tf_ts2prism");
  ros::NodeHandle nh;

  message_filters::Subscriber<sensor_msgs::Imu> imu_sub(nh, "/imu/data_raw", 1);
  message_filters::Subscriber<geometry_msgs::PointStamped> point_sub(nh, "/ts_points", 1);

  message_filters::TimeSynchronizer<sensor_msgs::Imu, geometry_msgs::PointStamped> sync(imu_sub, point_sub, 10);
  sync.registerCallback(boost::bind(&callback, _1, _2));

  ros::spin();
  return 0;
}

the error message is:

In file included from /usr/include/boost/bind.hpp:22:0,
                 from /opt/ros/kinetic/include/ros/publisher.h:35,
                 from /opt/ros/kinetic/include/ros/node_handle.h:32,
                 from /opt/ros/kinetic/include/ros/ros.h:45,
                 from /home/mango/tut_ws/src/totalstation/src/tf_ts2prism.cpp:1:
/usr/include/boost/bind/bind.hpp: In instantiation of ‘void boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<void>, F&, A&, int) [with F = void (*)(const boost::shared_ptr<const geometry_msgs::PointStamped_<std::allocator<void> > >&, const boost::shared_ptr<const sensor_msgs::Imu_<std::allocator<void> > >&); A = boost::_bi::list9<const boost::shared_ptr<const sensor_msgs::Imu_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PointStamped_<std::allocator<void> > >&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&, const boost::shared_ptr<const message_filters::NullType>&>; A1 = boost::arg<1>; A2 = boost::arg<2>]’:
/usr/include/boost/bind/bind.hpp:1102:50:   required from ‘boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F, L>::operator()(A1&&, A2&&, A3&&, A4&&, A5&&, A6&&, A7&&, A8&&, A9&&) [with A1 = const boost::shared_ptr<const sensor_msgs::Imu_<std::allocator<void> > >&; A2 = const boost::shared_ptr<const geometry_msgs::PointStamped_<std::allocator ...
(more)
2018-07-12 10:39:33 -0500 received badge  Scholar (source)
2018-07-12 10:39:07 -0500 commented answer How can i apply two sensor messages on one frame?

Thanks a lot! This was exactly what i was searching for... unfortunately by using the line sync.registerCallback(boost::

2018-07-12 10:38:48 -0500 commented answer How can i apply two sensor messages on one frame?

Thanks a lot! This was exactly what i was searching for... unfortunately by using the line sync.registerCallback(boost::

2018-07-12 09:27:06 -0500 edited question How can i apply two sensor messages on one frame?

How can i apply two sensor messages on one frame? I have a sensor which measures a position of one frame and the other s

2018-07-12 09:26:48 -0500 edited question How can i apply two sensor messages on one frame?

How can i apply two sensor messages on one frame? I have a sensor which measures a position of one frame and the other s

2018-07-12 09:26:48 -0500 received badge  Editor (source)
2018-07-12 09:26:21 -0500 edited question How can i apply two sensor messages on one frame?

How can i apply two sensor messages on one frame? I have a sensor which measures a position of one frame and the other s

2018-07-12 09:18:27 -0500 asked a question How can i apply two sensor messages on one frame?

How can i apply two sensor messages on one frame? I have a sensor which measures a position of one frame and the other s

2018-07-11 04:16:51 -0500 received badge  Popular Question (source)
2018-07-10 11:13:35 -0500 asked a question Trying to apply a rotation of one frame to another. Multiple callback transform?

Trying to apply a rotation of one frame to another. Multiple callback transform? I have two frames set up: prism_frame

2018-07-10 10:05:40 -0500 received badge  Supporter (source)