Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Base Station ROS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Larkin Heintzman
Base Station ROS
Commits
2e1b0948
Commit
2e1b0948
authored
Feb 02, 2022
by
Larkin Heintzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
image saving node wip
parent
58a74a63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
image_test.launch
base_station/launch/image_test.launch
+2
-2
machines.launch
base_station/launch/machines.launch
+3
-0
imageSaverNode.py
base_station/scripts/imageSaverNode.py
+15
-3
No files found.
base_station/launch/image_test.launch
View file @
2e1b0948
...
...
@@ -2,7 +2,7 @@
<!-- define all names parameter -->
<rosparam command="load" param="nameList">
["
nerudaKube
"]
["
baseStation
"]
</rosparam>
<!-- load machine names, plath, neruda, and home versions -->
...
...
@@ -27,7 +27,7 @@
<!-- launch neruda vehicle nodes -->
<include file="$(find base_station)/launch/remote_image_test.launch">
<arg name="machine_name" value="
nerudaKube
"/>
<arg name="machine_name" value="
baseStation
"/>
<arg name="machine_id" value="0"/>
</include>
...
...
base_station/launch/machines.launch
View file @
2e1b0948
...
...
@@ -24,6 +24,9 @@
<machine name="yeatsHouse" address="192.168.1.198" env-loader="/opt/ros/noetic/yeats_house_env.sh" user="larkin" default="never" timeout="20" password="Meepp973"/>
<machine name="yeatsModem" address="192.168.111.203" env-loader="/opt/ros/noetic/yeats_modem_env.sh" user="larkin" default="never" timeout="20" password="Meepp973"/>
<machine name="baseStation" address="localhost" env-loader="/opt/ros/noetic/env.sh" user="llh" default="never" timeout="20" password="Meepp973"/>
<!-- kubernetes connections, interface tbd -->
<machine name="nerudaKube" address="service-drone" env-loader="/opt/ros/noetic/kube_setup.sh" user="ssher" default="never" timeout="20" password="password"/>
...
...
base_station/scripts/imageSaverNode.py
View file @
2e1b0948
#! /usr/bin/python3
#! /home/llh/anaconda3/bin/python
# just saves the image instead of opening viewer window, for kubernetes node
import
rospy
,
sys
,
math
,
cv2
,
numpy
as
np
,
std_msgs
.
msg
from
sensor_msgs.msg
import
Image
from
std_msgs.msg
import
Header
import
os.path
,
getpass
from
cv_bridge
import
CvBridge
,
CvBridgeError
class
ImageViewer
():
...
...
@@ -11,26 +15,34 @@ class ImageViewer():
self
.
subscriber
=
rospy
.
Subscriber
(
"usb_camera/image_raw"
,
Image
,
self
.
imageCallback
)
self
.
params
=
None
self
.
image
=
None
self
.
seq
=
None
def
imageCallback
(
self
,
frame
):
# self.params = self.getParams()
try
:
self
.
image
=
self
.
bridge
.
imgmsg_to_cv2
(
frame
,
"bgr8"
)
self
.
seq
=
frame
.
header
.
seq
except
CvBridgeError
as
err
:
rospy
.
loginfo
(
"there was error!"
)
rospy
.
loginfo
(
err
)
def
main
():
iv
=
ImageViewer
()
rospy
.
init_node
(
"imageViewer"
)
rospy
.
init_node
(
"imageSaver"
)
folderName
=
"/home/"
+
getpass
.
getuser
()
+
"/imageDump"
# cv2.namedWindow("image window")
cv2
.
waitKey
(
200
)
while
not
rospy
.
is_shutdown
():
if
iv
.
image
is
not
None
:
# cv2.imshow("image window", iv.image)
cv2
.
imwrite
(
"/home/$USER/camera_image.jpeg"
,
iv
.
image
)
cv2
.
waitKey
(
10
)
if
np
.
mod
(
iv
.
seq
,
32
)
==
0
:
if
os
.
path
.
isdir
(
folderName
):
# print ("File exist")
cv2
.
imwrite
(
folderName
+
"/camera_image_{seq}.jpeg"
.
format
(
seq
=
iv
.
seq
),
iv
.
image
)
cv2
.
waitKey
(
1000
)
else
:
print
(
"File not exist"
)
# cv2.destroyAllWindows()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment