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

Yacoub's profile - activity

2017-02-15 22:21:18 -0500 received badge  Famous Question (source)
2016-05-16 03:37:25 -0500 received badge  Famous Question (source)
2016-02-22 18:22:13 -0500 received badge  Notable Question (source)
2016-02-14 01:19:00 -0500 received badge  Notable Question (source)
2016-02-10 12:34:36 -0500 commented answer Angular Velocity and accelerations

You mean that I need to do the following:

1- include URDF within the launch file 2- include the _Robot-state-publisher_ with the launch file as well 3- Write a tf broadcaster to estimate the angular speed

Is this right?

Thanks :)

2016-02-10 08:27:11 -0500 received badge  Popular Question (source)
2016-02-09 12:16:30 -0500 asked a question Angular Velocity and accelerations

Hi all,

I am trying to calculate the angular velocity and acceleration for 7DoF robot. Which does not support these measurements.

So I need to derive the joints variable online and publish the result as angular velocity.

Is there any package in ROS that can do this for me ?

Best Regards

Ali

2016-02-09 12:07:56 -0500 answered a question Callback function is not called
import graphlab
import rospy
from geometry_msgs.msg import WrenchStamped
import message_filters
from  sensor_msgs.msg import JointState
import sys
import roslibr code here
class Node:
     def __init__(self):
             self.fx_model = graphlab.load_model('src/ft_comp/scripts/models/Fx_model_joints_lr')
    self.fy_model = graphlab.load_model('src/ft_comp/scripts/models/Fy_model_joints_lr')
    self.fz_model = graphlab.load_model('src/ft_comp/scripts/models/Fz_model_joints_lr')
    self.Tx_model = graphlab.load_model('src/ft_comp/scripts/models/Tx_model_joints_lr')
    self.Ty_model = graphlab.load_model('src/ft_comp/scripts/models/Ty_model_joints_lr')
    self.Tz_model = graphlab.load_model('src/ft_comp/scripts/models/Tz_model_joints_lr')
    self.joint_sub = rospy.Subscriber('/joint_states_sync', JointState, self.callback, 10)

def callback(self,  joint_sub):
    print 'in callback function'
    #self.joints_array = []

def main(args):

   Nh = Node()
   rospy.init_node('Node', anonymous=True)

   try:

      rospy.spin()
  except KeyboardInterrupt:
    print "Shutting down syncronizer node"


 if __name__ == '__main__':
   main(sys.argv)
2016-02-09 11:59:53 -0500 received badge  Notable Question (source)
2016-02-09 11:59:53 -0500 received badge  Famous Question (source)
2015-12-21 11:19:34 -0500 received badge  Popular Question (source)
2015-12-17 02:04:19 -0500 received badge  Enthusiast
2015-12-16 04:11:01 -0500 answered a question Synchronizing 2 topics and adding a third topic

Hi Pnambiar I am trying to do something similar. but it seems that the callback function is not called. have you manage to sort it out? Regards Ali

2015-12-15 10:03:52 -0500 received badge  Editor (source)
2015-12-15 10:00:30 -0500 asked a question Callback function is not called

Hello, I am trying to subscribed with two different synchronized topics. So I've written a python program to do that. It compile without any errors. But the callback functions is not called.

Thanks Ali

#!/usr/bin/env python
import graphlab
import rospy
from geometry_msgs.msg import WrenchStamped
import message_filters
from  sensor_msgs.msg import JointState
class Node:
        def __init__(self):
             self.fx_model=graphlab.load_model('src/ft_comp/scripts/models/Fx_model_joints_lr')
             print 'models loading...'
             self.fy_model=graphlab.load_model('src/ft_comp/scripts/models/Fy_model_joints_lr')
             self.fz_model=graphlab.load_model('src/ft_comp/scripts/models/Fz_model_joints_lr')
             self.Tx_model=graphlab.load_model('src/ft_comp/scripts/models/Tx_model_joints_lr')
             self.Ty_model=graphlab.load_model('src/ft_comp/scripts/models/Ty_model_joints_lr')
             self.Tz_model=graphlab.load_model('src/ft_comp/scripts/models/Tz_model_joints_lr')
             self.Wrench_msg_sub=message_filters.Subscriber("ft_msgs_sync",WrenchStamped)
             self.Joint_msg_sub=message_filters.Subscriber("joint_states_sync", JointState)
             self.ts = message_filters.TimeSynchronizer([self.Wrench_msg_sub,self.Joint_msg_sub], 10)
             self.ts.registerCallback(self.callback)
             print 'models loading ...'

      def callback(self,ft_msgs_sync,joint_states_sync):
             print 'in callback function'
             Rostime=[]
             Rostime.append(ft_msgs_sync.rostime)
             force_array=[]
             for i in range(0,3):
             if i==0:
                force_array.append(ft_msgs_sync.wrench.force.x)
             if i==1:
                force_array.append(ft_msgs_sync.wrench.force.y)
             if i==2:
                force_array.append(ft_msgs_sync.wrench.force.z)

             joints_array=[]
             for i in range(0,2):
                 if i==0:
                     #joint_s
                     joints_array.append(joint_states_sync[0])
                 if i==1:
                     #joint_l
                     joints_array.append(joint_states_sync[1])
                 if i==2:
                     #joint_e
                     joints_array.append(joint_states_sync[2])
                     print 'hello'


 def listener():

   rospy.init_node('listener', anonymous=True)
   Nh=Node()
    rospy.spin()

 if __name__ == '__main__':
    listener()
2015-12-10 14:36:56 -0500 received badge  Scholar (source)
2015-12-10 04:35:21 -0500 commented question Synchronizing multiple topics and re-publish them

Thanks, perfectly working :)

2015-12-10 02:07:40 -0500 received badge  Popular Question (source)
2015-12-09 14:01:48 -0500 asked a question Synchronizing multiple topics and re-publish them

Hi, I am trying to synchronize robot joints and force/torque sensor message. So I've tried to use message_filters::sync_policies::ApproximateTime to do so, however, it does not seem to be working. I have no compile error but I can not see the new topics. The plan was to remap ft_message and joint_states once they are synchronized.

Could you please help me!!

Thanks Ali

#include <ros/ros.h>
#include <math.h>
#include<QDebug>
#include<QString>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <geometry_msgs/WrenchStamped.h>
#include <sensor_msgs/JointState.h>

using namespace sensor_msgs;
using namespace message_filters;
class Node{
     public:  
         Node():
                joints_sub_(nh_,"joint_states",100),
                ft_msgs_sub_(nh_,"ft_message",100),
                sync(MySyncPolicy(100), joints_sub_, ft_msgs_sub_){
                sync.registerCallback(boost::bind(&Node::callback, this,_1, _2));
           }


 void callback(const sensor_msgs::JointStateConstPtr& joint_s, const geometry_msgs::WrenchStampedConstPtr& ft_msgs)
    {
      double loop_rate_;
      nh_.param("loop_rate", loop_rate_, 650.0);
      ros::Rate loop_rate(loop_rate_);
      ros::Time::now();
      sensor_msgs::JointState joint_states_sync=*joint_s;
      geometry_msgs::WrenchStamped ft_msgs_sync=*ft_msgs;
      ros::Publisher joint_pub=nh_.advertise<sensor_msgs::JointState>("joint_states",100);
      ros::Publisher ft_msg_pub=nh_.advertise<geometry_msgs::WrenchStamped>("ft_msgs",100);
      joint_pub.publish(joint_states_sync);
      ft_msg_pub.publish(ft_msgs_sync);
    }
private:
ros::NodeHandle nh_;
typedef message_filters::Subscriber<sensor_msgs::JointState> joints_sub;
joints_sub joints_sub_;
typedef message_filters::Subscriber<geometry_msgs::WrenchStamped> ft_msg_sub;
ft_msg_sub ft_msgs_sub_;
typedef message_filters::sync_policies::ApproximateTime sensor_msgs::JointState,geometry_msgs::WrenchStamped> MySyncPolicy;
message_filters::Synchronizer< MySyncPolicy > sync;
};

int main(int argc, char **argv)
 {
  ros::init (argc, argv, "synchronizer");
   Node NH;
while (ros::ok())
{
    ros::spin();
}
ros::shutdown();
return 0;
}