-
Notifications
You must be signed in to change notification settings - Fork 1
Useful
-
ash@ROS:~$
ls -l /dev | grep USB
and it will show something likecrw-rw---- 1 root dialout 188, 0 Sep 2 14:11 ttyUSB0
whereroot
is the user anddialout
is the group - To add a particular user to a group
sudo usermod -aG dialout ash
. This will add userash
to the groupdialout
- To know the current user's group, run
groups ash
and it will produceash : ash dialout video
- clone this github repo
-
cd jekyll-serve
anddocker build -t jekyll-serve .
- Then go (
cd
) to the website folder containing theGemfile
. For example al-folio (has to be cloned locally) and it contains the Gemfile -
docker run -p 4000:4000 -v $(pwd):/site jekyll-serve
## run it on the directory containing the Gemfile - Then the following appears at the end on the terminal
Auto-regeneration: enabled for '/site'
Server address: http://0.0.0.0:4000/
Server running... press ctrl-c to stop.
- Open
http://0.0.0.0:4000/
in a browser to see the webpage
netstat -tulpn
kill -9 PID
Find a directory in linux
To find a directory called apt
in /
(root) file system, enter:
find / -type d -name "apt"
sudo find / -type d -name "apt"
-
find . -name thisfile.txt
### find a file
namespace rtabmap_util
{
class ObstaclesDetection : public nodelet::Nodelet
{
public:
private:
};
PLUGINLIB_EXPORT_CLASS(rtabmap_util::ObstaclesDetection, nodelet::Nodelet);
}
<library path="lib/librtabmap_util_plugins">
<class name="rtabmap_util/obstacles_detection"
type="rtabmap_util::ObstaclesDetection"
base_class_type="nodelet::Nodelet">
<description>
This is my nodelet.
</description>
</class
#include <pluginlib/class_loader.h>
int main()
{
pluginlib::ClassLoader<nodelet::Nodelet> poly_loader("nodelet", "nodelet::Nodelet");
boost::shared_ptr<nodelet::Nodelet> obstacleDetection = poly_loader.createInstance("rtabmap_util/obstacles_detection");
}
Note: Passing parameters to the ObstacleDetection
class is to be found out
Minimize windows on click here
gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'
sudo apt-get install texlive-lang-italian
- Go to fontIn and download the TTF version at the bottom. Extract the zip and double click on each font to install it
sudo apt-get install texlive-fonts-extra
sudo apt-get install texlive-latex-extra
sudo apt install texlive-luatex
sudo apt-get install texlive-lang-french
sudo dpkg --configure -a
Errors were encountered while processing: /var/cache/apt/archives/python3-catkin-pkg-modules_0.5.2-1_all.deb
sudo dpkg -i --force-overwrite python3-catkin-pkg-modules_0.5.2-1_all.deb
sudo apt-get -f install
Install CMake
Now CMake developer team in Kitware Inc provides APT repositiory. It allows you to install latest CMake via apt-get.
If you are using a minimal Ubuntu image or a Docker image, you may need to install the following packages:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg software-properties-common wget
Obtain a copy of our signing key:
wget -qO - https://apt.kitware.com/keys/kitware-archive-latest.asc | sudo apt-key add -
Add the repository to your sources list and update.
For Ubuntu Bionic Beaver (18.04):
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt-get update
sudo apt-get install cmake
- remove existing installations
sudo snap remove clion
sudo find / -iname "*JetBrains*"
- will have to manually deleted all JetBrains folders
- Download CLion and extract the
clion.xxx.
folder sudo mv /path/to/clion.xxx /opt
cd /opt/clion.xxx/bin
-
./clion.sh
## set all the login stuff here for license and open a project - Once clion is opened, create a
Desktop Entry
. This can be done byHelp-->FindAction
and search for Desktop Entry. Close CLion cd /usr/share/applications/
subl jetbrains-clion.desktop
- Add
bash -i -c
to theExec
(Exec=bash -i -c "/opt/clion-2022.1.2/bin/clion.sh" %f
) - Open
CLion
from anywhere and is good to go
Note: Clion once closed wont open again with the -i
option with bash
command in the Exec
. So tried this answer and changed Exec=bash -c "source ~/.bashrc && /opt/clion-2022.1.3/bin/clion.sh %f"
and it works now. Also, the following in .bashrc
needs to be commented out
case $- in
*i*) ;;
*) return;;
esac
-
sudo swapoff /swapfile
sudo rm /swapfile
sudo fallocate -l 15G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
-
sudo swapon /swapfile
or reboot
sudo apt-get install python/python3
Try python
or python2
python2.7
, python3
, python 3.6
. Depending upon the python
version, one of these should work but a symlink
is wrong or missing.
sudo rm /usr/bin/python3
sudo ln -s /usr/bin/python3.6 /usr/bin/python3
Install Cuda using APT
Install latest Nvidia Drivers
ubuntu-drivers devices
-
sudo ubuntu-drivers autoinstall
ORsudo apt install nvidia-driver-440
sudo reboot now
sudo passwd $whoami
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="[\[\033[01;31m\]\u\[\033[m\]@\[\033[01;34m\]\h\[\033[m\]] [\[\033[m\]\w\[\033[m\]]\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \[\033[01m\]-\[\033[m\] "
For other colors of the prompt,
export PS1="[\[\033[01;32m\]\u\[\033[m\]@\[\033[01;33m\]\h\[\033[m\]] [\[\033[m\]\w\[\033[m\]]\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \[\033[01m\]-\[\033[m\] "
# 01;32m for green and 01;33m for yellow
Name a terminal here
Comment out the following from .bashrc
case "$TERM" in
xterm*|rxvt*)
# JEFFYEE REMOVED because it makes commands to title() not work
#PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
PROMPT_COMMAND='echo -ne "\033]0;SOME TITLE HERE\007"'
Fails to find Eigen
for example #include <Eigen/Core>
throws error but can be rectified using #include <eigen3/Eigen/Core>
Another approach is
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen
CMTC error when catkin_make
sudo apt-get install libcgal-dev
Problems encountered
- Hard drive not being detected when trying to boot from the USB ubuntu disk and it tries to install it in the pendrive itself
** Procedure **
- Press
window+R
key to and type indiskmgmt.msc
. Shrink the drive to the required size for Ubuntu. This will be seen asunallocated
- Follow this and change SATA to AHCI
- Disable secure boot in BIOS
- There is a chance that the boot will complain about
mmx64.efi
not found error. Just go to the installation disk, in\efi\boot\
renamegrubx64.efi
tommx64.efi
. - Follow this to set up your
\swap
,\home
and\
(root) partitions
Note: Some Dell laptops goes to black screen when trying to connect to wifi during installation. Better connect via ethernet cable
- The error is caused by fonts used in Matplotlib plots. Check out this article. An example plot is available here
Update bashrc
with
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64/bin:$LD_LIBRARY_PATH
Here, the folder cudaa-10.2
should be appropriate as there could be other cuda versions depending on the GPU that you have
Updating grup after nvidia driver installation AskUbuntu
sudo nano /etc/default/grub
and add the parameter nvidia-drm.modeset=1
to the line GRUB_CMDLINE_LINUX_DEFAULT
. Save the change and run sudo update-grub
. Restart
Error:remote server display not supported e.g Wayland.
Solution:
Go to /etc/gdm3/custom.conf
file and change:
[daemon]
# Enabling automatic login
AutomaticLoginEnable=true
AutomaticLogin=$USERNAME
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
# to disable hibernating
sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
# to enable hibernating
import sys
sys.path.append('/path/to/application/app/folder')
-
sudo apt-get install vokoscreen
for audio + webcam recording -
sudo apt-get install kdenlive
for video editing like windows movie maker
Details here
import gym
gym.envs.registry.all()
d, s = 20, 'Ash'
print('%s is my name and my age is %.2d' % (s, d))
Out: Ash is my name and my age is 20
print('%s is my name and my age is %.4d' % (s, d))
Out: Ash is my name and my age is 0020
sudo apt install gnome-tweak-tool
This will show up as Tweaks
in the Menu
Install MuJoCo Youtube
-
Get the license
mjkey.txt
as detailed in here -
Download MuJoCo, extract and place it in the desired folder
-
Update the
~/.bashrc
as shown below by pointing to thebin
folder
export LD_LIBRARY_PATH=/home/ash/softwares/mujoco200_linux/bin:$LD_LIBRARY_PATH
export PATH=$LD_LIBRARY_PATH:$PATH
- Inside
bin
folder, run./simulate ../model/humanoid.xml
to test the installation
-
Unzip the downloaded mujoco directory into
~/.mujoco/mujoco200
, and place your license key (the mjkey.txt file from your email) at~/.mujoco/mjkey.txt
. -
Update
~/.bashrc
as follows (setbin
folder usingexport
)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ash/.mujoco/mujoco200/bin
pip3 install -U 'mujoco-py<2.1,>=2.0'
Note: If the above doesnt work, it's best to clone the mujoco-py repo and do a pip install -e .
to install dependencies.
- If
patchelf
error comes
sudo add-apt-repository ppa:jamesh/snap-support
sudo apt-get update
sudo apt install patchelf
sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
If you installed above libraries and you still see an error that -lGL cannot be found, most likely you need to create the symbolic link directly:
sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so
- If
GLEW
initialization error comes. Installlibglew-dev
using synaptic package manager and add the following tobashrc
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
Add robotpkg repo. Note: Replace the appropriate version of Ubuntu in the following line by lsb_release -c
-
sudo sh -c "echo 'deb [arch=amd64] http://robotpkg.openrobots.org/packages/debian/pub bionic robotpkg' >> /etc/apt/sources.list.d/robotpkg.list"
-
curl http://robotpkg.openrobots.org/packages/debian/robotpkg.key | sudo apt-key add -
-
sudo apt-get update
-
sudo apt-get install robotpkg-py36-pinocchio
-
Configure environment variables by adding the following in
.bashrc
export PATH=/opt/openrobots/bin:$PATH
export PKG_CONFIG_PATH=/opt/openrobots/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/opt/openrobots/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/opt/openrobots/lib/python2.7/site-packages:$PYTHONPATH
Analytical Derivatives of Rigid Body Dynamics Algorithms
-
sudo apt install python3-pip
-
pip3 install virtualenv
-
python3 -m venv /path/venv_name
-
source /path/venv_name/bin/activate
Remove
-
jupyter kernalspec list
-
jupyter kernelspec uninstall unwanted-kernel-name
Add
-
Activate virtual environment
source path_to_env/bin/activate
. -
pip install jupyter notebook
-
pip install --user ipykernel
-
python -m ipykernel install --user --name=env_name
Edit /etc/cups/cupsd.conf
Change:
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
To:
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType None
Order deny,allow
</Limit>
sudo service cups restart or restart
New document on right click menu here
touch ~/Templates/"Untitled Document"
“UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.”
solution: sudo apt-get install python3-tk
To have Terminator on the right click menu check here
sudo add-apt-repository ppa:daniel-marynicz/filemanager-actions
sudo apt-get install filemanager-actions-nautilus-extension
Run fma-config-tool
in the terminal. In the FileManager-Action Configuration Tool
, go to
File-->New Action, In Action tab, add context label as Open in terminator, check box 'display item on location context menu'. In command tab, add path as /usr/bin/terminator
or find out path of programs by typing which terminator
in terminal. Add Parameter --workidng-directory=%d/%b
solution: inotify_watch failed
echo fs.inotify.max_user_watches=65536 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Activate the virtual env by source path/to/venv/bin/activate
.
The MassMatrix folder has several files starting with filename wrapper
. Take the setup.py
outside MassMatrix folder and add path as shown below
af = '/home/ash/Ash/model_predictive_control/src/MassMatrix/'
ext_mods = [Extension(
af+'wrapper_module_0', [af+'wrapper_module_0.pyx', af+'wrapped_code_0.c'],
...............
..............
Then run python setup.py install
to make the wrapper_module_0.pyx
available for import. The import can be carried out as
from MassMatrix.wrapper_module_0 import autofunc_c as MassMatrix
jupyter notebook --generate-config
c.NotebookApp.browser = '/usr/bin/google-chrome'
You'll find the path for example by typing which firefox
Fix for 'error while loading shared libraries: cannot open shared object file: No such file or directory'
- Find where the library is placed if you don't know it.
sudo find / -name the_name_of_the_file.so
- Check for the existence of the dynamic library path environment variable(LD_LIBRARY_PATH)
echo $LD_LIBRARY_PATH
- if there is nothing to be displayed, add a default path value (or not if you wish to)
LD_LIBRARY_PATH=/usr/local/lib
- Add the desire path in the
.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:path_obtained_from_find
curl -o drake.tar.gz https://drake-packages.csail.mit.edu/drake/continuous/drake-latest-bionic.tar.gz
sudo tar -xvzf drake.tar.gz -C /opt
sudo /opt/drake/share/drake/setup/install_prereqs
export PYTHONPATH=/opt/drake/lib/python2.7/site-packages:${PYTHONPATH}
- Underactuated
git clone https://github.com/RussTedrake/underactuated.git
sudo underactuated/scripts/setup/ubuntu/18.04/install_prereqs
export PYTHONPATH=`pwd`/underactuated/src:${PYTHONPATH}
# change 'pwd' to the appropriate direction to which underactuated is cloned
python3 -c 'import pydrake; print(pydrake.__file__)
cd Downloads/drake_docker_utility_scripts
./docker_run_notebook.sh drake-20190129 ./set_1_code
# To open the jupyter connection
Open a browser and go to http://127.0.0.1:8080/
. Use password mit6832
.
Inside ~/Downloads/drake_docker_utility_scripts, run ./docker_run_bash_linux.sh drake-20190129 .
to get the terminal access
File->Settings->Project Interpreter and then '+' button 'opencv-python' --> Install package
sudo apt-get install unrar
unrar x filename.rar
After installing anaconda, by default the terminal appears to have (base) user@username:
. This would install all python packages to the anaconda installation directory. To prevent this, run the following
conda config --set auto_activate_base False
sudo add-apt-repository ppa:jonathonf/texlive-2019
sudo apt-get install texlive
sudo update-alternatives --config python3
(urdf model loading not working, 21/05/2019) Pre-requisite:
- Download Eigen3 linear algebra library from http://eigen.tuxfamily.org and extract it
-
cd
into the above folder.mkdir build
cd build
cmake ../
make install
-
git clone https://github.com/ros/urdfdom_headers.git
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release ../
sudo make install
-
git clone https://github.com/ros/urdfdom.git
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release ../
sudo make install
In the rbdl\CmakeLists.txt, change OPTION (RBDL_BUILD_PYTHON_WRAPPER "Build experimental python wrapper" ON)
OPTION (RBDL_BUILD_ADDON_URDFREADER "Build the (experimental) urdf reader" ON)
-
mkdir build
cd build/
sudo cmake -std=c++11 -D CMAKE_BUILD_TYPE=Release -D RBDL_BUILD_PYTHON_WRAPPER=ON RBDL_BUILD_ADDON_URDFREADER=ON ../ ../
sudo make -j4
sudo make install
The above will create a setup.py file in /path/rbdl/python/python. I copied the file to /path/rbdl/python and ransudo ./setup.py install
Testing:
- In the terminal, type
python
to go to python prompt. >>> import rbdl
(venv) test@test:~/Ash/robot_arm_RL$ pip list | grep tensorflow
# in pycharm terminal
-
pip install --upgrade scipy=1.2.0
# to have scipy.interpolate (not available in 0.17.0) - while running
catkin_make
, warehouseConfig.cmake error due to files missing in MoveIt. Reinstall MoveIt from here
sudo apt install python3-pip
sudo python -m pip uninstall pip && sudo apt install python-pip --reinstall
sudo apt-get remove python-pip
# to remove pip
pip install pip==9.0.1
# to install specific pip version
Note: Do not upgrade pip using pip install upgrade --pip
as it throws some error ImportError: cannot import name main
as of 18/03/2019
Note: The above import error no longer occurs after running hash -d pip
. (12/06/2019)
sudo apt-get install python-numpy python-scipy python-matplotlib
pip install slycot
pip install control
If the above slycot installation doesnt work, follow
pip install scikit-build
sudo apt-get install gfortran liblapack-dev
git clone https://github.com/python-control/Slycot.git slycot
cd slycot
sudo python setup.py install
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text
Uninstall sublime:
sudo apt-get remove sublime-text && sudo apt-get autoremove
-
If you have a CMakeLists.txt, cd to the directory and use 'cmake CMakeLists.txt' in terminal first and then 'make' to get the executable file. Note that the CMakeLists.txt should contain a file_name.cpp whose contents are to be there inside the same folder containing CMakeLists.txt as a separate file
-
Inverse kinematics in moveit is computed using the "compute_ik" service call. The compute_ik is defined as IK_SERVICE_NAME in the file capability_names.h (/src/moveit/moveit_ros/move_group/include/moveit/move_group) and it calls the kinematics_service_capability.cpp(/src/moveit/moveit_ros/move_group/src/default_capabilities) which has the function definition for IK.
pcl_viewer -multiview 1 chef.pcd
ps ax |grep controller.py
output: 16768 pts/17 Sl+ 0:00 python controller.py
kill -9 16768
Install ssh server from here
nc -v -w 1 10.5.32.5 -z 22
# To check if ssh is installed and 22 is the port number
ssh [email protected]
give the password: p_ _ g _ _n
to close type 'exit' or press ctrl+D
- Terminal on remote shows
ujjar@headlight
- On the host terminal, do the following
-
scp [email protected]:/home/ujjar/telesto_test/pcds_.zip /home/ash/Ash
# to copy file -
scp -r [email protected]:/home/ujjar/telesto_test/ /home/ash/Ash
# to copy folder
convert figure.png -trim +repage a.png
ffmpeg -i input.wmv -s size output.mp4
ffmpeg -i fwd_kin.mp4 -qscale 0 -vf scale=-1:760 fwd_kin.wmv
# to preserve quality
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
# libx265 (H.265) is better than libx264 (H.264) but it wont play in browser
ffmpeg -i input.mp4 -vcodec libx264 -crf 35 output.mp4
(size could be qcif 176x144, cif 352x288, 4cif 704x576, 16cif i408x1152, qqvga 160x120, qvga 320x240, vga 640x480, svga 800x600, xga 1024x768, uxga 1600x1200, qxga 2048x1536, sxga 1280x1024, qsxga 2560x2048, hsxga 5120x4096, wvga 852x480, wxga 1366x768, wsxga 1600x1024, wuxga 1920x1200, woxga 2560x1600, wqsxga 3200x2048, wquxga 3840x2400 )
ffmpeg -i input_name.mp3 -ss 00:01:40 -to 00:02:20 -c copy output_name.mp3
# crop from 1 min 40 sec to 2 min 20 sec
ffmpeg -i "concat:input_1.mp3|input2.mp3" -acodec copy output.mp3
ffmpeg -i source.mp4 -ss 00:00:00 -t 00:00:00 -vcodec copy -acodec copy splice.wmv
This will take source.mp4 and, using the same audio and video codecs and not degrading quality, take -t time after -ss start time and output as splice.wmv. Also, in some distributions, ffmpeg has been replaced with avconv. To run this install
sudo apt-get install libav-tools
Example:
avconv -i originalFile.wmv -ss 00:00:00 -t 00:00:10 -vcodec copy -acodec copy croppedFile.mp4
A similar thing can be done using VLC media player and the detailed instructions are here
ffmpeg -i DSC_0183.MOV -qscale:v 2 -s -s 1920x1080 thumb%04d.jpg -hide_banner
# -qscale to control quality of images
rename 's/\d+/sprintf("%04d", $&)/e' *.jpg
# to rename continuously to 4 digits (%4d 0001, 0002 ...)
ffmpeg -framerate 30 -pattern_type glob -i '*.jpg' -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
ffmpeg -ss 18 -t 47 -i dmp.wmv -vf scale=320:-1 -r 10 -f image2pipe -vcodec ppm - | convert -delay 5 -loop 0 - gif:- | convert -layers Optimize - dmp1.gif
-ss 18
skips the first 18 seconds
-t 47
for 47 seconds
ffmpeg -i input.mp4 -vf scale=400:400 output.mp4 -hide_banner
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex vstack output.mp4
for vertical stack
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex hstack output.mp4
for horizontal stack
ffmpeg -i sample.avi -q:a 0 -map a sample.mp3
To extract audio from video
sudo apt-get install -y meld
## for ubuntu 20.04
sudo apt-get install nautilus-compare
## for ubuntu 18.04
nautilus -q