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

cluelessnigerian's profile - activity

2020-04-16 09:21:13 -0500 received badge  Famous Question (source)
2020-04-16 09:21:13 -0500 received badge  Notable Question (source)
2019-10-31 05:57:51 -0500 received badge  Famous Question (source)
2019-10-31 05:57:51 -0500 received badge  Notable Question (source)
2019-10-31 05:57:51 -0500 received badge  Popular Question (source)
2019-10-15 17:37:47 -0500 received badge  Famous Question (source)
2018-06-15 17:15:53 -0500 marked best answer transform (x,y,z) coordinate from kinect to /map frame using tf

Hi, I'm tracking an object using a kinect and trying to publish the tf transform of that object in a "/map frame. I'm able to return the object's x, y and depth data using OpenCV. However, I'm struggling with the tf stuff. I've written a function which is meant to update the transform

void updatetransform(double x, double y, double z)
{
     r = -1.5708;
     p = 0;
     y = -3.1415;

   static tf::TransformBroadcaster br;  

  transform.setOrigin(tf::Vector3(x, y, z));
  quaternion.setRPY(r,p,y);  //where r p y are fixed 
  transform.setRotation(quaternion);

  br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "kinect2_ir_optical_frame","drone/base_link"));

  ROS_INFO("Sent Drone Transform at %f %f %f", x, y, z);

}

and in my launch file

<launch>
  <node name = "Drone_Detector" pkg="detector" type="detect_drone" output="screen" />
  <node pkg="tf" type="static_transform_publisher" name="baselink" args="0 0 1 -1.5708 0 -1.5708 /map /kinect2_link 50" />
</launch>

But when I run Rviz, using "/map" as a fixed frame, the drone/base_link tf isn't shown in the screen. I've attached a picture of what it looks like at this link. My x,y and depth values are okay from what the kinect but the transform is wrong. Am I doing something wrong here?

Also here's my tf_tree which looks about right to me. Link here

2017-10-07 13:26:52 -0500 received badge  Notable Question (source)
2017-08-01 07:03:55 -0500 received badge  Famous Question (source)
2017-08-01 07:03:55 -0500 received badge  Notable Question (source)
2017-07-12 17:06:38 -0500 received badge  Famous Question (source)
2017-04-28 10:25:18 -0500 asked a question Transform from map to odom for robot using rtabmap

Transform from map to odom for robot using rtabmap I built a custom robot using URDF and I'm trying to view the position

2017-04-20 14:02:27 -0500 commented answer transform (x,y,z) coordinate from kinect to /map frame using tf

I think I'm probably not calculating the transform properly. -438 and -323 are actual pixel positions of the object I'm

2017-04-20 09:24:35 -0500 received badge  Notable Question (source)
2017-04-20 09:24:35 -0500 received badge  Popular Question (source)
2017-04-20 07:02:23 -0500 commented answer transform (x,y,z) coordinate from kinect to /map frame using tf

I took your advice and took a look at TF -> Frames. The X,Y,Z values in the relative position are about right for dro

2017-04-19 17:44:13 -0500 received badge  Popular Question (source)
2017-04-19 10:55:36 -0500 asked a question transform (x,y,z) coordinate from kinect to /map frame using tf

transform (x,y,z) coordinate from kinect to /map frame using tf Hi, I'm tracking an object using a kinect and trying to

2017-04-19 02:06:06 -0500 received badge  Popular Question (source)
2017-02-23 18:15:59 -0500 commented question Visualising positions of a detected object in Rviz using find-object-2d

@matlabbe, I wasn't publishing tf when running the kinect bridge. Silly error really. I also managed to solve my first question. Thanks for all your help

2017-02-20 07:33:27 -0500 asked a question Visualising positions of a detected object in Rviz using find-object-2d

I'm using find-object to detect an object together with a Kinect 2 and I'm trying to display the trajectory or points that the object has moved within a room using RVIZ. I just want to draw lines between the last known position of the object and it's current position. I modified tf_example_node.cpp but I'm having a few problems.

My Issues are:

  • I'm using pose.GetRotation() as suggested to find the position of the object in 3D space but the line markers aren't being shown in rviz. A quick rostopic echo shows that visualization_marker isn't publishing anything. Am I doing this right here?

  • Also, I get a warning saying could not find a connection between "map" and "object" as they are not part of the same tree. I'm trying to visualise the movement within a fixed frame /map. How would I achieve this?

This is my code

#include <ros/ros.h>
#include <tf/transform_listener.h>
#include <find_object_2d/ObjectsStamped.h>
#include <QtCore/QString>
#include <visualization_msgs/Marker.h>

#include <cmath>


class TfExample
{
public:
    TfExample() :
        mapFrameId_("/map"),
        objFramePrefix_("object")
    {
        ros::NodeHandle pnh("~");
        pnh.param("map_frame_id", mapFrameId_, mapFrameId_);
        pnh.param("object_prefix", objFramePrefix_, objFramePrefix_);

    ros::NodeHandle nh;
    subs_ = nh.subscribe("objectsStamped", 1, &TfExample::objectsDetectedCallback, this);

    ros::NodeHandle n;
        marker_pub = n.advertise<visualization_msgs::Marker>("visualization_marker", 10);

}

// Here I synchronize with the ObjectsStamped topic to
// know when the TF is ready and for which objects
void objectsDetectedCallback(const find_object_2d::ObjectsStampedConstPtr & msg)
{


            ros::Rate loop_rate(30);

    if(msg->objects.data.size())
    {
        for(unsigned int i=0; i<msg->objects.data.size(); i+=12)
        {
            // get data
            int id = (int)msg->objects.data[i];
                 std::string objectFrameId = QString("%1_%2").arg(objFramePrefix_.c_str()).arg(id).toStdString(); // "object_1", "object_2"

                 points.header.frame_id = line_strip.header.frame_id = line_list.header.frame_id = QString("/object_%1").arg(id).toStdString();
                 points.header.stamp = line_strip.header.stamp = line_list.header.stamp = ros::Time::now();
                 points.ns = line_strip.ns = line_list.ns = "points_and_lines";
                 points.action = line_strip.action = line_list.action = visualization_msgs::Marker::ADD;
                 points.pose.orientation.w = line_strip.pose.orientation.w = line_list.pose.orientation.w = 1.0;

                 tf::StampedTransform pose;
                 tf::StampedTransform poseCam;

            try
            {
                // Get transformation from "object_#" frame to target frame "map"
                // The timestamp matches the one sent over TF
                tfListener_.lookupTransform(mapFrameId_, objectFrameId, msg->header.stamp, pose);
                tfListener_.lookupTransform(msg->header.frame_id, objectFrameId, msg->header.stamp, poseCam);
            }
            catch(tf::TransformException & ex)
            {
                ROS_WARN("%s",ex.what());
                continue;
            }

            // Here "pose" is the position of the object "id" in "/map" frame.
            ROS_INFO("Object_%d [x,y,z] [x,y,z,w] in \"%s\" frame: [%f,%f,%f] [%f,%f,%f,%f]",
                    id, mapFrameId_.c_str(),
                    pose.getOrigin().x(), pose.getOrigin().y(), pose.getOrigin().z(),
                    pose.getRotation().x(), pose.getRotation().y(), pose.getRotation().z(), pose.getRotation().w());


            ROS_INFO("Object_%d [x,y,z] [x,y,z,w] in \"%s\" frame: [%f,%f,%f] [%f,%f,%f,%f]",
                    id, msg->header.frame_id.c_str(),
                    poseCam.getOrigin().x(), poseCam.getOrigin().y(), poseCam.getOrigin().z(),
                    poseCam.getRotation().x(), poseCam.getRotation().y(), poseCam.getRotation().z(), poseCam.getRotation().w());

            points.id = 0;
            line_strip ...
(more)
2017-01-29 13:47:41 -0500 received badge  Enthusiast
2017-01-20 06:35:25 -0500 asked a question Help 3D navigation using a known map

Hello, I'm using rtab map and a kinect to generate a map of a corridor. I was wondering if it was possible to fly a UAV to a known point within the generated map.

My project statement requires me to:

  • Manually map and generate a pointcloud of an environment.
    • Using the generated map, fly a quadcopter/ UAV autonomously to a point within the generated map.

I'm able to use rtab map to generate a map of an environment however, I'm not sure where to start for the second point. I can't seem to find anything relating to the second point.. Could someone please point me in the right direction.

2016-11-13 08:25:25 -0500 asked a question How to visualize laser sensor data from a bag file

I've been looking at laser sensor datasets online over the weekend and I'm not quite sure how to visualize the output in Rviz. I don't have a laser sensor but I want to get an understanding of what the output of these devices look like.

For example, at the following link, there's a bag file which you can download and play using rosbag play. I run the command and I can get an output of the x y z position data by using

rostopic echo

on the /microstrain/imu topic but when I run rviz nothing shows up.

I guess my question is:

  1. What are the general steps required to view a visual representation of what is recorded in bagfiles (especially laser scanners)

  2. Are there any good tutorials out there to help with this? I've been searching all weekend and it seems most tutorials miss out something I'm meant to know as a complete newbie

2016-11-12 06:55:46 -0500 received badge  Popular Question (source)
2016-11-11 09:55:32 -0500 commented answer catkin_make won't recognise ROS Package

Thanks, that makes sense now. I was wondering what rosmake was referring to as I'd never come across in all the tutorials I'd come across

2016-11-11 09:40:28 -0500 received badge  Scholar (source)
2016-11-11 09:09:58 -0500 commented answer catkin_make won't recognise ROS Package

Yes it is.

2016-11-11 09:08:20 -0500 asked a question catkin_make won't recognise ROS Package

Hi, I'm new to ROS and I've been trying to check out the package at the following link: https://github.com/dimatura/loam_cont... . I've cloned it to my catkin workspace but when I try to build the package using

catkin_make

it doesn't seem to recognise the package. This is my output:

-- Using CATKIN_DEVEL_PREFIX: /home/daniel/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/daniel/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.4
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/daniel/catkin_ws/build

Am I doing something wrong? Could someone please point me in the right direction?