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

Running into issues with running flight #11

Open
smarkoco opened this issue May 8, 2023 · 1 comment
Open

Running into issues with running flight #11

smarkoco opened this issue May 8, 2023 · 1 comment

Comments

@smarkoco
Copy link
Contributor

smarkoco commented May 8, 2023

Right now, my primary goals are:

  1. better understand how to configure flight so I can adjust which modules are used, and how to disable ones I'm not currently trying to test (because right now I am still running everything on an Raspberry CM4 IO board, with no components communicating except the camera)
  2. get flight to send the video feed to a pc_controller on another computer at 192.168.1.111

I've had a number of errors I'm trying to better understand. First, when running directly after compilation (just to see what errors I would get), I saw a "bad mount" error related to this line, so I was wondering what is the intention of mounting /var? I ended up commenting out the mount line and addressing a different "file not exist: /var/flight/config.lua" error by running mkdir /var/flight and cp config.lua /var/flight.

Next, I am having issues related to No DPI CRTC/Connector found. Do you know how I could just disable certain modules so I can just focus on the video feed for now?
image

Finally, would you mind letting me know how I can configure the socket IP address to test the video transmission to a running controller_pc process on another local PC (such as 192.168.1.111)? I see at this line where the variable is declared, but am not sure where the value of SOCKADDR gets set. I looked through all the "config"-related files but ran into a dead end, sadly.

Thanks in advance!

@dridri
Copy link
Owner

dridri commented May 8, 2023

I did not finish it yet, but you could take a look at the Configuration wiki.
This is more than just a configuration file, the LUA engine actually spawn class (by allocating and calling constructors)) instances by itself. If you are not afraid of automatically-generated C++ code, you can take a look at flight/build/lua_init.cpp:lua_init()

Take a look to /flight/config.lua as an example.

Some variables are mandatory, but most of their values should be ok if left empty :

frame = Multicopter {
	maxspeed = 1.0,
	motors = {},
	matrix = {}
}

imu = IMU {
	gyroscopes = {},
	accelerometers = {},
	magnetometers = {},
	altimeters = {},
	gpses = {},
}

-- same scales as betaflight
PID.pscale = 0.032029
PID.iscale = 0.244381
PID.dscale = 0.000529
stabilizer = Stabilizer {
	loop_time = 500, -- 500 µs => 2000Hz stabilizer update
	rate_speed = 1000, -- deg/sec
	pid_roll = PID( 45, 70, 40 ),
	pid_pitch = PID( 46, 70, 40 ),
	pid_yaw = PID( 45, 90, 2 ),
	horizon_angles = Vector( 20.0, 20.0 ),
	pid_horizon = PID( 150, 0, 0 )
}

controller = Controller {
	expo = Vector(4, 4, 3.5, 2.25),
	link = Socket {
		type = Socket.UDP,
		port = 2020,
		read_timeout = 500
	}
}

For the camera, something like this should be what you are asking for :

camera_link = Socket {
	type = Socket.UDPLite,
	port = 2021,
	broadcast = false
}

camera = LinuxCamera {
	vflip = false,
	hflip = false,
	hdr = true, -- this forces framerate down to 30 (HW limitation)
	width = 1920,
	height = 1080,
	framerate = 50,
	sharpness = 0.5,
	preview_output = LiveOutput(), -- this live outputs to HDMI / DPI / CRT / etc, can be removed
	video_output = V4L2Encoder {
		video_device = "/dev/video11",
		bitrate = 8 * 1024 * 1024,
		width = 1920,
		height = 1080,
		framerate = 30,
		link = camera_link
	}
}

In the controller_pc app, go to File → Settings, Connection tab, then :

  • select TCP/IP mode
  • enter your PI4's IP adress
  • choose UDP port 2020 for controller
  • choose UDPLite port 2021 for video

You don't have to start video recording, the live stream should show up by itself without any action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants