I am using a Jupyter notebook for my project with a Xbox controller to control a robot in real time.
import ipywidgets.widgets as widgets
is used
it works directly assigning them to sliders or motors using traitlets, but I do not how to do calculations with them beforehand.
If I assign these values to variables, it gets the current value at the time of running the cell.
Here is working code that assigns directly to motor:
left_link = traitlets.dlink((controller.axes[1], 'value'), (robot.left_motor, 'value'), transform=lambda x: -x)
However, I need to calculate the angle I want to go, therefore calculating arctan2 of two axes of joystick values (the transform: lambda
does not suffice I think?).
I do not understand how I should take on this problem, as I have never worked with always updating variables, like the Xbox controller variables. Please tell me if you need any more information.