Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanscherzinger committed Apr 8, 2024
1 parent c84c492 commit 438e330
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class CartesianControllerBase : public controller_interface::ControllerInterface
*
* @return True if the controller is active, false otherwise
*/
bool isActive() const {return m_active;};
bool isActive() const { return m_active; };

KDL::Chain m_robot_chain;

Expand Down
45 changes: 24 additions & 21 deletions cartesian_controller_tests/integration_tests/integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,44 +155,47 @@ def test_inputs_with_nans(self):
The controllers' callbacks store them even when in inactive state after startup.
We then check if every controller can be activated normally.
"""

def publish_nan_targets():
# Target pose
target_pose = PoseStamped()
target_pose.header.frame_id = "base_link"
target_pose.pose.position.x = float('nan')
target_pose.pose.position.y = float('nan')
target_pose.pose.position.z = float('nan')
target_pose.pose.orientation.x = float('nan')
target_pose.pose.orientation.y = float('nan')
target_pose.pose.orientation.z = float('nan')
target_pose.pose.orientation.w = float('nan')
target_pose.pose.position.x = float("nan")
target_pose.pose.position.y = float("nan")
target_pose.pose.position.z = float("nan")
target_pose.pose.orientation.x = float("nan")
target_pose.pose.orientation.y = float("nan")
target_pose.pose.orientation.z = float("nan")
target_pose.pose.orientation.w = float("nan")
self.target_pose_pub.publish(target_pose)

# Force-torque sensor
ft_sensor_wrench = WrenchStamped()
ft_sensor_wrench.wrench.force.x = float('nan')
ft_sensor_wrench.wrench.force.y = float('nan')
ft_sensor_wrench.wrench.force.z = float('nan')
ft_sensor_wrench.wrench.torque.x = float('nan')
ft_sensor_wrench.wrench.torque.y = float('nan')
ft_sensor_wrench.wrench.torque.z = float('nan')
ft_sensor_wrench.wrench.force.x = float("nan")
ft_sensor_wrench.wrench.force.y = float("nan")
ft_sensor_wrench.wrench.force.z = float("nan")
ft_sensor_wrench.wrench.torque.x = float("nan")
ft_sensor_wrench.wrench.torque.y = float("nan")
ft_sensor_wrench.wrench.torque.z = float("nan")
self.ft_sensor_wrench_pub.publish(ft_sensor_wrench)

# Target wrench
target_wrench = WrenchStamped()
target_wrench.wrench.force.x = float('nan')
target_wrench.wrench.force.y = float('nan')
target_wrench.wrench.force.z = float('nan')
target_wrench.wrench.torque.x = float('nan')
target_wrench.wrench.torque.y = float('nan')
target_wrench.wrench.torque.z = float('nan')
target_wrench.wrench.force.x = float("nan")
target_wrench.wrench.force.y = float("nan")
target_wrench.wrench.force.z = float("nan")
target_wrench.wrench.torque.x = float("nan")
target_wrench.wrench.torque.y = float("nan")
target_wrench.wrench.torque.z = float("nan")
self.target_wrench_pub.publish(target_wrench)

for name in self.our_controllers:
self.start_controller(name)
publish_nan_targets()
time.sleep(3) # process some update() cycles
self.assertTrue(self.check_state(name, 'active'), f"{name} survives inputs with NaNs")
time.sleep(3) # process some update() cycles
self.assertTrue(
self.check_state(name, "active"), f"{name} survives inputs with NaNs"
)
self.stop_controller(name)

def check_state(self, controller, state):
Expand Down

0 comments on commit 438e330

Please sign in to comment.