mirror of
https://github.com/bjoernellens1/rmp220_middleware.git
synced 2025-01-18 16:16:58 +00:00
Update rmp220_middleware.py
This commit is contained in:
parent
90a6d1d9f9
commit
1ce84a813d
@ -46,6 +46,29 @@ class StateMachineNode:
|
||||
# Timer for periodic updates
|
||||
self.timer = rospy.Timer(rospy.Duration(0.01), self.timer_callback) # 100 Hz
|
||||
|
||||
|
||||
def chassis_mode_callback(self, msg):
|
||||
"""
|
||||
Callback function for handling the chassis mode feedback.
|
||||
Sets the state of the robot based on the chassis mode.
|
||||
"""
|
||||
if self.state == State.PAUSED:
|
||||
return
|
||||
|
||||
if msg.chassis_mode == 0:
|
||||
self.state = State.DISABLED
|
||||
rospy.loginfo('Set chassis_mode to DISABLED')
|
||||
elif msg.chassis_mode == 1:
|
||||
self.state = State.ENABLED
|
||||
rospy.loginfo('Set chassis_mode to ENABLED')
|
||||
elif msg.chassis_mode == 2:
|
||||
self.state = State.PASSIVE
|
||||
rospy.loginfo('Set chassis_mode to PASSIVE')
|
||||
elif msg.chassis_mode == 3:
|
||||
self.state = State.STOPPED
|
||||
rospy.loginfo('Set chassis_mode to STOPPED')
|
||||
|
||||
|
||||
def enable_chassis(self):
|
||||
if self.chassis_enable_client:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user