Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor printing of current configuration settings #84

78 changes: 41 additions & 37 deletions src/ConfigFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,45 @@ void Ros_ConfigFile_ValidateNonCriticalSettings()
}
}

void Ros_ConfigFile_PrintActiveConfiguration()
{
Ros_Debug_BroadcastMsg("Config: ros_domain_id = %d", g_nodeConfigSettings.ros_domain_id);
Ros_Debug_BroadcastMsg("Config: node_name = '%s'", g_nodeConfigSettings.node_name);
Ros_Debug_BroadcastMsg("Config: node_namespace = '%s'", g_nodeConfigSettings.node_namespace);
Ros_Debug_BroadcastMsg("Config: remap_rules = '%s'", g_nodeConfigSettings.remap_rules);
Ros_Debug_BroadcastMsg("Config: agent_ip_address = '%s'", g_nodeConfigSettings.agent_ip_address);
Ros_Debug_BroadcastMsg("Config: agent_port_number = '%s'", g_nodeConfigSettings.agent_port_number);
Ros_Debug_BroadcastMsg("Config: sync_timeclock_with_agent = %d", g_nodeConfigSettings.sync_timeclock_with_agent);
Ros_Debug_BroadcastMsg("Config: namespace_tf = %d", g_nodeConfigSettings.namespace_tf);
Ros_Debug_BroadcastMsg("Config: publish_tf = %d", g_nodeConfigSettings.publish_tf);
Ros_Debug_BroadcastMsg("List of configured joint names:");
for (int i = 0; i < MAX_CONTROLLABLE_GROUPS; i += 1)
{
Ros_Debug_BroadcastMsg("---");
for (int j = 0; j < MP_GRP_AXES_NUM; j += 1)
{
if (strlen(g_nodeConfigSettings.joint_names[(i * MP_GRP_AXES_NUM) + j]) > 0)
Ros_Debug_BroadcastMsg(g_nodeConfigSettings.joint_names[(i * MP_GRP_AXES_NUM) + j]);
else
Ros_Debug_BroadcastMsg("x");
}
}
Ros_Debug_BroadcastMsg("---");
Ros_Debug_BroadcastMsg("Config: logging.log_to_stdout = %d", g_nodeConfigSettings.log_to_stdout);
Ros_Debug_BroadcastMsg("Config: update_periods.executor_sleep_period = %d", g_nodeConfigSettings.executor_sleep_period);
Ros_Debug_BroadcastMsg("Config: update_periods.action_feedback_publisher_period = %d", g_nodeConfigSettings.action_feedback_publisher_period);
Ros_Debug_BroadcastMsg("Config: update_periods.controller_status_monitor_period = %d", g_nodeConfigSettings.controller_status_monitor_period);
Ros_Debug_BroadcastMsg("Config: publisher_qos.robot_status = %d", g_nodeConfigSettings.qos_robot_status);
Ros_Debug_BroadcastMsg("Config: publisher_qos.joint_states = %d", g_nodeConfigSettings.qos_joint_states);
Ros_Debug_BroadcastMsg("Config: publisher_qos.tf = %d", g_nodeConfigSettings.qos_tf);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but these lines will now only print a nr (ie: the value of the enum member). They used to print the name of the QoS profile.

It would be nice if we could add a mapping from the enum integer to their string description again, as that would be much more human readable, but I won't block merging this PR for that (seeing as this was already accepted as part of #81.

Ros_Debug_BroadcastMsg("Config: tf_frame_prefix = '%s'", g_nodeConfigSettings.tf_frame_prefix);
Ros_Debug_BroadcastMsg("Config: stop_motion_on_disconnect = %d", g_nodeConfigSettings.stop_motion_on_disconnect);
Ros_Debug_BroadcastMsg("Config: inform_job_name = '%s'", g_nodeConfigSettings.inform_job_name);
Ros_Debug_BroadcastMsg("Config: allow_custom_inform_job = %d", g_nodeConfigSettings.allow_custom_inform_job);
Ros_Debug_BroadcastMsg("Config: userlan_monitor_enabled = %d", g_nodeConfigSettings.userlan_monitor_enabled);
Ros_Debug_BroadcastMsg("Config: userlan_monitor_port = %d", g_nodeConfigSettings.userlan_monitor_port);
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
}

void Ros_ConfigFile_Parse()
{
BOOL bAlarmOnce = TRUE;
Expand Down Expand Up @@ -772,46 +811,11 @@ void Ros_ConfigFile_Parse()
continue;
}

} while (!bOkToInit);
} while (!bOkToInit);
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved

Ros_ConfigFile_ValidateCriticalSettings();
Ros_ConfigFile_ValidateNonCriticalSettings();

Ros_Debug_BroadcastMsg("Config: ros_domain_id = %d", g_nodeConfigSettings.ros_domain_id);
Ros_Debug_BroadcastMsg("Config: node_name = %s", g_nodeConfigSettings.node_name);
Ros_Debug_BroadcastMsg("Config: node_namespace = %s", g_nodeConfigSettings.node_namespace);
Ros_Debug_BroadcastMsg("Config: remap_rules = %s", g_nodeConfigSettings.remap_rules);
Ros_Debug_BroadcastMsg("Config: agent_ip_address = %s", g_nodeConfigSettings.agent_ip_address);
Ros_Debug_BroadcastMsg("Config: agent_port_number = %s", g_nodeConfigSettings.agent_port_number);
Ros_Debug_BroadcastMsg("Config: sync_timeclock_with_agent = %d", g_nodeConfigSettings.sync_timeclock_with_agent);
Ros_Debug_BroadcastMsg("Config: namespace_tf = %d", g_nodeConfigSettings.namespace_tf);
Ros_Debug_BroadcastMsg("Config: publish_tf = %d", g_nodeConfigSettings.publish_tf);
Ros_Debug_BroadcastMsg("List of configured joint names:");
for (int i = 0; i < MAX_CONTROLLABLE_GROUPS; i += 1)
{
Ros_Debug_BroadcastMsg("---");
for (int j = 0; j < MP_GRP_AXES_NUM; j += 1)
{
if (strlen(g_nodeConfigSettings.joint_names[(i * MP_GRP_AXES_NUM) + j]) > 0)
Ros_Debug_BroadcastMsg(g_nodeConfigSettings.joint_names[(i * MP_GRP_AXES_NUM) + j]);
else
Ros_Debug_BroadcastMsg("x");
}
}
Ros_Debug_BroadcastMsg("---");
Ros_Debug_BroadcastMsg("Config: log_to_stdout = %d", g_nodeConfigSettings.log_to_stdout);
Ros_Debug_BroadcastMsg("Config: executor_sleep_period = %d", g_nodeConfigSettings.executor_sleep_period);
Ros_Debug_BroadcastMsg("Config: action_feedback_publisher_period = %d", g_nodeConfigSettings.action_feedback_publisher_period);
Ros_Debug_BroadcastMsg("Config: controller_status_monitor_period = %d", g_nodeConfigSettings.controller_status_monitor_period);
Ros_Debug_BroadcastMsg("Config: robot_status = %d", g_nodeConfigSettings.qos_robot_status);
Ros_Debug_BroadcastMsg("Config: joint_states = %d", g_nodeConfigSettings.qos_joint_states);
Ros_Debug_BroadcastMsg("Config: tf = %d", g_nodeConfigSettings.qos_tf);
Ros_Debug_BroadcastMsg("Config: tf_frame_prefix = %s", g_nodeConfigSettings.tf_frame_prefix);
Ros_Debug_BroadcastMsg("Config: stop_motion_on_disconnect = %d", g_nodeConfigSettings.stop_motion_on_disconnect);
Ros_Debug_BroadcastMsg("Config: inform_job_name = %s", g_nodeConfigSettings.inform_job_name);
Ros_Debug_BroadcastMsg("Config: allow_custom_inform_job = %d", g_nodeConfigSettings.allow_custom_inform_job);
Ros_Debug_BroadcastMsg("Config: userlan_monitor_enabled = %d", g_nodeConfigSettings.userlan_monitor_enabled);
Ros_Debug_BroadcastMsg("Config: userlan_monitor_port = %d", g_nodeConfigSettings.userlan_monitor_port);
Ros_ConfigFile_PrintActiveConfiguration();
}

rmw_qos_profile_t const* const Ros_ConfigFile_To_Rmw_Qos_Profile(Ros_QoS_Profile_Setting val)
Expand Down