Ask Your Question

dan's profile - activity

2019-10-15 02:15:11 -0500 marked best answer rosserial deserialization error

I am trying to publish an odometry message from an arduino using rosserial. I have it publishing a tf message fine. But the odom message first required increasing the buffer_size and now gives this error:

[INFO] [WallTime: 1376950638.665497] ROS Serial Python Node
[INFO] [WallTime: 1376950638.671086] Connecting to /dev/ttyACM0 at 57600 baud
[INFO] [WallTime: 1376950641.232339] Note: publish buffer size is 1024 bytes
[INFO] [WallTime: 1376950641.232938] Setup publisher on tf [tf/tfMessage]
[INFO] [WallTime: 1376950641.242256] Setup publisher on odom [nav_msgs/Odometry]
Traceback (most recent call last):
  File ".../catkin_ws/src/rosserial/rosserial_python/nodes/serial_node.py", line 82, in <module>
    client.run()
  File ".../catkin_ws/install/lib/python2.7/dist-packages/rosserial_python/SerialClient.py", line 425, in run
    self.callbacks[topic_id](msg)
  File ".../catkin_ws/install/lib/python2.7/dist-packages/rosserial_python/SerialClient.py", line 99, in handlePacket
    m.deserialize(data)
  File "/opt/ros/groovy/lib/python2.7/dist-packages/nav_msgs/msg/_Odometry.py", line 220, in deserialize
    raise genpy.DeserializationError(e) #most likely buffer underfill
genpy.message.DeserializationError: unpack requires a string argument of length 288

Sometimes, about one in three, there is also this error right after the INFO messages shown above. I suspect it is just some sort of lost sync, since I just installed the latest version of rosserial on a new build of Groovy.

[ERROR] [WallTime: 1376951210.467803] Mismatched protocol version in packet: lost sync or rosserial_python is from different ros release than the rosserial client
[INFO] [WallTime: 1376951210.468270] Protocol version of client is Rev 0 (rosserial 0.4 and earlier), expected Rev 1 (rosserial 0.5+)

Here is the code:

/* 
 * rosserial Planar Odometry Example
 */

#include <ros.h>
#include <ros/time.h>
#include <tf/tf.h>
#include <tf/transform_broadcaster.h>
#include <nav_msgs/Odometry.h>

ros::NodeHandle  nh;

geometry_msgs::TransformStamped t;
tf::TransformBroadcaster broadcaster;
nav_msgs::Odometry myOdom;
ros::Publisher odom_pub("odom", &myOdom);

double x = 1.0;
double y = 0.0;
double theta = 1.57;

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

void setup()
{
  nh.initNode();
  broadcaster.init(nh);
  nh.advertise(odom_pub);
  myOdom.pose.covariance = {0.001, 0, 0, 0, 0, 0, // covariance on x
                        0, 0.001, 0, 0, 0, 0,  // covariance on y
                        0, 0, 0.001, 0, 0, 0,  // covariance on z
                        0, 0, 0, 99999, 0, 0,  // large covariance on rot x
                        0, 0, 0, 0, 99999, 0,  // large covariance on rot y
                        0, 0, 0, 0, 0, 0.001};  //covariance on rot z

}

void loop()
{  
  // drive in a circle
  double vx = 0.2, vy = 0.2;
  double vtheta = 0.18;
  x += cos(theta)*vx*0.1;
  y += sin(theta)*vy*0.1;
  theta += vtheta*0.1;
  if(theta > 3.14)
    theta=-3.14;

  /* 
  Serial.print("x , y, theta = ");
  Serial.print(x);
  Serial.print(", ");
  Serial.print(y);
  Serial.print(", ");
  Serial.println(theta);
  */

  // tf odom->base_link
  t.header.frame_id = odom;
  t.child_frame_id = base_link;

  t.transform.translation.x = x;
  t.transform.translation.y = y;

  t.transform.rotation = tf::createQuaternionFromYaw(theta);
  t.header.stamp = nh.now();

  broadcaster.sendTransform(t);
  nh.spinOnce();

  myOdom.header.stamp = nh.now();
  myOdom.header.frame_id ...
(more)
2019-10-04 10:03:37 -0500 received badge  Famous Question (source)
2019-09-24 04:24:23 -0500 received badge  Popular Question (source)
2019-05-20 01:17:18 -0500 received badge  Necromancer (source)
2019-05-06 20:48:14 -0500 received badge  Notable Question (source)
2019-03-19 20:51:51 -0500 commented question using two arms with moveit, unable to get joints for both

Sure, that makes sense, but it does not address this particular problem. With two move groups, this is more like two id

2019-03-19 05:07:40 -0500 received badge  Popular Question (source)
2019-03-18 09:13:51 -0500 commented question using two arms with moveit, unable to get joints for both

Yes, one in each namespace. Is that not correct?

2019-03-18 09:13:14 -0500 commented question using two arms with moveit, unable to get joints for both

Yes, one in each namespace.

2019-03-17 23:51:52 -0500 edited question using two arms with moveit, unable to get joints for both

using two arms with moveit, unable to get joints for both I am setting up a robot that has two arms, setup in different

2019-03-17 20:30:56 -0500 asked a question using two arms with moveit, unable to get joints for both

using two arms with moveit, unable to get joints for both I am setting up a robot that has two arms, setup in different

2019-01-13 11:28:39 -0500 received badge  Notable Question (source)
2019-01-13 11:28:39 -0500 received badge  Famous Question (source)
2019-01-11 12:50:16 -0500 marked best answer are the turtlebot covariance matrices right?

I am settting up covariance matrices and don't understand some of the entries used for turtlebot. from: /opt/ros/groovy/stacks/turtlebot_create/create_node/src/create_node/covariances.py

first, we have :

> ODOM_POSE_COVARIANCE = [1e-3, 0, 0, 0, 0, 0, 
>                         0, 1e-3, 0, 0, 0, 0,
>                         0, 0, 1e6, 0, 0, 0,
>                         0, 0, 0, 1e6, 0, 0,
>                         0, 0, 0, 0, 1e6, 0,
>                         0, 0, 0, 0, 0, 1e3]

Why is the covariance on z axis (last row) rotation = 1e3? This is large considering the gyro accuracy. Seems like it should be more like 1e-3.

next, we have the covariance used when the robot is stopped, so we know some parameters much more accurately:

ODOM_POSE_COVARIANCE2 = [1e-9, 0, 0, 0, 0, 0, 
                         0, 1e-3, 1e-9, 0, 0, 0,
                         0, 0, 1e6, 0, 0, 0,
                         0, 0, 0, 1e6, 0, 0,
                         0, 0, 0, 0, 1e6, 0,
                         0, 0, 0, 0, 0, 1e-9]

I don't understand the entries here for covariance y (second row). Seems like the diagonal entry should be the same as x (1e-9 instead of 1e-3) and I don't understand why there is an off-diagonal nonzero (but close, at 1e-9) entry for y-z. Are those axes coupled somehow?

Next, we have the twist ones:

ODOM_TWIST_COVARIANCE = [1e-3, 0, 0, 0, 0, 0, 
                         0, 1e-3, 0, 0, 0, 0,
                         0, 0, 1e6, 0, 0, 0,
                         0, 0, 0, 1e6, 0, 0,
                         0, 0, 0, 0, 1e6, 0,
                         0, 0, 0, 0, 0, 1e3]

Since odom twist is reported in the child (robot, typically base_footprint) frame, for a turtlebot, there is no y or z velocity, only x. So why does the y velocity covariance (second row) = 1e-3 instead of 1e6? And again, why is the z rotation (last row) covariance (1e3) so large?

Finally, for twist when stopped:

ODOM_TWIST_COVARIANCE2 = [1e-9, 0, 0, 0, 0, 0, 
                          0, 1e-3, 1e-9, 0, 0, 0,
                          0, 0, 1e6, 0, 0, 0,
                          0, 0, 0, 1e6, 0, 0,
                          0, 0, 0, 0, 1e6, 0,
                          0, 0, 0, 0, 0, 1e-9]

Again, I don't understand why the y twist covariance (2nd row) is 1e-3 instead of 1e6 and also why there is an off-diagonal entry (1e-9) y-z coupling instead of just 0 there.

2018-11-07 04:45:26 -0500 received badge  Famous Question (source)
2018-10-19 05:46:01 -0500 marked best answer how to remove forward bias in move_base

I have a robot that senses and moves in reverse just as well as in forward. However, move_base trajectories are highly biased toward turning the robot around and moving forward. I tried setting prefer_forward_cost_function to 0.0 and also tied turning on and off DWA, but these have no apparent effect.

Is there some way to remove the forward bias in move_base?

Revised:

I tried the excellent suggestion of making min_vel_x negative and initially thought it worked, but in fact, it does not.

The output from move_base still does not generate negative x velocities. When given a goal to the rear, with a blank map, it turns 180 degrees and goes there. If I set max_vel_x = 0.0, then it just turns in place. Here is base_local_planner_params.yaml

Second revise: I swapped from TrajectoryPlanner to DWAPlanner (param file and move_base output shown below) but it does not seem to make any difference.

Third revise: I was entering DWAPlanner parameters, but did not select DWAPlanner as the local planner, so it was defaulting to TrajectoryPlanner. Adding this line to the parameter list fixed that and the bot now goes backwards.

base_local_planner: "DWAPlannerROS"

Many thanks to David Lu for his help with this.

controller_frequency: 4.0
recovery_behavior_enabled: true
clearing_rotation_allowed: false

DWAPlannerROS:
   max_vel_x: 0.3
   min_vel_x: -0.5
   max_rotational_vel: 0.5
   min_vel_theta: -0.5
   min_in_place_vel_theta: 0.2
   escape_vel: -0.1
   acc_lim_x: 2.3
   acc_lim_y: 2.3
   acc_lim_theta: 1.5

   holonomic_robot: false
   yaw_goal_tolerance: 0.1 # about 6 degrees
   xy_goal_tolerance: 0.2  # 20 cm
   latch_xy_goal_tolerance: false
   pdist_scale: 0.8
   gdist_scale: 0.6
   meter_scoring: true
   prefer_forward_cost_function: 0.0

   heading_lookahead: 1.0
   heading_scoring: false
   heading_scoring_timestep: 0.8
   occdist_scale: 0.1
   oscillation_reset_dist: 0.05
   publish_cost_grid_pc: false
   prune_plan: true

   sim_time: 1.5
   sim_granularity: 0.025
   angular_sim_granularity: 0.025
   vx_samples: 8
   vtheta_samples: 20
   dwa: true
   simple_attractor: false

Just in case it is useful, here is the output from move_base startup. Note that it is using rangefinders as sources and I thought maybe the rear sensors were creating an obstacle, but the behavior is unchanged with the hokuyo sensors removed.

SUMMARY
========

PARAMETERS
 * /map_server/frame_id: map
 * /move_base/DWAPlannerROS/acc_lim_theta: 1.5
 * /move_base/DWAPlannerROS/acc_lim_x: 2.3
 * /move_base/DWAPlannerROS/acc_lim_y: 2.3
 * /move_base/DWAPlannerROS/angular_sim_granularity: 0.025
 * /move_base/DWAPlannerROS/dwa: True
 * /move_base/DWAPlannerROS/escape_vel: -0.1
 * /move_base/DWAPlannerROS/gdist_scale: 0.6
 * /move_base/DWAPlannerROS/heading_lookahead: 1.0
 * /move_base/DWAPlannerROS/heading_scoring: False
 * /move_base/DWAPlannerROS/heading_scoring_timestep: 0.8
 * /move_base/DWAPlannerROS/holonomic_robot: False
 * /move_base/DWAPlannerROS/latch_xy_goal_tolerance: False
 * /move_base/DWAPlannerROS/max_rotational_vel: 0.5
 * /move_base/DWAPlannerROS/max_vel_x: 0.3
 * /move_base/DWAPlannerROS/meter_scoring: True
 * /move_base/DWAPlannerROS/min_in_place_vel_theta: 0.2
 * /move_base/DWAPlannerROS/min_vel_theta: -0.5
 * /move_base/DWAPlannerROS/min_vel_x: -0.5
 * /move_base/DWAPlannerROS/occdist_scale: 0.1
 * /move_base/DWAPlannerROS/oscillation_reset_dist: 0.05
 * /move_base/DWAPlannerROS/pdist_scale: 0.8
 * /move_base/DWAPlannerROS/prefer_forward_cost_function: 0.0
 * /move_base/DWAPlannerROS/prune_plan: True
 * /move_base/DWAPlannerROS/publish_cost_grid_pc: False
 * /move_base/DWAPlannerROS/sim_granularity: 0.025
 * /move_base/DWAPlannerROS/sim_time: 1.5
 * /move_base/DWAPlannerROS/simple_attractor: False
 * /move_base/DWAPlannerROS/vtheta_samples: 20
 * /move_base/DWAPlannerROS/vx_samples: 8
 * /move_base/DWAPlannerROS/xy_goal_tolerance: 0.2
 * /move_base/DWAPlannerROS/yaw_goal_tolerance: 0.1
 * /move_base/clearing_rotation_allowed: False
 * /move_base/controller_frequency: 4.0
 * /move_base/global_costmap/footprint: [[0 ...
(more)
2018-09-28 02:54:18 -0500 received badge  Famous Question (source)
2018-09-19 13:17:27 -0500 received badge  Notable Question (source)
2018-09-14 05:17:44 -0500 received badge  Popular Question (source)
2018-09-06 07:41:09 -0500 received badge  Popular Question (source)
2018-09-06 02:49:21 -0500 commented question robot_localization with cartographer and amcl

So far it is working really well. I changed the differentials to make AMCL "false" and cartographer "true" because the

2018-09-04 13:04:28 -0500 edited question robot_localization with cartographer and amcl

robot_localization with cartographer and amcl I am using cartographer_ros along with amcl and an imu and wheel odometry

2018-09-03 23:06:58 -0500 edited question robot_localization with cartographer and amcl

robot_localization with cartographer and amcl I am using cartographer_ros along with amcl and an imu and wheel odometry

2018-09-03 23:03:26 -0500 edited question robot_localization with cartographer and amcl

robot_localization with cartographer and amcl I am using cartographer_ros along with amcl and an imu and wheel odometry

2018-09-03 23:01:49 -0500 asked a question robot_localization with cartographer and amcl

robot_localization with cartographer and amcl I am using cartographer_ros along with amcl and an imu and wheel odometry

2018-08-20 00:57:07 -0500 received badge  Famous Question (source)
2018-08-06 04:59:28 -0500 marked best answer rosserial lost sync with device

I occasionally get a lost sync message with rosserial: "Lost sync with device, restarting..." and am wondering what exactly is being restarted and how best to recover from that in the arduino code.

It seems that the python code is fine with starting while the arduino is running its loop(). So am I correct in interpreting that to mean the python code does not need to be running for the setup() part of the arduino code, the part where the initNode() statement as well as the advertise and subscribe statements occur?

I am driving a roomba with the arduino and it seems I most often get the "lost sync" when the roomba is taking its time getting some task completed. The python code does not recover from that. I tried putting in a statement to check if the connection was up: while (!nh.connected())...... but whenever it disconnected, it would just stay in this loop and never recover.

Suggestions?

2018-08-06 02:11:19 -0500 commented answer in amcl amcl_node.cpp what does the draw_weight_as_height_ parameter do?

see above, you have the right link.

2018-08-06 02:10:15 -0500 commented question in amcl amcl_node.cpp what does the draw_weight_as_height_ parameter do?

Yes, that is the code I was using. I swapped back to the standard ROS base due to better support, but I really liked th

2018-08-06 02:09:41 -0500 commented question in amcl amcl_node.cpp what does the draw_weight_as_height_ parameter do?

Yes, that is the code I was using. I swapped back to the standard ROS base due to better support, but I really liked th

2018-08-06 02:00:06 -0500 commented answer Running a raspberry pi(wiring pi) node with roslaunch

That's a common problem with wiringpi and ROS. You will have to go through the hassle of setting permissions on /dev/mem

2018-08-06 01:57:46 -0500 commented answer Running a raspberry pi(wiring pi) node with roslaunch

That's a common problem with wiringpi. You will have to go through the hassle of setting permissions on /dev/mem and /d

2018-08-06 01:57:17 -0500 commented answer Running a raspberry pi(wiring pi) node with roslaunch

That's a common problem with wiringpi. You will have to go through the hassle of setting permissions on /dev/mem and /d

2018-08-04 16:14:08 -0500 answered a question Running a raspberry pi(wiring pi) node with roslaunch

Did you source the workspace? Normally, the source call is made in ~/.bashrc, but you can also just use it from the com

2018-08-04 13:48:22 -0500 asked a question rplidar A2 amcl parameters

rplidar A2 amcl parameters I am using an rplidar A2 for mapping and for localization. I have two different platforms, o

2018-08-02 23:24:21 -0500 received badge  Good Question (source)
2018-07-26 01:03:27 -0500 marked best answer amcl estimation quality

I would like to know how much to trust the amcl output pose. One thought is to see how well the laser data correlates with obstacles in the cost map, another is to calculate the variance of the particle locations. Is there some standard way to estimate the quality of the amcl pose?

2018-07-09 13:56:20 -0500 marked best answer networking machines connected in series

I have 3 machines that are connected in series. Machine #1 is running roscore and is networked locally to Machine #2. Everything works fine between those two. Machine #3 accesses Machine #2 via a VPN connection, but is not allowed to access Machine #1 directly. How do I get Machine #3 to see the rosmaster on Machine #1?

2018-07-05 01:15:46 -0500 received badge  Notable Question (source)
2018-06-21 19:19:10 -0500 received badge  Popular Question (source)
2018-06-21 12:05:36 -0500 commented question amcl with rotated map

It is helpful when debugging since the map's x and y axes will line up with amcl's. For example, look at rviz and see t

2018-06-20 21:08:24 -0500 edited question amcl with rotated map

amcl with rotated map I know this was asked previously, but since there was no answer, I hope it is OK to ask. I would

2018-06-20 21:07:35 -0500 asked a question amcl with rotated map

amcl with rotated map I know this was asked previously, but since there was no answer, I hope it is OK to ask. I would

2018-06-04 16:31:28 -0500 received badge  Self-Learner (source)
2018-06-03 09:49:32 -0500 marked best answer tango ros streamer has java runtime exception

I installed tango_ros_streamer from the play store, following the instructions here: http://wiki.ros.org/tango_ros_streamer

The app loaded and connected to the roscore on my main computer and the ROS indicator turned green. However, the tango indicator is yellow and I am not seeing any data other than in the /android/IMU topic, which is publishing normally. The log indicates a Java runtime exception after "ROS CONNECTION latch released!"

Here are the topics that exist:

/android/imu

/rosout

/rosout_agg

/tango/status

Here are the nodes that exist:

/android

/parameter_node

/rosout

/tango_service_client_node

Here is the tango log file (192.168.1.62 is the correct address for the tango):

> ed: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</parameter_node,
> http://192.168.1.62:33283/>,
> TopicIdentifier</rosout>>,
> Topic<TopicIdentifier</rosout>,
> TopicDescription<rosgraph_msgs/Log,
> acffd30cd6b6de30f120938c17c593fb>>>>
> I/Registrar( 4394): Response<Success,
> Success, []> I/Registrar( 4394):
> Response<Success, Success, []>
> I/DefaultPublisher( 4394): Publisher
> registered:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</tango_service_client_node,
> http://192.168.1.62:38113/>,
> TopicIdentifier</rosout>>,
> Topic<TopicIdentifier</rosout>,
> TopicDescription<rosgraph_msgs/Log,
> acffd30cd6b6de30f120938c17c593fb>>>>
> I/DefaultPublisher( 4394): Publisher
> registered:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</android,
> http://192.168.1.62:56484/>,
> TopicIdentifier</rosout>>,
> Topic<TopicIdentifier</rosout>,
> TopicDescription<rosgraph_msgs/Log,
> acffd30cd6b6de30f120938c17c593fb>>>>
> I/Registrar( 4394): Registering
> subscriber:
> Subscriber<Topic<TopicIdentifier</tango/status>,
> TopicDescription<std_msgs/Int8,
> 27ffa0c9c4b8fb8492252bcad9e5c57b>>>
> I/Registrar( 4394): Registering
> publisher:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</android,
> http://192.168.1.62:56484/>,
> TopicIdentifier</android/imu>>,
> Topic<TopicIdentifier</android/imu>,
> TopicDescription<sensor_msgs/Imu,
> 6a62c6daae103f4ff57a132d6f95cec2>>>>
> I/Registrar( 4394): Response<Success,
> Success, []> I/Registrar( 4394):
> Response<Success, Success, []>
> I/DefaultPublisher( 4394): Publisher
> registered:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</android,
> http://192.168.1.62:56484/>,
> TopicIdentifier</android/imu>>,
> Topic<TopicIdentifier</android/imu>,
> TopicDescription<sensor_msgs/Imu,
> 6a62c6daae103f4ff57a132d6f95cec2>>>>
> I/RunningActivity( 5105):
> initAndStartRosJavaNode
> I/RunningActivity( 5105): Waiting for
> ROS CONNECTION latch release...
> I/RunningActivity( 5105): ROS
> CONNECTION latch released!
> E/RunningActivity( 5105): Uncaught
> exception of type class
> java.lang.RuntimeException
> I/Registrar( 5105):
> MasterXmlRpcEndpoint URI:
> http://192.168.1.62:11311/
> I/Registrar( 5105):
> MasterXmlRpcEndpoint URI:
> http://192.168.1.62:11311/
> I/Registrar( 5105):
> MasterXmlRpcEndpoint URI:
> http://192.168.1.62:11311/
> I/Registrar( 5105): Registering
> publisher:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</android,
> http://192.168.1.62:57114/>,
> TopicIdentifier</rosout>>,
> Topic<TopicIdentifier</rosout>,
> TopicDescription<rosgraph_msgs/Log,
> acffd30cd6b6de30f120938c17c593fb>>>>
> I/Registrar( 5105): Registering
> publisher:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</tango_service_client_node,
> http://192.168.1.62:55304/>,
> TopicIdentifier</rosout>>,
> Topic<TopicIdentifier</rosout>,
> TopicDescription<rosgraph_msgs/Log,
> acffd30cd6b6de30f120938c17c593fb>>>>
> I/Registrar( 5105): Registering
> publisher:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</parameter_node,
> http://192.168.1.62:51005/>,
> TopicIdentifier</rosout>>,
> Topic<TopicIdentifier</rosout>,
> TopicDescription<rosgraph_msgs/Log,
> acffd30cd6b6de30f120938c17c593fb>>>>
> I/Registrar( 5105): Response<Success,
> Success, []> I/Registrar( 5105):
> Response<Success, Success, []>
> I/Registrar( 5105): Response<Success,
> Success, []> I/DefaultPublisher(
> 5105): Publisher registered:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</parameter_node,
> http://192.168.1.62:51005/>,
> TopicIdentifier</rosout>>,
> Topic<TopicIdentifier</rosout>,
> TopicDescription<rosgraph_msgs/Log,
> acffd30cd6b6de30f120938c17c593fb>>>>
> I/DefaultPublisher( 5105): Publisher
> registered:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</android,
> http://192.168.1.62:57114/>,
> TopicIdentifier</rosout>>,
> Topic<TopicIdentifier</rosout>,
> TopicDescription<rosgraph_msgs/Log,
> acffd30cd6b6de30f120938c17c593fb>>>>
> I/DefaultPublisher( 5105): Publisher
> registered:
> Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</tango_service_client_node,
> http://192.168.1.62:55304/>,
> TopicIdentifier</rosout>>,
> Topic<TopicIdentifier</rosout ...
(more)
2018-05-30 00:13:00 -0500 received badge  Famous Question (source)
2018-05-17 07:54:30 -0500 received badge  Famous Question (source)