Hello,
After running rosbot_ekf
for about 10 minutes, the robot stops and displays the message “process has died.”
The software installed on the robot is Ubuntu 18.04 + ROS Melodic + Docker + Husarnet client.
Additionally, I have modified part of the firmware to publish the PWM signals of each motor.
The code added to the firmware is as follows:
// other header
#include <std_msgs/Float32.h>
// other code
std_msgs::Float32 pwm_msg1;
std_msgs::Float32 pwm_msg2;
std_msgs::Float32 pwm_msg3;
std_msgs::Float32 pwm_msg4;
// The original codes...
ros::Publisher *pwm_pub1;
ros::Publisher *pwm_pub2;
ros::Publisher *pwm_pub3;
ros::Publisher *pwm_pub4;
// The original codes...
volatile bool pwm_publish_flag1 = true;
volatile bool pwm_publish_flag2 = true;
volatile bool pwm_publish_flag3 = true;
volatile bool pwm_publish_flag4 = true;
// The original codes...
static void initPwmPublisher1()
{
pwm_pub1 = new ros::Publisher("pwm1", &pwm_msg1);
nh.advertise(*pwm_pub1);
}
static void initPwmPublisher2()
{
pwm_pub2 = new ros::Publisher("pwm2", &pwm_msg2);
nh.advertise(*pwm_pub2);
}
static void initPwmPublisher3()
{
pwm_pub3 = new ros::Publisher("pwm3", &pwm_msg3);
nh.advertise(*pwm_pub3);
}
static void initPwmPublisher4()
{
pwm_pub4 = new ros::Publisher("pwm4", &pwm_msg4);
nh.advertise(*pwm_pub4);
// The original codes...
int main()
{
// The original codes...
initPwmPublisher1();
initPwmPublisher2();
initPwmPublisher3();
initPwmPublisher4();
// The original codes...
if (pwm_publish_flag1)
{
// Get duty cycle
pwm_msg1.data = 1-RosbotDrive::getInstance().getSpeed((RosbotMotNum)0, SpeedMode::DUTY_CYCLE);
if (nh.connected())
{
pwm_pub1->publish(&pwm_msg1);
}
}
if (pwm_publish_flag2)
{
// Get duty cycle
pwm_msg2.data = 1-RosbotDrive::getInstance().getSpeed((RosbotMotNum)1, SpeedMode::DUTY_CYCLE);
if (nh.connected())
{
pwm_pub2->publish(&pwm_msg2);
}
}
if (pwm_publish_flag3)
{
// Get duty cycle
pwm_msg3.data = 1-RosbotDrive::getInstance().getSpeed((RosbotMotNum)2, SpeedMode::DUTY_CYCLE);
if (nh.connected())
{
pwm_pub3->publish(&pwm_msg3);
}
}
if (pwm_publish_flag4)
{
// Get duty cycle
pwm_msg4.data = 1-RosbotDrive::getInstance().getSpeed((RosbotMotNum)3, SpeedMode::DUTY_CYCLE);
if (nh.connected())
{
pwm_pub4->publish(&pwm_msg4);
}
}
// The original codes...
The full code that was generated is available at the link below.
How can I solve this problem?
Thank you.