Closed hubdwoo closed 1 year ago
Log from @vedesh1408 ?
Driver is installed and it builds without any error. Launch files runs but there is an issue with CAN I think?
@dylan-gonzalez yes those logs are from Vedesh and Kendrick
Using the humble branch from sbg_ros2_driver
But they only have packages for ros foxy and galactic - packages not found for either
Looks like to use the ros2 drivers will have to use Ubuntu 20.04 or older Can do the same with the ros1 drivers
Can we have a docker container running Ubuntu 20.04 to use their foxy/galactic driver?
Does SBG run over CAN or direct ethernet to the PC? Answer: it sends over serial, and is connected to a usb-serial cable.
It works, but get the same error as @vedesh1408 before with it not being able to open the com port. Except that it is trying to find a device /dev/sbg - I'm not sure why it hasn't defaulted to /dev/ttyUSB0 as in the config file in the sbg_ros2_driver repo.
Edit: realised that the docker container cannot access the host device tree. Need to figure out some way to fix this.
Following this link to fix. Disconnected and reconnected the usb-serial sbg cable, realised that it is ttyUSB0 in the device tree. Need to change the sbg-driver config file to use /dev/ttyUSB0 instead of the default /dev/sbg, so I need to build the package from source.
Steps
docker pull ros:foxy
docker run -it ros:foxy
inside the interactive terminal running inside the docker container now--include-eol-distros
in the rosdep update
step since foxy is EOL.colcon build
But this throws an error when building from source.
Build the docker image
sudo docker build . -t sbg:ros2-foxy -f Dockerfile
Run the docker container in the background
sudo docker run -e DISPLAY -e TERM --privileged -v "/dev:/dev:rw" -v "/lib/modules:/lib/modules:rw" -v "/tmp/.X11-unix:/tmp/.X11-unix:rw" --net=host --name sbg --entrypoint /ros_entrypoint.sh -d sbg:ros2-foxy /usr/bin/tail -f /dev/null
Attach to the container
sudo docker exec -it sbg bash
Create a symbolic link from /dev/sbg --> /dev/ttyUSB0
sudo ln -s /dev/ttyUSB0 /dev/sbg
But this still throws the error: sbgInterfaceSerialCreate: Unable to open the com port: /dev/sbg
After a bit of ChatGPT'ing, I found that the user does not have access to the USB ports without running sudo
. Can't use sudo
with a ros2 launch, so I modified the Dockerfile to include the following:
RUN usermod -aG dialout $USERNAME
Apparently the dialout group gives the user access to USB ports. (and the sbg_ros2_driver repo README actually says to do this lol rip).
Restarting the container, I think it at least recognises the SBG device now? But getting a SBG_TIME_OUT error.
Looking at this issue it seems that maybe the baud rate is not set correctly. Looking at the SBG sensor inside the van it looks like an Ellipse-N. There is an example Ellipse-N config file in the sbg_ros2_driver repo, but I don't think there's a way to use this config file from the sbg_ros2_driver binary. Might have to take another look into building the driver from source again.
Seems to work better now... at least it seems to be the correct baud rate. But doing a ros2 topic echo
on the topics shows that nothing is publishing.
Guess maybe I should try building from source again... Still gives the same error though
But there is a commit from someone at Streetdrone that seems to have fixed this issue - so not sure why this error is still occuring?
Because he mentioned that that commit works for humble...
So I've built it from source on humble and the driver works now! Well, no topics are being published.
I just tried restarting the machine and now it's at least got topics there.. but nothing is being published.
I've submitted a ticket to Streetdrone here
Bit confused by what it's saying in the manual here... apparently SBG sends data over CAN?
So do we have to first set up the can0 interface? Is that why nothing is being published to the topics?
using command
sudo dmesg | grep tty
shows base_baud = 115200
this was different from baud shown when using ros2 launch (230400)
tried changing the receiving baud rate using
stty -F /dev/ttyUSB0 115200
verify that it is changed using
stty -F /dev/ttyUSB0 -a
when running ros2 launch that sets the baud rate to 230400, so that was useless
went into config file and manually changed it under: ~/sbg/humble_ws/install/sbg_driver/share/sbg_driver/config/example/ellipse_N_default.yaml from 230400 to 115200
works!!!
testing: worked: /sbg/ekf_euler /sbg/ekf_nav /sbg/ekf_quat /sbg/gps_pos /sbg/gps_vel /sbg/imu_data /sbg/status /sbg/utc_time
did not work (nothing is being printed): /sbg/gps_hdt /sbg/gps_raw
On the StreetDrone Github Page they have a fork of a sbg_ros2_driver