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

Reza1984's profile - activity

2019-10-24 05:45:26 -0500 received badge  Popular Question (source)
2019-10-24 05:45:26 -0500 received badge  Notable Question (source)
2019-10-24 05:45:26 -0500 received badge  Famous Question (source)
2019-03-22 03:11:47 -0500 received badge  Notable Question (source)
2019-03-22 03:11:47 -0500 received badge  Famous Question (source)
2018-02-21 06:35:04 -0500 received badge  Famous Question (source)
2017-04-20 14:55:49 -0500 received badge  Famous Question (source)
2017-04-20 13:43:22 -0500 marked best answer roscd: command not found

Hi

I faced this error: "roscd: command not found" same as rosnode except for roscore.

I have already setup my .bashrc by "source /opt/ros/jade/setup.bash"

Thanks

2016-11-07 17:04:01 -0500 received badge  Famous Question (source)
2016-10-20 08:56:36 -0500 received badge  Notable Question (source)
2016-08-17 09:15:13 -0500 received badge  Famous Question (source)
2016-06-02 06:29:43 -0500 asked a question pcl::KdTreeFLANN<pcl::PointXYZ> gives memory corruption!

When I add the following line into my code, I get memory corruption error:

pcl::KdTreeFLANN<pcl::pointxyz> kdtree;

In fact i'm subscribing to "/rtabmap/cloud_map" (using turtlebot RTAB-map) and do some processes. All the processes works well except when I add that line of KdTreeFLANN the program crashes.

I appreciate if anyone helps me. Thanks.

2016-06-02 06:19:23 -0500 received badge  Famous Question (source)
2016-06-02 06:18:13 -0500 received badge  Popular Question (source)
2016-05-18 21:24:41 -0500 received badge  Notable Question (source)
2016-05-09 20:54:32 -0500 marked best answer Turtlesim pose

I'm using the following code to generate a time-dependent velocity command for the turtle

%%%%%%%%%%%%%%%%%%%

int main(int argc, char**argv) {

ros::init(argc, argv, "pub_one");

ros::NodeHandle n;

ros::Publisher pub = n.advertise<turtlesim::velocity>("/turtle1/command_velocity", 1000); srand(time(0)); double secs1 =ros::Time::now().toSec();

while(pub.getNumSubscribers() == 0) ros::Duration(0.1).sleep();

ros::Rate r(1);

while(true) {

turtlesim::Velocity msg;

double secs2 =ros::Time::now().toSec();

double secs3=secs2-secs1;

msg.linear=.2*secs3;

msg.angular=.2*secs3;

pub.publish(msg);

ROS_INFO("Sending random velocity command: linear=%f angular=%f time=%f", msg.linear, msg.angular,secs3);

ros::spinOnce();

r.sleep(); } }

%%%%%%%%%%%%%%%%

I don't know how I can change the code to get the position of the turtle at each time?

In fact, I wanna make a feedback control by using the position of the turtle and a desired position.

I really appreciate if you help me in this case!

2016-04-28 20:40:10 -0500 asked a question V-REP crashes!

Hi there

When I load and run the youbot model in V-REP it crashes. Here is the error

Initialization successful.

publisher callback

arg 0: arm_controller

publisher callback

arg 0: gripper_controller

publisher callback

arg 0: /cmd_vel

init

publisher callback

arg 0: /clock

publisher callback

arg 0: /kinect

arg 4: /kinect_depthSensor

publisher callback

arg 0: /scan_front

arg 2: scan_front_scan

arg 4: /base_laser_front_link

[FATAL] [1461892299.029723739]: ASSERTION FAILED

    file = /opt/ros/indigo/include/ros/publisher.h

    line = 102

    cond = false

    message = 

[FATAL] [1461892299.029925493]: Call to publish() on an invalid Publisher

[FATAL] [1461892299.029972311]: 

Trace/breakpoint trap (core dumped)

I will be thankful if you can help me. Thanks.

2016-03-15 21:29:19 -0500 commented answer Unmet dependencies while installing ROS Jade on Ubuntu 14.04.2

Check the following link:

http://wiki.ros.org/jade/Migration

2016-03-15 04:35:01 -0500 answered a question Unmet dependencies while installing ROS Jade on Ubuntu 14.04.2

Apparently, ROS Jade has some issues with Ubuntu 14.04 as I faced too.
In the installation tutorial (section 1.4 in the box) there is a solution for it. However, it didn't work for me! and I couldn't find any solution for that dependency issue. I ended up using indigo and it works like charm!

2016-03-15 03:16:57 -0500 commented question Problem of using Turtlebot to process image.

I haven't worked with opencv but I used ROS-PCL. There I get the point cloud using ROS messages then convert it to PCL data and process the data then covert it back to ROS message. I think for opencv also should work the same. btw you define a ros node and you never used it, is it correct way?

2016-03-15 02:23:36 -0500 commented answer Ros-Arduino subscriber

Thanks, the main issue was the Arduino couldn't read large messages with high publishing rate. Instead of sending sensor_msgs::LaserScan I sent std_msgs::Float32 message with low publish rate and could see the messages in Arduino Uno.

2016-03-14 11:13:54 -0500 received badge  Notable Question (source)
2016-03-14 09:32:42 -0500 received badge  Popular Question (source)
2016-03-14 01:40:59 -0500 received badge  Famous Question (source)
2016-03-13 22:47:20 -0500 edited question How to read LaserScan by Arduino?

Hi

I'm using Xtion sensor to get LaserScan data using the following commands:

$ roslaunch turtlebot_bringup minimal.launch
$ roslaunch rtabmap_ros demo_turtlebot_mapping.launch rgbd_odometry:=true
$ roslaunch rtabmap_ros demo_turtlebot_rviz.launch

I can read /scan which is type "sensor_msgs/LaserScan".

I want to use this data in Aurdoino board.

I think, I have to use the following headers in Arduino code :

#include <ros/ros.h>
#include <sensor_msgs/LaserScan.h>

and the following codes:

$ ros::NodeHandle nh;
$ ros::Subscriber sub = nh.subscribe<sensor_msgs::LaserScan>("scan", 1000, scanCallback);

Now how I can access to scan array?

I appreciate if you help me.

EDIT:

I could finally find the issue. My Arduino board cannot read large data with high rate of publishing. So I just publish a std_msgs::Float32 message with low publish rate.

2016-03-13 22:02:28 -0500 answered a question Subscribe and Publish a arbitrary topic!

Thanks I solved my problem. Here is the code:

#include <ros/ros.h>
#include <iostream>
#include <sensor_msgs/LaserScan.h>
#include <std_msgs/Float32.h>

std_msgs::Float32 mindist;

void Callback_laser(const sensor_msgs::LaserScan::ConstPtr& scan)
{

float minval = scan->ranges[0];
    for(int i=0;i<scan->ranges.size();i++)
    {
        if(scan->ranges[i]<minval or minval!=minval)
           minval=scan->ranges[i];
    }

       ROS_INFO("min_range[%f] \n",minval);

       mindist.data=minval;

}



int main(int argc, char** argv)
{
    ros::init(argc, argv, "subscribing"); 

    ros::NodeHandle n;

    ros::Subscriber laser_subscriber = n.subscribe<sensor_msgs::LaserScan>("scan", 1000, Callback_laser);

    ros::Publisher pub=n.advertise<std_msgs::Float32>("mindist", 1000);

    ros::Rate loop_rate(10);

      while (ros::ok())
      {

         pub.publish(mindist);
         ros::spinOnce();
         loop_rate.sleep();
      }

     return 0; 

}
2016-03-13 21:22:50 -0500 asked a question Subscribe and Publish a arbitrary topic!

Hi

I would like to subscribe to the Laserscan data and process it and publish something. Unfortunately, I keep getting error. I appreciate if you help. here is my code:

#include <ros/ros.h>
#include <iostream>
#include <sensor_msgs/LaserScan.h>
#include <std_msgs/Float32.h>

std_msgs::Float32 minval;

void Callback_laser(const sensor_msgs::LaserScan::ConstPtr& scan)
{

minval = scan->ranges[0];
    for(int i=0;i<scan->ranges.size();i++)
    {
        if(scan->ranges[i]<minval or minval!=minval)
           minval=scan->ranges[i];
    }

}


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

    ros::Subscriber laser_subscriber = n.subscribe<sensor_msgs::LaserScan>("scan", 1000, Callback_laser);

    ros::Publisher pub=n.advertise<std_msgs::Float32>("minval", 1000);

    ros::Rate loop_rate(10);

      while (ros::ok())
      {
         pub.publish(minval);
         ros::spinOnce();
         loop_rate.sleep();
      }


     return 0; 
}

Thanks in advance for your help.

2016-03-13 20:37:11 -0500 commented answer How to read LaserScan by Arduino?

I should note that, I add a command in callback function to on the LED but it doesn't on it.

2016-03-13 20:37:08 -0500 commented answer How to read LaserScan by Arduino?

I should note that, I add a command in callback function to on the LED but it doesn't on it.

2016-03-13 20:36:12 -0500 commented answer How to read LaserScan by Arduino?

Thank you for your reply! I tried different baud rates but nothing changed! I think the issue is the Laserscan data is too large and it cannot call the callback function! (just a guess)

2016-03-13 20:35:18 -0500 commented answer How to read LaserScan by Arduino?

Thank you for your reply! My issue is not that as I also used only one serial connection! I think the issue is the Laserscan data is too large and it cannot call the callback function! (just a guess)

2016-03-11 01:08:36 -0500 received badge  Notable Question (source)
2016-03-10 22:14:20 -0500 answered a question How to read LaserScan by Arduino?

I would like to summarize all the issues I faced and how I solved it:

First issue: The following error in uploading the program:

avrdude: ser_recv(): programmer is not responding avrdude: stk500_recv(): programmer is not responding

There were some solution using reset bottom but it didn't work for me. I finally found out I should use "sudo arduino" to lunch the arduino and after that I can easily upload.

Second issue: using "sudo arduino" gave me this error:

fatal error: ros.h: No such file or directory compilation terminated.

Unfortunately methods in internet didn't help me. I just tried to copy ros-lib form sketchbook to "/usr/share/arduino/libraries" and Hallelujah the error was gone! :)

Finally the main part of my code is as follows:

#include <ros.h>
#include <sensor_msgs/LaserScan.h>

void Callback_laser(const sensor_msgs::LaserScan& scan)
{
double minval = scan.ranges[0];

    for(int i=0;i<500;i++)
    {
       if(scan.ranges[i]<minval or minval!=minval)
           minval=scan.ranges[i];
    } 
   Serial.println(minval);
}

ros::NodeHandle nh;
ros::Subscriber<sensor_msgs::LaserScan> laser_subscriber("scan", &Callback_laser);

void setup() {

  nh.initNode();
  nh.subscribe(laser_subscriber);

}

void loop() {

 nh.spinOnce();
 delay(100); 

}

I thought, it works fine but apparently it doesn't! When I put a command in callback function to on the LED it doesn't on the LED. I think the reason is the laserscan data is too large! (Not Sure Though)

Even when I run "Hello World" program in ros-arduino tutorial, hello world with those strange characters are printed!

In the following attached picture you can see the results. right terminal I run "rostopic echo /scan"; left terminal I run "rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0", and top is Serial monitor.

image description

2016-03-10 21:12:10 -0500 commented answer How to read LaserScan by Arduino?

Sorry I face other issues in working with arduino, after I solve I will reply your comment. Thanks

2016-03-10 11:19:58 -0500 received badge  Popular Question (source)
2016-03-10 02:23:30 -0500 commented answer Ros-Arduino subscriber

I put that command in callback the LED was just off but when put in void loop() it start blinking. Seems the callback function is not executed.

2016-03-10 02:12:26 -0500 commented question Ros-Arduino subscriber

When I put Serial.print("Hello = :"); inside void loop() I can see the message, but I cannot see any message when it's inside callback

2016-03-10 02:09:53 -0500 commented answer Ros-Arduino subscriber

Thanks, I forgot to add it here. I edited my question.

2016-03-10 02:04:16 -0500 received badge  Student (source)
2016-03-10 01:58:28 -0500 asked a question Ros-Arduino subscriber

Hi

I would like to send a message to arduino serial monitor, here is my code

#include <ros.h>
#include <sensor_msgs/LaserScan.h>

void Callback_laser(const sensor_msgs::LaserScan& scan)
{
   Serial.print("Hello = :");
   Serial.println(scan.ranges[0]);
}

   ros::NodeHandle nh;
   ros::Subscriber<sensor_msgs::LaserScan> laser_subscriber("scan", &Callback_laser);

void setup() {

  nh.initNode();
  nh.subscribe(laser_subscriber);

 Serial.begin(9600);

}

void loop() {

  nh.spinOnce();
  delay(10);
}

but nothing will appear in serial monitor!

Could you please tell me what is the problem with my code?

Thanks in advance for your help.