mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
Connection to last_letter once again successful
This commit is contained in:
parent
24d3399fd5
commit
54c1efe5e1
@ -53,40 +53,25 @@ last_letter::last_letter(const char *home_str, const char *_frame_str) :
|
||||
void last_letter::start_last_letter(void)
|
||||
{
|
||||
pid_t child_pid = fork();
|
||||
if (child_pid != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (child_pid == 0) {
|
||||
// in child
|
||||
close(0);
|
||||
open("/dev/null", O_RDONLY);
|
||||
for (uint8_t i=3; i<100; i++) {
|
||||
close(i);
|
||||
}
|
||||
|
||||
char argHome[50];
|
||||
sprintf(argHome,"home:=[%f,%f,%f]",home.lat*1.0e-7,home.lng*1.0e-7,(double)home.alt*1.0e-2);
|
||||
|
||||
const char *uav_name = strchr(frame_str, ':');
|
||||
if (uav_name != NULL) {
|
||||
uav_name++;
|
||||
}
|
||||
|
||||
int ret = execlp("roslaunch",
|
||||
"roslaunch",
|
||||
"last_letter",
|
||||
"launcher.launch",
|
||||
"gazebo.launch",
|
||||
"ArduPlane:=true",
|
||||
"simRate:=500",
|
||||
"deltaT:=0.002",
|
||||
argHome,
|
||||
uav_name,
|
||||
NULL);
|
||||
if (ret != 0) {
|
||||
perror("roslaunch");
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
send servos
|
||||
@ -125,8 +110,6 @@ void last_letter::recv_fdm(const struct sitl_input &input)
|
||||
airspeed = pkt.airspeed;
|
||||
airspeed_pitot = pkt.airspeed;
|
||||
|
||||
// update magnetic field
|
||||
update_mag_field_bf();
|
||||
|
||||
// auto-adjust to last_letter frame rate
|
||||
uint64_t deltat_us = pkt.timestamp_us - last_timestamp_us;
|
||||
@ -146,6 +129,10 @@ void last_letter::update(const struct sitl_input &input)
|
||||
send_servos(input);
|
||||
recv_fdm(input);
|
||||
sync_frame_time();
|
||||
|
||||
update_position();
|
||||
// update magnetic field
|
||||
update_mag_field_bf();
|
||||
}
|
||||
|
||||
} // namespace SITL
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t fdm_port = 9002;
|
||||
static const uint16_t fdm_port = 5002;
|
||||
|
||||
/*
|
||||
packet sent to last_letter
|
||||
|
Loading…
Reference in New Issue
Block a user