mukmalone / hello_robot

3 stars 2 forks source link

Upgrading Linorobot to noetic #15

Closed mukmalone closed 3 years ago

mukmalone commented 3 years ago

!/usr/bin/env bash

set -e

source /opt/ros/$(dir /opt/ros)/setup.bash

sudo cp files/49-teensy.rules /etc/udev/rules.d/

ROSDISTRO="$(rosversion -d)" BASE=$1 SENSOR=$2 ARCH="$(uname -m)" echo $ARCH

if [ "$3" != "test" ] then if [ "$*" == "" ] then echo "No arguments provided" echo echo "Example: $ ./install.sh 2wd xv11" echo exit 1

    elif [[ "$1" != "2wd" && "$1" != "4wd" && "$1" != "mecanum" && "$1" != "ackermann" ]]
        then
            echo "Invalid linorobot base: $1"
            echo
            echo "Valid Options:"
            echo "2wd"
            echo "4wd"
            echo "ackermann"
            echo "mecanum"
            echo
            exit 1

    elif [[ "$2" != "xv11" && "$2" != "rplidar" && "$2" != "ydlidar" && "$2" != "hokuyo" && "$2" != "kinect" && "$2" != "realsense" ]]
        then
            echo "Invalid linorobot sensor: $2"
            echo
            echo "Valid Options:"
            echo "hokuyo"
            echo "kinect"
            echo "lms1xx"
            echo "realsense"
            echo "rplidar"
            echo "xv11"
            echo "ydlidar"
            echo
            exit 1

    elif [[ "$ARCH" != "x86_64" && "$2" == "realsense" ]]
        then
            echo "Intel Realsense R200 is not supported in $ARCH architecture."
            exit 1

    fi

    echo
    echo -n "You are installing ROS-$ROSDISTRO Linorobot for $BASE base with a $SENSOR sensor. Enter [y] to continue. " 
    read reply
    if [[ "$reply" != "y" && "$reply" != "Y" ]]
        then
            echo "Wrong input. Exiting now"
            exit 1
    fi

fi

echo echo "INSTALLING NOW...." echo

sudo apt-get update sudo apt-get install -y \ avahi-daemon \ openssh-server \ python-setuptools \ python-dev \ build-essential \ python-gudev replaced with gir1.2-gudev-1.0 added sudo apt install python-is-python3

sudo easy_install pip replaced with sudo apt install python3-pip sudo python2.7 -m pip install -U platformio replaced with sudo pip3 install -U platformio sudo rm -rf $HOME/.platformio/

source /opt/ros/$ROSDISTRO/setup.bash

cd $HOME mkdir -p linorobot_ws/src cd $HOME/linorobot_ws/src catkin_init_workspace

sudo apt-get install -y \ ros-$ROSDISTRO-roslint \ ros-$ROSDISTRO-rosserial \ ros-$ROSDISTRO-rosserial-arduino \ ros-$ROSDISTRO-imu-filter-madgwick \ ros-$ROSDISTRO-gmapping \ ros-$ROSDISTRO-map-server \ ros-$ROSDISTRO-navigation \ ros-$ROSDISTRO-robot-localization \ ros-$ROSDISTRO-tf2 \ ros-$ROSDISTRO-tf2-ros

if [[ "$3" == "test" ]] then sudo apt-get install -y \ ros-$ROSDISTRO-xv-11-laser-driver \ ros-$ROSDISTRO-rplidar-ros \ ros-$ROSDISTRO-urg-node \ ros-$ROSDISTRO-lms1xx \ ros-$ROSDISTRO-freenect-launch \ ros-$ROSDISTRO-depthimage-to-laserscan \ ros-$ROSDISTRO-teb-local-planner

    cd $HOME/linorobot_ws/src
    git clone https://github.com/EAIBOT/ydlidar.git

else if [[ "$SENSOR" == "hokuyo" ]] then sudo apt-get install -y ros-$ROSDISTRO-urg-node hokuyoip= echo "" echo -n "Input your hokuyo IP. Press Enter to skip (Serial Based LIDAR): " read hokuyoip echo "export LIDARIP=$hokuyoip" >> $HOME/.bashrc

elif [[ "$SENSOR" == "kinect" ]]
    then
        sudo apt-get install -y ros-$ROSDISTRO-freenect-launch
        sudo apt-get install -y ros-$ROSDISTRO-depthimage-to-laserscan

elif [[ "$SENSOR" == "lms1xx" ]]
    then
        sudo apt-get install -y ros-$ROSDISTRO-lms1xx
        echo ""
        echo -n "Input your LMS1xx IP: "
        read lms1xxip
        echo "export LIDARIP=$lms1xxip" >> $HOME/.bashrc

elif [[ "$SENSOR" == "realsense" ]]
    then
        sudo apt-get install -y ros-$ROSDISTRO-realsense-camera
        sudo apt-get install -y ros-$ROSDISTRO-depthimage-to-laserscan

elif [[ "$SENSOR" == "rplidar" ]]
    then
        sudo apt-get install -y ros-$ROSDISTRO-rplidar-ros  ***didn't find package

elif [[ "$SENSOR" == "xv11" ]]
    then
        sudo apt-get install -y ros-$ROSDISTRO-xv-11-laser-driver

elif [[ "$SENSOR" == "ydlidar" ]]
    then
        cd $HOME/linorobot_ws/src
        git clone https://github.com/EAIBOT/ydlidar.git
fi

if [[ "$BASE" == "ackermann" ]]
    then
        sudo apt-get install -y ros-$ROSDISTRO-teb-local-planner
fi

fi

cd $HOME/linorobot_ws/src git clone https://github.com/linorobot/linorobot.git git clone https://github.com/linorobot/imu_calib.git git clone https://github.com/linorobot/lino_pid.git git clone https://github.com/linorobot/lino_udev.git git clone https://github.com/linorobot/lino_msgs.git

cd $HOME/linorobot_ws/src/linorobot TRAVIS_BRANCH="echo $TRAVIS_BRANCH" if [ "$TRAVIS_BRANCH" = "devel" ]; then git checkout devel; fi

cd $HOME/linorobot_ws/src/linorobot/teensy/firmware export PLATFORMIO_CI_SRC=$PWD/src/firmware.ino platformio ci --project-conf=./platformio.ini --lib="./lib/ros_lib" --lib="./lib/config" --lib="./lib/motor" --lib="./lib/kinematics" --lib="./lib/pid" --lib="./lib/imu" --lib="./lib/encoder"

echo "source $HOME/linorobot_ws/devel/setup.bash" >> $HOME/.bashrc echo "export LINOLIDAR=$SENSOR" >> $HOME/.bashrc echo "export LINOBASE=$BASE" >> $HOME/.bashrc source $HOME/.bashrc

cd $HOME/linorobot_ws catkin_make --pkg lino_msgs catkin_make

echo echo "INSTALLATION DONE!" echo

mukmalone commented 3 years ago

Robot specific teensy parameters

define K_P 0.55 // P constant 0.6

define K_I 0.3 // I constant 0.3

define K_D 0.125 // D constant 0.5

//define your robot' specs here

define MAX_RPM 330 // motor's maximum RPM

define COUNTS_PER_REV 1318 // wheel encoder's no of ticks per rev 1330

define WHEEL_DIAMETER 0.060 // wheel's diameter in meters

define PWM_BITS 8 // PWM Resolution of the microcontroller

define LR_WHEELS_DISTANCE 0.156 // 0.156 distance between left and right wheels

define FR_WHEELS_DISTANCE 0.165 // 0.165 distance between front and rear wheels.

mukmalone commented 3 years ago

laser.launch

<node pkg="tf2_ros" type="static_transform_publisher" name="base_link_to_laser" args="0.195 0 0.233 0 0 0  /base_link /laser"/>
mukmalone commented 3 years ago

https://github.com/linorobot/linorobot/issues/31#issuecomment-650132815

This fixed the gudev issues with Python capatibility

sudo apt install python-gobject sudo apt install libtool-bin sudo apt install python-gobject-2-dev sudo apt install autoconf sudo apt-get install libgudev-1.0-dev git clone https://github.com/nzjrs/python-gudev.git cd python-gudev ./autogen.sh make sudo make install rosrun lino_udev lino_udev.py sudo cp 58-lino.rules /etc/udev/rules.d/58-lino.rules

mukmalone commented 3 years ago

Install rplidar_ros from source since the package is not available for Noetic

https://github.com/robopeak/rplidar_ros

mukmalone commented 3 years ago

Navigation issue:

Warning: Invalid argument "/map" passed to canTransform argument target_frame in tf2 frame_ids cannot start with a '/' like:

Fix was to remove any / from topic definitions in yaml files for navigation such as local costmap and global costmap