Compare commits

...

12 Commits

Author SHA1 Message Date
Junwoo Hwang 930459319e Revert "Change target tcp server to Linux Laptop"
This reverts commit 5c83e4e73a.
2022-10-11 14:15:02 +02:00
Junwoo Hwang 5c83e4e73a Change target tcp server to Linux Laptop 2022-10-06 10:13:13 +02:00
Junwoo Hwang 08b8b9ad95 Enable TCP Blaster - following David's documentation 2022-10-05 16:07:38 +02:00
Junwoo Hwang baa0e8a46d Add modified Px4 Simple App for SLIP testing (couldn't compile) 2022-10-05 15:47:34 +02:00
Junwoo Hwang 5df558f1cb Re-enable Net library inclusion for NuttX build in FMU-v6x
- But it will be deleted when you trigger `menuconfig` again anyways :P
2022-10-04 13:58:44 +02:00
Junwoo Hwang 5951a0944d Update NuttX submodule with debug message 2022-10-04 13:50:08 +02:00
Junwoo Hwang 9ef0dc0c4c Include NuttX-apps submodule debug changes commit 2022-10-04 11:05:23 +02:00
Junwoo Hwang 53549549fe Remote THTTPD Example source from the build 2022-10-04 11:05:00 +02:00
Junwoo Hwang 60570a2008 Enable THTTPD web server example & dependencies
- Still doesn't compile, but WIP
2022-10-03 16:50:43 +02:00
Junwoo Hwang d6b1564e8e Enable SLIP Web server example 2022-10-03 10:08:19 +02:00
Junwoo Hwang 7042ba63de Update to use slip.c fixed NuttX branch for SLIP enabled build 2022-10-03 09:44:59 +02:00
Junwoo Hwang ebde760569 Enable NET_SLIP for FMUv6x NuttX config
- Configurable via `menuconfig` interface
2022-09-23 16:21:23 +02:00
5 changed files with 57 additions and 74 deletions
+1 -2
View File
@@ -8,8 +8,8 @@ CONFIG_BOARD_SERIAL_TEL2="/dev/ttyS4"
CONFIG_BOARD_SERIAL_TEL3="/dev/ttyS1"
CONFIG_DRIVERS_ADC_BOARD_ADC=y
CONFIG_DRIVERS_BAROMETER_BMP388=y
CONFIG_DRIVERS_BAROMETER_MS5611=y
CONFIG_DRIVERS_BAROMETER_INVENSENSE_ICP201XX=y
CONFIG_DRIVERS_BAROMETER_MS5611=y
CONFIG_DRIVERS_BATT_SMBUS=y
CONFIG_DRIVERS_CAMERA_CAPTURE=y
CONFIG_DRIVERS_CAMERA_TRIGGER=y
@@ -24,7 +24,6 @@ CONFIG_DRIVERS_IMU_INVENSENSE_ICM20649=y
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42670P=y
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
CONFIG_DRIVERS_MAGNETOMETER_RM3100=y
CONFIG_COMMON_LIGHT=y
CONFIG_COMMON_MAGNETOMETER=y
CONFIG_COMMON_OPTICAL_FLOW=y
@@ -63,6 +63,11 @@ CONFIG_DEV_FIFO_SIZE=0
CONFIG_DEV_PIPE_MAXSIZE=1024
CONFIG_DEV_PIPE_SIZE=70
CONFIG_ETH0_PHY_LAN8742A=y
CONFIG_EXAMPLES_TCPBLASTER=y
CONFIG_EXAMPLES_TCPBLASTER_DRIPADDR=0x0a2a0001
CONFIG_EXAMPLES_TCPBLASTER_INIT=y
CONFIG_EXAMPLES_TCPBLASTER_IPADDR=0x0a2a00b3
CONFIG_EXAMPLES_TCPBLASTER_SERVERIP=0x0a2a0018
CONFIG_EXPERIMENTAL=y
CONFIG_FAT_DMAMEMORY=y
CONFIG_FAT_LCNAMES=y
@@ -79,6 +84,7 @@ CONFIG_FS_PROCFS_INCLUDE_PROGMEM=y
CONFIG_FS_PROCFS_MAX_TASKS=64
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_FS_ROMFS=y
CONFIG_FS_UNIONFS=y
CONFIG_GRAN=y
CONFIG_GRAN_INTR=y
CONFIG_HAVE_CXX=y
@@ -91,7 +97,6 @@ CONFIG_IOB_THROTTLE=0
CONFIG_IPCFG_BINARY=y
CONFIG_IPCFG_CHARDEV=y
CONFIG_IPCFG_PATH="/fs/mtd_net"
CONFIG_LIBC_FLOATINGPOINT=y
CONFIG_LIBC_LONG_LONG=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
@@ -118,12 +123,14 @@ CONFIG_NETINIT_DRIPADDR=0XC0A800FE
CONFIG_NETINIT_THREAD=y
CONFIG_NETINIT_THREAD_PRIORITY=49
CONFIG_NETUTILS_TELNETD=y
CONFIG_NETUTILS_THTTPD=y
CONFIG_NET_ARP_IPIN=y
CONFIG_NET_ARP_SEND=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ETH_PKTSIZE=1518
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_SLIP=y
CONFIG_NET_SOLINGER=y
CONFIG_NET_TCP=y
CONFIG_NET_TCPBACKLOG=y
+46 -69
View File
@@ -33,7 +33,9 @@
/**
* @file px4_simple_app.c
* Minimal application example for PX4 autopilot
*
* Simple app to test SLIP utility.
* Partial copy of platforms/nuttx/NuttX/apps/examples/thttpd/thttpd_main.c
*
* @author Example User <mail@example.com>
*/
@@ -41,86 +43,61 @@
#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/tasks.h>
#include <px4_platform_common/posix.h>
#include <unistd.h>
#include <stdio.h>
#include <poll.h>
#include <string.h>
#include <math.h>
// #include <unistd.h>
// #include <stdio.h>
// #include <poll.h>
// #include <string.h>
// #include <math.h>
// #include "netutils/netlib.h"
/* Include SLIP related libraries / macro defs */
#ifdef CONFIG_NET_SLIP
/* TTY device to use */
#pragma message "NET_SLIP is enabled, adding the libraries!"
// # include <nuttx/net/net.h>
# include <nuttx/net/slip.h>
# ifndef CONFIG_NET_SLIPTTY
# define CONFIG_NET_SLIPTTY "/dev/ttyS4"
# endif
# define SLIP_DEVNO 0
# ifndef NET_DEVNAME
# define NET_DEVNAME "sl0"
# endif
#endif
#include <uORB/uORB.h>
#include <uORB/topics/vehicle_acceleration.h>
#include <uORB/topics/vehicle_attitude.h>
__EXPORT int px4_simple_app_main(int argc, char *argv[]);
int px4_simple_app_main(int argc, char *argv[])
{
PX4_INFO("Hello Sky!");
PX4_INFO("PX4 Simple SLIP Testing App!");
/* subscribe to vehicle_acceleration topic */
int sensor_sub_fd = orb_subscribe(ORB_ID(vehicle_acceleration));
/* limit the update rate to 5 Hz */
orb_set_interval(sensor_sub_fd, 200);
/* Sanity Checks */
// static_assert(CONFIG_NET_SLIPTTY == "/dev/ttyS4");
/* advertise attitude topic */
struct vehicle_attitude_s att;
memset(&att, 0, sizeof(att));
orb_advert_t att_pub = orb_advertise(ORB_ID(vehicle_attitude), &att);
/* Configure SLIP */
/* one could wait for multiple topics with this technique, just using one here */
px4_pollfd_struct_t fds[] = {
{ .fd = sensor_sub_fd, .events = POLLIN },
/* there could be more file descriptors here, in the form like:
* { .fd = other_sub_fd, .events = POLLIN },
*/
};
#ifdef CONFIG_NET_SLIP
int ret = slip_initialize(SLIP_DEVNO, CONFIG_NET_SLIPTTY);
int error_counter = 0;
if (ret < 0) {
printf("ERROR: SLIP initialization failed: %d\n", ret);
exit(1);
}
for (int i = 0; i < 5; i++) {
/* wait for sensor update of 1 file descriptor for 1000 ms (1 second) */
int poll_ret = px4_poll(fds, 1, 1000);
#endif
/* handle the poll result */
if (poll_ret == 0) {
/* this means none of our providers is giving us data */
PX4_ERR("Got no data within a second");
} else if (poll_ret < 0) {
/* this is seriously bad - should be an emergency */
if (error_counter < 10 || error_counter % 50 == 0) {
/* use a counter to prevent flooding (and slowing us down) */
PX4_ERR("ERROR return value from poll(): %d", poll_ret);
}
error_counter++;
} else {
if (fds[0].revents & POLLIN) {
/* obtained data for the first file descriptor */
struct vehicle_acceleration_s accel;
/* copy sensors raw data into local buffer */
orb_copy(ORB_ID(vehicle_acceleration), sensor_sub_fd, &accel);
PX4_INFO("Accelerometer:\t%8.4f\t%8.4f\t%8.4f",
(double)accel.xyz[0],
(double)accel.xyz[1],
(double)accel.xyz[2]);
/* set att and publish this information for other apps
the following does not have any meaning, it's just an example
*/
att.q[0] = accel.xyz[0];
att.q[1] = accel.xyz[1];
att.q[2] = accel.xyz[2];
orb_publish(ORB_ID(vehicle_attitude), att_pub, &att);
}
/* there could be more file descriptors here, in the form like:
* if (fds[1..n].revents & POLLIN) {}
*/
}
// Idle by just sleeping for 1 second continuously
while (true) {
px4_usleep(1E6);
}
PX4_INFO("exiting");