Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of baud rate values in RTPS #8808

Closed
drisebor opened this issue Feb 3, 2018 · 2 comments · Fixed by #8823
Closed

Incorrect handling of baud rate values in RTPS #8808

drisebor opened this issue Feb 3, 2018 · 2 comments · Fixed by #8823
Labels

Comments

@drisebor
Copy link
Contributor

drisebor commented Feb 3, 2018

Bug Report

This is a problem with the fast RTPS code.

For both client and agent code, baud rate values are generated from the program argument by converting the argument directly to a number. However in termios.h, the baud rate is encoded in a number of preset values, eg B57600. This affects the agent running on Ubuntu since the encoded value is different from the actual baud rate. As a result executing the following in Ubuntu terminal:
./micrortps_agent -b 57600 -d /dev/ttyUSB1
results in this failure message:
UART transport: device: /dev/ttyUSB1; baudrate: 57600; sleep: 1us; poll: 0ms

ERR SET BAUD /dev/ttyUSB1: 0 (22)
Close UART
EXITING...

With the problem corrected using an extra function to convert the baud rate to the encoded value, the behaviour shown in the terminal is:
UART transport: device: /dev/ttyUSB1; baudrate: 57600; sleep: 1us; poll: 0ms

no flush
sensor_combined publisher started

Note that there may be a separate problem with the code generation for the agent application. To obtain the above result, the agent software was generated using a modified msg/tools/generate_microRTPS_bridge.py script with the following diff:

53,54c53,59
<     if dir[0] != '/':
<         dir = root_path + "/" + dir
---
>     if len(dir)>0:
>         if dir[0] != '/':
>             dir = root_path + "/" + dir
>     else:
>         dir = root_path
> 
>     print "dir returned from get_absolute_path",dir
66c71
< parser.add_argument("-t", "--topic-msg-dir", dest='msgdir', type=str, nargs=1, help="Topics message dir, by default msg/", default="msg")
---
> parser.add_argument("-t", "--topic-msg-dir", dest='msgdir', type=str, nargs=1, help="Topics message dir, by default msg/", default="")
@PX4BuildBot
Copy link
Collaborator

GitMate.io thinks possibly related issues are #4764 (VTOL: Nasty Yaw problem after back trans. in ALT and POS), and #7675 (Some questions about “mc_att_control” hope to get help).

@PX4BuildBot PX4BuildBot added the bug label Feb 3, 2018
@LorenzMeier
Copy link
Member

@drisebor Thanks! Would you mind sending a pull request with the proposed fixes?
https://dev.px4.io/en/contribute/#source-code-management

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants