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
58a74a63
Commit
58a74a63
authored
Feb 02, 2022
by
Larkin Heintzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
images and shebang updates
parent
e4f7ae05
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
46 deletions
+41
-46
image_test.launch
base_station/launch/image_test.launch
+2
-7
remote_image_test.launch
base_station/launch/remote_image_test.launch
+1
-1
imageSaverNode.py
base_station/scripts/imageSaverNode.py
+38
-0
imageSaverNode.py
database_tools/scripts/imageSaverNode.py
+0
-38
No files found.
base_station/launch/image_test.launch
View file @
58a74a63
...
...
@@ -8,27 +8,22 @@
<!-- load machine names, plath, neruda, and home versions -->
<include file="$(find base_station)/launch/machines.launch"/>
<node name="waypointGenerator" pkg="database_tools" type="waypointGenerator.py">
<!-- type of path, from "points" below, "spiral", or "squares" -->
<!-- <node name="waypointGenerator" pkg="database_tools" type="waypointGenerator.py">
<param name="pathType" type="string" value="spiral"/>
<param name="spiralRadius" type="double" value="1"/>
<param name="spiralLoops" type="double" value="2"/>
<param name="spiralHeight" type="double" value="1"/>
<param name="altitudeIncrement" type="double" value="0"/>
<!-- base altitude of all waypoints/position -->
<param name="altitude" type="double" value="2"/>
<!-- number of drones to generate waypoints for -->
<param name="droneNum" type="double" value="3"/>
<rosparam command="load" param="anchorPoint">
<!-- backyard center -->
[37.227531, -80.406156]
</rosparam>
<!-- nearby tree variation -->
<rosparam command="load" param="pathPoints">
[]
</rosparam>
</node>
</node>
-->
<!-- launch neruda vehicle nodes -->
<include file="$(find base_station)/launch/remote_image_test.launch">
...
...
base_station/launch/remote_image_test.launch
View file @
58a74a63
...
...
@@ -7,7 +7,7 @@
<group ns="$(arg machine_name)">
<!-- run viewer on base station laptop -->
<node name="imageViewer" pkg="base_station" type="image
View
erNode.py"/>
<node name="imageViewer" pkg="base_station" type="image
Sav
erNode.py"/>
<!-- 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/imageSaverNode.py
0 → 100755
View file @
58a74a63
#! /usr/bin/python3
# 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
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
.
imwrite
(
"/home/$USER/camera_image.jpeg"
,
iv
.
image
)
cv2
.
waitKey
(
10
)
# cv2.destroyAllWindows()
if
__name__
==
"__main__"
:
main
()
database_tools/scripts/imageSaverNode.py
deleted
100755 → 0
View file @
e4f7ae05
#!/usr/bin/python3
import
rospy
import
cv2
# ROS Image message
from
sensor_msgs.msg
import
Image
# ROS Image message -> OpenCV2 image converter
from
cv_bridge
import
CvBridge
,
CvBridgeError
# OpenCV2 for saving an image
# Instantiate CvBridge
bridge
=
CvBridge
()
def
image_callback
(
msg
):
try
:
# Convert your ROS Image message to OpenCV2
cv2_img
=
bridge
.
imgmsg_to_cv2
(
msg
,
"bgr8"
)
rospy
.
loginfo
(
"received new image."
)
# Save your OpenCV2 image as a jpeg
cv2
.
imwrite
(
'/home/llh/sarwebui/media/droneimages/camera_image.jpeg'
,
cv2_img
)
except
CvBridgeError
as
e
:
print
(
e
)
def
main
():
rospy
.
init_node
(
'image_handler'
)
# Define your image topic
if
(
rospy
.
get_param
(
'camera_type'
)
==
0
):
image_topic
=
"dji_osdk_ros/fpv_camera_images"
else
:
image_topic
=
"dji_osdk_ros/main_camera_images"
# Set up your subscriber and define its callback
rospy
.
Subscriber
(
image_topic
,
Image
,
image_callback
)
# Spin until ctrl + c
rospy
.
loginfo
(
"image handler ready for images..."
)
rospy
.
spin
()
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