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

Salahuddin_Khan's profile - activity

2022-08-24 03:43:33 -0500 received badge  Nice Question (source)
2021-09-09 02:31:58 -0500 received badge  Notable Question (source)
2020-07-30 23:52:15 -0500 received badge  Popular Question (source)
2020-07-13 05:25:47 -0500 received badge  Rapid Responder (source)
2020-07-13 05:25:47 -0500 answered a question Nodelets not running together

Turns out the all those 3 Nodelets had while loops inside onInit, only one Nodelet with a while loop inside works, I gue

2020-07-12 19:21:45 -0500 edited question Nodelets not running together

Nodelets not running together I'm trying to run 4 nodelets together, but for some reason the last 3 seem to be incompati

2020-07-12 18:45:04 -0500 received badge  Organizer (source)
2020-07-12 18:30:04 -0500 edited question Nodelets not running together

Nodelets not running together I'm trying to run 4 nodelets together, but for some reason the last 3 seem to be incompati

2020-07-12 18:29:20 -0500 asked a question Nodelets not running together

Nodelets not running together I'm trying to run 4 nodelets together, but for some reason the last 3 seem to be incompati

2020-01-16 05:35:06 -0500 marked best answer Multiple TF issues while running SLAM

I am running ETH zurich's version of ORB SLAM on a bagfile of Kitti dataset of Stereo Images which I am playing at 0.1 r. The SLAM publishes TF in the camera's frame, world->cam0 1) I am trying to publish a static transform between cam0 and base-link the following code using in the launch file,

<node pkg="tf2_ros" type="static_transform_publisher" name="camera_broadcaster" args="1 0 0.5 -1.57 0 -1.57 base_link cam0" />

while I am able to see it when I echo /tf_static

sal@sal:~/helper_ws$ rostopic echo /tf_static 
transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 0
        nsecs:         0
      frame_id: "base_link"
    child_frame_id: "cam0"
    transform: 
      translation: 
        x: 1.0
        y: 0.0
        z: 0.5
      rotation: 
        x: -0.499999841466
        y: 0.499601836645
        z: -0.499999841466
        w: 0.500398163355
---

but when I do rosrun tf view_frames this is what I get image description

I am also unable to visualize it in Rviz which says no transform exists between cam0 and base_link

This same problem exists when I run S-PTAM slam ,I wrote a small code to subscribe to pose and republish a transform between a new frame odom to the cam_link and still face the same issue. This issue only occurs when I publish a static transform on moving frame like cam0 if I instead publish on some other new random frame everything works perfectly.

Not sure what is wrong.

<node pkg="tf2_ros" type="static_transform_publisher" name="camera_broadcaster" args="1 0 0.5 -1.57 0 -1.57 base_link camera_link" />

image description

here is sample tf data from orb_slam:

transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 1385798169
        nsecs:  22117622
      frame_id: "world"
    child_frame_id: "cam0"
    transform: 
      translation: 
        x: 25.4732408315
        y: -1.2908452135
        z: 79.1472754724
      rotation: 
        x: 0.0172311913033
        y: 0.69976084093
        z: 0.00217123302013
        w: 0.714166043224
---
transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 1385798169
        nsecs:  22117622
      frame_id: "world"
    child_frame_id: "cam0"
    transform: 
      translation: 
        x: 25.4732408315
        y: -1.2908452135
        z: 79.1472754724
      rotation: 
        x: 0.0172311913033
        y: 0.69976084093
        z: 0.00217123302013
        w: 0.714166043224
---
transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 1385798169
        nsecs:  23126248
      frame_id: "world"
    child_frame_id: "cam0"
    transform: 
      translation: 
        x: 25.4732408315
        y: -1.2908452135
        z: 79.1472754724
      rotation: 
        x: 0.0172311913033
        y: 0.69976084093
        z: 0.00217123302013
        w: 0.714166043224
---
2020-01-16 05:35:03 -0500 commented answer Multiple TF issues while running SLAM

Yes, you're right, that was the problem.

2019-10-18 04:32:09 -0500 received badge  Famous Question (source)
2019-09-12 14:37:10 -0500 received badge  Famous Question (source)
2019-09-12 14:37:10 -0500 received badge  Notable Question (source)
2019-09-12 14:37:10 -0500 received badge  Popular Question (source)
2019-08-31 06:30:48 -0500 received badge  Famous Question (source)
2019-07-22 17:46:14 -0500 received badge  Popular Question (source)
2019-07-22 17:46:14 -0500 received badge  Notable Question (source)
2019-05-02 11:03:41 -0500 marked best answer Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::Transform>

I'm trying to find a cascaded transform but I'm running into the following errors :

tf::TransformListener listener;
tf::StampedTransform transform_cd;
try
{
  for(unsigned int i=0; i<tag_detection_array.detections.size(); i++) {
    geometry_msgs::PoseStamped pose;
    pose.pose = tag_detection_array.detections[i].pose.pose.pose;
    pose.header = tag_detection_array.detections[i].pose.header;
    tf::Stamped<tf::Transform> tag_transform, transform_td, transform_tc;
    tf::poseStampedMsgToTF(pose, tag_transform);
    listener.lookupTransform("camera", "drone",  tag_transform.stamp_, transform_cd);
    transform_tc = tag_transform.inverse();
    transform_td = transform_tc*transform_cd;
    tf::Matrix3x3(transform_td.getRotation()).getRPY(uavRollENU, uavPitchENU, uavYawENU);
    if(pose.pose.position.z>0.1 && fabs(uavPitchENU) < 30/57.2958 && fabs(uavRollENU) < 30/57.2958)
    {
      tf_pub_.sendTransform(tf::StampedTransform(tag_transform,
                                              tag_transform.stamp_,
                                              camera_tf_frame_,
                                              detection_names[i]));
      tf::poseStampedTFToMsg(transform_td, pose);


    error: no match for ‘operator=’ (operand types are ‘tf::Stamped<tf::Transform>’ and ‘tf::Transform’)
     transform_tc = tag_transform.inverse();
error: no match for ‘operator=’ (operand types are ‘tf::Stamped<tf::Transform>’ and ‘tf::Transform’)
     transform_td = transform_tc*transform_cd;
2019-05-02 10:36:00 -0500 answered a question Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::Transform>

I rectified the error by : tf::TransformListener listener; tf::StampedTransform transform_cd; tf::Transform transform

2019-05-02 09:22:04 -0500 edited question Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::Transform>

Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::transform> I'm trying to find a cascaded tra

2019-05-02 09:21:26 -0500 commented question Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::Transform>

This is what I'm attempting to do transform_tc = tag_transform.inverse(); transform_td = transform_tc*transform_cd;

2019-05-02 09:20:20 -0500 edited question Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::Transform>

Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::transform> I'm trying to find a cascaded tra

2019-05-02 09:14:36 -0500 edited question Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::Transform>

Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::transform> I'm trying to find a cascaded tra

2019-05-02 09:12:59 -0500 edited question Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::Transform>

Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::transform> I'm trying to find a cascaded tra

2019-05-02 09:12:08 -0500 asked a question Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::Transform>

Extract tf::Transform from tf::StampedTransform & tf::Stamped<tf::transform> I'm trying to find a cascaded tra

2019-04-07 22:36:38 -0500 marked best answer Fusing multiple sensors of same type using robot_localization.

Hi, I understand fairly clearly how data from Multiple sensors of different type like IMU, GPS , Wheel-Odometry etc can be fused using the Kalman-Filter.

But how does robot_localization fuses data from multiple sensors of same type say velocity input from 2 Wheel Odometers?

Is it simply weight averaged using their individual co-variances and the combined output is sent as a single Odometry measurement to the Kalman filter or is it a lot more complex process?

2019-04-05 07:12:13 -0500 received badge  Notable Question (source)
2018-12-29 14:36:19 -0500 received badge  Famous Question (source)
2018-09-14 17:23:49 -0500 marked best answer Simulate GPS sensor via ROS plugins (Hector_Plugins)

Hi, I am new to ROS I'm trying to simulate some realistic sensors with noise, drift and bias on a DBW car. I have used the following code to simulate an IMU .

<gazebo reference="${name}">
<gravity>true</gravity>
<sensor name="imu_sensor" type="imu">
  <always_on>true</always_on>
  <update_rate>100</update_rate>
  <visualize>true</visualize>
  <topic>__default_topic__</topic>
  <plugin filename="libgazebo_ros_imu_sensor.so" name="imu_plugin">
    <topicName>imu</topicName>
    <bodyName>imu_link</bodyName>
    <updateRateHZ>10.0</updateRateHZ>
    <gaussianNoise>0.0</gaussianNoise>
    <xyzOffset>0 0 0</xyzOffset>
    <rpyOffset>0 0 0</rpyOffset>
    <frameName>imu_link</frameName>
  </plugin> 

</sensor>
</gazebo>

and I'd be grateful if someone could help me out with GPS , I've already downloaded the Hector Plugins ( http://wiki.ros.org/hector_gazebo_plu... ) but I'm not sure how to modify the code to use those plugins.

Thank You, Sal.

2018-09-11 07:33:38 -0500 received badge  Popular Question (source)
2018-09-11 07:33:38 -0500 received badge  Notable Question (source)
2018-07-30 07:51:23 -0500 received badge  Popular Question (source)
2018-07-30 07:08:14 -0500 marked best answer ROS c++ Class Subscriber doesn't work while publishing in constructor

Hi, The following code subscribes to topics containing data of individual wheel angular velocities, I am simply combining them and publishing the Odometry of the base_link.

I've been trying to do everything in the class itself but when I am running the While loop which is publishing the Odometry in the constructor the Subscriber Callback functions don't work. In the following code callback functions don't work. While rostopic info shows that I am subscribing to those topics but the callbacks just don't run.

When I remove the while loop from the constructor and place it inside one of the callbacks , Everything runs smoothly

#include "ros/ros.h"
#include "geometry_msgs/TwistStamped.h"
#include "geometry_msgs/Pose2D.h"
#include "nav_msgs/Odometry.h"
#include <stdio.h>

class Wheelodom
{
public:

  Wheelodom()
  {
    pub1 = n_.advertise<nav_msgs::Odometry>("odom", 5);
    sub1 = n_.subscribe<geometry_msgs::TwistStamped>("left_wheel_odom", 10, &Wheelodom::odomCallback_l, this);
    sub2 = n_.subscribe<geometry_msgs::TwistStamped>("right_wheel_odom", 10, &Wheelodom::odomCallback_r, this);
    initialize();
    reset_pose();
    ros::Rate loop_rate(20);
    while(ros::ok())
    {
      calculate_vel();
      ROS_INFO("%f", av_l);
      calculate_delta_pose();
      calculate_integrated_pose();
      publish_odom();
      loop_rate.sleep();
    } 

  }

  void initialize()
  {
    simba_link = "base_link";
    odom_pose.x = 0.0;
    odom_pose.y = 0.0;
    odom_pose.theta = 0.0;
    delta_odom_pose.x = 0.0;
    delta_odom_pose.y = 0.0;
    delta_odom_pose.theta = 0.0;
    cur_time = ros::Time::now();
    prev_time = ros::Time::now();
    Wheel_radius_r = 0.065;
    Wheel_radius_l = 0.065;
    rear_axle = 0.21;
    h = 0.07;
    av_l = 0.0;
    av_r = 0.0;
  }
  void reset_pose()
  {
    odom_pose.x = 0.0;
    odom_pose.y = 0.0;
    odom_pose.theta = 0.0;
    delta_odom_pose.x = 0.0;
    delta_odom_pose.y = 0.0;
    delta_odom_pose.theta = 0.0;
  }

  void odomCallback_l(const geometry_msgs::TwistStamped::ConstPtr& data)
  {

    av_l = data->twist.linear.x;
    ROS_INFO("data received");

  }

  void odomCallback_r(const geometry_msgs::TwistStamped::ConstPtr& data)
  {

    av_r = data->twist.linear.x;

  }

  void calculate_vel()
  {
    odom.twist.twist.linear.x = ((av_l*Wheel_radius_l) + (av_r*Wheel_radius_r))/2;
    odom.twist.twist.angular.z = ((av_r*Wheel_radius_r) - (av_l*Wheel_radius_l))/rear_axle;
  }

  void calculate_delta_pose()
  {
    cur_time = ros::Time::now();
    elapsed_time = cur_time-prev_time;
    prev_time = cur_time;
    delta_odom_pose.theta =  odom.twist.twist.angular.z * elapsed_time.toSec();
    delta_odom_pose.x = odom.twist.twist.linear.x * elapsed_time.toSec() * cos(odom_pose.theta + delta_odom_pose.theta * 0.5);
    delta_odom_pose.y = odom.twist.twist.linear.x * elapsed_time.toSec() * sin(odom_pose.theta + delta_odom_pose.theta * 0.5);

  }

  void calculate_integrated_pose()
  {
    odom_pose.x += delta_odom_pose.x;
    odom_pose.y += delta_odom_pose.y;
    odom_pose.theta += delta_odom_pose.theta;
    odom.pose.pose.position.x = odom_pose.x;
    odom.pose.pose.position.y = odom_pose.y;
    odom.pose.pose.position.z = h;
    odom.pose.pose.orientation.x = 0.0;
    odom.pose.pose.orientation.y = 0.0;
    odom.pose.pose.orientation.z = sin(0.5 * odom_pose.theta); 
    odom.pose.pose.orientation.w = cos(0.5 * odom_pose.theta);

  }

  void publish_odom()
  {
    odom.header.frame_id = "w_odom";
    odom.child_frame_id = simba_link;
    odom.header.stamp = cur_time;
    pub1.publish(odom);
  }

private:
  ros::NodeHandle n_; 
  ros::Publisher pub1;
  ros::Subscriber sub1, sub2;
  std::string simba_link;
  nav_msgs::Odometry odom;
  float Wheel_radius_r,Wheel_radius_l;
  float rear_axle;
  float av_l,av_r,h; //angular velocities
  ros::Duration elapsed_time;
  ros::Time cur_time;
  ros::Time prev_time;
  geometry_msgs::Pose2D delta_odom_pose;
  geometry_msgs::Pose2D odom_pose;
};

int main(int argc, char **argv)
{
  ros::init(argc, argv, "simba_wheel_odom");
  Wheelodom odomObject;
  //odomObject
//  odomObject.initialize();
//  odomObject.reset_pose ...
(more)
2018-07-30 07:08:14 -0500 received badge  Scholar (source)
2018-07-30 06:29:44 -0500 commented question ROS c++ Class Subscriber doesn't work while publishing in constructor

It's working !!

2018-07-30 06:25:16 -0500 commented question ROS c++ Class Subscriber doesn't work while publishing in constructor

Yeah your'e right . Thanks !

2018-07-30 06:10:46 -0500 commented question ROS c++ Class Subscriber doesn't work while publishing in constructor

Uncommenting those portions inside main also leads to the same problem i.e : subscriber callbacks don't work.

2018-07-30 06:03:36 -0500 edited question ROS c++ Class Subscriber doesn't work while publishing in constructor

ROS c++ Class Subscriber doesn't work while publishing in constructor Hi, The following code subscribes to topics conta

2018-07-30 05:58:50 -0500 asked a question ROS c++ Class Subscriber doesn't work while publishing in constructor

ROS c++ Class Subscriber doesn't work while publishing in constructor Hi, The following code subscribes to topics conta

2018-07-12 01:51:49 -0500 asked a question Compiling gmapping on Raspberry pi 3

Compiling gmapping on Raspberry pi 3 I followed this http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Kinetic%20on%20th

2018-07-12 01:36:59 -0500 commented answer How to add cv_bridge and image_transport package to compile in Raspberry Pi?

Hey luck on solving this error? I am trying to compile gmapping on Raspberry Pi and after installing a few dependencies

2018-06-02 07:20:16 -0500 asked a question Multiple TF issues while running SLAM

Multiple TF issues while running SLAM I am running ETH zurich's version of ORB SLAM on a bagfile of Kitti dataset of Ste

2018-05-27 12:39:28 -0500 received badge  Famous Question (source)
2018-04-09 04:18:07 -0500 commented answer robot_localization:fusion of IMU and visual inertial odometry(VIO)

It could happen that a component of gravity is being reflected on one of the x,y axis as drone could tilt translating in

2018-04-09 04:17:55 -0500 commented answer robot_localization:fusion of IMU and visual inertial odometry(VIO)

It could happen that a component of gravity is being reflected on one of the x,y axis as drone could tilt translating in