ros2_control - rolling
Loading...
Searching...
No Matches
mujoco_ros2_control
mujoco_ros2_control
src
render_loop_exit.hpp
1
17
#ifndef MUJOCO_ROS2_CONTROL__RENDER_LOOP_EXIT_HPP_
18
#define MUJOCO_ROS2_CONTROL__RENDER_LOOP_EXIT_HPP_
19
20
#include <atomic>
21
#include <memory>
22
23
#include <rclcpp/context.hpp>
24
25
namespace
mujoco_ros2_control::detail
26
{
27
28
inline
bool
handle_render_loop_exit(std::atomic<int>&
exit_request
,
29
const
std::atomic<bool>&
explicit_shutdown_requested
,
30
const
std::shared_ptr<rclcpp::Context>&
context
)
31
{
32
// MuJoCo sets exitrequest when the window closes, so it cannot distinguish a user close from
33
// MujocoSimulation::shutdown(). The owner marks the latter before waking RenderLoop().
34
exit_request
.store(1);
35
if
(
explicit_shutdown_requested
.load())
36
{
37
return
false
;
38
}
39
40
return
context
&&
context
->shutdown(
"MuJoCo rendering window closed"
);
41
}
42
43
}
// namespace mujoco_ros2_control::detail
44
45
#endif
// MUJOCO_ROS2_CONTROL__RENDER_LOOP_EXIT_HPP_
mujoco_ros2_control::detail
Definition
utils.hpp:97
mujoco_ros2_control::detail::sample_noise
Eigen::Matrix< double, N, 1 > sample_noise(double stddev, NoiseDistribution distribution, std::mt19937 &rng)
Fills an N-vector with independent zero-mean noise samples of the given standard deviation and shape,...
Definition
utils.hpp:108
Generated by
1.9.8