git commit -m "first commit for v2"
This commit is contained in:
13
Devices/Packages/sick_line_guidance/test/scripts/cleanup.bash
Executable file
13
Devices/Packages/sick_line_guidance/test/scripts/cleanup.bash
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
pushd ../../../../
|
||||
echo -e "\n# cleanup.bash: Stopping rosmaster and all rosnodes...\n# rosnode kill -a ; sleep 5 ; killall rosmaster ; sleep 5"
|
||||
rosnode kill -a ; sleep 5 ; killall roslaunch ; sleep 5 ; killall rosmaster ; sleep 5
|
||||
echo -e "\n# cleanup.bash: Deleting ros cache and logfiles and catkin folders ./build ./devel ./install"
|
||||
rosclean purge -y
|
||||
rm -rf ./build ./devel ./install
|
||||
rm -rf ~/.ros/*
|
||||
# rm -rf ~/.ros/log/*
|
||||
catkin clean --yes --all-profiles --verbose
|
||||
catkin_make clean
|
||||
popd
|
||||
|
||||
16
Devices/Packages/sick_line_guidance/test/scripts/clion.bash
Executable file
16
Devices/Packages/sick_line_guidance/test/scripts/clion.bash
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# init ros environment
|
||||
source /opt/ros/melodic/setup.bash
|
||||
source ../../../../devel/setup.bash
|
||||
|
||||
# start edit resource-files
|
||||
gedit ./run.bash ./runsimu.bash ../../../sick_line_guidance/launch/sick_canopen_simu.launch ../../../sick_line_guidance/launch/sick_line_guidance.launch ../../../sick_line_guidance/ols/sick_line_guidance_ols10.yaml ../../../sick_line_guidance/ols/sick_line_guidance_ols20.yaml ../../../sick_line_guidance/mls/sick_line_guidance_mls.yaml &
|
||||
|
||||
# start clion
|
||||
# pushd ../../../sick_line_guidance
|
||||
# ~/Public/clion-2018.3.3/bin/clion.sh &
|
||||
pushd ../../../..
|
||||
~/Public/clion-2018.3.3/bin/clion.sh ./src &
|
||||
popd
|
||||
|
||||
21
Devices/Packages/sick_line_guidance/test/scripts/echo_topics.bash
Executable file
21
Devices/Packages/sick_line_guidance/test/scripts/echo_topics.bash
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
source ../../../../install/setup.bash
|
||||
printf "\033c"
|
||||
|
||||
# display PointCloud2 messages
|
||||
rosrun rviz rviz &
|
||||
|
||||
# plot sensor positions
|
||||
rqt_plot /ols/position[0] /ols/position[1] /ols/position[2] &
|
||||
# rqt_plot /cloud &
|
||||
|
||||
# print some values from the object directory of the can device
|
||||
rostopic list
|
||||
rostopic echo -n 1 /node1_1001 & rostopic echo -n 1 /node1_1018sub1 & rostopic echo -n 1 /node1_1018sub4
|
||||
rosservice call /driver/get_object node1 1001sub false
|
||||
rosservice call /driver/get_object node1 1018sub1 false
|
||||
rosservice call /driver/get_object node1 1018sub4 false
|
||||
|
||||
# print ros topics for ols and mls
|
||||
rostopic echo /mls & rostopic echo /ols & rostopic echo /cloud & rostopic echo /diagnostics
|
||||
|
||||
30
Devices/Packages/sick_line_guidance/test/scripts/make.bash
Executable file
30
Devices/Packages/sick_line_guidance/test/scripts/make.bash
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# delete old logfiles
|
||||
pushd ../../../..
|
||||
rm -rf install/lib/sick_line_guidance/*
|
||||
rm -rf install/share/sick_line_guidance/*
|
||||
rm -f build/catkin_make_install.log
|
||||
|
||||
# make install
|
||||
catkin_make install 2>&1 | tee -a build/catkin_make_install.log
|
||||
source ./install/setup.bash
|
||||
|
||||
# lint, install by running
|
||||
# sudo apt-get install python-catkin-lint
|
||||
# catkin_lint -W1 src/sick_line_guidance
|
||||
|
||||
# print warnings and errors
|
||||
echo -e "\nmake.bash finished.\n"
|
||||
echo -e "catkin_make warnings:"
|
||||
cat build/catkin_make_install.log | grep -i "warning:"
|
||||
echo -e "\ncatkin_make errors:"
|
||||
cat build/catkin_make_install.log | grep -i "error:"
|
||||
|
||||
# print sick_line_guidance install files, libraries, executables
|
||||
echo -e "\ninstall/lib/sick_line_guidance:"
|
||||
ls -al install/lib/sick_line_guidance/*
|
||||
echo -e "\ninstall/share/sick_line_guidance:"
|
||||
ls install/share/sick_line_guidance/*.*
|
||||
popd
|
||||
|
||||
9
Devices/Packages/sick_line_guidance/test/scripts/makeall.bash
Executable file
9
Devices/Packages/sick_line_guidance/test/scripts/makeall.bash
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
echo -e "makeall.bash: build and install ros sick_line_guidance driver"
|
||||
sudo echo -e "makeall.bash started."
|
||||
source /opt/ros/noetic/setup.bash
|
||||
./cleanup.bash
|
||||
./makepcan.bash
|
||||
./make.bash
|
||||
echo -e "makeall.bash finished."
|
||||
|
||||
41
Devices/Packages/sick_line_guidance/test/scripts/makepcan.bash
Executable file
41
Devices/Packages/sick_line_guidance/test/scripts/makepcan.bash
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
# install packages required for peak can device driver
|
||||
|
||||
if [ -f ../../../../../peak_systems/pcanview-ncurses_0.8.7-0_amd64.deb ] ; then
|
||||
pushd ../../../../../peak_systems
|
||||
sudo apt-get install libncurses5
|
||||
sudo dpkg --install pcanview-ncurses_0.8.7-0_amd64.deb
|
||||
popd
|
||||
fi
|
||||
|
||||
# build and install peak can device driver
|
||||
|
||||
if [ -d ../../../../../peak_systems/peak-linux-driver-8.17.0 ] ; then
|
||||
pushd ../../../../../peak_systems/peak-linux-driver-8.17.0
|
||||
# install required packages
|
||||
sudo apt-get install can-utils
|
||||
sudo apt-get install gcc-multilib
|
||||
sudo apt-get install libelf-dev
|
||||
sudo apt-get install libpopt-dev
|
||||
sudo apt-get install tree
|
||||
# build and install pcan driver
|
||||
make clean
|
||||
make NET=NETDEV_SUPPORT
|
||||
sudo make install
|
||||
# install the modules
|
||||
sudo modprobe pcan
|
||||
sudo modprobe can
|
||||
sudo modprobe vcan
|
||||
sudo modprobe slcan
|
||||
# setup and configure "can0" net device
|
||||
sudo ip link set can0 type can
|
||||
sudo ip link set can0 up type can bitrate 125000 # configure the CAN bitrate, f.e. 125000 bit/s
|
||||
# check installation
|
||||
# ./driver/lspcan --all # should print "pcanusb32" and pcan version
|
||||
# tree /dev/pcan-usb # should show a pcan-usb device
|
||||
# ip -a link # should print some "can0: ..." messages
|
||||
ip -details link show can0 # should print some details about "can0" net device
|
||||
popd
|
||||
fi
|
||||
|
||||
69
Devices/Packages/sick_line_guidance/test/scripts/run.bash
Executable file
69
Devices/Packages/sick_line_guidance/test/scripts/run.bash
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set environment, clear screen and logfiles
|
||||
if [ ! -d ~/.ros/log ] ; then mkdir -p ~/.ros/log ; fi
|
||||
printf "\033c"
|
||||
source ../../../../install/setup.bash
|
||||
echo -e "\n# run.bash: Stopping rosmaster and all rosnodes...\n# rosnode kill -a ; sleep 5 ; killall rosmaster ; sleep 5"
|
||||
rosnode kill -a ; sleep 5 ; killall rosmaster ; sleep 5
|
||||
rm -rf ~/.ros/log/*
|
||||
|
||||
# initialize can net device, can0 by peak can adapter
|
||||
# sudo ip link set can0 up type can bitrate 125000
|
||||
NUM_BITRATE_125000=$(ip -details link show can0 | grep "bitrate 125000" | wc -l)
|
||||
if [ "$NUM_BITRATE_125000" = "0" ] ; then
|
||||
echo -e "# run sick_line_guidance:\n# sudo ip link set can0 up type can bitrate 125000"
|
||||
sudo ip link set can0 up type can bitrate 125000
|
||||
fi
|
||||
echo -e "# run sick_line_guidance:\n# ip -details link show can0"
|
||||
ip -details link show can0
|
||||
|
||||
# check can net device by sending 000#0x820A (can command reset communication to device 0x0A), should be answered by 70A#00 (boot message from device 0x0A)
|
||||
# for ((n=0;n<=2;n++)) ; do
|
||||
# candump -ta -n 2 can0 &
|
||||
# cansend can0 000#820A
|
||||
# sleep 1
|
||||
# done
|
||||
|
||||
# Start OLS20 simulation
|
||||
# ./runsimu.bash
|
||||
|
||||
# start can logging
|
||||
# printf "\033c" ; candump -ta can0 2>&1 | tee ~/.ros/log/candump.log
|
||||
candump -ta can0 2>&1 | tee ~/.ros/log/candump.log &
|
||||
|
||||
# get/set values from object directory with canopen_chain_node service, f.e. Object 2001sub5 (sensorFlipped, UINT8, defaultvalue: 0x01)
|
||||
# rosservice call /driver/get_object "{node: 'node1', object: '2001sub5', cached: false}"
|
||||
# rosservice call /driver/set_object "{node: 'node1', object: '2001sub5', value: '0x01', cached: false}"
|
||||
|
||||
# Start ros driver canopen_chain_node, sick_line_guidance_node and sick_line_guidance_cloud_publisher
|
||||
|
||||
# echo -e "\n# run sick_line_guidance:\n# roslaunch -v --screen sick_line_guidance sick_line_guidance.launch yaml:=sick_line_guidance_ols10.yaml\n"
|
||||
# roslaunch -v --screen sick_line_guidance sick_line_guidance.launch yaml:=sick_line_guidance_ols10.yaml 2>&1 | tee ~/.ros/log/sick_line_guidance_ols10.log # start OLS10 driver
|
||||
|
||||
echo -e "\n# run sick_line_guidance:\n# roslaunch -v --screen sick_line_guidance sick_line_guidance.launch yaml:=sick_line_guidance_ols20.yaml\n"
|
||||
roslaunch -v --screen sick_line_guidance sick_line_guidance.launch yaml:=sick_line_guidance_ols20.yaml 2>&1 | tee ~/.ros/log/sick_line_guidance_ols20.log # start OLS20 driver
|
||||
|
||||
# echo -e "\n# run sick_line_guidance:\n# roslaunch -v --screen sick_line_guidance sick_line_guidance.launch yaml:=sick_line_guidance_mls.yaml\n"
|
||||
# roslaunch -v --screen sick_line_guidance sick_line_guidance.launch yaml:=sick_line_guidance_mls.yaml 2>&1 | tee ~/.ros/log/sick_line_guidance_mls.log # start MLS driver
|
||||
|
||||
# read some object indices (f.e. 1001=ErrorRegister, 1018sub1=VendorID, 1018sub4=SerialNumber)
|
||||
# rostopic echo -n 1 /node1_1001 & rostopic echo -n 1 /node1_1018sub1 & rostopic echo -n 1 /node1_1018sub4
|
||||
# rosservice call /driver/get_object node1 1001sub false
|
||||
# rosservice call /driver/get_object node1 1018sub1 false
|
||||
# rosservice call /driver/get_object node1 1018sub4 false
|
||||
|
||||
# Check errors and warnings in ros logfiles
|
||||
killall candump
|
||||
grep "\[ WARN\]" ~/.ros/log/*.log ~/.ros/log/*/ros*.log ~/.ros/log/*/sick*.log >> ~/.ros/log/ros_log_warnings.txt
|
||||
grep "\[ERROR\]" ~/.ros/log/*.log ~/.ros/log/*/ros*.log ~/.ros/log/*/sick*.log >> ~/.ros/log/ros_log_errors.txt
|
||||
cat ~/.ros/log/ros_log_warnings.txt
|
||||
cat ~/.ros/log/ros_log_errors.txt
|
||||
|
||||
# Zip all logfiles
|
||||
mkdir ./tmp
|
||||
cp -rf ~/.ros/log ./tmp
|
||||
now=$(date +"%Y%m%d_%H%M%S")
|
||||
tar -cvzf ./$now-ros-logfiles.tgz ./tmp/log
|
||||
rm -rf ./tmp
|
||||
|
||||
112
Devices/Packages/sick_line_guidance/test/scripts/runsimu.bash
Executable file
112
Devices/Packages/sick_line_guidance/test/scripts/runsimu.bash
Executable file
@@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set environment, clear screen and logfiles
|
||||
if [ ! -d ~/.ros/log ] ; then mkdir -p ~/.ros/log ; fi
|
||||
printf "\033c"
|
||||
source ../../../../install/setup.bash
|
||||
echo -e "\n# runsimu.bash: Stopping rosmaster and all rosnodes...\n# rosnode kill -a ; sleep 5 ; killall rosmaster ; sleep 5"
|
||||
rosnode kill -a ; sleep 5 ; killall roslaunch ; sleep 5 ; killall rosmaster ; sleep 5
|
||||
rm -rf ~/.ros/log/*
|
||||
|
||||
# Initialize can net device, can0 by peak can adapter
|
||||
# sudo ip link set can0 type can loopback on # loopback not supported
|
||||
# sudo ip link set can0 up type can bitrate 125000 # set default bitrate 125000 bit/s
|
||||
|
||||
# Reset can0 net device
|
||||
# sudo ip link set can0 down
|
||||
# sleep 1
|
||||
# sudo ip link set can0 up type can bitrate 125000
|
||||
# sleep 1
|
||||
|
||||
# Set default bitrate 125000 bit/s
|
||||
NUM_BITRATE_125000=$(ip -details link show can0 | grep "bitrate 125000" | wc -l)
|
||||
if [ "$NUM_BITRATE_125000" = "0" ] ; then
|
||||
echo -e "# run ols/mls simulation:\n# sudo ip link set can0 up type can bitrate 125000"
|
||||
sudo ip link set can0 up type can bitrate 125000
|
||||
fi
|
||||
echo -e "# run ols/mls simulation:\n# ip -details link show can0"
|
||||
ip -details link show can0
|
||||
sleep 1
|
||||
|
||||
# Start can logging
|
||||
# candump -ta can0 &
|
||||
# candump -ta can0 2>&1 | tee ~/.ros/log/candump.log &
|
||||
|
||||
# Simulation with cangineberry: Upload firmware (BEDS slave) and beds-file CiA401_IO_Node3
|
||||
# ./coiaupdater -p /dev/ttyS0 -f ../APPS/CANopenIA-BEDS/CgB_COIA_BEDS1.3_sec.bin # install firmware CANopen IA BEDS slave
|
||||
# ./coiaupdater -p /dev/ttyS0 -d ../APPS/CANopenIA-BEDS/EDS/CiA401_IO_Node3.bin
|
||||
# Simulation with cangineberry: Read/write objects 6401sub1 (LCP1), 6401sub2 (LCP2), 6401sub3 (LCP3), 6401sub4 (WidthLCP1), 6401sub5 (WidthLCP2), 6401sub6 (WidthLCP3)
|
||||
# ./coia -p /dev/ttyS0 --read=0x6401,0x01
|
||||
# ./coia -p /dev/ttyS0 --write=0x6401,0x01,2,0x1234
|
||||
# ./coia -p /dev/ttyS0 --write=0x6401,0x01,2,0xABCD
|
||||
|
||||
# get/set values from object directory with canopen_chain_node service, f.e. Object 2001sub5 (sensorFlipped, UINT8, defaultvalue: 0x01)
|
||||
# rosservice call /driver/get_object "{node: 'node1', object: '2001sub5', cached: false}"
|
||||
# rosservice call /driver/set_object "{node: 'node1', object: '2001sub5', value: '0x01', cached: false}"
|
||||
|
||||
# Run simulation for OLS and MLS by yaml-file configuration
|
||||
device_settings_map=( "OLS20:sick_line_guidance_ols20.yaml;120" "OLS10:sick_line_guidance_ols10.yaml;30" "MLS:sick_line_guidance_mls.yaml;30" )
|
||||
for((device_cnt=0;device_cnt<=2;device_cnt++)) ; do
|
||||
device=${device_settings_map[$device_cnt]%%:*}
|
||||
settings_str=${device_settings_map[$device_cnt]##*:}
|
||||
IFS=';' settings_list=($settings_str)
|
||||
yaml_file=${settings_list[0]}
|
||||
run_seconds=${settings_list[1]}
|
||||
echo -e "runsimu.bash: settings for $device device: yaml_file $yaml_file, run for $run_seconds seconds."
|
||||
|
||||
# Start can2ros converter
|
||||
# echo -e "\n# run ols/mls simulation:\n# roslaunch -v --screen sick_line_guidance sick_line_guidance_can2ros_node.launch\n"
|
||||
# roslaunch -v --screen sick_line_guidance sick_line_guidance_can2ros_node.launch &
|
||||
echo -e "\n# run ols/mls simulation:\n# roslaunch -v sick_line_guidance sick_line_guidance_can2ros_node.launch\n"
|
||||
roslaunch -v sick_line_guidance sick_line_guidance_can2ros_node.launch &
|
||||
sleep 5
|
||||
|
||||
# Start ros2can converter
|
||||
# echo -e "\n# run ols/mls simulation:\n# roslaunch -v --screen sick_line_guidance sick_line_guidance_ros2can_node.launch\n"
|
||||
# roslaunch -v --screen sick_line_guidance sick_line_guidance_ros2can_node.launch &
|
||||
echo -e "\n# run ols/mls simulation:\n# roslaunch -v sick_line_guidance sick_line_guidance_ros2can_node.launch\n"
|
||||
roslaunch -v sick_line_guidance sick_line_guidance_ros2can_node.launch &
|
||||
sleep 5
|
||||
|
||||
# Start OLS20 simulation
|
||||
echo -e "\n# run ols/mls simulation:\n# roslaunch -v sick_line_guidance sick_canopen_simu.launch device:=$device\n"
|
||||
roslaunch -v --screen sick_line_guidance sick_canopen_simu.launch device:=$device 2>&1 | tee ~/.ros/log/sick_canopen_simu_$device.log &
|
||||
# echo -e "\n# run ols/mls simulation:\n# roslaunch -v sick_line_guidance sick_canopen_simu.launch device:=$device\n"
|
||||
# roslaunch -v sick_line_guidance sick_canopen_simu.launch device:=$device &
|
||||
sleep 5
|
||||
|
||||
# check can net device by sending 000#0x820A (can command reset communication to device 0x0A), should be answered by 70A#00 (boot message from device 0x0A)
|
||||
for ((n=0;n<1;n++)) ; do
|
||||
candump -ta -n 2 can0 &
|
||||
cansend can0 000#820A
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Start ros driver for MLS or OLS, incl. canopen_chain_node, sick_line_guidance_node and sick_line_guidance_cloud_publisher
|
||||
echo -e "\n# run sick_line_guidance:\n# roslaunch -v sick_line_guidance sick_line_guidance.launch yaml:=$yaml_file\n"
|
||||
roslaunch -v --screen sick_line_guidance sick_line_guidance.launch yaml:=$yaml_file 2>&1 | tee ~/.ros/log/$yaml_file.log &
|
||||
# echo -e "\n# run sick_line_guidance:\n# roslaunch -v sick_line_guidance sick_line_guidance.launch yaml:=$yaml_file\n"
|
||||
# roslaunch -v sick_line_guidance sick_line_guidance.launch yaml:=$yaml_file &
|
||||
|
||||
# Run simulation for a while
|
||||
sleep $run_seconds
|
||||
|
||||
# Exit simulation, shutdown all ros nodes
|
||||
echo -e "\n# runsimu.bash: Stopping rosmaster and all rosnodes...\n# rosnode kill -a ; sleep 5 ; killall rosmaster ; sleep 5"
|
||||
rosnode kill -a ; sleep 5 ; killall rosmaster ; sleep 5
|
||||
|
||||
done
|
||||
|
||||
|
||||
# Check errors and warnings in ros logfiles
|
||||
killall candump
|
||||
echo -e "\n#\n# OLS/MLS simulation finished.\n#\n"
|
||||
grep "\[ WARN\]" ~/.ros/log/*.log ~/.ros/log/*/ros*.log ~/.ros/log/*/sick*.log >> ~/.ros/log/ros_log_warnings.txt
|
||||
grep "\[ERROR\]" ~/.ros/log/*.log ~/.ros/log/*/ros*.log ~/.ros/log/*/sick*.log >> ~/.ros/log/ros_log_errors.txt
|
||||
grep "MeasurementVerificationStatistic" ~/.ros/log/*.log ~/.ros/log/*/ros*.log ~/.ros/log/*/sick*.log >> ~/.ros/log/simulation_statistic.txt
|
||||
echo -e "\nSimulation warnings and errors:\n"
|
||||
cat ~/.ros/log/ros_log_warnings.txt
|
||||
cat ~/.ros/log/ros_log_errors.txt
|
||||
echo -e "\nSimulation statistic:\n"
|
||||
cat ~/.ros/log/simulation_statistic.txt
|
||||
|
||||
15
Devices/Packages/sick_line_guidance/test/scripts/vs_code.bash
Executable file
15
Devices/Packages/sick_line_guidance/test/scripts/vs_code.bash
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
if [ -f /opt/ros/noetic/setup.bash ] ; then
|
||||
source /opt/ros/noetic/setup.bash
|
||||
elif [ -f /opt/ros/foxy/setup.bash ] ; then
|
||||
source /opt/ros/foxy/setup.bash
|
||||
fi
|
||||
pushd ../../../..
|
||||
if [ -f ./install/setup.bash ] ; then
|
||||
source ./install/setup.bash
|
||||
fi
|
||||
|
||||
code ./sick_line_guidance_vscode.code-workspace
|
||||
popd
|
||||
Reference in New Issue
Block a user