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

charlie's profile - activity

2019-04-28 17:52:55 -0500 commented answer Navigation stack not publishing Obstacles & inflation obstacles details

I added the maps as described above and the topics - the /move_base/local_costmap/costmap does seem to infate the regio

2018-12-18 05:49:25 -0500 received badge  Famous Question (source)
2018-04-03 20:08:19 -0500 received badge  Famous Question (source)
2018-02-07 23:37:13 -0500 received badge  Notable Question (source)
2018-02-07 23:37:13 -0500 received badge  Popular Question (source)
2017-11-04 04:42:22 -0500 received badge  Student (source)
2017-08-03 09:19:02 -0500 received badge  Notable Question (source)
2017-07-28 13:57:49 -0500 received badge  Necromancer (source)
2017-07-28 13:57:49 -0500 received badge  Self-Learner (source)
2017-07-28 13:57:49 -0500 received badge  Teacher (source)
2017-02-22 16:11:47 -0500 received badge  Popular Question (source)
2017-02-19 21:47:01 -0500 received badge  Supporter (source)
2017-02-19 20:51:47 -0500 commented question missing odom to base tf link - dropped 100% odom messages

I used rqt_console and rqt_logger to review the DEBUG data and I found that every time it loops through this code I see "Publisher on '/tf' deregistering callbacks". I suspect I need to make /tf global outide the callback loop. I've tried a couple of options with no success. suggestions?

2017-02-06 08:02:24 -0500 answered a question Fake LaserScan on Arduino 2560 – The LaserScan data seems to transfer correctly, except the program hangs up after ~ 11-18 successful data transfers.

There are a lot of comments about the small amount of memory available in the arduino products. I still used the MEGA and decided to convert the Arduino program to a publisher that sends the laser data one measurement at a time via rosserial followed by an end of data code. Then when the end of data signal is reached the .cpp code on the PC converts all the previously recieved data to a proper Laser scan data format and publishes that data to the robot. I was able to get ~45 data points measured using a pulsed light sensor with a rotating motor and an encoder providing the angle information pushed up to the PC @ 57600 data rate. With this setup I get a scan about every 2 seconds. The scan rate is limited by the Arduino data transfer rate.

2017-01-31 20:23:27 -0500 asked a question missing odom to base tf link - dropped 100% odom messages

I have recorded a bag file using a physical robot with odometry and lidar info.

The robot uses arduino controllers to push data up to a PC using rosserial.

All seems to work correctly until I attempt to create a map with gmapping.

Once I have driven the robot around and saved a XXXXXXX.bag file

I start the core, then use "rosparam set use_sim_time true" , then "rosrun gmapping slam_gmapping", then "rosbag play --clock XXXXXXX.bag" ' I see MessageFilter [target=odom] dropped 100% of the messages so far........and mapsaver waits forever the map.......

rqt_bag shows tf and odom data, raw data shows data in both /odom and /tf, everything looks correct.

when I run rosrun tf_view_frames I only see base_link----> laser_frame and broadcaster /tf info.

However, I expeccted to see /odom---->base_link as well, but this is not the case.

I have included the PC code to convert the arduino serial data to odom/tf messaages.

does anyone has any suggestions ?

// ************************************************************ //
// *****                                                  ***** //
// *****  Arduino --> ROS                                 ***** //
// *****                                                  ***** //
// ***** This program process a minimal set of odometry   ***** //
// ***** data from the Arduino "Encoder_Data" topic       ***** //
// ***** and converts it into standard ROS                ***** //
// ***** nav_msgs/Odometry message format                 ***** //
// *****                                                  ***** //
// ***** Arduino program is MotCont_A_0p67                ***** //
// *****                                                  ***** //
// *****                                                  ***** //
//                                                              //
//                                                              //
// ************************************************************ //
// ***** Subscriber to Adruino topic Encoder_Data         ***** //
// ************************************************************ //
// ***** The subscribed data is                           ***** //
// ***** Vx                                               ***** //
// ***** Vy                                               ***** //
// ***** vTh                                              ***** //
// ***** x coordinate total distance                      ***** //
// ***** y coordinate total distance                      ***** //
// ***** theta total coordinate rotated                   ***** //
// ***** vxy linear velocity
// ***** 999                                              ***** //
// *****                                                  ***** //
// ************************************************************ //
// ***** Then publish to nav_msgs/Odometry message        ***** //
// ************************************************************ //
// ***** std_msgs/Header Message                          ***** //
// *****     uint32 seq                                   ***** //
// *****     time stamp                                   ***** //
// *****     string frame_id                              ***** //
// ************************************************************ //
// ***** geometry_msgs/PoseWithCovariance Message         ***** //
// *****     geometry_msgs/Pose pose                      ***** //
// *****     float64 covariance                           ***** //
// ***** geometry_msgs/TwistWithCovariance Message        ***** //
// *****     geometry_msgs/Twist twist                    ***** //
// *****     float64 covariance                           ***** //
// ************************************************************ //
//                                                              //

#include <ros/ros.h>
#include <std_msgs/Float32.h>
#include <geometry_msgs/Vector3.h>
#include <tf/transform_broadcaster.h>
#include <nav_msgs/Odometry.h>

// streamed arduino odometry data 

  int count = 0;
  double A_odom_data[10];

class ExampleCls
{
public:
    ExampleCls();
    void EncoderDataCallback(const std_msgs::Float32::ConstPtr& float_msg);

private:
    ros::NodeHandle nh_;
    ros::Subscriber Float32_sub_;
    ros::Publisher odom_pub;
};

ExampleCls::ExampleCls() 
{
    odom_pub = nh_.advertise<nav_msgs::Odometry>("odom",50);    
    Float32_sub_ = nh_.subscribe<std_msgs::Float32> ("Encoder_Data", 1000, &ExampleCls::EncoderDataCallback, this);
}

void ExampleCls::EncoderDataCallback(const std_msgs::Float32::ConstPtr& float_msg)
{

 //ROS_INFO("I heard:[%f]",float_msg->data);
 //ROS_INFO("count:[%i]",count);

     // Fill the array from the Arduino
     A_odom_data[count] = float_msg-> data;
     count = count + 1;

     //A_odom_data[0] = vx
     //A_odom_data[1] = vy
     //A_odom_data[2] = vth
     //A_odom_data[3] = Total X traveled
     //A_odom_data[4] = Total Y traveled
     //A_odom_data[5] = Total Th
     //A_odom_data[6] = vxy
     //A_odom_data[7] = 999

    if (float_msg-> data == 999)
      {
        //ROS_INFO("publish data");
        ros::Time current_time = ros::Time::now();
        tf::TransformBroadcaster odom_broadcaster;
        geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(A_odom_data[5]);  //Total Th


        // ***************************************
        // **** Publish the transfor over tf *****
        // ***************************************
    geometry_msgs::TransformStamped odom_trans;
    odom_trans.header.stamp = current_time;
    odom_trans.header.frame_id = "odom";
    odom_trans.child_frame_id = "base_link";

    odom_trans.transform.translation.x = A_odom_data[3];  // Linear X
    odom_trans.transform.translation.y = A_odom_data[4];  // Linear Y
    odom_trans.transform.translation.z = 0;
    odom_trans.transform.rotation = odom_quat;

        // Send the transform
    odom_broadcaster.sendTransform(odom_trans);

        // ******************************************
        // **** Publish odom messages over ROS ******
        // ******************************************
    nav_msgs::Odometry odom;
    odom.header.stamp = current_time;
    odom.header.frame_id = "odom";

        // **** Set the position ****
    odom.pose.pose.position.x = A_odom_data[3];  // Linear X
    odom.pose.pose.position.y = A_odom_data[4];  // Linear Y
    odom.pose.pose.position.z = 0.0 ...
(more)
2016-12-19 11:18:56 -0500 commented question Laser scan posting frequency

My setup is currently and differential base using a max speed 0.1 m/s, the laser scan rate is one scan every 4 seconds. - charlie

2016-12-18 20:34:36 -0500 asked a question Laser scan posting frequency

Is there a minimum frequency (i.e. samples per second or even seconds between samples) of laser scan data posts required to properly generate a ros bag file used to generate a successful map using gmapping?

2016-02-02 02:10:22 -0500 received badge  Notable Question (source)
2016-02-02 00:51:12 -0500 received badge  Popular Question (source)
2015-09-16 03:14:47 -0500 received badge  Famous Question (source)
2015-07-28 08:53:37 -0500 asked a question Arduino sensor data recombined and published on master computer

I having trouble publishing LaserScan data directly from an Arduinio Mega 2560, is there an example where data is published to the Master in a simpler format and then recombined on the master into the standard Laserscan message type and republished?

2015-07-26 20:42:35 -0500 commented answer Fake LaserScan on Arduino 2560 – The LaserScan data seems to transfer correctly, except the program hangs up after ~ 11-18 successful data transfers.

Thanks for the info I tried removing the delay and ran the launch file ( I had to change the port to ACM0) it ran for 5 cycles then stopped.

2015-07-26 20:32:33 -0500 received badge  Notable Question (source)
2015-07-22 22:30:48 -0500 received badge  Popular Question (source)
2015-07-21 17:59:35 -0500 commented answer Fake LaserScan on Arduino 2560 – The LaserScan data seems to transfer correctly, except the program hangs up after ~ 11-18 successful data transfers.

I changed the delay from 500 to 1, it made no difference.

2015-07-21 15:57:53 -0500 asked a question Fake LaserScan on Arduino 2560 – The LaserScan data seems to transfer correctly, except the program hangs up after ~ 11-18 successful data transfers.

Fake LaserScan on Arduino 2560 – The LaserScan data seems to transfer correctly, except the program hangs up after ~ 11-18 successful data transfers.

Any suggestions?

Last successful data transfer looks like this – The data package is small to keep it simple.

---
header: 
  seq: 11
  stamp: 
    secs: 1437511609
    nsecs: 32560897
  frame_id: laser_frame
angle_min: -1.57000005245
angle_max: 1.57000005245
angle_increment: 0.785000026226
time_increment: 10.0
scan_time: 4.0
range_min: 0.10000000149
range_max: 30.0
ranges: [0.0, 1.0, 2.0, 3.0, 4.0]
intensities: [0.0, 1.0, 4.0, 9.0, 16.0]
---

Here is the code

#include "math.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

// ROS includes
#include <ros.h>
#include <ros/time.h>
#include <sensor_msgs/LaserScan.h>

sensor_msgs::LaserScan CDLaser_msg;

//
float f_angle_min;
float f_angle_max;
float f_angle_increment;
float f_time_increment;
float f_scan_time;
float f_range_min;
float f_range_max;
float f_ranges[5]; // max of 30 measurements
float f_intensities[5];

int publisher_timer;

ros:: Publisher pub_Laser("LaserData", &CDLaser_msg);
ros::NodeHandle nh;

void setup() 
{
  nh.initNode();
  nh.advertise(pub_Laser);

  f_angle_min = -1.57;
  f_angle_max = 1.57;
  f_angle_increment = 0.785;  // 3.14/4   - 5 measurement points
  f_time_increment = 10;
  f_scan_time = 4;
  f_range_min = 0.1;
  f_range_max = 30;

  CDLaser_msg.ranges_length = 5;
  CDLaser_msg.intensities_length = 5;

  // create the test data
  for (int z = 0 ; z<5; z++)
  {
    f_ranges[z] = z;
    f_intensities[z] = z*z;
  }
}

void loop() 
{
  if (millis() > publisher_timer)
  {
    CDLaser_msg.header.stamp = nh.now();
    CDLaser_msg.header.frame_id = "laser_frame";
    CDLaser_msg.angle_min = f_angle_min;
    CDLaser_msg.angle_max = f_angle_max;
    CDLaser_msg.angle_increment = f_angle_increment;
    CDLaser_msg.time_increment = f_time_increment;
    CDLaser_msg.scan_time = f_scan_time;
    CDLaser_msg.range_min = f_range_min;
    CDLaser_msg.range_max = f_range_max;

    for (int z = 0 ; z<5; z++)
    {
      CDLaser_msg.ranges[z] = f_ranges[z];
    }

    for (int z = 0 ; z<5; z++)
    {
      CDLaser_msg.intensities[z] = f_intensities[z];
    }

    publisher_timer = millis() + 1000;
    pub_Laser.publish(&CDLaser_msg);
  }
  nh.spinOnce();
  delay(500);
}
2015-07-06 09:45:21 -0500 received badge  Enthusiast
2015-07-05 23:49:45 -0500 received badge  Famous Question (source)
2015-07-05 20:11:52 -0500 answered a question fake LaserScan on Arduino 2560 gives error Unable to sync with device possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

I have come to realize that rosserial cannot handle large amount of data. I have been able to resolve some of my issues. I think it would be useful to see the fake laser example complete for the arduino just as an example on how to serialize the data variables properly. Therefore, I have restricted the data size to five ranges and intensities and continues to see if I can make this work.

The Groovy/ Hydro issue is resolved

  • I can now see the individual variables transferred correctly

  • I still have problems with 1) The range and intensities arrays are not handled correctly 2) The program hangs up after ~ 18 data transfers (probably runs out of memory)

Suggestions - C

Terminal 1

cd@M755:~$ roscore ... logging to /home/cd/.ros/log/8b28ee40-218d-11e5-9c0a-48f8b391f66d/roslaunch-M755-2182.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://M755:54111/ ros_comm version 1.11.13

SUMMARY

PARAMETERS * /rosdistro: indigo * /rosversion: 1.11.13

NODES

auto-starting new master process[master]: started with pid [2238] ROS_MASTER_URI=http://M755:11311/

setting /run_id to 8b28ee40-218d-11e5-9c0a-48f8b391f66d process[rosout-1]: started with pid [2251] started core service [/rosout]

Terminal 2

cd@M755:~$ source /opt/ros/indigo/setup.bash cd@M755:~$ rosrun rosserial_python serial_node.py /dev/ttyACM0 [INFO] [WallTime: 1435932768.452098] ROS Serial Python Node [INFO] [WallTime: 1435932768.456914] Connecting to /dev/ttyACM0 at 57600 baud /opt/ros/indigo/lib/python2.7/dist-packages/rosserial_python/SerialClient.py:336: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Pu... for more information. self.pub_diagnostics = rospy.Publisher('/diagnostics', diagnostic_msgs.msg.DiagnosticArray) /opt/ros/indigo/lib/python2.7/dist-packages/rosserial_python/SerialClient.py:101: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Pu... for more information. self.publisher = rospy.Publisher(self.topic, self.message) [INFO] [WallTime: 1435932771.823503] Note: publish buffer size is 512 bytes [INFO] [WallTime: 1435932771.824101] Setup publisher on LaserData [sensor_msgs/LaserScan]

Terminal 3

cd@M755:~$ rostopic echo LaserData header: seq: 1 stamp: secs: 1435932785 nsecs: 11943992 frame_id: laser_frame angle_min: -1.57000005245 angle_max: 1.57000005245 angle_increment: 0.785000026226 time_increment: 10.0 scan_time: 4.0 range_min: 0.10000000149 range_max: 30.0 ranges: [0.0, 1.0, 4.0, 9.00011920928955, 1.5519318162641656e-36]

intensities: [0.0, 1.0, 4.0, 9.00011920928955, 1.5519318162641656e-36]

. . .


header: seq: 18 stamp: secs: 1435932802 nsecs: 189945055 frame_id: laser_frame angle_min: -1.57000005245 angle_max: 1.57000005245 angle_increment: 0.785000026226 time_increment: 10.0 scan_time: 4.0 range_min: 0.10000000149 range_max: 30.0 ranges: [0.0, 1.0, 4.0, 9.00011920928955, 1.5519318162641656e-36]

intensities: [0.0, 1.0, 4.0, 9.00011920928955, 1.5519318162641656e-36]

#include "math.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

// ROS includes
#include <ros.h>
#include <ros/time.h>
#include <sensor_msgs/LaserScan.h>

sensor_msgs::LaserScan CDLaser_msg;

//
float f_angle_min;
float f_angle_max;
float f_angle_increment;
float f_time_increment ...
(more)
2015-06-28 02:07:44 -0500 received badge  Notable Question (source)
2015-06-26 10:00:31 -0500 received badge  Popular Question (source)
2015-06-26 08:06:48 -0500 received badge  Editor (source)
2015-06-24 22:23:56 -0500 asked a question fake LaserScan on Arduino 2560 gives error Unable to sync with device possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

Hi,

I am having trouble making LaserScan run on Arduino. I have modified the c version of the fake laserscan code to run on an Arduino Mega 2560 using Indigo rosserial. I am receiving the error

Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino.

I have reinstalled the ros_lib and confirmed other tutorials such as TEMP102 work correctly so I know the basic functionality is OK.

This is my procedure

Terminal 1 -

roscore
  • The ros core starts and run w/o error

Terminal 2

source /opt/ros/indigo/setup.bash
rosrun rosserial_python serial_node.py/dev/ttyACM0

after a few second I see the error as described above.

Here is my Arduino code for the fake laser.

#include "math.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

// ROS includes
#include <ros.h>
#include <ros/time.h>
//#include<std_msgs/Float32.h>
#include <sensor_msgs/LaserScan.h>

sensor_msgs::LaserScan Laser_msg;
ros:: Publisher pub_Laser("LaserData", &Laser_msg);
ros::NodeHandle nh;

double ranges[100];
double Intensities[100];

void setup()
{
  nh.initNode();
  nh.advertise(pub_Laser);

  for (int z = 0 ; z<90; z++)
   {
      Laser_msg.ranges[z] = z/3;
      Laser_msg.intensities[z] = z/3;
   }
}

void loop()
{
   Laser_msg.header.stamp = nh.now();
 // Laser_msg.header.frame.id = "laser_frame";
  Laser_msg.angle_min = -1.57;  // start angle of the scan in Radians
  Laser_msg.angle_max = 1.57;  // stop angle of the scan in Radians
  Laser_msg.angle_increment = 0.34;   // angular distance between measurements in Radians 3.14/90
  Laser_msg.time_increment = 4; // seconds between measurements
  Laser_msg.range_min = 0.1;  // min dist in meters
  Laser_msg.range_max = 30;  // max dist in meters

  pub_Laser.publish(&Laser_msg);
  nh.spinOnce();
}

any help would be apprciated -C