diff --git a/rosflight_gcs/rviz/viz_mag.rviz b/rosflight_gcs/rviz/viz_mag.rviz index 196e0823..95759bfa 100644 --- a/rosflight_gcs/rviz/viz_mag.rviz +++ b/rosflight_gcs/rviz/viz_mag.rviz @@ -101,7 +101,7 @@ Visualization Manager: Value: true - Class: rviz_default_plugins/Marker Enabled: true - Marker Topic: /viz/cloud + Topic: /viz/cloud Name: Mag Measurements Namespaces: "": true diff --git a/rosflight_gcs/src/viz.cpp b/rosflight_gcs/src/viz.cpp index a7fbd738..822e8fc0 100644 --- a/rosflight_gcs/src/viz.cpp +++ b/rosflight_gcs/src/viz.cpp @@ -42,7 +42,7 @@ Viz::Viz() // retrieve params // initialize variables - mag_skip_ = 20; + mag_skip_ = 1; mag_throttle_ = 0; // Magnetometer visualization @@ -61,9 +61,11 @@ void Viz::magCallback(const sensor_msgs::msg::MagneticField::ConstSharedPtr & ms { if (mag_throttle_ > mag_skip_) { // unpack message - double x = msg->magnetic_field.x; - double y = msg->magnetic_field.y; - double z = msg->magnetic_field.z; + + float SCALING_FACTOR = 100'000.; // To make the changes appear. + double x = msg->magnetic_field.x*SCALING_FACTOR; + double y = msg->magnetic_field.y*SCALING_FACTOR; + double z = msg->magnetic_field.z*SCALING_FACTOR; // get euler angles from vector (assume no roll) double yaw = atan2(y, x); @@ -102,7 +104,7 @@ void Viz::magCallback(const sensor_msgs::msg::MagneticField::ConstSharedPtr & ms pts_msg.action = visualization_msgs::msg::Marker::ADD; // set points style - pts_msg.scale.x = 0.1; + pts_msg.scale.x = 0.05; pts_msg.scale.y = pts_msg.scale.x; pts_msg.scale.z = pts_msg.scale.x; pts_msg.color.a = 1.0;