Kinarm | Interactive Robotics Brain Injury Research

  • Products
  • Clinical Applications
  • News
  • Support
  • About Us
  • Contact

Mobile nav

creating a dynamic target

creating a dynamic target

Posted on May 23, 2018

DWQA Questions › creating a dynamic target
0 Vote Up Vote Down
Chris Hewitson asked 5 years ago
Chris Hewitson replied 5 years ago

Hello,

I would like to replace cursor feedback with a ring centred at a start target that changes radius as a function of cursor position (distance from the start target).

I have added ring_state to the main trial block in indicate when the ring should be switched on, and have created a hollow target for the ring. The ring’s location is provided by the parameters table (entered into the target block). I am not sure how to bypass the VISUAL_RADIUS value from the parameter table in order to change the radius of the ring dynamically.

Can I simply modify the VCODES that leave the target block with a function that replaces VCode(10) with the distance of cursor position and start target, or should I modify the target row inputs that enter the target block? Thanks in advance.

Chris

2 Answers
0 Vote Up Vote Down
Koloman Varady Staff answered 5 years ago

Hi Chris,

You can simply modify the VCODES that leave the target block with a function that replaces VCODE(10) with the distance of cursor position and start target.

The VISUAL_RADIUS value in the Parameter Table Defn block is only referenced in the Show Target blocks which creates the VCODE. After the VCODE leaves the Show Target block, you can overwrite any parts of it to your liking. The VCODE values that are passed into the Process Video CMD block are the ones that are drawn.

Cheers,

Koloman

Chris Hewitson replied 5 years ago

Thanks Koloman,

I have written the following function to modify the target VCODES:

function VCODES_OUT = Feedback_Ring(Ring_state, Cursor_X, Cursor_Y, VCODES_IN)

VCODES = VCODES_IN;
radii = hypot((Cursor_X -VCODES(3)), (Cursor_Y-VCODES(4))); %determine distance of cursor from start target center

if Ring_state == 1;
VCODES(10) = radii;
VCODES(5) = -2^31; % set to no-fill

% Set stroke value to ‘green’ by converting to uint32 format
full = (2^32 – 1);
VCODES(6) =(full*(2^64)) + full; % THIS DOES NOT WORK
else
VCODES(10) = VCODES(10);
end
VCODES_OUT = VCODES;
end

But I am unclear as to how I can change the stroke colour to green. Specifically how to format in uint32. Are you able to assist with this?

0 Vote Up Vote Down
Koloman Varady Staff answered 5 years ago

For colours, what I do is I find the hex value using a website like http://www.color-hex.com/ and then convert to decimal using hex2dec. So maybe for green, if you want to use #00ff00:

VCODES(6) = hex2dec(’00ff00′);

I find it’s easy for me to keep track of what colour is what and also easy to swap in another colour.

Chris Hewitson replied 5 years ago

Great! Thanks

Support

  • User Guides & Documentation
  • Software Downloads
  • Install/Maintain Your KINARM Lab
  • Training Videos
  • New User Training
  • Creating Custom Tasks
  • Sample Custom Tasks
  • Q&A Forum
  • Publications by Research Area

Products

  • Platform Comparison
  • Kinarm Exoskeleton Lab
  • Kinarm End-Point Lab
  • Kinarm Standard Tests
  • Dexterit-E
  • Dexterit-E Explorer
  • NHP Kinarm Exoskeleton Lab

Clinical Applications

  • Clinical Applications
    • Stroke and TIA
    • Traumatic Brain Injury (TBI)
    • Neurological Disease
    • Pediatric
    • Primarily Non-Neurological
  • Clinical Research Sites
  • Publications

News

  • Kinarm News
  • Events
    • Neuroscience
    • Kinarm Camp
  • Product Notices
  • @KinarmLab Twitter Feed
  • Open Jobs

Support

  • Kinarm Help & Support
  • User Guides & Documentation
  • Software Downloads
  • Installing & Maintaining Your Kinarm Lab
  • Training Videos
  • New User Training
  • Creating Custom Tasks
  • Sample Custom Tasks
  • Q&A Forum

About Us

  • About Us
  • Our People
  • Quality
  • Supplier Requirements
  • End-User License Agreement
  • Intellectual Property
  • Privacy & Terms

Contact

  • Contact Kinarm
    • International Sales Agents
  • Request an Account
footer-logo

140 Railway St. Kingston, ON K7K 2L9 Canada Toll Free: (888) 533-4393 Phone: (613) 507-4393 info@kinarm.com

© Copyright BKIN Technologies. All Rights Reserved

Quality | Privacy Policy | Web design/development by 1dea Design + Media Inc.