Skip to content

Commit

Permalink
Merge pull request #79 from hsp-iit/feature/camera_parameters
Browse files Browse the repository at this point in the history
camera parameters defaulting at startup
  • Loading branch information
steb6 authored Jul 11, 2024
2 parents 26371e3 + d19c01d commit e0a62a7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
19 changes: 15 additions & 4 deletions scripts/realsense_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
import yarp
from yarp import IFrameGrabberControls

EXPOSURE=1
GAIN=8
HUE=4

props = yarp.Property()
props.put('device', 'RGBDSensorClient')
props.put('localImagePort', '/RealsenseGUI/rgbImage:i')
Expand Down Expand Up @@ -38,8 +42,15 @@
border_width=0), sg.InputText(size=(5, 1), key='hue_tb')]
]

# Default Camera Parameters tested in roboarena

iface.setFeature(EXPOSURE, 0.75 / 100.)
iface.setFeature(GAIN, 35 / 100.)
iface.setFeature(HUE, 55 / 100.)


# Create the window
window = sg.Window('Sliders Example', layout)
window = sg.Window('Realsense Parameters', layout)

# Event loop
while True:
Expand All @@ -50,15 +61,15 @@
value = values[event]
window.Element("exposure_tb").Update(value)
window.Element("exposure_sl").Update(value)
iface.setFeature(1, value / 100.)
iface.setFeature(EXPOSURE, value / 100.)

elif event == 'gain_sl':
value = values['gain_sl']
iface.setFeature(8, value / 100.)
iface.setFeature(GAIN, value / 100.)

elif event == 'hue_sl':
value = values['hue_sl']
iface.setFeature(4, value / 100.)
iface.setFeature(HUE, value / 100.)

# # Update the slider values based on their text inputs
# for key in ('exposure', 'gain', 'hue'):
Expand Down
10 changes: 8 additions & 2 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ tmux split-window -h -t $TMUX_NAME
tmux select-pane -T "RealSense GUI"
tmux send-keys -t $TMUX_NAME "docker exec -it $DOCKER_CONTAINER_NAME bash" Enter
tmux send-keys -t $TMUX_NAME "cd perception" Enter
tmux send-keys -t $TMUX_NAME "python scripts/realsense_gui.py"
tmux send-keys -t $TMUX_NAME "python scripts/realsense_gui.py" Enter

# COMMUNICATION #######################################################################
tmux select-layout -t $TMUX_NAME tiled
Expand Down Expand Up @@ -197,9 +197,15 @@ then
tmux split-window -h -t $TMUX_NAME
tmux send-keys -t $TMUX_NAME "docker exec -it $DOCKER_CONTAINER_NAME bash" Enter
tmux send-keys -t $TMUX_NAME "yarp repeat /depthCamera/depthImage:r" Enter
tmux send-keys -t $TMUX_NAME "./connect_camera.sh" Enter
fi

if [ -n "$REPEATER" ] # Variable is non-null
then
tmux split-window -h -t $TMUX_NAME
tmux send-keys -t $TMUX_NAME "docker exec -it $DOCKER_CONTAINER_NAME bash" Enter
tmux send-keys -t $TMUX_NAME "cd perception" Enter
tmux send-keys -t $TMUX_NAME "sleep 3 && ./connect_camera.sh" Enter
fi
tmux split-window -h -t $TMUX_NAME

# RPC server
Expand Down

0 comments on commit e0a62a7

Please sign in to comment.