mirror of
https://github.com/bjoernellens1/rmp220_middleware.git
synced 2025-01-18 16:16:58 +00:00
update
This commit is contained in:
parent
f54826682b
commit
3de3c3f669
@ -64,11 +64,15 @@ class StateMachineNode:
|
|||||||
self.joy_sub = rospy.Subscriber('/joy', Joy, self.joy_callback)
|
self.joy_sub = rospy.Subscriber('/joy', Joy, self.joy_callback)
|
||||||
self.chassis_mode_sub = rospy.Subscriber('/chassis_mode_fb', ChassisModeFb, self.chassis_mode_callback)
|
self.chassis_mode_sub = rospy.Subscriber('/chassis_mode_fb', ChassisModeFb, self.chassis_mode_callback)
|
||||||
|
|
||||||
# Service client initialization with a check
|
# Initialize JoystickServiceCaller
|
||||||
self.chassis_enable_client = None # Ensure it's initialized to None
|
self.joystick_service_caller = JoystickServiceCaller()
|
||||||
|
|
||||||
|
#None # Ensure it's initialized to None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rospy.wait_for_service('set_chassis_enable', timeout=5)
|
#rospy.wait_for_service('set_chassis_enable', timeout=5)
|
||||||
self.chassis_enable_client = rospy.ServiceProxy('set_chassis_enable', RosSetChassisEnableCmdSrv)
|
# Service client initialization with a check
|
||||||
|
self.chassis_enable_client = self.joystick_service_caller.service_proxy
|
||||||
rospy.loginfo('Chassis enable service available.')
|
rospy.loginfo('Chassis enable service available.')
|
||||||
except rospy.ROSException as e:
|
except rospy.ROSException as e:
|
||||||
rospy.logerr(f"Failed to wait for 'set_chassis_enable' service: {e}")
|
rospy.logerr(f"Failed to wait for 'set_chassis_enable' service: {e}")
|
||||||
@ -76,9 +80,6 @@ class StateMachineNode:
|
|||||||
# Timer for periodic updates
|
# Timer for periodic updates
|
||||||
self.timer = rospy.Timer(rospy.Duration(0.01), self.timer_callback) # 100 Hz
|
self.timer = rospy.Timer(rospy.Duration(0.01), self.timer_callback) # 100 Hz
|
||||||
|
|
||||||
# Initialize JoystickServiceCaller
|
|
||||||
self.joystick_service_caller = JoystickServiceCaller()
|
|
||||||
|
|
||||||
def chassis_mode_callback(self, msg):
|
def chassis_mode_callback(self, msg):
|
||||||
"""
|
"""
|
||||||
Callback function for handling the chassis mode feedback.
|
Callback function for handling the chassis mode feedback.
|
||||||
|
Loading…
Reference in New Issue
Block a user