Hi, am trying to subscribe to a Niryo simulator ros topic "/niryo_robot_hardware_interface/hardware_status" , i write a code following the RosSharp subscibers, but i am not able to get any result, i verified the subscribers with "rostopics info" and i found that i don't even subscribe, i tried to do an rostopic echo, and the ros a correctly publishing into the topic, i tried also pynirio to test if it's possible to get the HardwareStatus with it, and yes no problem with that.
Here is my question:
So my question is , is the code bellow wrong, do you encoutered the same problem, do you have any suggestion or sollution
I am using the latest ROS# version available here on the master branch.
My OS is:
My Unity Version is: 2020.3.19f
My ROS Distribution is: Melodic
My Build Target Platform is: Windows, Android
Relevant Code:
using RosSharp.RosBridgeClient;
using RosSharp.RosBridgeClient.MessageTypes.NiryoRobot;
using UnityEngine.UI;
public class HardwarestatusSubscriber : UnitySubscriber<HardwareStatus>
{
public Text text;
public int temp;
public bool isRecieved;
protected override void Start()
{
base.Start();
}
protected override void ReceiveMessage(HardwareStatus message)
{
isRecieved = true;
temp = message.temperatures[0];
}
}
And this is the HardwareStatus msg :
using RosSharp.RosBridgeClient.MessageTypes.Std;
namespace RosSharp.RosBridgeClient.MessageTypes.NiryoRobot
{
public class HardwareStatus : Message
{
public const string RosMessageName = "niryo_robot_msgs/HardwareStatus";
public Header header { get; set; }
// Raspberry Pi board
public int rpi_temperature { get; set; }
// Ned, One, ....
public string hardware_version { get; set; }
// Hardware State
public const sbyte ERROR = -1;
public const sbyte NORMAL = 0;
public const sbyte DEBUG = 1;
public const sbyte REBOOT = 2;
public sbyte hardware_state { get; set; }
// Motors
public bool connection_up { get; set; }
public string error_message { get; set; }
public bool calibration_needed { get; set; }
public bool calibration_in_progress { get; set; }
public string[] motor_names { get; set; }
public string[] motor_types { get; set; }
public int[] temperatures { get; set; }
public double[] voltages { get; set; }
public int[] hardware_errors { get; set; }
public string[] hardware_errors_message { get; set; }
public HardwareStatus()
{
this.header = new Header();
this.rpi_temperature = 0;
this.hardware_version = "";
this.hardware_state = 0;
this.connection_up = false;
this.error_message = "";
this.calibration_needed = false;
this.calibration_in_progress = false;
this.motor_names = new string[0];
this.motor_types = new string[0];
this.temperatures = new int[0];
this.voltages = new double[0];
this.hardware_errors = new int[0];
this.hardware_errors_message = new string[0];
}
public HardwareStatus(Header header, int rpi_temperature, string hardware_version, sbyte hardware_state, bool connection_up, string error_message, bool calibration_needed, bool calibration_in_progress, string[] motor_names, string[] motor_types, int[] temperatures, double[] voltages, int[] hardware_errors, string[] hardware_errors_message)
{
this.header = header;
this.rpi_temperature = rpi_temperature;
this.hardware_version = hardware_version;
this.hardware_state = hardware_state;
this.connection_up = connection_up;
this.error_message = error_message;
this.calibration_needed = calibration_needed;
this.calibration_in_progress = calibration_in_progress;
this.motor_names = motor_names;
this.motor_types = motor_types;
this.temperatures = temperatures;
this.voltages = voltages;
this.hardware_errors = hardware_errors;
this.hardware_errors_message = hardware_errors_message;
}
}
}
Hi, am trying to subscribe to a Niryo simulator ros topic "/niryo_robot_hardware_interface/hardware_status" , i write a code following the RosSharp subscibers, but i am not able to get any result, i verified the subscribers with "rostopics info" and i found that i don't even subscribe, i tried to do an rostopic echo, and the ros a correctly publishing into the topic, i tried also pynirio to test if it's possible to get the HardwareStatus with it, and yes no problem with that.
Here is my question: So my question is , is the code bellow wrong, do you encoutered the same problem, do you have any suggestion or sollution
I am using the latest ROS# version available here on the master branch.
Relevant Code:
And this is the HardwareStatus msg :