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

AgentNoise's profile - activity

2022-07-05 10:07:42 -0500 received badge  Famous Question (source)
2022-07-05 10:07:42 -0500 received badge  Notable Question (source)
2021-04-21 11:20:15 -0500 received badge  Taxonomist
2017-11-06 01:43:27 -0500 received badge  Student (source)
2017-11-06 01:43:13 -0500 received badge  Self-Learner (source)
2017-11-06 01:43:13 -0500 received badge  Teacher (source)
2017-05-28 09:52:52 -0500 received badge  Famous Question (source)
2017-04-10 23:41:09 -0500 received badge  Famous Question (source)
2016-10-19 18:53:39 -0500 received badge  Notable Question (source)
2016-04-12 05:25:22 -0500 received badge  Famous Question (source)
2016-03-28 14:44:43 -0500 received badge  Notable Question (source)
2016-02-15 09:51:20 -0500 received badge  Popular Question (source)
2016-01-26 08:14:04 -0500 received badge  Popular Question (source)
2016-01-23 12:59:26 -0500 asked a question rosserial tf and publisher issues

When using rosserial tf and just a regular publisher I get the error: "Serial Port read returned short (expected 78 bytes, received 15 instead). [WARN] [WallTime: 1453575297.279503] Serial Port read failure"

If I remove the nh.advertise(pun_range) from the code below it works just fine. Is it not possible to use both at the same time? I would like to be able to publish data from the sensor on a tf topic and a different topic for a non tf node.

/* 
 * rosserial Time and TF Example
 * Publishes a transform at current time
 */

#include <ros.h>
#include <ros/time.h>
#include <tf/transform_broadcaster.h>
#include <sensor_msgs/Range.h>

ros::NodeHandle  nh;

sensor_msgs::Range range_msg;
geometry_msgs::TransformStamped t;
tf::TransformBroadcaster broadcaster;
ros::Publisher pub_range( "/ultrasound", &range_msg);

char base_link[] = "/base_link";
char odom[] = "/odom";

void setup()
{
  nh.initNode();
  nh.advertise(pub_range);
  broadcaster.init(nh);
}

void loop()
{  
  t.header.frame_id = odom;
  t.child_frame_id = base_link;
  t.transform.translation.x = 1.0; 
  t.transform.rotation.x = 0.0;
  t.transform.rotation.y = 0.0; 
  t.transform.rotation.z = 0.0; 
  t.transform.rotation.w = 1.0;  
  t.header.stamp = nh.now();
  broadcaster.sendTransform(t);
  nh.spinOnce();
  delay(10);
}
2016-01-17 22:12:26 -0500 commented answer Rosserial checksum error

That seems to be close to the trick. I set it to do the range_msg first, then do the transform. I also it on a timer so there is a 50 or 250ms break between range_msg and the transform. That kind of works but after a minute or so it looses connection, reconnects and gets the error Creation of

2016-01-17 21:03:53 -0500 answered a question Rosserial checksum error

Well I figured out the checksum part of the issue. I was using frameid for both my tf broadcaster and the range_msg frame header id's. When I changed frameid to odom for the broadcaster it cleared it up.

I am still getting the "Serial Port read returned short" error

Edit: It appears the new ping library is what is causing the issue. If I use the function from the example it works just fine

2016-01-17 19:06:47 -0500 asked a question Rosserial checksum error

When running "rosrun rosserial_python serial_node.py /dev/ttyACM0" I get the error message "wrong checksum for topic id and msg". After that it may continue to connect but the error "Serial Port read returned short (expected 78 bytes, received 5 instead)." comes up, or it may just not connect and keep trying. Whats weirder is if I restart the PC and run the code it works fine, I can launch RVIZ, with "roslaunch robot_description robot_description.py" and it will show me the range sensor and move about as i move my hand to and from the sensor. The next time I run it I get the above errors.

The code I am using is below. pretty basic for the tf stuff, really just copied the arduino copy as a test

//////////////////LIBRARIES///////////////////
#include <NewPing.h>
#include <ros.h>
#include <ros/time.h>
#include <sensor_msgs/Range.h>
#include <tf/transform_broadcaster.h>
//////////////////LIBRARIES///////////////////

//////////////////ROS Vars and OBJECTS///////////////////
ros::NodeHandle  nh;
sensor_msgs::Range range_msg;
ros::Publisher pub_range( "/ultrasound", &range_msg);
geometry_msgs::TransformStamped t;
tf::TransformBroadcaster sonar_broadcaster;

char base_link[] = "/base_link";  //set the TF child frame 
char odom[] = "/odom";
char frameid[] = "/ultrasound";
//////////////////ROS Vars and OBJECTS///////////////////


//////////////////SONAR Vars and OBJECT///////////////////
int sonar_pin =12;
NewPing sensor(sonar_pin, sonar_pin, 25);
//////////////////SONAR Vars and OBJECT///////////////////


void setup()
{
  nh.initNode();
  nh.advertise(pub_range);
  sonar_broadcaster.init(nh);


  t.header.frame_id =  frameid;
  t.child_frame_id = base_link;

  range_msg.radiation_type = sensor_msgs::Range::ULTRASOUND; //set the message type and the sensor radiation type
  range_msg.header.frame_id = frameid;
  range_msg.field_of_view = (10.0/180.0) * 3.14;
  range_msg.min_range = 0.0;
  range_msg.max_range = 10;


  digitalWrite(sonar_pin, HIGH); //turn internal pull-up resistor on
}

long range_time;

void loop()
{

  //publish the adc value every 50 milliseconds
  //since it takes that long for the sensor to stablize
  if ( millis() >= range_time )
  {

    t.header.frame_id = frameid;
    t.child_frame_id = base_link;
    t.transform.translation.x = 1.0; 
    t.transform.rotation.x = 0.0;
    t.transform.rotation.y = 0.0; 
    t.transform.rotation.z = 0.0; 
    t.transform.rotation.w = 1.0;  
    t.header.stamp = nh.now();
    sonar_broadcaster.sendTransform(t); 
    range_msg.range = sensor.ping_in();
    range_msg.header.stamp = nh.now();
    pub_range.publish(&range_msg);
    range_time =  millis() + 28;
  }

  nh.spinOnce();
}
2016-01-14 21:01:16 -0500 received badge  Enthusiast
2016-01-08 10:15:37 -0500 received badge  Popular Question (source)
2016-01-07 21:51:52 -0500 answered a question Python not finding interperter

Oh, that was so obvious. Need to pay more attention. Thank you.

2016-01-07 21:51:12 -0500 received badge  Supporter (source)
2016-01-07 21:51:10 -0500 received badge  Scholar (source)
2016-01-07 20:57:25 -0500 asked a question Python not finding interperter

I created a very simply hello world node in python. Though I can not get rosrun to execute because the python script will not find the interpreter. When I run whereis python the first path I get it /user/bin/python3.4m. There are several more bin paths listed and I have tried them all. Not sure why it wont find it. See the whereis and code below

Code

    ! /user/bin/python3.4m
import rospy
from std_msgs.msg import String

def talker():
pub = rospy.Publisher('hello_pub',String,queue_size=10)
rospy.init_node('hello_world_publisher',anonymous=True)
r = rospy.Rate(10) #10hz

while not rospy.is_shutdown():
str = "hello world %S"%rospy.get_time()
rospy.login(str)
pub.publish(str)
r.sleep()

if__name__=='__main__':
try:
talker()
except rospy.ROSInterruptException:pass

whereis

! /user/bin/python3.4m
import rospy
from std_msgs.msg import String

def talker():
pub = rospy.Publisher('hello_pub',String,queue_size=10)
rospy.init_node('hello_world_publisher',anonymous=True)
r = rospy.Rate(10) #10hz

while not rospy.is_shutdown():
str = "hello world %S"%rospy.get_time()
rospy.login(str)
pub.publish(str)
r.sleep()

if__name__=='__main__':
try:
talker()
except rospy.ROSInterruptException:pass
2015-12-23 00:40:48 -0500 received badge  Notable Question (source)
2015-12-22 08:09:27 -0500 commented answer enviroment variable not updating with source

I removed the full jade_workspace directory and tried to use the rsws init command again and it does not create the devel directory. I will just use the catkin method after I get off work

2015-12-22 07:52:16 -0500 commented answer enviroment variable not updating with source

Looks like I did not create the workspace properly, there is no devel directory. I will start fresh and try again. I am not using the TK1 platform, I do have an Nvidia GPU in my machine.

2015-12-22 07:51:07 -0500 commented answer enviroment variable not updating with source

Ok It looks like there is not a devel directory in my jade_workspace, so I setup my workspace incorrectly. I Will start fresh and try again. Is it better to use the ROS workspace/package setup or the catkin?

2015-12-22 01:56:27 -0500 received badge  Popular Question (source)
2015-12-21 23:44:17 -0500 asked a question enviroment variable not updating with source

I'm running Jade on a Ubuntu 14.04 machine. I used ' rosws init ~/jade_workspace /opt/ros/jade' to create the workspace and then used source ' ~/jade_workspace/setup.bash ' to set the environment var but running echo $ROS_PACKAGE_PATH does not list that as a source. Though roscd takes me right to it. See screenshot of shell to see

https://www.dropbox.com/s/q957mhvzd0d...