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

Attempt at making the installation easier #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,19 @@ add_dependencies(${PROJECT_NAME}
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)

install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)
catkin_install_python(PROGRAMS script/add_rule
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(FILES script/99-imu-3dm-gx4.rules script/README.md
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
1 change: 1 addition & 0 deletions script/99-imu-3dm-gx4.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Lord Microstrain",ATTRS{product}=="Lord Inertial Sensor", MODE="0777", GROUP="imu", SYMLINK+="lord_imu"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a symlink this way doesn't work well when you have multiple IMUs connected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I haven't found a good way to handle multiple gx4's. Also, testing that configuration is difficult.

16 changes: 5 additions & 11 deletions script/add_rule
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
#!/bin/bash


if [[ $UID != 0 ]]; then
echo "Please start the script as root or sudo!"
exit 1
fi

read -p "This will add $SUDO_USER to group imu are you sure? y/n: " -n 1 -r
read -p "This will add $USER to group imu are you sure? y/n: " -n 1 -r
echo #newline
if [[ $REPLY =~ ^[Yy]$ ]]
then
# add group and user
groupadd imu
adduser $SUDO_USER imu
sudo groupadd imu
sudo adduser $USER imu

# addudev rule
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # get directory where this script is stored
cp $DIR/imu_3dm_gx4.rules /etc/udev/rules.d/
sudo cp $DIR/99-imu-3dm-gx4.rules /etc/udev/rules.d/

#reload udev
udevadm control --reload-rules
sudo udevadm control --reload-rules
fi
1 change: 0 additions & 1 deletion script/imu_3dm_gx4.rules

This file was deleted.

2 changes: 1 addition & 1 deletion src/imu_3dm_gx4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ int main(int argc, char **argv) {
bool verbose;

// load parameters from launch file
nh.param<std::string>("device", device, "/dev/ttyACM0");
nh.param<std::string>("device", device, "/dev/lord_imu");
nh.param<int>("baudrate", baudrate, 115200);
nh.param<std::string>("frame_id", frameId, std::string("imu"));
nh.param<int>("imu_rate", requestedImuRate, 100);
Expand Down