Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Development_Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Montaño Sarria, Andres Felipe
Development_Environment
Commits
19453246
Commit
19453246
authored
1 year ago
by
Montaño Sarria, Andres Felipe
Browse files
Options
Downloads
Patches
Plain Diff
Improve if sentences
parent
b5d72f5e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dotfiles/docker.sh
+7
-6
7 additions, 6 deletions
dotfiles/docker.sh
dotfiles/ros.sh
+12
-28
12 additions, 28 deletions
dotfiles/ros.sh
with
19 additions
and
34 deletions
dotfiles/docker.sh
+
7
−
6
View file @
19453246
...
...
@@ -41,9 +41,9 @@ function dockbuild(){
key
=
$2
if
[[
$key
=
"--shell"
]]
;
then
shell
=
$3
if
[[
$
shell
=
"zsh"
]]
;
then
if
[[
"
${
shell
}
"
=
=
"zsh"
]]
;
then
shell_path
=
"/usr/bin/zsh"
elif
[[
$
shell
=
"bash"
]]
;
then
elif
[[
"
${
shell
}
"
=
=
"bash"
]]
;
then
shell_path
=
"/bin/bash"
else
echo
"
${
RED
}
SHELL:
${
shell
}
not supported
${
NC
}
"
...
...
@@ -97,7 +97,6 @@ function dockrun() {
case
$key
in
--ws
)
workspace
=
"
${
HOME
}
/ros/
${
container_name
}
/
$3
"
export
ROS_WORKSPACE
=
$workspace
shift
shift
;;
...
...
@@ -108,11 +107,11 @@ function dockrun() {
;;
--share
)
resource
=
$3
if
[[
$
resource
=
"video"
]]
;
then
if
[[
"
${
resource
}
"
=
=
"video"
]]
;
then
resource_to_share
=
"--volume /dev/video0:/dev/video0"
elif
[[
$
resource
=
"pcan"
]]
;
then
elif
[[
"
${
resource
}
"
=
=
"pcan"
]]
;
then
resource_to_share
=
"--volume /dev/pcanusb32:/dev/pcanusb32"
elif
[[
$
resource
=
"dev"
]]
;
then
elif
[[
"
${
resource
}
"
=
=
"dev"
]]
;
then
resource_to_share
=
"--volume /dev:/dev"
fi
shift
...
...
@@ -130,6 +129,8 @@ function dockrun() {
esac
done
export
ROS_WORKSPACE
=
${
workspace
}
echo
"
${
BLUE
}
Container name:
${
container_name
}
"
echo
"Workspace:
${
workspace
}
"
echo
"Shell:
${
docker_shell
}
"
...
...
This diff is collapsed.
Click to expand it.
dotfiles/ros.sh
+
12
−
28
View file @
19453246
...
...
@@ -9,7 +9,7 @@ else
fi
# Enable colcon tools
if
[[
"
${
ROS_VERSION
}
"
=
2
]]
;
then
if
[[
"
${
ROS_VERSION
}
"
-eq
2
]]
;
then
# Quick directory change
if
[[
-f
"/usr/share/colcon_cd/function/colcon_cd.sh"
]]
;
then
source
/usr/share/colcon_cd/function/colcon_cd.sh
...
...
@@ -21,8 +21,8 @@ if [[ "${ROS_VERSION}" = 2 ]]; then
fi
# Source rosmon
function
smon
(){
if
[[
${
ROS_VERSION
}
=
1
]]
;
then
function
sourcero
smon
(){
if
[[
"
${
ROS_VERSION
}
"
-eq
1
]]
;
then
if
[[
-f
"/opt/ros/
${
ROS_DISTRO
}
/etc/catkin/profile.d/50-rosmon.
${
ext
}
"
]]
;
then
source
/opt/ros/
${
ROS_DISTRO
}
/etc/catkin/profile.d/50-rosmon.
${
ext
}
else
...
...
@@ -33,23 +33,7 @@ function smon(){
# cd to the root of the workspace
function
roshome
(){
if
[
"
${
ROS_VERSION
}
"
=
1
]
then
if
command
-v
roscd &> /dev/null
then
roscd
&&
cd
..
export
ROS_HOME
=
$(
pwd
)
else
echo
"command ** roscd ** not found"
fi
else
if
command
-v
colcon_cd &> /dev/null
then
colcon_cd
else
echo
"command ** colcon_cd ** not found"
fi
fi
cd
${
ROS_HOME
}
}
# Source the current workspace
...
...
@@ -59,7 +43,7 @@ function sourcews(){
ws_name
=
${
cropped
%%/*
}
ws_path
=
${
HOME
}
/ros/
${
ROS_DISTRO
}
/
${
ws_name
}
if
[
"
${
ROS_VERSION
}
"
=
1
]
if
[
[
"
${
ROS_VERSION
}
"
-eq
1
]
]
then
FILE
=
${
ws_path
}
/devel/setup.
${
ext
}
else
...
...
@@ -70,29 +54,29 @@ function sourcews(){
if
[[
-f
$FILE
]]
;
then
cd
${
ws_path
}
echo
"
${
GREEN
}
Sourcing workspace:
${
FILE
}${
NC
}
"
source
$FILE
&&
smon
source
$FILE
&&
sourcero
smon
cd
${
current_dir
}
export
ROS_HOME
=
${
ws_path
}
else
echo
"
${
RED
}
Workspace not found:
${
FILE
}${
NC
}
"
export
ROS_HOME
=
/opt/ros/
${
ROS_DISTRO
}
fi
}
# Source the current workspace
function
sourceros
(){
source
/opt/ros/
${
ROS_DISTRO
}
/setup.
${
ext
}
export
ROS_HOME
=
"/opt/ros/
${
ROS_DISTRO
}
/"
# In ROS 1 source rosmon
if
[
"
${
ROS_VERSION
}
"
=
1
]
if
[
[
"
${
ROS_VERSION
}
"
-eq
1
]
]
then
smon
sourcero
smon
fi
}
# Automatic catkin build
function
cb
()
{
pwd_cb
=
$(
pwd
)
if
[
"
${
ROS_VERSION
}
"
=
1
]
if
[
[
"
${
ROS_VERSION
}
"
-eq
1
]
]
then
roshome
catkin build
--summarize
--cmake-args
-DCMAKE_BUILD_TYPE
=
Release
--
"
$@
"
...
...
@@ -106,7 +90,7 @@ function cb() {
# Clean workspace (delete the generated folders, then catkin build)
function
cbclean
(){
if
[
"
${
ROS_VERSION
}
"
=
1
]
if
[
[
"
${
ROS_VERSION
}
"
-eq
1
]
]
then
roshome
&&
rm
-rf
build devel
install
&&
catkin build
--summarize
--cmake-args
-DCMAKE_BUILD_TYPE
=
Release
else
...
...
@@ -136,7 +120,7 @@ alias sc=sourcews
# Check if ROS_DISTRO is set.
if
[[
-z
"
${
ROS_DISTRO
}
"
]]
;
then
ROS_DIR
=
/opt/ros
if
[
-d
"
$ROS_DIR
"
]
;
if
[
-d
"
$
{
ROS_DIR
}
"
]
;
then
export
ROS_DISTRO
=
$(
basename
$(
find /opt/ros/
*
-maxdepth
0
-type
d |
head
-1
))
#echo "ROS_DISTRO set to ${ROS_DISTRO}"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment