Go to the documentation of this file.
12 #include <mrpt/core/WorkerThreadsPool.h>
13 #include <mrpt/obs/CObservation.h>
14 #include <mrpt/obs/CObservation3DRangeScan.h>
15 #include <mrpt/obs/CObservationGPS.h>
16 #include <mrpt/obs/CObservationIMU.h>
17 #include <mrpt/obs/CObservationPointCloud.h>
18 #include <mrpt/system/CTicTac.h>
19 #include <mrpt/system/CTimeLogger.h>
23 #if defined(MVSIM_HAS_ZMQ) && defined(MVSIM_HAS_PROTOBUF)
30 #if PACKAGE_ROS_VERSION == 1
31 #include <dynamic_reconfigure/server.h>
32 #include <geometry_msgs/Polygon.h>
33 #include <geometry_msgs/PoseArray.h>
34 #include <geometry_msgs/PoseWithCovarianceStamped.h>
35 #include <geometry_msgs/Twist.h>
36 #include <mvsim/mvsimNodeConfig.h>
37 #include <nav_msgs/MapMetaData.h>
38 #include <nav_msgs/OccupancyGrid.h>
39 #include <nav_msgs/Odometry.h>
42 #include <rosgraph_msgs/Clock.h>
43 #include <sensor_msgs/CameraInfo.h>
44 #include <std_msgs/Bool.h>
45 #include <tf2_msgs/TFMessage.h>
46 #include <visualization_msgs/MarkerArray.h>
65 #include <geometry_msgs/msg/polygon.hpp>
66 #include <geometry_msgs/msg/pose_array.hpp>
67 #include <geometry_msgs/msg/pose_with_covariance_stamped.hpp>
68 #include <geometry_msgs/msg/twist.hpp>
69 #include <nav_msgs/msg/map_meta_data.hpp>
70 #include <nav_msgs/msg/occupancy_grid.hpp>
71 #include <nav_msgs/msg/odometry.hpp>
72 #include <rclcpp/clock.hpp>
73 #include <rclcpp/rclcpp.hpp>
74 #include <rclcpp/time_source.hpp>
75 #include <sensor_msgs/msg/camera_info.hpp>
76 #include <std_msgs/msg/bool.hpp>
77 #include <tf2_msgs/msg/tf_message.hpp>
78 #include <visualization_msgs/msg/marker_array.hpp>
102 #if PACKAGE_ROS_VERSION == 1
103 template <
typename T,
typename... Args>
106 return boost::make_shared<T>(std::forward<Args>(
args)...);
109 template <
typename T>
112 template <
typename T,
typename... Args>
115 return std::make_shared<T>(std::forward<Args>(
args)...);
118 template <
typename T>
129 #if PACKAGE_ROS_VERSION == 1
146 #if PACKAGE_ROS_VERSION == 1
148 void configCallback(mvsim::mvsimNodeConfig&
config, uint32_t level);
158 4 , mrpt::WorkerThreadsPool::POLICY_FIFO};
174 #if defined(MVSIM_HAS_ZMQ) && defined(MVSIM_HAS_PROTOBUF)
178 #if PACKAGE_ROS_VERSION == 1
182 rclcpp::Node::SharedPtr
n_;
186 #if PACKAGE_ROS_VERSION == 1
195 #if PACKAGE_ROS_VERSION == 1
201 rclcpp::Publisher<Msg_OccupancyGrid>::SharedPtr
pub_map_ros;
211 #if PACKAGE_ROS_VERSION == 1
225 std::map<std::string, mvsim_node::shared_ptr<ros::Publisher>>
pub_sensors;
236 rclcpp::Subscription<Msg_Twist>::SharedPtr
sub_cmd_vel;
240 rclcpp::Publisher<Msg_Odometry>::SharedPtr
pub_odom;
249 std::map<std::string, mvsim_node::shared_ptr<PublisherWrapperBase>>
pub_sensors;
259 rclcpp::Publisher<Msg_TFMessage>::SharedPtr
pub_tf;
281 #if PACKAGE_ROS_VERSION == 1
344 mrpt::system::CTimeLogger
profiler_{
true ,
"mvsim_node"};
void onNewObservation(const mvsim::Simulable &veh, const mrpt::obs::CObservation::Ptr &obs)
bool do_fake_localization_
void spin()
Process pending msgs, run real-time simulation, etc.
std::shared_ptr< T > make_shared(Args &&... args)
mrpt::system::CTicTac tim_teleop_refresh_
ros_Time base_last_cmd_
received a vel_cmd (for watchdog)
mvsim::World::TGUIKeyEvent gui_key_events_
std::string vehVarName(const std::string &sVarName, const mvsim::VehicleBase &veh) const
int publisher_history_len_
rclcpp::Publisher< Msg_MapMetaData >::SharedPtr pub_map_metadata
bool force_publish_vehicle_namespace_
If true, vehicle namespaces will be used even if there is only one vehicle:
rclcpp::Subscription< Msg_Twist >::SharedPtr sub_cmd_vel
Subscribers vehicle's "cmd_vel" topic.
TThreadParams thread_params_
std::map< mvsim::VehicleBase *, double > lastCmdVelTimestamp_
std::map< std::string, mvsim_node::shared_ptr< PublisherWrapperBase > > pub_sensors
Map <sensor_label> => publisher.
rclcpp::Publisher< Msg_PoseArray >::SharedPtr pub_particlecloud
nav_msgs::msg::MapMetaData Msg_MapMetaData
MVSimNode(rclcpp::Node::SharedPtr &n)
void publishWorldElements(mvsim::WorldElementBase &obj)
std::shared_ptr< T > shared_ptr
visualization_msgs::msg::MarkerArray Msg_MarkerArray
mrpt::system::CTicTac tim_publish_tf_
rclcpp::Clock::SharedPtr clock_
double realtime_factor_
(Defaul=1.0) >1: speed-up, <1: slow-down
static void thread_update_GUI(TThreadParams &thread_params)
mrpt::WorkerThreadsPool ros_publisher_workers_
geometry_msgs::msg::Twist Msg_Twist
void terminateSimulation()
tf2_msgs::msg::TFMessage Msg_TFMessage
geometry_msgs::msg::Polygon Msg_Polygon
rclcpp::Publisher< Msg_Odometry >::SharedPtr pub_odom
Publisher of "odom" topic.
nav_msgs::msg::Odometry Msg_Odometry
rclcpp::Publisher< Msg_Bool >::SharedPtr pub_collision
"<VEH>/collision"
sensor_msgs::msg::CameraInfo Msg_CameraInfo
rclcpp::Publisher< Msg_Odometry >::SharedPtr pub_ground_truth
"base_pose_ground_truth" topic
mrpt::system::CTicTac realtime_tictac_
rclcpp::Publisher< Msg_PoseWithCovarianceStamped >::SharedPtr pub_amcl_pose
"fake_localization" pubs:
rclcpp::Publisher< Msg_OccupancyGrid >::SharedPtr pub_map_ros
used for simul_map publication
geometry_msgs::msg::PoseArray Msg_PoseArray
void notifyROSWorldIsUpdated()
double period_ms_publish_tf_
bool publish_tf_odom2baselink_
void onROSMsgCmdVel(Msg_Twist_CSPtr cmd, mvsim::VehicleBase *veh)
std_msgs::msg::Bool Msg_Bool
geometry_msgs::msg::Twist::ConstSharedPtr Msg_Twist_CSPtr
ros_Duration base_watchdog_timeout_
rclcpp::Duration ros_Duration
void publishVehicles(mvsim::VehicleBase &veh)
size_t teleop_idx_veh_
for teleoperation from the GUI (selects the focused" vehicle)
const tf2::Transform tfIdentity_
Unit transform (const, once)
rclcpp::Publisher< Msg_TFMessage >::SharedPtr pub_tf_static
void initPubSubs(TPubSubPerVehicle &out_pubsubs, mvsim::VehicleBase *veh)
nav_msgs::msg::OccupancyGrid Msg_OccupancyGrid
bool world_init_ok_
will be true after a success call to loadWorldModel()
void launch_mvsim_server()
void internalOn(const mvsim::VehicleBase &veh, const mrpt::obs::CObservation2DRangeScan &obs)
geometry_msgs::msg::PoseWithCovarianceStamped Msg_PoseWithCovarianceStamped
double period_ms_teleop_refresh_
std::mutex pubsub_vehicles_mtx_
rclcpp::Publisher< Msg_MarkerArray >::SharedPtr pub_chassis_markers
"<VEH>/chassis_markers"
int gui_refresh_period_ms_
rclcpp::Publisher< Msg_Polygon >::SharedPtr pub_chassis_shape
"<VEH>/chassis_shape"
mvsim_node::shared_ptr< mvsim::World > mvsim_world_
mrpt::system::CTimeLogger profiler_
rclcpp::Publisher< Msg_TFMessage >::SharedPtr pub_tf
"<VEH>/tf", "<VEH>/tf_static"
Msg_MarkerArray chassis_shape_msg
std::vector< TPubSubPerVehicle > pubsub_vehicles_
void loadWorldModel(const std::string &world_xml_file)
rclcpp::Node::SharedPtr n_
mvsim
Author(s):
autogenerated on Wed May 28 2025 02:13:08