I'm not able with any youtube tutorial and blogs to make a joystick movement for my topdown 2d game on godot
as I said, follow step by step several tutorials on the internet / youtube and I couldn't get my joystick for my topdown2d game
You should not need any special code to use a joystick with Godot. Run of the mill code like this should work:
extends KinematicBody2D
var speed := 500.0
func _physics_process(_delta:float) -> void:
var velocity := Vector2(
Input.get_axis("left", "right"),
Input.get_axis("forward", "backward")
) * speed
move_and_slide(velocity)
Either that or something similar you might find in most tutorials. Which probably use "ui_left", "ui_right", "ui_up" and "ui_down" which are pre-defined actions. And yes, there are also pre-defined joystick inputs for those actions, but they might not be correct for your device.
Before configuring the actions, make sure the device is recognized by the operating system (you might need to install/update drivers). You might also want to run a diagnostic tool to check if it can send input.
Now, configure the actions on Project Settings -> Input Map. You can add new actions or modify the pre-existing ones. Once you have the action defined, click on the "+" icon on the right, and there you will find the "Joy Button" and "Joy Axis" options which will let you configure the joystick input for the action. Double click will allow you to modify the existing ones.
There is always the chance you configured the wrong input on the wrong action. You could figure it out by trial an error or with the help of a diagnostic tool.
If your device works, the configuration is correct and it still does not work. We could be talking of a compatibility issue. You might want to report a bug on github.
I can't help you further without knowing what did you try and the results you got.
Related
I am currently using dronekit-python to implement somewhat of a Mission Planner clone, as an API. I've generally been able to replicate most important features from Mission Planner; however, some features don't seem to be present.
One such feature is reading live servo outputs, which can be done in Setup > Mandatory Hardware > Servo Output (image below). I have been able to emulate getting/setting the output's function, min, trim, max, and reversed values through parameters. However, I cannot seem to access the live position values through dronekit. How would you go about this?
A second feature is reading specific values from the plane, beyond the class attributes present. This is available in Mission Planner when double-clicking a value in the Quick pane in order to change what measurement is displayed (image below). For my use case, I'd like to specifically access battery_voltage2 and battery_remaining2, as these are vital measurements for our system. I tried using vehicle.battery in dronekit, but this seems to only display data from battery 1. Any ideas?
Thank You so much for the help!
It might be possible to get the battery information and other information from the drone by using Mavlink messages. For battery information, look at the BATTERY_STATUS (#147) Mavlink message. For servo information, look at the SERVO_OUTPUT_RAW (#36) message.
In order to receive these messages, look into using message listeners from dronekit-python. You should be able to receive and parse the Mavlink message.
In general, you can use message listeners and the dronekit-python message factory to receive and send Mavlink messages, which allows you more control than some of the built-in dronekit functions. If you decide to control the drone this way, though, be careful because it's pretty easy to mess up your logic and have the drone behave unexpectedly.
Hope this helps!
I am currently working on a dialog in Composer that would let me turn all my lists in PVA vertical by calling it and passing 3-5 strings used to form the list. I am however a little stuck, my first issue is that the inputs I'd like to provide to the dialog through the dialog interface input option do not seem to actually come up as a variable in the dialog itself, see the picture for clarity. Picture of Composer Dialog Interface
We have around 250 topics in our PVA bot now, and it therefore wouldn't really do to 'hardcode' the options in for every list we have. I could live with having 3-5 dialogs based on the amount of inputs if that is a limiting factor (I am not sure if we have to use all the input strings per se for example, or if we can omit empty ones.
What I'd like to do is make an empty array, and then push the strings provided to the dialog from PVA which will then form the list: Composer array
But the variables I passed in the dialogue interface are not showing up as options in the dialog creation itself.
I know I can access PVA variables by making them global, but I'd like to go a little more beyond that.
So, in PVA, decide what strings to pass to Composer, use these to make a vertical list and pass this back, and make sure that the composer steps are dynamic so that I can re-use this list-making dialog in any of the places where I need a vertical list.
I've also seen recommendations of just using CSS/HTML templates if you want /all/ your lists to be vertical (which I do), I just can't find more information about that, just: https://powervirtualagents.microsoft.com/en-us/blog/change-your-power-virtual-agents-default-canvas-bot-icon-and-name/
Any suggestions on whether this is a painstaking route I am trying to take through Composer, and any success using the canvases/HTML instead?
Kind regards
Niels
Using a "Dialog"-box (so a .top file too), how can i turn NAO's brain leds on? I know that you can call an output like "$turnledson=1" and connect it to "Set Leds"-box and turn the leds on that way, but what about a command that can activate them without the need of another box from choregraphe? Something like "^start(animations/LEDs/BrainLedsOn)", if it exists.
There is no direct LED commands in QiChat.
However, if in your app myapp you create a new behavior called brain/anim1 (with a box in it!), and you make sure it is exposed (checked in the project properties), you can use ^start(myapp/brain/anim1) to start your Choregraphe behavior within your QiChat code.
But as you can see, you need to use a Choregraphe box somewhere in the end.
I have an very simple applescript:
tell application "Opera"
get URL of active tab of window 1
end tell
I want to see Apple Events underlying. So I have launched it with these two environment variables enabled:
export AEDebugSends=1;
export AEDebugReceives=1
Now I am getting this output:
osascript browser.scpt
{core,getd target='psn '[Opera] {----={form=prop,want=prop,seld=URL ,from={form=prop,want=prop,seld=acTa,from={form=indx,want=cwin,seld=1,from=NULL-impl}}}} attr:{csig=65536 returnID=15130}
I would expect to see calls to functions defined here: https://developer.apple.com/documentation/coreservices/apple_events?language=objc
My final goal is to translate that Applescript into c or Obj-C code.
Could someone help me to understand the meaning of the output?
Thanks in advance
would expect to see calls to functions defined here
Well, stop expecting that. What you have is the Apple event itself, expressed in AEPrint notation, as explained here:
https://developer.apple.com/library/archive/technotes/tn/tn2045.html
You can use that to construct the same Apple event, or you can form it in pieces using higher level commands. But either way, it is not up to the system to write your code for you! That is the Apple event, built for you by AppleScript. Learning to read AEPrint notation, learning the structure of an Apple event, learning to build the same Apple event by hand, is all something you must do yourself.
Just to give an example of the reasoning you will use:
Your Apple event starts with the verb coregetd. That is the Apple event equivalent of get (the first word in your AppleScript), as you learn from looking in the application's SDEF dictionary.
OK, now we know the verb; what's the direct object? It's an URLĀ (note the space, these are four-letter codes); that is the Apple event equivalent of your URL (again, we learn this through the dictionary).
OK, but what URL? It's the URL of the acTa, which is the active tab (again, the dictionary shows us this equivalence).
OK, but the acTa of what? ...
And so on. Once you have broken down the Apple event into properties and elements and objects specifiers in this way, you can build it up again through Carbon or Cocoa commands.
You have chosen, for reasons that escape me, to embark on a very long journey. You have elected to throw away the simplicity of AppleScript notation and construct an Apple event yourself. You have chosen a long road involving much learning. There is no shortcut; the runtime is not going to write your code for you. The longest journey begins with the first step. Begin!
So I'm working on something that's going to be a rather large undertaking. I've figured out how to do a "bare-bones" kind of dice hud that just rolls a basic 2-20. However now I need to go to the next step.
I want to make a roleplaying system dice hud for my sim. For this I want it so that when you click the HUD you get a menu, that lists all the skills in my system. When you click the skill it refrences a notecard in the Hud to do some minor math before displaying the result: IE.
There's a normal 2d6, 2d8, 2d10, 2d12, 2d16, 2d20 ((Whatever basic configuration that always rolls a standard die))
Though I want it to look into a note card to add in a character's "STATS" and "SKILL LEVEL"
So say they want to hit someone with a sword?
I want the Hud to generate a random value between 2 and 12, then add in the character's Strength, speed, perception stats as well as their sword skill level.
If I could see the basics of HOW to start this I can then move forward from there.
You cannot write into a note card using a LSL (or other) script.
If you want to roll a dice, simply use llRound( llFrand ); or integer x = (integer)llFrand(19)+1;
You could use a webserver to save information like that. Just google free web space, you're gonna find a lot. SL's HTTP communication is, let's say, ok.
This is kind of a big project. If you don't know where/how to start you should hire a professional. Just look for groups in-world. You're going to find a lot of people willing to help you :)
In LSL you cannot write in a notecard, however if you try OpenSim you can use that function:
osMakeNotecard(string notecardName, list contents);
But that is only available in OpenSim, see osMakeNotecard.