Why can't youbot_battery_monitor connect to serial port? [closed]

asked 2014-05-19 03:45:34 -0500

m.hoev gravatar image

updated 2014-05-20 00:46:54 -0500

Hi,

i am trying to get youbot_battery_monitor running on my youbot. The README (cannot post link, please check yourself on google) says i could run youbot_battery_monitor as standalone program. But when i try to run it with

$ ./home/youbotuser/Software/catkin_ws/devel/lib/youbot_battery_monitor/youbot_battery_monitor /dev/youbot/lcd_display eth1 wlan0 &

it says "could not to connect to serial port: /dev/youbot/lcd_display"

I wrote a udev rule 110-battery.rule:

SUBSYSTEM=="usb", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="059d", SYMLINK+="youbot/lcd_display", RUN+="/home/youbotuser/Software/catkin_ws/src/youbot_diagnostics/youbot_battery_monitor/youbot_battery_monitor.sh"

My youbot_battery_monitor.sh looks like this:

#!/bin/bash

export ROS_MASTER_URI=http: //localhost:11311

/home/youbotuser/Software/catkin_ws/devel/lib/youbot_battery_monitor/youbot_battery_monitor /dev/youbot/lcd_display eth1 wlan0 &

The udev rule seems to be working. It at least generates the /dev/youbot/lcd_display file. But i am not really sure about using SUBSYSTEM=="usb"?!

I don't use the youbot that long yet. I'd really much appreciate any help. Thanks a lot.


Edited after ahendrix 2nd comment:

I think i finally solved the problem why it cannot connect to the serial port. But it is still not running properly yet. I can execute youbot_battery_monitor.sh by typing "sudo bash youbot_battery_monitor.sh". I obviously needed the root rights i got by adding sudo.

This is the output i get then:

sudo bash youbot_battery_monitor.sh

youbotuser@Jakobs-youBot:~/Software/catkin_ws/src/youbot_diagnostics/youbot_battery_monitor$ try to connect to serial port: /dev/youbot/lcd_display

serial port /dev/youbot/lcd_displayis already open

connected to serial port: /dev/youbot/lcd_display

[W ]

[L ]

[W ]

[L ] ....

Every time it prints [W ] and [L ] it is beeping.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by m.hoev
close date 2014-05-20 23:50:50

Comments

Are the permissions on /dev/youbot/lcd_display correct? It looks like that udev rule should already be starting the battery monitor; perhaps you should check to see if it's already running?

ahendrix gravatar image ahendrix  ( 2014-05-19 05:11:16 -0500 )edit

the lcd_display file has these permissions: lrwxrwxrwx 1 root root The udev rule does start youbot_battery_monitor.sh, which starts the exe. The process is running. But it is beeping the whole time and i think it is beeping because it doesn't get a signal because cannot connect to the serial port??

m.hoev gravatar image m.hoev  ( 2014-05-19 22:17:01 -0500 )edit

I suspect the process that's running has a lock on the serial port so that other programs can't open it. I would look for a log from that process to see if and how it's failing, or just kill it and run it again from the terminal, where you can actually see the output.

ahendrix gravatar image ahendrix  ( 2014-05-19 22:33:31 -0500 )edit

Check edited question...

m.hoev gravatar image m.hoev  ( 2014-05-19 23:11:51 -0500 )edit

Solved it. I changed SUBSYSTEM=="usb" to SUBSYSTEM=="tty". This fixed it. Now it is running how it is supposed to do. Tanks a lot for your help.

m.hoev gravatar image m.hoev  ( 2014-05-20 23:50:20 -0500 )edit