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
a0ec68de
Commit
a0ec68de
authored
Feb 02, 2022
by
Larkin Heintzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remote image launch file updates
parent
2e1b0948
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
46 deletions
+16
-46
remote_image_test.launch
base_station/launch/remote_image_test.launch
+5
-1
imageNode.py
base_station/scripts/imageNode.py
+11
-7
imageViewerNode.py
base_station/scripts/imageViewerNode.py
+0
-38
No files found.
base_station/launch/remote_image_test.launch
View file @
a0ec68de
...
...
@@ -7,7 +7,11 @@
<group ns="$(arg machine_name)">
<!-- run viewer on base station laptop -->
<node name="imageViewer" pkg="base_station" type="imageSaverNode.py"/>
<node name="imageNode" pkg="base_station" type="imageNode.py">
<param name="visualize" type="bool" value="false"/>
<param name="save" type="bool" value="true"/>
<param name="folderName" type="string" value="/home/ssher/imageDump"/>
</node>
<!-- run webcam stream on remote node -->
<!-- got to do this here because including a file to a remote machine is apparently frowned upon -->
...
...
base_station/scripts/image
Saver
Node.py
→
base_station/scripts/imageNode.py
View file @
a0ec68de
#! /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
...
...
@@ -29,8 +26,12 @@ class ImageViewer():
def
main
():
iv
=
ImageViewer
()
rospy
.
init_node
(
"imageSaver"
)
folderName
=
"/home/"
+
getpass
.
getuser
()
+
"/imageDump"
# cv2.namedWindow("image window")
windowFlag
=
rospy
.
get_param
(
"~visualize"
)
saveFlag
=
rospy
.
get_param
(
"~save"
)
folderName
=
rospy
.
get_param
(
"~folderName"
)
# folderName = "/home/" + getpass.getuser() + "/imageDump"
if
windowFlag
:
cv2
.
namedWindow
(
"image window"
)
cv2
.
waitKey
(
200
)
while
not
rospy
.
is_shutdown
():
...
...
@@ -39,8 +40,11 @@ def main():
if
np
.
mod
(
iv
.
seq
,
32
)
==
0
:
if
os
.
path
.
isdir
(
folderName
):
# print ("File exist")
if
windowFlag
:
cv2
.
imshow
(
"image window"
,
iv
.
image
)
if
saveFlag
:
cv2
.
imwrite
(
folderName
+
"/camera_image_{seq}.jpeg"
.
format
(
seq
=
iv
.
seq
),
iv
.
image
)
cv2
.
waitKey
(
10
00
)
cv2
.
waitKey
(
10
)
else
:
print
(
"File not exist"
)
...
...
base_station/scripts/imageViewerNode.py
deleted
100755 → 0
View file @
2e1b0948
#! /home/llh/anaconda3/bin/python
# may need to change that shebang for jetson
import
rospy
,
sys
,
math
,
cv2
,
numpy
as
np
,
std_msgs
.
msg
from
sensor_msgs.msg
import
Image
from
cv_bridge
import
CvBridge
,
CvBridgeError
class
ImageViewer
():
def
__init__
(
self
):
self
.
bridge
=
CvBridge
()
self
.
subscriber
=
rospy
.
Subscriber
(
"usb_camera/image_raw"
,
Image
,
self
.
imageCallback
)
self
.
params
=
None
self
.
image
=
None
def
imageCallback
(
self
,
frame
):
# self.params = self.getParams()
try
:
self
.
image
=
self
.
bridge
.
imgmsg_to_cv2
(
frame
,
"bgr8"
)
except
CvBridgeError
as
err
:
rospy
.
loginfo
(
"there was error!"
)
rospy
.
loginfo
(
err
)
def
main
():
iv
=
ImageViewer
()
rospy
.
init_node
(
"imageViewer"
)
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
.
waitKey
(
10
)
cv2
.
destroyAllWindows
()
if
__name__
==
"__main__"
:
main
()
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