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

hydro serial package stopbits enum is showing duplicate values

asked 2014-02-20 13:08:16 -0500

kurt.christofferson gravatar image

updated 2016-10-24 09:02:11 -0500

ngrennan gravatar image

I am writing node to publish several sonar readings in a skirt being driven by an arduino. My node listens on the serial port and advertises an array of sensor_msgs/Range. I am depending on the ros-hydro-serial package to drive the serial port. I wanted to handle communications between the arduino and the node with parameter values. Therefore I am trying to look for and set all possibilities using ROS parameters. (Note: issuetracker does not seem to have anything on the serial package so I thought I would post here first. I have taken out support for stopbits_one_point_five and am not being held up. No urgency but would like to know if I am doing something wrong)

I was using the attributes of a serial connection in a switch and received a compiler error. "error: duplicate case value".

<snip of code>
switch (foo) {
   . . . 
   case serial::stopbits_one_point_five :
   case serial::stopbits_two :   //compiler issues the duplicate case value error for this line
      the other;
    . . . 

I note in looking at the header it contains.

<snip of the ROS hydro serial.h header>
 * Enumeration defines the possible stopbit types for the serial port.
typedef enum {
  stopbits_one = 1,
  stopbits_two = 2
} stopbits_t;

This has the affect of assigning the same value for the stopbits_one_point_five and the stopbits_two values.

My environment: Ubuntu 12.04 gcc 4.6.3

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-02-20 13:30:28 -0500

William gravatar image

updated 2014-02-20 13:47:15 -0500

This bug was fixed in this pull request:

It should be fixed in serial >= 1.1.6. The version in hydro is still 1.1.5, I'll correct that now.

EDIT: I have release 1.1.7 into groovy, hydro, and indigo. You can monitor the version available from the different debians for hydro here:

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-02-20 13:08:16 -0500

Seen: 231 times

Last updated: Feb 20 '14