ROS Answers: Open Source Q&A Forum - RSS feedhttps://answers.ros.org/questions/Open source question and answer forum written in Python and DjangoenROS Answers is licensed under Creative Commons Attribution 3.0Thu, 11 Jul 2013 20:00:26 -0500How to put Hokuyo laser sensor on p2os?https://answers.ros.org/question/44691/how-to-put-hokuyo-laser-sensor-on-p2os/I'm new at gazebo, and I would like to know how to put a hokuyo sensor on my p2os model. I am not using a real robot, I just want to know how to add a sensor on my simulation. Thanks!MendelsonThu, 27 Sep 2012 10:14:38 -0500https://answers.ros.org/question/44691/What's the top recommended camera for a novice in pictures that's fairly affordable?https://answers.ros.org/question/67152/whats-the-top-recommended-camera-for-a-novice-in-pictures-thats-fairly-affordable/Cam for pictures?IsaacThu, 11 Jul 2013 20:00:26 -0500https://answers.ros.org/question/67152/distance from a baselink vector to some fixed frame on the maphttps://answers.ros.org/question/42074/distance-from-a-baselink-vector-to-some-fixed-frame-on-the-map/Hello
Im trying to get the distance between my 4 baselink vectors and the fixed frame on the map. I assumed that my robot is a rectangle with dimension 60x90 cm and the base link is in the center of that rectangle. I made the transformation and just want the know the distance between those 4 baselink vectors( vectors between the 4 corners of the rectangle) and some fixed frame (point in the map). I have this code but dont know is I include all details wright and also how to calculate that minimal distance between the 4 vectors and the point in the map.
This is my node
#include <ros/ros.h>
#include <tf/transform_listener.h>
#include "std_msgs/String.h"
#include <vector>
#include <ros/package.h>
#include "geometry_msgs/PoseWithCovarianceStamped.h"
#include "geometry_msgs/Quaternion.h"
int main(int argc, char** argv){
ros::init(argc, argv, "my_tf_listener");
ros::NodeHandle node;
tf::TransformListener transform_listener;
while (node.ok())
{
tf::StampedTransform transform;
try{
listener.lookupTransform("/base_link", "/door1",
ros::Time(0), transform);
}
catch (tf::TransformException ex){
ROS_ERROR("%s",ex.what());
}
tf::Stamped<tf::Pose> corner1(
tf::Pose(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.30, -0.45, 0.0)),
ros::Time(0), "base_link");
tf::Stamped<tf::Pose> corner2(
tf::Pose(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.30, 0.45, 0.0)),
ros::Time(0), "base_link");
tf::Stamped<tf::Pose> corner3(
tf::Pose(tf::Quaternion(0, 0, 0, 1), tf::Vector3(-0.30, -0.45, 0.0)),
ros::Time(0), "base_link");
tf::Stamped<tf::Pose> corner4(
tf::Pose(tf::Quaternion(0, 0, 0, 1), tf::Vector3(-0.30, 0.45, 0.0)),
ros::Time(0), "base_link");
tf::Stamped<tf::Pose> transformed_corner_1;
transform_listener.transformPose("map", corner1, transformed_corner_1);
tf::Stamped<tf::Pose> transformed_corner_2;
transform_listener.transformPose("map", corner2, transformed_corner_2);
tf::Stamped<tf::Pose> transformed_corner_3;
transform_listener.transformPose("map", corner3, transformed_corner_3);
tf::Stamped<tf::Pose> transformed_corner_4;
transform_listener.transformPose("map", corner4, transformed_corner_4);
double vect_a = transformed_corner_1.getOrigin();
double vect_b = transformed_corner_2.getOrigin();
double vect_c = transformed_corner_3.getOrigin();
double vect_d = transformed_corner_4.getOrigin();
ROS_INFO(" vect_a =%f", vect_a, " vect_b =%f", vect_b," vect_c =%f",
vect_c," vect_d =%f", vect_d,);
rate.sleep();
}
return 0;
};
Any help?
Thanks
AstronautWed, 22 Aug 2012 20:26:35 -0500https://answers.ros.org/question/42074/