Skip to content

Commit

Permalink
add posisition data in acq()
Browse files Browse the repository at this point in the history
  • Loading branch information
d-hoshino2626 committed Nov 8, 2024
1 parent cb5b003 commit e96b9f2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions socs/agents/wiregrid_actuator/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,9 @@ def acq(self, session, params=None):
'STR2': 0 or 1, (0: OFF, 1:ON)
.
.
}
},
'position':
'inside' or 'outside' or 'unknown'
},
'timestamp':1601925677.6914878
}
Expand Down Expand Up @@ -845,12 +847,26 @@ def acq(self, session, params=None):
zip(onoff_st, self.actuator.st.io_names):
data['data']['stopper_{}'.format(name)] = onoff
onoff_dict_st[name] = onoff
# Data for position
if (onoff_dict_ls['LSR1'] == 1 or onoff_dict_ls['LSL1'] == 1) \
and not (onoff_dict_ls['LSR2'] == 1 or onoff_dict_ls['LSL2'] == 1):
position = 'outside'
elif (onoff_dict_ls['LSR2'] == 1 or onoff_dict_ls['LSL2'] == 1) \
and not (onoff_dict_ls['LSR1'] == 1 or onoff_dict_ls['LSL1'] == 1):
position = 'inside'
else:
position = 'unknown'
self.log.warn(
'acq(): '
'Unknown position!')
data['data']['position'] = position
# publish data
self.agent.publish_to_feed('wgactuator', data)
# store session.data
field_dict = {'motor': onoff_mt,
'limitswitch': onoff_dict_ls,
'stopper': onoff_dict_st}
'stopper': onoff_dict_st,
'position': position}
session.data['timestamp'] = current_time
session.data['fields'] = field_dict

Expand Down

0 comments on commit e96b9f2

Please sign in to comment.